build.mk 23 KB

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