build.mk 21 KB

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