build.mk 25 KB

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