build.mk 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  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. CONFIG_CONFIG_IN = Config.in
  4. CONFIG = adk/config
  5. DEFCONFIG= ADK_DEBUG=n \
  6. ADK_BUILD_WITH_DEBUG=n \
  7. ADK_DISABLE_CHECKSUM=n \
  8. ADK_PACKAGE_BUSYBOX_HIDE=n \
  9. ADK_DISABLE_KERNEL_PATCHES=n \
  10. ADK_DISABLE_TARGET_KERNEL_PATCHES=n \
  11. ADK_DISABLE_HONOUR_CFLAGS=n \
  12. ADK_KERNEL_FB_CON_DECOR=n \
  13. ADK_CHOOSE_APPLIANCE=n \
  14. ADK_WGET_TIMEOUT=180 \
  15. ADK_MAKE_PARALLEL=y \
  16. ADK_MAKE_JOBS=4 \
  17. ADK_LEAVE_ETC_ALONE=n \
  18. ADK_SIMPLE_NETWORK_CONFIG=n \
  19. ADK_USE_CCACHE=n \
  20. ADK_RUNTIME_START_SERVICES=n \
  21. ADK_PACKAGE_BASE_FILES=y \
  22. ADK_PACKAGE_KEXECINIT=n \
  23. ADK_PACKAGE_CLASSPATH=n \
  24. ADK_PACKAGE_OPENSSL=n \
  25. ADK_PACKAGE_LIBOPENSSL=n \
  26. ADK_PACKAGE_LIBOPENSSL_DEV=n \
  27. ADK_PACKAGE_LIBOPENSSL_WITH_CRYPTODEV=n \
  28. ADK_PACKAGE_OPENSSL_PKCS11=n \
  29. ADK_PACKAGE_OPENSSL_UTIL=n \
  30. ADK_PACKAGE_SSLTUNNEL=n \
  31. ADK_PACKAGE_LM_SENSORS_DETECT=n \
  32. ADK_PACKAGE_CRYPTINIT=n \
  33. ADK_KERNEL_MPTCP=n \
  34. ADK_STATIC_TOOLCHAIN=n \
  35. ADK_TOOLCHAIN_WITH_SSP=n \
  36. ADK_TARGET_USE_SSP=n \
  37. ADK_TOOLCHAIN_WITH_LTO=n \
  38. ADK_TARGET_USE_LTO=n \
  39. ADK_TOOLCHAIN_WITH_GOLD=n \
  40. ADK_TARGET_USE_GOLD=n \
  41. ADK_TARGET_USE_GNU_HASHSTYLE=n \
  42. ADK_TARGET_USE_PIE=n \
  43. ADK_TARGET_USE_STATIC_LIBS=n \
  44. ADK_TARGET_USE_LD_RELRO=n \
  45. ADK_TARGET_USE_LD_BIND_NOW=n \
  46. ADK_TARGET_USE_LD_GC=n \
  47. BUSYBOX_IFPLUGD=n \
  48. BUSYBOX_EXTRA_COMPAT=n \
  49. BUSYBOX_FEATURE_IFCONFIG_SLIP=n \
  50. BUSYBOX_BBCONFIG=n \
  51. BUSYBOX_SELINUX=n \
  52. BUSYBOX_INSTALL_NO_USR=n \
  53. BUSYBOX_MODPROBE_SMALL=n \
  54. BUSYBOX_EJECT=n \
  55. BUSYBOX_UBIDETACH=n \
  56. BUSYBOX_UBIATTACH=n \
  57. BUSYBOX_BUILD_LIBBUSYBOX=n \
  58. BUSYBOX_FEATURE_2_4_MODULES=n \
  59. BUSYBOX_LOCALE_SUPPORT=n \
  60. BUSYBOX_FEATURE_PREFER_APPLETS=n \
  61. BUSYBOX_FEATURE_SUID=n \
  62. BUSYBOX_SELINUXENABLED=n \
  63. BUSYBOX_FEATURE_INSTALLER=n \
  64. BUSYBOX_PAM=n \
  65. BUSYBOX_FLASH_LOCK=n \
  66. BUSYBOX_FLASH_UNLOCK=n \
  67. BUSYBOX_FLASH_ERASEALL=n \
  68. BUSYBOX_PIE=n \
  69. BUSYBOX_TASKSET=n \
  70. BUSYBOX_DEBUG=n \
  71. BUSYBOX_NOMMU=n \
  72. BUSYBOX_WERROR=n \
  73. BUSYBOX_STATIC=n \
  74. BUSYBOX_FEATURE_AIX_LABEL=n \
  75. BUSYBOX_FEATURE_SUN_LABEL=n \
  76. BUSYBOX_FEATURE_OSF_LABEL=n \
  77. BUSYBOX_FEATURE_SGI_LABEL=n \
  78. BUSYBOX_FEATURE_INETD_RPC=n \
  79. BUSYBOX_FEATURE_MOUNT_NFS=n \
  80. BUSYBOX_FEATURE_VI_REGEX_SEARCH=n \
  81. ADK_KERNEL_RT2X00_DEBUG=n \
  82. ADK_KERNEL_ATH5K_DEBUG=n \
  83. ADK_KERNEL_BUG=n \
  84. ADK_KERNEL_DEBUG_WITH_KGDB=n
  85. noconfig_targets:= menuconfig \
  86. _config \
  87. _mconfig \
  88. distclean \
  89. defconfig
  90. POSTCONFIG= -@\
  91. if [ ! -f .firstrun ]; then \
  92. $(ADK_TOPDIR)/adk/tools/pkgrebuild;\
  93. rebuild=0; \
  94. cleandir=0; \
  95. if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
  96. touch .rebuild.busybox;\
  97. rebuild=1;\
  98. fi; \
  99. for i in ADK_SIMPLE_NETWORK_CONFIG ADK_RUNTIME_ ADK_TARGET_ROOTFS;do \
  100. if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
  101. touch .rebuild.base-files;\
  102. rebuild=1;\
  103. fi; \
  104. done; \
  105. for i in ADK_TARGET_GPU_MEM ADK_KERNEL_SND_BCM2708;do \
  106. if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
  107. touch .rebuild.bcm28xx-bootloader;\
  108. rebuild=1;\
  109. fi; \
  110. done; \
  111. if [ "$$(grep ^ADK_RUNTIME_TIMEZONE .config|md5sum)" != "$$(grep ^ADK_RUNTIME_TIMEZONE .config.old|md5sum)" ];then \
  112. touch .rebuild.musl .rebuild.uclibc-ng .rebuild.glibc;\
  113. rebuild=1;\
  114. fi; \
  115. if [ "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config|md5sum)" != "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config.old|md5sum)" ];then \
  116. touch .rebuild.dropbear .rebuild.openssh;\
  117. rebuild=1;\
  118. fi; \
  119. if [ "$$(grep ^ADK_TARGET_KERNEL_VERSION .config|md5sum)" != "$$(grep ^ADK_TARGET_KERNEL_VERSION .config.old|md5sum)" ];then \
  120. cleandir=1;\
  121. rebuild=1;\
  122. fi; \
  123. if [ "$$(grep ^ADK_TARGET_USE .config|md5sum)" != "$$(grep ^ADK_TARGET_USE .config.old|md5sum)" ];then \
  124. cleandir=1;\
  125. rebuild=1;\
  126. fi; \
  127. if [ $$cleandir -eq 1 ];then \
  128. echo "You should rebuild with 'make cleansystem'";\
  129. fi; \
  130. if [ $$rebuild -eq 1 ];then \
  131. cp .config .config.old;\
  132. fi; \
  133. fi; \
  134. if [ -f .firstrun ]; then rm .firstrun; fi
  135. # Pull in the user's configuration file
  136. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  137. -include $(ADK_TOPDIR)/.config
  138. endif
  139. ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  140. include $(ADK_TOPDIR)/rules.mk
  141. all: world
  142. ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}/package/*/Makefile) $(ADK_TOPDIR)/adk/tools/depmaker
  143. @printf " ---> generating dependencies.. "
  144. $(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
  145. @printf "done\n"
  146. .NOTPARALLEL:
  147. .PHONY: all world clean cleandir cleansystem distclean image_clean
  148. world:
  149. @mkdir -p $(DL_DIR) $(HOST_BUILD_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
  150. $(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
  151. ifeq ($(ADK_APPLIANCE_TOOLCHAIN),y)
  152. $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
  153. else
  154. ifeq ($(ADK_TARGET_OS_BAREMETAL),y)
  155. $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
  156. endif
  157. ifeq ($(ADK_TARGET_OS_LINUX),y)
  158. $(MAKE) -f mk/build.mk package/hostcompile toolchain/final target/config-prepare target/compile package/compile root_clean package/install target/install package_index
  159. endif
  160. endif
  161. package_index:
  162. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  163. -cd ${PACKAGE_DIR} && \
  164. ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  165. endif
  166. ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
  167. -cd ${PACKAGE_DIR} && \
  168. ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  169. endif
  170. ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
  171. @mkdir -p ${STAGING_TARGET_DIR}/lib
  172. @mkdir -p ${STAGING_TARGET_DIR}/bin
  173. @mkdir -p ${STAGING_TARGET_DIR}/etc
  174. @mkdir -p ${STAGING_TARGET_DIR}/usr/bin
  175. @mkdir -p ${STAGING_TARGET_DIR}/usr/include
  176. @mkdir -p ${STAGING_TARGET_DIR}/usr/lib/pkgconfig
  177. @mkdir -p ${STAGING_HOST_DIR}/usr/bin
  178. @mkdir -p ${STAGING_HOST_DIR}/usr/lib
  179. @mkdir -p ${STAGING_HOST_DIR}/usr/include
  180. @for i in lib64 lib32 libx32; do \
  181. cd ${STAGING_TARGET_DIR}; ln -sf lib $$i; \
  182. cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
  183. cd ${STAGING_HOST_DIR}; ln -sf lib $$i; \
  184. cd ${STAGING_HOST_DIR}/usr; ln -sf lib $$i; \
  185. done
  186. ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
  187. echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
  188. echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
  189. package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${ADK_TOPDIR}/package/Depends.mk
  190. $(MAKE) -C package $(patsubst package/%,%,$@)
  191. target/%:
  192. $(MAKE) -C target $(patsubst target/%,%,$@)
  193. toolchain/%: ${STAGING_TARGET_DIR}
  194. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  195. image:
  196. $(MAKE) -C target image
  197. targethelp:
  198. $(MAKE) -C target targethelp
  199. kernelconfig:
  200. ${KERNEL_MAKE_ENV} ${MAKE} -C "${LINUX_DIR}" \
  201. ARCH=$(ADK_TARGET_ARCH) \
  202. ${KERNEL_MAKE_OPTS} \
  203. menuconfig
  204. # create a new package from package/.template
  205. newpackage:
  206. @echo "Creating new package $(PKG)"
  207. $(CP) $(ADK_TOPDIR)/package/.template$(TYPE) $(ADK_TOPDIR)/package/$(PKG)
  208. pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
  209. $(SED) "s#@UPKG@#$$pkg#" $(ADK_TOPDIR)/package/$(PKG)/Makefile
  210. $(SED) 's#@PKG@#$(PKG)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
  211. $(SED) 's#@VER@#$(VER)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
  212. @echo "Edit package/$(PKG)/Makefile to complete"
  213. root_clean:
  214. rm -rf $(TARGET_DIR)
  215. mkdir -p $(TARGET_DIR)
  216. touch $(TARGET_DIR)/.adk
  217. # Do a per-package clean here, too. This way stale headers and
  218. # libraries from target_*/ get wiped away, which keeps
  219. # future package build's configure scripts from returning false
  220. # dependencies information.
  221. clean:
  222. @printf " ---> cleaning target build directories and files.. "
  223. $(MAKE) -C $(CONFIG) clean
  224. for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
  225. while read file ; do \
  226. rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
  227. done < ${STAGING_PKG_DIR}/$$f ; \
  228. rm ${STAGING_PKG_DIR}/$$f ; \
  229. done
  230. rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  231. ${ADK_TOPDIR}/package/pkglist.d
  232. rm -f ${ADK_TOPDIR}/package/Depends.mk
  233. @printf "done\n"
  234. cleankernel:
  235. @printf " ---> cleaning kernel build directories.. "
  236. @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
  237. @printf "done\n"
  238. cleandir:
  239. @printf " ---> cleaning all build directories and files.. "
  240. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  241. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
  242. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  243. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
  244. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  245. @rm -f .menu .tmpconfig.h .rebuild* make.log
  246. @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
  247. @printf "done\n"
  248. cleansystem:
  249. @printf " ---> cleaning system build directories and files .. "
  250. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  251. @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  252. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  253. @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
  254. @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
  255. @printf "done\n"
  256. distclean:
  257. @printf " ---> cleaning build directories, files and downloads.. "
  258. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  259. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
  260. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  261. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
  262. @rm -rf package/pkglist.d package/pkgconfigs.d
  263. @rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk make.log
  264. @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
  265. @rm -f target/*/Config.in.arch target/*/Config.in.systems target/config/Config.in.tasks
  266. @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
  267. @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
  268. @rm -f package/Config.in.auto* target/config/Config.in.system
  269. @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
  270. @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
  271. @printf "done\n"
  272. else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  273. ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
  274. include ${ADK_TOPDIR}/mk/vars.mk
  275. else
  276. include $(ADK_TOPDIR)/prereq.mk
  277. endif
  278. all: menuconfig
  279. @echo "Start the build with \"make\" or with \"make v\" to be verbose"
  280. # configuration
  281. # ---------------------------------------------------------------------------
  282. # force entering the subdir, as dependency checking is done there
  283. .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
  284. $(CONFIG)/conf:
  285. @$(MAKE) -C $(CONFIG) conf
  286. $(CONFIG)/mconf:
  287. @$(MAKE) -C $(CONFIG)
  288. defconfig: .menu $(CONFIG)/conf
  289. @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
  290. echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
  291. fi
  292. @if [ ! -z "$(ADK_TEST_BASE)" ];then \
  293. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  294. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  295. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  296. fi
  297. @if [ ! -z "$(ADK_TEST_LTP)" ];then \
  298. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  299. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  300. echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
  301. fi
  302. @if [ ! -z "$(ADK_TEST_MKSH)" ];then \
  303. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  304. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  305. echo "ADK_PACKAGE_PERL=y" >> $(ADK_TOPDIR)/.defconfig; \
  306. echo "ADK_PACKAGE_MKSH_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  307. fi
  308. @if [ ! -z "$(ADK_TEST_UCLIBC_NG_TESTSUITE)" ];then \
  309. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  310. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  311. echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  312. fi
  313. @if [ ! -z "$(ADK_TEST_MUSL_TESTSUITE)" ];then \
  314. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  315. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  316. echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  317. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  318. fi
  319. @if [ ! -z "$(ADK_TEST_GLIBC_TESTSUITE)" ];then \
  320. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  321. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  322. echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  323. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  324. fi
  325. @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
  326. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  327. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  328. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  329. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  330. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  331. echo "ADK_PACKAGE_UCLIBC_NG_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  332. fi
  333. @if [ ! -z "$(ADK_TEST_MUSL_NATIVE)" ];then \
  334. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  335. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  336. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  337. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  338. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  339. echo "ADK_PACKAGE_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  340. fi
  341. @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
  342. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  343. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  344. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  345. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  346. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  347. echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  348. fi
  349. @if [ ! -z "$(ADK_APPLIANCE)" ];then \
  350. grep "^config" target/config/Config.in.tasks \
  351. |grep -i "_$(ADK_APPLIANCE)$$" \
  352. |sed -e "s#^config \(.*\)#\1=y#" \
  353. >> $(ADK_TOPDIR)/.defconfig; \
  354. fi
  355. @if [ ! -z "$(ADK_TARGET_OS)" ];then \
  356. grep "^config" target/config/Config.in.os \
  357. |grep -i "_$(ADK_TARGET_OS)$$" \
  358. |sed -e "s#^config \(.*\)#\1=y#" \
  359. >> $(ADK_TOPDIR)/.defconfig; \
  360. fi
  361. @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
  362. grep "^config" target/config/Config.in.arch.choice \
  363. |grep -i "_$(ADK_TARGET_ARCH)$$" \
  364. |sed -e "s#^config \(.*\)#\1=y#" \
  365. >> $(ADK_TOPDIR)/.defconfig; \
  366. fi
  367. @if [ ! -z "$(ADK_TARGET_FS)" ];then \
  368. grep "^config" target/config/Config.in.rootfs \
  369. |grep -i "$(ADK_TARGET_FS)" \
  370. |sed -e "s#^config \(.*\)#\1=y#" \
  371. >> $(ADK_TOPDIR)/.defconfig; \
  372. fi
  373. @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
  374. grep "^config" target/config/Config.in.abi \
  375. |grep -i "$(ADK_TARGET_ABI)$$" \
  376. |sed -e "s#^config \(.*\)#\1=y#" \
  377. >> $(ADK_TOPDIR)/.defconfig; \
  378. fi
  379. @if [ ! -z "$(ADK_TARGET_FLOAT)" ];then \
  380. grep "^config" target/config/Config.in.float \
  381. |grep -i "$(ADK_TARGET_FLOAT)_" \
  382. |sed -e "s#^config \(.*\)#\1=y#" \
  383. >> $(ADK_TOPDIR)/.defconfig; \
  384. fi
  385. @if [ ! -z "$(ADK_TARGET_BINFMT)" ];then \
  386. grep "^config" target/config/Config.in.binfmt \
  387. |grep -i "$(ADK_TARGET_BINFMT)$$" \
  388. |sed -e "s#^config \(.*\)#\1=y#" \
  389. >> $(ADK_TOPDIR)/.defconfig; \
  390. fi
  391. @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
  392. grep "^config" target/config/Config.in.endian \
  393. |grep -i "$(ADK_TARGET_ENDIAN)" \
  394. |sed -e "s#^config \(.*\)#\1=y#" \
  395. >> $(ADK_TOPDIR)/.defconfig; \
  396. fi
  397. @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
  398. libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
  399. grep "^config" target/config/Config.in.libc \
  400. |grep -i "$$libc$$" \
  401. |sed -e "s#^config \(.*\)#\1=y#" \
  402. >> $(ADK_TOPDIR)/.defconfig; \
  403. fi
  404. @if [ ! -z "$(ADK_TARGET_CPU)" ];then \
  405. cpu=$$(echo "$(ADK_TARGET_CPU)" |sed -e "s/-/_/g"); \
  406. grep -h "^config" target/config/Config.in.cpu \
  407. |grep -i "$$cpu$$" \
  408. |sed -e "s#^config \(.*\)#\1=y#" \
  409. >> $(ADK_TOPDIR)/.defconfig; \
  410. fi
  411. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  412. system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
  413. grep -h "^config" target/*/Config.in.systems \
  414. |grep -i "$$system$$" \
  415. |sed -e "s#^config \(.*\)#\1=y#" \
  416. >> $(ADK_TOPDIR)/.defconfig; \
  417. fi
  418. @if [ ! -z "$(ADK_TARGET_LIBC_VERSION)" ];then \
  419. libcversion=$$(echo "$(ADK_TARGET_LIBC_VERSION)"|sed -e "s/\./_/g"); \
  420. if [ "$$libcversion" = "git" ];then \
  421. if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
  422. echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  423. fi; \
  424. if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
  425. echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  426. fi; \
  427. if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
  428. echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  429. fi; \
  430. else \
  431. grep "^config" target/config/Config.in.libc \
  432. |grep -i "$$libcversion$$" \
  433. |sed -e "s#^config \(.*\)#\1=y#" \
  434. >> $(ADK_TOPDIR)/.defconfig; \
  435. fi; \
  436. fi
  437. @if [ ! -z "$(ADK_APPLIANCE)" ];then \
  438. $(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
  439. fi
  440. allconfig:
  441. @if [ ! -z "$(ADK_APPLIANCE)" ];then \
  442. grep "^config" target/config/Config.in.tasks \
  443. |grep -i "_$(ADK_APPLIANCE)"\$$ \
  444. |sed -e "s#^config \(.*\)#\1=y#" \
  445. >> $(ADK_TOPDIR)/all.config; \
  446. fi
  447. @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
  448. grep "^config" target/config/Config.in.arch.choice \
  449. |grep -i "$(ADK_TARGET_ARCH)"\$$ \
  450. |sed -e "s#^config \(.*\)#\1=y#" \
  451. >> $(ADK_TOPDIR)/all.config; \
  452. fi
  453. @for symbol in ${DEFCONFIG}; do \
  454. echo $$symbol >> $(ADK_TOPDIR)/all.config; \
  455. done
  456. @if [ ! -z "$(ADK_TARGET_FS)" ];then \
  457. grep "^config" target/config/Config.in.rootfs \
  458. |grep -i "$(ADK_TARGET_FS)" \
  459. |sed -e "s#^config \(.*\)#\1=y#" \
  460. >> $(ADK_TOPDIR)/all.config; \
  461. fi
  462. @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
  463. grep "^config" target/config/Config.in.libc \
  464. |grep -i "$(ADK_TARGET_LIBC)" \
  465. |sed -e "s#^config \(.*\)#\1=y#" \
  466. >> $(ADK_TOPDIR)/all.config; \
  467. fi
  468. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  469. system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
  470. grep -h "^config" target/*/Config.in.systems \
  471. |grep -i "$$system$$" \
  472. |sed -e "s#^config \(.*\)#\1=y#" \
  473. >> $(ADK_TOPDIR)/all.config; \
  474. fi
  475. menuconfig: $(CONFIG)/mconf defconfig .menu
  476. @if [ ! -f .config ];then \
  477. $(CONFIG)/conf --olddefconfig $(CONFIG_CONFIG_IN); \
  478. fi
  479. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  480. ${POSTCONFIG}
  481. _config: $(CONFIG)/conf allconfig .menu
  482. -@touch .config
  483. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  484. ${POSTCONFIG}
  485. distclean cleandir:
  486. @printf " ---> cleaning build directories, files and downloads.. "
  487. @$(MAKE) -C $(CONFIG) clean
  488. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
  489. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
  490. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  491. @rm -rf package/pkglist.d package/pkgconfigs.d
  492. @rm -f .config* .defconfig .tmpconfig.h all.config make.log
  493. @rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
  494. @rm -f target/*/Config.in.arch target/*/Config.in.systems
  495. @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
  496. @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
  497. @rm -f package/Config.in.auto* target/config/Config.in.system target/config/Config.in.tasks
  498. @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
  499. @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
  500. @printf "done\n"
  501. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  502. $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
  503. @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
  504. $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
  505. @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
  506. $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
  507. @$(HOST_CC) $(HOST_CFLAGS) -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
  508. menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard tasks/*)
  509. @printf " ---> generating menu structure.. "
  510. @$(SHELL) $(ADK_TOPDIR)/scripts/create-menu
  511. @$(ADK_TOPDIR)/adk/tools/pkgmaker
  512. @:>.menu
  513. @printf "done\n"
  514. dep: $(ADK_TOPDIR)/adk/tools/depmaker
  515. @printf " ---> generating dependencies.. "
  516. @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
  517. @printf "done\n"
  518. .PHONY: menu dep
  519. include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
  520. check-dejagnu:
  521. @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
  522. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
  523. -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
  524. adk/tests/adk.exp.in > adk/tests/adk.exp
  525. @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
  526. adk/tests/master.exp
  527. check-gcc: check-dejagnu
  528. env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
  529. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c
  530. check-g++: check-dejagnu
  531. env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
  532. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c++
  533. check: check-gcc check-g++