build.mk 23 KB

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