build.mk 22 KB

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