build.mk 22 KB

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