build.mk 23 KB

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