build.mk 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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. TOPDIR=$(shell pwd)
  4. export TOPDIR
  5. ifneq ($(shell umask 2>/dev/null | sed 's/0*022/OK/'),OK)
  6. $(error your umask is not 022)
  7. endif
  8. CONFIG_CONFIG_IN = Config.in
  9. CONFIG = config
  10. DEFCONFIG= ADK_DEBUG=n \
  11. ADK_STATIC=n \
  12. ADK_WGET_TIMEOUT=180 \
  13. ADK_MAKE_PARALLEL=y \
  14. ADK_MAKE_JOBS=4 \
  15. ADK_LEAVE_ETC_ALONE=n \
  16. ADK_SIMPLE_NETWORK_CONFIG=n \
  17. ADK_USE_CCACHE=n \
  18. ADK_PACKAGE_BASE_FILES=y \
  19. ADK_PACKAGE_E2FSCK_STATIC=n \
  20. ADK_PACKAGE_KEXECINIT=n \
  21. ADK_PACKAGE_INSTALLER=n \
  22. ADK_PACKAGE_LM_SENSORS_DETECT=n \
  23. ADK_PACKAGE_PACEMAKER=n \
  24. ADK_PACKAGE_PACEMAKER_MGMTD=n \
  25. ADK_PACKAGE_PACEMAKER_PYTHON_GUI=n \
  26. ADK_PACKAGE_CLASSPATH=n \
  27. ADK_PACKAGE_GRUB=n \
  28. ADK_PACKAGE_U_BOOT=n \
  29. ADK_PACKAGE_CRYPTINIT=n \
  30. ADK_PACKAGE_PAM=n \
  31. ADK_PACKAGE_VIRTINST=n \
  32. ADK_PACKAGE_URLGRABBER=n \
  33. ADK_PACKAGE_LIBSSP=n \
  34. ADK_PACKAGE_OPENAFS=n \
  35. ADK_PACKAGE_OPENJDK7=n \
  36. ADK_PKG_XORG=n \
  37. ADK_PKG_CONSOLE=n \
  38. ADK_PKG_TEST=n \
  39. ADK_PKG_MPDBOX=n \
  40. ADK_PKG_DEVELOPMENT=n \
  41. ADK_TOOLCHAIN_GCC_USE_SSP=n \
  42. ADK_TOOLCHAIN_GCC_USE_LTO=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_NOMMU=n \
  68. BUSYBOX_WERROR=n \
  69. BUSYBOX_STATIC=n \
  70. BUSYBOX_FEATURE_AIX_LABEL=n \
  71. BUSYBOX_FEATURE_SUN_LABEL=n \
  72. BUSYBOX_FEATURE_OSF_LABEL=n \
  73. BUSYBOX_FEATURE_SGI_LABEL=n \
  74. BUSYBOX_FEATURE_INETD_RPC=n \
  75. BUSYBOX_FEATURE_MOUNT_NFS=n \
  76. BUSYBOX_FEATURE_VI_REGEX_SEARCH=n \
  77. ADK_KERNEL_RT2X00_DEBUG=n \
  78. ADK_KERNEL_ATH5K_DEBUG=n \
  79. ADK_KERNEL_BUG=n \
  80. ADK_KERNEL_DEBUG_WITH_KGDB=n
  81. noconfig_targets:= menuconfig \
  82. _config \
  83. _mconfig \
  84. distclean \
  85. defconfig \
  86. tags
  87. POSTCONFIG= -@\
  88. if [ -f .adkinit ];then rm .adkinit;\
  89. else \
  90. if [ -f .config.old ];then \
  91. $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgrebuild;\
  92. rebuild=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_RUNTIME_PASSWORD ADK_RUNTIME_TMPFS_SIZE ADK_RUNTIME_HOSTNAME ADK_TARGET_ROOTFS ADK_RUNTIME_CONSOLE ADK_RUNTIME_GETTY ADK_RUNTIME_SHELL;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. if [ "$$(grep ^ADK_RUNTIME_TIMEZONE .config|md5sum)" != "$$(grep ^ADK_RUNTIME_TIMEZONE .config.old|md5sum)" ];then \
  104. touch .rebuild.musl .rebuild.uclibc .rebuild.glibc;\
  105. rebuild=1;\
  106. fi; \
  107. if [ "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config|md5sum)" != "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config.old|md5sum)" ];then \
  108. touch .rebuild.dropbear .rebuild.openssh;\
  109. rebuild=1;\
  110. fi; \
  111. if [ "$$(grep ^ADK_RUNTIME_KBD_LAYOUT .config|md5sum)" != "$$(grep ^ADK_RUNTIME_KBD_LAYOUT .config.old|md5sum)" ];then \
  112. touch .rebuild.bkeymaps;\
  113. rebuild=1;\
  114. fi; \
  115. if [ "$$(grep ^ADK_KERNEL_VERSION_ .config|md5sum)" != "$$(grep ^ADK_KERNEL_VERSION_ .config.old|md5sum)" ];then \
  116. make kernelclean;\
  117. fi; \
  118. if [ "$$(grep ^ADK_LINUX_ARM_WITH_THUMB .config|md5sum)" != "$$(grep ^ADK_LINUX_ARM_WITH_THUMB .config.old|md5sum)" ];then \
  119. echo "You should make cleandir, after changing thumb mode";\
  120. fi; \
  121. if [ $$rebuild -eq 1 ];then \
  122. cp .config .config.old;\
  123. fi; \
  124. fi; \
  125. fi
  126. # Pull in the user's configuration file
  127. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  128. -include $(TOPDIR)/.config
  129. endif
  130. ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  131. include $(TOPDIR)/rules.mk
  132. all: world
  133. ${TOPDIR}/package/Depends.mk: ${TOPDIR}/.config $(wildcard ${TOPDIR}/package/*/Makefile)
  134. $(STAGING_HOST_DIR)/usr/bin/depmaker > ${TOPDIR}/package/Depends.mk
  135. .NOTPARALLEL:
  136. .PHONY: all world clean cleandir cleantoolchain distclean image_clean
  137. world:
  138. mkdir -p $(DL_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
  139. $(TOOLS_BUILD_DIR) $(STAGING_HOST_DIR)/usr/bin \
  140. $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
  141. ${BASH} ${TOPDIR}/scripts/scan-pkgs.sh
  142. ${BASH} ${TOPDIR}/scripts/update-sys
  143. ${BASH} ${TOPDIR}/scripts/update-pkg
  144. ifeq ($(ADK_TOOLCHAIN),y)
  145. ifeq ($(ADK_TOOLCHAIN_ONLY),y)
  146. $(MAKE) -f mk/build.mk tools/install toolchain/fixup package/compile
  147. else
  148. $(MAKE) -f mk/build.mk tools/install toolchain/fixup package/compile root_clean package/install
  149. endif
  150. else
  151. $(MAKE) -f mk/build.mk tools/install toolchain/fixup target/config-prepare target/compile package/compile root_clean package/install target/install package_index
  152. endif
  153. package_index:
  154. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  155. -cd ${PACKAGE_DIR} && \
  156. ${BASH} ${TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  157. endif
  158. ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
  159. mkdir -p ${STAGING_TARGET_DIR}/{bin,etc,lib,usr/bin,usr/include,usr/lib/pkgconfig} \
  160. ${STAGING_HOST_DIR}/{usr/bin,usr/lib,usr/include}
  161. for i in lib64 lib32 libx32;do \
  162. cd ${STAGING_TARGET_DIR}/; ln -sf lib $$i; \
  163. cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
  164. done
  165. ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
  166. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  167. echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
  168. echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
  169. endif
  170. package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${TOPDIR}/package/Depends.mk
  171. $(MAKE) -C package $(patsubst package/%,%,$@)
  172. target/%:
  173. $(MAKE) -C target $(patsubst target/%,%,$@)
  174. toolchain/%: ${STAGING_TARGET_DIR}
  175. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  176. tools/%:
  177. $(MAKE) -C tools $(patsubst tools/%,%,$@)
  178. image:
  179. $(MAKE) -C target image
  180. switch:
  181. if [ -f .config ];then \
  182. echo "Saving configuration for target system: ${ADK_TARGET_SYSTEM} with arch: ${ADK_TARGET_ARCH}";\
  183. cp -p .config .config.${ADK_TARGET_ARCH}_${ADK_TARGET_SYSTEM};\
  184. fi
  185. if [ -f .config.old ];then cp -p .config.old .config.old.${ADK_TARGET_ARCH}_${ADK_TARGET_SYSTEM};fi
  186. if [ -f .config.${ARCH}_${SYSTEM} ];then \
  187. cp -p .config.${ARCH}_${SYSTEM} .config; \
  188. cp -p .config.old.${ARCH}_${SYSTEM} .config.old; \
  189. $(MAKE) dep; rm .rebuild.* 2>/dev/null ; \
  190. echo "Setting configuration to target system: ${SYSTEM} with arch: ${ARCH}"; \
  191. else \
  192. echo "No old target config found" ;\
  193. mv .config .config.bak ; mv .config.old .config.old.bak; rm .rebuild.* 2>/dev/null ; \
  194. if [ ! -z "$(SYSTEM)" ];then \
  195. make ARCH=${ARCH} SYSTEM=${SYSTEM} menuconfig; \
  196. else \
  197. make menuconfig; \
  198. fi \
  199. fi
  200. kernelconfig:
  201. ${KERNEL_MAKE_ENV} ${MAKE} \
  202. ARCH=$(ARCH) \
  203. ${KERNEL_MAKE_OPTS} \
  204. -C $(BUILD_DIR)/linux menuconfig
  205. # create a new package from package/.template
  206. newpackage:
  207. @echo "Creating new package $(PKG)"
  208. $(CP) $(TOPDIR)/package/.template$(TYPE) $(TOPDIR)/package/$(PKG)
  209. pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
  210. $(SED) "s#@UPKG@#$$pkg#" $(TOPDIR)/package/$(PKG)/Makefile
  211. $(SED) 's#@PKG@#$(PKG)#' $(TOPDIR)/package/$(PKG)/Makefile
  212. $(SED) 's#@VER@#$(VER)#' $(TOPDIR)/package/$(PKG)/Makefile
  213. @echo "Edit package/$(PKG)/Makefile to complete"
  214. root_clean:
  215. @$(TRACE) root_clean
  216. rm -rf $(TARGET_DIR)
  217. mkdir -p $(TARGET_DIR)
  218. # Do a per-package clean here, too. This way stale headers and
  219. # libraries from target_*/ get wiped away, which keeps
  220. # future package build's configure scripts from returning false
  221. # dependencies information.
  222. clean:
  223. @$(TRACE) clean
  224. $(MAKE) -C $(CONFIG) clean
  225. for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
  226. while read file ; do \
  227. rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
  228. done < ${STAGING_PKG_DIR}/$$f ; \
  229. rm ${STAGING_PKG_DIR}/$$f ; \
  230. done
  231. rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  232. ${TOPDIR}/package/pkglist.d
  233. rm -f ${TOPDIR}/package/Depends.mk
  234. cleankernel:
  235. @$(TRACE) cleankernel
  236. rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
  237. cleandir:
  238. @$(TRACE) cleandir
  239. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  240. rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
  241. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  242. rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  243. rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  244. rm -f .menu .tmpconfig.h .rebuild* ${TOPDIR}/package/Depends.mk ${TOPDIR}/prereq.mk
  245. cleantoolchain:
  246. @$(TRACE) cleantoolchain
  247. @rm -rf $(BUILD_DIR_PFX) $(TARGET_DIR_PFX) \
  248. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  249. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  250. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  251. @rm -f .menu .tmpconfig.h .rebuild* ${TOPDIR}/package/Depends.mk
  252. distclean:
  253. @$(TRACE) distclean
  254. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  255. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR) \
  256. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  257. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  258. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  259. @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  260. .menu ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
  261. else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  262. ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
  263. include ${TOPDIR}/mk/vars.mk
  264. else
  265. include $(TOPDIR)/prereq.mk
  266. export BASH MAKE LANGUAGE LC_ALL OStype PATH CC_FOR_BUILD QEMU SHELL
  267. endif
  268. all: menuconfig
  269. @echo "Start the build with \"make\" or with \"make v\" to be verbose"
  270. # configuration
  271. # ---------------------------------------------------------------------------
  272. # force entering the subdir, as dependency checking is done there
  273. .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
  274. $(CONFIG)/conf:
  275. @$(MAKE) -C $(CONFIG) conf
  276. $(CONFIG)/mconf:
  277. @$(MAKE) -C $(CONFIG)
  278. defconfig: .menu $(CONFIG)/conf
  279. @${BASH} ${TOPDIR}/scripts/update-sys
  280. @${BASH} ${TOPDIR}/scripts/update-pkg
  281. ifeq (${OStype},Linux)
  282. @echo ADK_HOST_LINUX=y > $(TOPDIR)/.defconfig
  283. endif
  284. ifeq (${OStype},FreeBSD)
  285. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/.defconfig
  286. endif
  287. ifeq (${OStype},MirBSD)
  288. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/.defconfig
  289. endif
  290. ifeq (${OStype},OpenBSD)
  291. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/.defconfig
  292. endif
  293. ifeq (${OStype},NetBSD)
  294. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/.defconfig
  295. endif
  296. ifeq (${OStype},Darwin)
  297. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/.defconfig
  298. endif
  299. ifneq (,$(filter CYGWIN%,${OStype}))
  300. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/.defconfig
  301. endif
  302. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  303. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  304. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  305. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  306. @if [ ! -z "$(ARCH)" ];then \
  307. grep "^config" target/config/Config.in.arch.choice \
  308. |grep -i "$(ARCH)"\$$ \
  309. |sed -e "s#^config \(.*\)#\1=y#" \
  310. >> $(TOPDIR)/.defconfig; \
  311. fi
  312. @for symbol in ${DEFCONFIG}; do \
  313. echo $$symbol >> $(TOPDIR)/.defconfig; \
  314. done
  315. @if [ ! -z "$(FS)" ];then \
  316. grep "^config" target/config/Config.in \
  317. |grep -i "$(FS)" \
  318. |sed -e "s#^config \(.*\)#\1=y#" \
  319. >> $(TOPDIR)/.defconfig; \
  320. fi
  321. @if [ ! -z "$(COLLECTION)" ];then \
  322. grep -h "^config" target/packages/pkg-available/* \
  323. |grep -i "$(COLLECTION)" \
  324. |sed -e "s#^config \(.*\)#\1=y#" \
  325. >> $(TOPDIR)/.defconfig; \
  326. fi
  327. @if [ ! -z "$(LIBC)" ];then \
  328. grep "^config" target/config/Config.in \
  329. |grep -i "$(LIBC)" \
  330. |sed -e "s#^config \(.*\)#\1=y#" \
  331. >> $(TOPDIR)/.defconfig; \
  332. fi
  333. @if [ ! -z "$(SYSTEM)" ];then \
  334. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  335. grep -h "^config" target/*/Config.in.systems \
  336. |grep -i "$$system$$" \
  337. |sed -e "s#^config \(.*\)#\1=y#" \
  338. >> $(TOPDIR)/.defconfig; \
  339. fi
  340. @if [ ! -z "$(SYSTEM)" ];then \
  341. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  342. fi
  343. modconfig:
  344. ifeq (${OStype},Linux)
  345. @echo ADK_HOST_LINUX=y > $(TOPDIR)/all.config
  346. endif
  347. ifeq (${OStype},FreeBSD)
  348. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/all.config
  349. endif
  350. ifeq (${OStype},MirBSD)
  351. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/all.config
  352. endif
  353. ifeq (${OStype},OpenBSD)
  354. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/all.config
  355. endif
  356. ifeq (${OStype},NetBSD)
  357. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/all.config
  358. endif
  359. ifeq (${OStype},Darwin)
  360. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/all.config
  361. endif
  362. ifneq (,$(filter CYGWIN%,${OStype}))
  363. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/all.config
  364. endif
  365. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  366. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  367. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  368. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  369. @if [ ! -z "$(ARCH)" ];then \
  370. grep "^config" target/config/Config.in.arch.choice \
  371. |grep -i "$(ARCH)"\$$ \
  372. |sed -e "s#^config \(.*\)#\1=y#" \
  373. >> $(TOPDIR)/all.config; \
  374. fi
  375. @for symbol in ${DEFCONFIG}; do \
  376. echo $$symbol >> $(TOPDIR)/all.config; \
  377. done
  378. @if [ ! -z "$(FS)" ];then \
  379. grep "^config" target/config/Config.in \
  380. |grep -i "$(FS)" \
  381. |sed -e "s#^config \(.*\)#\1=y#" \
  382. >> $(TOPDIR)/all.config; \
  383. fi
  384. @if [ ! -z "$(LIBC)" ];then \
  385. grep "^config" target/config/Config.in \
  386. |grep -i "$(LIBC)" \
  387. |sed -e "s#^config \(.*\)#\1=y#" \
  388. >> $(TOPDIR)/all.config; \
  389. fi
  390. @if [ ! -z "$(SYSTEM)" ];then \
  391. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  392. grep -h "^config" target/*/Config.in.systems \
  393. |grep -i "$$system" \
  394. |sed -e "s#^config \(.*\)#\1=y#" \
  395. >> $(TOPDIR)/all.config; \
  396. fi
  397. menuconfig: $(CONFIG)/mconf defconfig .menu package/Config.in.auto
  398. @${BASH} ${TOPDIR}/scripts/update-sys
  399. @${BASH} ${TOPDIR}/scripts/update-pkg
  400. @if [ ! -f .config ];then \
  401. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  402. fi
  403. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  404. ${POSTCONFIG}
  405. _config: $(CONFIG)/conf .menu package/Config.in.auto
  406. -@touch .config
  407. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  408. ${POSTCONFIG}
  409. .NOTPARALLEL: _mconfig
  410. _mconfig: ${CONFIG}/conf _mconfig2 _config
  411. _mconfig2: ${CONFIG}/conf modconfig .menu
  412. @${CONFIG}/conf -m ${RCONFIG} >/dev/null
  413. distclean:
  414. @$(MAKE) -C $(CONFIG) clean
  415. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR) \
  416. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  417. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(TOOLS_BUILD_DIR)
  418. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  419. @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  420. .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG
  421. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  422. # build all target architecture and libc combinations (toolchain only)
  423. bulktoolchain:
  424. @if [ -z "$(LIBC)" ];then \
  425. libc="glibc uclibc musl"; \
  426. else \
  427. libc="$(LIBC)"; \
  428. fi; \
  429. for libc in $$libc;do \
  430. while read arch; do \
  431. mkdir -p ${TOPDIR}/firmware; \
  432. ( \
  433. echo === building $$arch $$libc toolchain-$$arch on $$(date); \
  434. tarch=$$(echo $$arch|sed -e "s#el##" -e "s#eb##" -e "s#mips64.*#mips#" -e "s#hf##" -e "s#x86_64.*#x86_64#" ); \
  435. carch=$$(echo $$arch|sed -e "s#sh#sh4#" -e "s#hf##" -e "s#mips64n.*#mips64#" -e "s#mips64el.*#mips64el#" -e "s#x86_64.*#x86_64#" ); \
  436. $(GMAKE) prereq && \
  437. $(GMAKE) ARCH=$$tarch SYSTEM=toolchain-$$arch LIBC=$$libc defconfig; \
  438. tabi=$$(grep ^ADK_TARGET_ABI= .config|cut -d \" -f 2);\
  439. if [ $$arch = "armhf" ];then arch=arm; else arch=$$arch;fi; \
  440. if [ -z $$tabi ];then abi="";else abi=_$$tabi;fi; \
  441. if [ -f ${TOPDIR}/firmware/toolchain_$${carch}_$${libc}$${abi}.tar.xz ];then exit;fi; \
  442. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit; break;fi; \
  443. tar -cvJf ${TOPDIR}/firmware/toolchain_$${carch}_$${libc}$${abi}.tar.xz toolchain_${GNU_HOST_NAME} target_$${carch}_$${libc}$${abi}; \
  444. $(GMAKE) cleantoolchain; \
  445. rm .config; \
  446. ) 2>&1 | tee -a $(TOPDIR)/firmware/toolchain_build.log; \
  447. if [ -f .exit ];then break;fi \
  448. done <${TOPDIR}/target/tarch.lst ;\
  449. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  450. done
  451. test-framework:
  452. @if [ -z "$(LIBC)" ];then \
  453. libc="glibc uclibc musl"; \
  454. else \
  455. libc="$(LIBC)"; \
  456. fi; \
  457. for libc in $$libc;do \
  458. ( \
  459. mkdir -p $(TOPDIR)/firmware/; \
  460. for arch in arm armhf microblaze microblazeel mips mipsel mips64 mips64el ppc ppc64 sh4 sh4eb sparc sparc64 i686 x86_64;do \
  461. tarch=$$(echo $$arch|sed -e "s#el##" -e "s#eb##" -e "s#mips64.*#mips#" -e "s#i686#x86#" -e "s#sh4#sh#" -e "s#hf##"); \
  462. echo === building qemu-$$arch for $$libc with $$tarch on $$(date); \
  463. $(GMAKE) prereq && \
  464. $(GMAKE) ARCH=$$tarch SYSTEM=qemu-$$arch LIBC=$$libc FS=initramfsarchive COLLECTION=test defconfig; \
  465. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit; exit 1;fi; \
  466. tabi=$$(grep ^ADK_TARGET_ABI= .config|cut -d \" -f 2);\
  467. if [ -z $$tabi ];then abi="";else abi=_$$tabi;fi; \
  468. if [ $$arch = "armhf" ];then qarch=arm; else qarch=$$arch;fi; \
  469. cp -a root_qemu_$${qarch}_$${libc}$${abi} root; \
  470. mkdir -p $(TOPDIR)/firmware/qemu/$$arch; \
  471. tar cJvf $(TOPDIR)/firmware/qemu/$$arch/root.tar.xz root; \
  472. if [ -d root ];then rm -rf root;fi; \
  473. cp $(TOPDIR)/firmware/qemu_$${qarch}_$${libc}$${abi}/qemu-$${qarch}-initramfsarchive-kernel \
  474. $(TOPDIR)/firmware/qemu/$$arch/kernel; \
  475. rm .config; \
  476. done; \
  477. ) 2>&1 | tee $(TOPDIR)/firmware/test-framework-build.log; \
  478. if [ -f .exit ];then echo "Bulk build failed!"; break;fi \
  479. done
  480. if [ -f .exit ];then rm .exit;exit 1;fi
  481. release:
  482. for libc in uclibc glibc musl;do \
  483. ( \
  484. echo === building $$libc on $$(date); \
  485. $(GMAKE) prereq && \
  486. $(GMAKE) ARCH=$(ARCH) SYSTEM=$(SYSTEM) LIBC=$$libc FS=archive allmodconfig; \
  487. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit; exit 1;fi; \
  488. rm .config; \
  489. ) 2>&1 | tee $(TOPDIR)/firmware/release-build.log; \
  490. if [ -f .exit ];then echo "Bulk build failed!"; break;fi \
  491. done
  492. if [ -f .exit ];then rm .exit;exit 1;fi
  493. # build all target architecture, target systems and libc combinations
  494. bulk:
  495. for libc in uclibc glibc musl;do \
  496. while read arch; do \
  497. systems=$$(./scripts/getsystems $$arch|grep -v toolchain); \
  498. for system in $$systems;do \
  499. mkdir -p $(TOPDIR)/firmware; \
  500. ( \
  501. echo === building $$arch $$system $$libc on $$(date); \
  502. $(GMAKE) prereq && \
  503. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc FS=archive defconfig; \
  504. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit; exit 1;fi; \
  505. rm .config; \
  506. ) 2>&1 | tee $(TOPDIR)/firmware/bulkbuild.log; \
  507. if [ -f .exit ]; then break;fi \
  508. done; \
  509. if [ -f .exit ]; then break;fi \
  510. done <${TOPDIR}/target/arch.lst ;\
  511. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  512. done
  513. bulkall:
  514. for libc in uclibc glibc musl;do \
  515. while read arch; do \
  516. systems=$$(./scripts/getsystems $$arch| grep -v toolchain); \
  517. for system in $$systems;do \
  518. mkdir -p $(TOPDIR)/firmware; \
  519. ( \
  520. echo === building $$arch $$system $$libc on $$(date); \
  521. $(GMAKE) prereq && \
  522. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc FS=archive allconfig; \
  523. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit; exit 1;fi; \
  524. rm .config; \
  525. ) 2>&1 | tee $(TOPDIR)/firmware/bulkallbuild.log; \
  526. if [ -f .exit ]; then break;fi \
  527. done; \
  528. if [ -f .exit ]; then break;fi \
  529. done <${TOPDIR}/target/arch.lst ;\
  530. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  531. done
  532. bulkallmod:
  533. for libc in uclibc glibc musl;do \
  534. while read arch; do \
  535. systems=$$(./scripts/getsystems $$arch| grep -v toolchain); \
  536. for system in $$systems;do \
  537. mkdir -p $(TOPDIR)/firmware; \
  538. ( \
  539. echo === building $$arch $$system $$libc on $$(date); \
  540. $(GMAKE) prereq && \
  541. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc FS=archive allmodconfig; \
  542. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then echo $$system-$$libc >.exit; exit 1;fi; \
  543. $(GMAKE) clean; \
  544. rm .config; \
  545. ) 2>&1 | tee $(TOPDIR)/firmware/bulkallmodbuild.log; \
  546. if [ -f .exit ]; then break;fi \
  547. done; \
  548. if [ -f .exit ]; then break;fi \
  549. done <${TOPDIR}/target/arch.lst ;\
  550. if [ -f .exit ];then echo "Bulk build failed!"; cat .exit;rm .exit; exit 1;fi \
  551. done
  552. $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgmaker: $(TOPDIR)/tools/adk/pkgmaker.c $(TOPDIR)/tools/adk/sortfile.c $(TOPDIR)/tools/adk/strmap.c
  553. @mkdir -p host_$(GNU_HOST_NAME)/usr/bin
  554. @$(CC_FOR_BUILD) -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
  555. $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgrebuild: $(TOPDIR)/tools/adk/pkgrebuild.c $(TOPDIR)/tools/adk/strmap.c
  556. @$(CC_FOR_BUILD) -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c
  557. package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgmaker $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgrebuild
  558. @echo "Generating menu structure ..."
  559. @$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/pkgmaker
  560. @:>.menu
  561. $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/depmaker: $(TOPDIR)/tools/adk/depmaker.c
  562. @mkdir -p host_$(GNU_HOST_NAME)/usr/bin
  563. $(CC_FOR_BUILD) -g -o $@ $(TOPDIR)/tools/adk/depmaker.c
  564. dep: $(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/depmaker
  565. @echo "Generating dependencies ..."
  566. @$(TOPDIR)/host_$(GNU_HOST_NAME)/usr/bin/depmaker > ${TOPDIR}/package/Depends.mk
  567. .PHONY: menu dep
  568. include $(TOPDIR)/toolchain/gcc/Makefile.inc
  569. check-dejagnu:
  570. @-rm tests/adk.exp tests/master.exp >/dev/null 2>&1
  571. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" tests/adk.exp.in > \
  572. tests/adk.exp.in.tmp
  573. @sed -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" tests/adk.exp.in.tmp > \
  574. tests/adk.exp
  575. @sed -e "s#@TOPDIR@#$(TOPDIR)#" tests/master.exp.in > \
  576. tests/master.exp
  577. check-gcc: check-dejagnu
  578. env DEJAGNU=$(TOPDIR)/tests/master.exp \
  579. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-gcc
  580. check-g++: check-dejagnu
  581. env DEJAGNU=$(TOPDIR)/tests/master.exp \
  582. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-g++
  583. check: check-gcc check-g++