1
0

rules.mk 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/prereq.mk
  4. -include $(ADK_TOPDIR)/.config
  5. ifeq ($(ADK_VERBOSE),1)
  6. START_TRACE:= :
  7. END_TRACE:= :
  8. TRACE:= :
  9. CMD_TRACE:= :
  10. PKG_TRACE:= :
  11. MAKE_TRACE:=
  12. DL_TRACE:=
  13. EXTRA_MAKEFLAGS:=
  14. SET_DASHX:= set -x
  15. else
  16. START_TRACE:= echo -n " ---> "
  17. END_TRACE:= echo
  18. TRACE:= echo " ---> "
  19. CMD_TRACE:= echo -n
  20. PKG_TRACE:= echo "------> "
  21. EXTRA_MAKEFLAGS:= -s
  22. MAKE_TRACE:= >/dev/null 2>&1 || { echo "Build failed. Please re-run make with v to see what's going on"; false; }
  23. DL_TRACE:= >/dev/null 2>&1
  24. SET_DASHX:= :
  25. endif
  26. # Strip off the annoying quoting
  27. ADK_TARGET_OS:= $(strip $(subst ",, $(ADK_TARGET_OS)))
  28. ADK_TARGET_ARCH:= $(strip $(subst ",, $(ADK_TARGET_ARCH)))
  29. ADK_TARGET_SYSTEM:= $(strip $(subst ",, $(ADK_TARGET_SYSTEM)))
  30. ADK_TARGET_BOARD:= $(strip $(subst ",, $(ADK_TARGET_BOARD)))
  31. ADK_TARGET_CPU_ARCH:= $(strip $(subst ",, $(ADK_TARGET_CPU_ARCH)))
  32. ADK_TARGET_CPU_TYPE:= $(strip $(subst ",, $(ADK_TARGET_CPU_TYPE)))
  33. ADK_TARGET_KERNEL:= $(strip $(subst ",, $(ADK_TARGET_KERNEL)))
  34. ADK_TARGET_LIBC:= $(strip $(subst ",, $(ADK_TARGET_LIBC)))
  35. ADK_TARGET_LIBC_PATH:= $(strip $(subst ",, $(ADK_TARGET_LIBC_PATH)))
  36. ADK_TARGET_LIBC_ABI_PATH:= $(strip $(subst ",, $(ADK_TARGET_LIBC_ABI_PATH)))
  37. ADK_TARGET_ENDIAN:= $(strip $(subst ",, $(ADK_TARGET_ENDIAN)))
  38. ADK_TARGET_ENDIAN_SUFFIX:= $(strip $(subst ",, $(ADK_TARGET_ENDIAN_SUFFIX)))
  39. ADK_TARGET_GCC_CPU:= $(strip $(subst ",, $(ADK_TARGET_GCC_CPU)))
  40. ADK_TARGET_GCC_ARCH:= $(strip $(subst ",, $(ADK_TARGET_GCC_ARCH)))
  41. ADK_TARGET_BINFMT:= $(strip $(subst ",, $(ADK_TARGET_BINFMT)))
  42. ADK_TARGET_FLOAT:= $(strip $(subst ",, $(ADK_TARGET_FLOAT)))
  43. ADK_TARGET_FPU:= $(strip $(subst ",, $(ADK_TARGET_FPU)))
  44. ADK_TARGET_INSTRUCTION_SET:= $(strip $(subst ",, $(ADK_TARGET_INSTRUCTION_SET)))
  45. ADK_TARGET_CFLAGS:= $(strip $(subst ",, $(ADK_TARGET_CFLAGS)))
  46. ADK_TARGET_CPU_FLAGS:= $(strip $(subst ",, $(ADK_TARGET_CPU_FLAGS)))
  47. ADK_TARGET_CFLAGS_OPT:= $(strip $(subst ",, $(ADK_TARGET_CFLAGS_OPT)))
  48. ADK_TARGET_ABI_CFLAGS:= $(strip $(subst ",, $(ADK_TARGET_ABI_CFLAGS)))
  49. ADK_TARGET_ABI:= $(strip $(subst ",, $(ADK_TARGET_ABI)))
  50. ADK_TARGET_ABI_MIPS64:= $(strip $(subst ",, $(ADK_TARGET_ABI_MIPS64)))
  51. ADK_TARGET_ABI_RISCV:= $(strip $(subst ",, $(ADK_TARGET_ABI_RISCV)))
  52. ADK_TARGET_IP:= $(strip $(subst ",, $(ADK_TARGET_IP)))
  53. ADK_TARGET_SUFFIX:= $(strip $(subst ",, $(ADK_TARGET_SUFFIX)))
  54. ADK_TARGET_CMDLINE:= $(strip $(subst ",, $(ADK_TARGET_CMDLINE)))
  55. ADK_TOOLCHAIN_LLVM_VERSION:= $(strip $(subst ",, $(ADK_TOOLCHAIN_LLVM_VERSION)))
  56. ADK_QEMU_ARGS:= $(strip $(subst ",, $(ADK_QEMU_ARGS)))
  57. ADK_RUNTIME_TMPFS_SIZE:= $(strip $(subst ",, $(ADK_RUNTIME_TMPFS_SIZE)))
  58. ADK_RUNTIME_CONSOLE_SERIAL_SPEED:= $(strip $(subst ",, $(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)))
  59. ADK_RUNTIME_CONSOLE_SERIAL_DEVICE:= $(strip $(subst ",, $(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE)))
  60. ADK_RUNTIME_CONSOLE_VGA_DEVICE:= $(strip $(subst ",, $(ADK_RUNTIME_CONSOLE_VGA_DEVICE)))
  61. ADK_RUNTIME_DEFAULT_LOCALE:= $(strip $(subst ",, $(ADK_RUNTIME_DEFAULT_LOCALE)))
  62. ADK_HOST:= $(strip $(subst ",, $(ADK_HOST)))
  63. ADK_VENDOR:= $(strip $(subst ",, $(ADK_VENDOR)))
  64. ADK_DL_DIR:= $(strip $(subst ",, $(ADK_DL_DIR)))
  65. ADK_COMPRESSION_TOOL:= $(strip $(subst ",, $(ADK_COMPRESSION_TOOL)))
  66. ADK_LIBC_VERSION:= $(strip $(subst ",, $(ADK_LIBC_VERSION)))
  67. ADK_PARAMETER_NETCONSOLE_SRC_IP:= $(strip $(subst ",, $(ADK_PARAMETER_NETCONSOLE_SRC_IP)))
  68. ADK_PARAMETER_NETCONSOLE_DST_IP:= $(strip $(subst ",, $(ADK_PARAMETER_NETCONSOLE_DST_IP)))
  69. ADK_JFFS2_OPTS:= $(strip $(subst ",, $(ADK_JFFS2_OPTS)))
  70. ADK_TARGET_LINUX_KERNEL_VERSION:= $(strip $(subst ",, $(ADK_TARGET_LINUX_KERNEL_VERSION)))
  71. ADK_TARGET_LINUX_KERNEL_GIT:= $(strip $(subst ",, $(ADK_TARGET_LINUX_KERNEL_GIT)))
  72. ADK_TARGET_LINUX_KERNEL_GIT_VER:= $(strip $(subst ",, $(ADK_TARGET_LINUX_KERNEL_GIT_VER)))
  73. ADK_TARGET_LINUX_KERNEL_GIT_TYPE:= $(strip $(subst ",, $(ADK_TARGET_LINUX_KERNEL_GIT_TYPE)))
  74. ADK_TARGET_LINUX_KERNEL_DEFCONFIG:= $(strip $(subst ",, $(ADK_TARGET_LINUX_KERNEL_DEFCONFIG)))
  75. ADK_TARGET_WALDUX_KERNEL_GIT:= $(strip $(subst ",, $(ADK_TARGET_WALDUX_KERNEL_GIT)))
  76. ADK_TARGET_WALDUX_KERNEL_GIT_VER:= $(strip $(subst ",, $(ADK_TARGET_WALDUX_KERNEL_GIT_VER)))
  77. ADK_TARGET_WALDUX_KERNEL_GIT_TYPE:= $(strip $(subst ",, $(ADK_TARGET_WALDUX_KERNEL_GIT_TYPE)))
  78. ADK_TARGET_WALDUX_KERNEL_DEFCONFIG:= $(strip $(subst ",, $(ADK_TARGET_WALDUX_KERNEL_DEFCONFIG)))
  79. ADK_TARGET_GENIMAGE_FILENAME:= $(strip $(subst ",, $(ADK_TARGET_GENIMAGE_FILENAME)))
  80. ADK_TARGET_ROOTDEV:= $(strip $(subst ",, $(ADK_TARGET_ROOTDEV)))
  81. ADK_TARGET_KARCH:=$(ADK_TARGET_ARCH)
  82. # translate toolchain arch to kernel arch
  83. ifeq ($(ADK_TARGET_ARCH),aarch64)
  84. ADK_TARGET_KARCH:=arm64
  85. endif
  86. ifeq ($(ADK_TARGET_ARCH),bfin)
  87. ADK_TARGET_KARCH:=blackfin
  88. endif
  89. ifeq ($(ADK_TARGET_ARCH),or1k)
  90. ADK_TARGET_KARCH:=openrisc
  91. endif
  92. ifeq ($(ADK_TARGET_ARCH),ppc)
  93. ADK_TARGET_KARCH:=powerpc
  94. endif
  95. ifeq ($(ADK_TARGET_ARCH),ppc64)
  96. ADK_TARGET_KARCH:=powerpc
  97. endif
  98. ifeq ($(ADK_TARGET_ARCH),mips64)
  99. ADK_TARGET_KARCH:=mips
  100. endif
  101. ifeq ($(ADK_TARGET_ARCH),hppa)
  102. ADK_TARGET_KARCH:=parisc
  103. endif
  104. ifeq ($(ADK_TARGET_ARCH),riscv32)
  105. ADK_TARGET_KARCH:=riscv
  106. endif
  107. ifeq ($(ADK_TARGET_ARCH),riscv64)
  108. ADK_TARGET_KARCH:=riscv
  109. endif
  110. include $(ADK_TOPDIR)/mk/vars.mk
  111. ifneq (${show},)
  112. .DEFAULT_GOAL:= show
  113. show:
  114. @$(info ${${show}})
  115. else ifneq (${dump},)
  116. __shquote= '$(subst ','\'',$(1))'
  117. __dumpvar= echo $(call __shquote,$(1)=$(call __shquote,${$(1)}))
  118. .DEFAULT_GOAL:= show
  119. show:
  120. @$(foreach _s,${dump},$(call __dumpvar,${_s});)
  121. endif