build.mk 21 KB

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