build.mk 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  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_MAKE_PARALLEL=y \
  13. ADK_MAKE_JOBS=4 \
  14. ADK_PACKAGE_GRUB=n \
  15. ADK_PACKAGE_BASE_FILES=y \
  16. ADK_PACKAGE_PYTHON=n \
  17. ADK_TOOLCHAIN_GCC_JAVA=n \
  18. ADK_TOOLCHAIN_GCC_OBJC=n \
  19. ADK_TOOLCHAIN_GCC_USE_SSP=n \
  20. ADK_TOOLCHAIN_GCC_USE_LTO=n \
  21. BUSYBOX_BBCONFIG=n \
  22. BUSYBOX_SELINUX=n \
  23. BUSYBOX_INSTALL_NO_USR=n \
  24. BUSYBOX_MODPROBE_SMALL=n \
  25. BUSYBOX_EJECT=n \
  26. BUSYBOX_BUILD_LIBBUSYBOX=n \
  27. BUSYBOX_FEATURE_2_4_MODULES=n \
  28. BUSYBOX_LOCALE_SUPPORT=n \
  29. BUSYBOX_FEATURE_PREFER_APPLETS=n \
  30. BUSYBOX_FEATURE_SUID=n \
  31. BUSYBOX_SELINUXENABLED=n \
  32. BUSYBOX_FEATURE_INSTALLER=n \
  33. BUSYBOX_PAM=n \
  34. BUSYBOX_FLASH_LOCK=n \
  35. BUSYBOX_FLASH_UNLOCK=n \
  36. BUSYBOX_FLASH_ERASEALL=n \
  37. BUSYBOX_PIE=n \
  38. BUSYBOX_TASKSET=n \
  39. BUSYBOX_DEBUG=n \
  40. BUSYBOX_NOMMU=n \
  41. BUSYBOX_WERROR=n \
  42. BUSYBOX_STATIC=n \
  43. BUSYBOX_FEATURE_AIX_LABEL=n \
  44. BUSYBOX_FEATURE_SUN_LABEL=n \
  45. BUSYBOX_FEATURE_OSF_LABEL=n \
  46. BUSYBOX_FEATURE_SGI_LABEL=n \
  47. ADK_KERNEL_RT2X00_DEBUG=n \
  48. ADK_KERNEL_ATH5K_DEBUG=n \
  49. ADK_KERNEL_DEBUG_WITH_KGDB=n
  50. noconfig_targets:= menuconfig \
  51. guiconfig \
  52. _config \
  53. _mconfig \
  54. distclean \
  55. defconfig \
  56. tags
  57. POSTCONFIG= -@\
  58. if [ -f .adkinit ];then rm .adkinit;\
  59. else \
  60. if [ -f .config.old ];then \
  61. $(TOPDIR)/bin/tools/pkgrebuild;\
  62. rebuild=0; \
  63. if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
  64. touch .rebuild.busybox;\
  65. rebuild=1;\
  66. fi; \
  67. for i in ADK_RUNTIME_PASSWORD ADK_RUNTIME_HOSTNAME ADK_TARGET_ROOTFS ADK_RUNTIME_CONSOLE;do \
  68. if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
  69. touch .rebuild.base-files;\
  70. rebuild=1;\
  71. fi; \
  72. done; \
  73. if [ "$$(grep ^ADK_RUNTIME_TIMEZONE .config|md5sum)" != "$$(grep ^ADK_RUNTIME_TIMEZONE .config.old|md5sum)" ];then \
  74. touch .rebuild.eglibc .rebuild.uclibc .rebuild.glibc;\
  75. rebuild=1;\
  76. fi; \
  77. if [ "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config|md5sum)" != "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config.old|md5sum)" ];then \
  78. touch .rebuild.dropbear .rebuild.openssh;\
  79. rebuild=1;\
  80. fi; \
  81. if [ "$$(grep ^ADK_RUNTIME_KBD_LAYOUT .config|md5sum)" != "$$(grep ^ADK_RUNTIME_KBD_LAYOUT .config.old|md5sum)" ];then \
  82. touch .rebuild.bkeymaps;\
  83. rebuild=1;\
  84. fi; \
  85. if [ $$rebuild -eq 1 ];then \
  86. cp .config .config.old;\
  87. fi; \
  88. fi; \
  89. fi
  90. # Pull in the user's configuration file
  91. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  92. -include $(TOPDIR)/.config
  93. endif
  94. ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  95. include $(TOPDIR)/rules.mk
  96. all: world
  97. ${TOPDIR}/package/Depends.mk: ${TOPDIR}/.config $(wildcard ${TOPDIR}/package/*/Makefile)
  98. $(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk
  99. .NOTPARALLEL:
  100. .PHONY: all world clean cleantarget cleandir distclean image_clean
  101. world:
  102. mkdir -p $(DISTDIR) $(BUILD_DIR) $(TARGET_DIR) $(PACKAGE_DIR)/.stamps \
  103. $(TOOLS_DIR) $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)
  104. ${BASH} ${TOPDIR}/scripts/scan-pkgs.sh
  105. ${BASH} ${TOPDIR}/scripts/update-sys
  106. ${BASH} ${TOPDIR}/scripts/update-pkg
  107. ifeq ($(ADK_NATIVE),y)
  108. $(MAKE) -f mk/build.mk toolchain/kernel-headers-prepare tools/install target/config-prepare target/compile package/compile root_clean package/install package_index target/install
  109. else
  110. ifeq ($(ADK_TOOLCHAIN_ONLY),y)
  111. $(MAKE) -f mk/build.mk toolchain/install tools/install package/compile
  112. else
  113. $(MAKE) -f mk/build.mk toolchain/install tools/install target/config-prepare target/compile package/compile root_clean package/install target/install package_index
  114. endif
  115. endif
  116. package_index:
  117. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  118. -cd ${PACKAGE_DIR} && \
  119. ${BASH} ${TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  120. endif
  121. ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
  122. mkdir -p ${STAGING_TARGET_DIR}/{bin,etc,lib,usr/include,usr/lib} \
  123. ${STAGING_HOST_DIR}/{bin,lib,usr/bin,usr/lib}
  124. ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
  125. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  126. echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
  127. echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
  128. endif
  129. package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${TOPDIR}/package/Depends.mk
  130. $(MAKE) -C package $(patsubst package/%,%,$@)
  131. target/%:
  132. $(MAKE) -C target $(patsubst target/%,%,$@)
  133. toolchain/%: ${STAGING_TARGET_DIR}
  134. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  135. tools/%:
  136. $(MAKE) -C tools $(patsubst tools/%,%,$@)
  137. image:
  138. $(MAKE) -C target image
  139. switch:
  140. if [ -f .config ];then \
  141. echo "Saving configuration for target system: ${ADK_TARGET_SYSTEM} with arch: ${ADK_TARGET_ARCH}";\
  142. cp -p .config .config.${ADK_TARGET_ARCH}_${ADK_TARGET_SYSTEM};\
  143. fi
  144. if [ -f .config.old ];then cp -p .config.old .config.old.${ADK_TARGET_ARCH}_${ADK_TARGET_SYSTEM};fi
  145. if [ -f .config.${ARCH}_${SYSTEM} ];then \
  146. cp -p .config.${ARCH}_${SYSTEM} .config; \
  147. cp -p .config.old.${ARCH}_${SYSTEM} .config.old; \
  148. echo "Setting configuration to target system: ${SYSTEM} with arch: ${ARCH}"; \
  149. else \
  150. echo "No old target config found" ;\
  151. mv .config .config.bak ;\
  152. if [ ! -z "$(SYSTEM)" ];then \
  153. make ARCH=${ARCH} SYSTEM=${SYSTEM} menuconfig; \
  154. else \
  155. make menuconfig; \
  156. fi \
  157. fi
  158. kernelconfig:
  159. cp $(TOPDIR)/target/$(ADK_TARGET_ARCH)/kernel.config $(BUILD_DIR)/linux/.config
  160. ${KERNEL_MAKE_ENV} ${MAKE} ${KERNEL_MAKE_OPTS} -C $(BUILD_DIR)/linux menuconfig
  161. cp $(BUILD_DIR)/linux/.config $(TOPDIR)/target/$(ADK_TARGET_ARCH)/kernel.config
  162. # create a new package from package/.template
  163. newpackage:
  164. @echo "Creating new package $(PKG)"
  165. $(CP) $(TOPDIR)/package/.template $(TOPDIR)/package/$(PKG)
  166. pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
  167. $(SED) "s#@UPKG@#$$pkg#" $(TOPDIR)/package/$(PKG)/Makefile
  168. $(SED) 's#@PKG@#$(PKG)#' $(TOPDIR)/package/$(PKG)/Makefile
  169. $(SED) 's#@VER@#$(VER)#' $(TOPDIR)/package/$(PKG)/Makefile
  170. @echo "Edit package/$(PKG)/Makefile to complete"
  171. root_clean:
  172. @$(TRACE) root_clean
  173. rm -rf $(TARGET_DIR)
  174. mkdir -p $(TARGET_DIR)
  175. # Do a per-package clean here, too. This way stale headers and
  176. # libraries from target_*/ get wiped away, which keeps
  177. # future package build's configure scripts from returning false
  178. # dependencies information.
  179. clean:
  180. @$(TRACE) clean
  181. $(MAKE) -C $(CONFIG) clean
  182. for d in ${STAGING_PKG_DIR}; do \
  183. for f in $$(ls $$d/[a-z]* 2>/dev/null); do \
  184. while read file ; do \
  185. rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
  186. done < $$f ; \
  187. rm $$f ; \
  188. done \
  189. done
  190. rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR) \
  191. ${TOPDIR}/package/pkglist.d
  192. rm -f ${TOPDIR}/package/Depends.mk
  193. cleankernel:
  194. @$(TRACE) cleankernel
  195. rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
  196. cleandir:
  197. @$(TRACE) cleandir
  198. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  199. rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) \
  200. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  201. rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  202. rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  203. rm -f .menu .tmpconfig.h .rebuild* ${TOPDIR}/package/Depends.mk ${TOPDIR}/prereq.mk
  204. cleantarget:
  205. @$(TRACE) cleantarget
  206. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  207. rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR)
  208. rm -rf $(TOOLCHAIN_BUILD_DIR) $(STAGING_HOST_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR)
  209. rm -f .tmpconfig.h all.config .defconfig
  210. distclean:
  211. @$(TRACE) distclean
  212. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  213. @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \
  214. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  215. @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  216. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  217. @rm -f .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  218. .menu ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
  219. else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  220. ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
  221. include ${TOPDIR}/mk/vars.mk
  222. else
  223. include $(TOPDIR)/prereq.mk
  224. export BASH MAKE LANGUAGE LC_ALL OStype PATH CC_FOR_BUILD
  225. endif
  226. all: menuconfig
  227. @echo "Start the build with \"make\" or with \"make v\" to be verbose"
  228. # configuration
  229. # ---------------------------------------------------------------------------
  230. # force entering the subdir, as dependency checking is done there
  231. .PHONY: $(CONFIG)/conf $(CONFIG)/mconf $(CONFIG)/gconf
  232. $(CONFIG)/conf:
  233. @$(MAKE) -C $(CONFIG) conf
  234. $(CONFIG)/mconf:
  235. @$(MAKE) -C $(CONFIG)
  236. $(CONFIG)/gconf:
  237. @$(MAKE) -C $(CONFIG) gconf
  238. defconfig: .menu $(CONFIG)/conf
  239. @${BASH} ${TOPDIR}/scripts/update-sys
  240. @${BASH} ${TOPDIR}/scripts/update-pkg
  241. ifeq (${OStype},Linux)
  242. @echo ADK_HOST_LINUX=y > $(TOPDIR)/.defconfig
  243. endif
  244. ifeq (${OStype},FreeBSD)
  245. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/.defconfig
  246. endif
  247. ifeq (${OStype},MirBSD)
  248. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/.defconfig
  249. endif
  250. ifeq (${OStype},OpenBSD)
  251. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/.defconfig
  252. endif
  253. ifeq (${OStype},NetBSD)
  254. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/.defconfig
  255. endif
  256. ifeq (${OStype},Darwin)
  257. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/.defconfig
  258. endif
  259. ifneq (,$(filter CYGWIN%,${OStype}))
  260. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/.defconfig
  261. endif
  262. ifeq ($(ADKtype),ibm-x40)
  263. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  264. @echo ADK_TARGET_SYSTEM_IBM_X40=y >> $(TOPDIR)/.defconfig
  265. @sed -e "s#config ADK_TARGET#config ADK_NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  266. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  267. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  268. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  269. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  270. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  271. endif
  272. ifeq ($(ADKtype),lemote-yeelong)
  273. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  274. @echo ADK_TARGET_SYSTEM_LEMOTE_YEELONG=y >> $(TOPDIR)/.defconfig
  275. @sed -e "s#config ADK_TARGET#config ADK_NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  276. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  277. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  278. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  279. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  280. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  281. endif
  282. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  283. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  284. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  285. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  286. @if [ ! -z "$(ARCH)" ];then \
  287. grep "^config" target/config/Config.in.arch.choice \
  288. |grep -i "$(ARCH)"\$$ \
  289. |sed -e "s#^config \(.*\)#\1=y#" \
  290. >> $(TOPDIR)/.defconfig; \
  291. fi
  292. @for symbol in ${DEFCONFIG}; do \
  293. echo $$symbol >> $(TOPDIR)/.defconfig; \
  294. done
  295. @if [ ! -z "$(FS)" ];then \
  296. grep "^config" target/config/Config.in \
  297. |grep -i "$(FS)" \
  298. |sed -e "s#^config \(.*\)#\1=y#" \
  299. >> $(TOPDIR)/.defconfig; \
  300. fi
  301. @if [ ! -z "$(PKG)" ];then \
  302. grep "^config" target/config/Config.in \
  303. |grep -i "$(PKG)" \
  304. |sed -e "s#^config \(.*\)#\1=y#" \
  305. >> $(TOPDIR)/.defconfig; \
  306. fi
  307. @if [ ! -z "$(LIBC)" ];then \
  308. grep "^config" target/config/Config.in \
  309. |grep -i "$(LIBC)" \
  310. |sed -e "s#^config \(.*\)#\1=y#" \
  311. >> $(TOPDIR)/.defconfig; \
  312. fi
  313. @if [ ! -z "$(SYSTEM)" ];then \
  314. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  315. grep -h "^config" target/*/Config.in.systems \
  316. |grep -i "$$system$$" \
  317. |sed -e "s#^config \(.*\)#\1=y#" \
  318. >> $(TOPDIR)/.defconfig; \
  319. fi
  320. @if [ ! -z "$(SYSTEM)" ];then \
  321. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  322. fi
  323. modconfig:
  324. ifeq (${OStype},Linux)
  325. @echo ADK_HOST_LINUX=y > $(TOPDIR)/all.config
  326. endif
  327. ifeq (${OStype},FreeBSD)
  328. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/all.config
  329. endif
  330. ifeq (${OStype},MirBSD)
  331. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/all.config
  332. endif
  333. ifeq (${OStype},OpenBSD)
  334. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/all.config
  335. endif
  336. ifeq (${OStype},NetBSD)
  337. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/all.config
  338. endif
  339. ifeq (${OStype},Darwin)
  340. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/all.config
  341. endif
  342. ifneq (,$(filter CYGWIN%,${OStype}))
  343. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/all.config
  344. endif
  345. ifeq ($(ADKtype),ibmx-40)
  346. @echo ADK_TARGET_SYSTEM_IBM_X40=y >> $(TOPDIR)/all.config
  347. @sed -e "s#TARGET#NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  348. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  349. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  350. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  351. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  352. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  353. endif
  354. ifeq ($(ADKtype),lemote-yeelong)
  355. @echo ADK_TARGET_SYSTEM_LEMOTE_YEELONG=y >> $(TOPDIR)/all.config
  356. @sed -e "s#TARGET#NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  357. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  358. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  359. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  360. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  361. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  362. endif
  363. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  364. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  365. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  366. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  367. @if [ ! -z "$(ARCH)" ];then \
  368. grep "^config" target/config/Config.in.arch.choice \
  369. |grep -i "$(ARCH)"\$$ \
  370. |sed -e "s#^config \(.*\)#\1=y#" \
  371. >> $(TOPDIR)/all.config; \
  372. fi
  373. @for symbol in ${DEFCONFIG}; do \
  374. echo $$symbol >> $(TOPDIR)/all.config; \
  375. done
  376. @if [ ! -z "$(FS)" ];then \
  377. grep "^config" target/config/Config.in \
  378. |grep -i "$(FS)" \
  379. |sed -e "s#^config \(.*\)#\1=y#" \
  380. >> $(TOPDIR)/all.config; \
  381. fi
  382. @if [ ! -z "$(PKG)" ];then \
  383. grep "^config" target/config/Config.in \
  384. |grep -i "$(PKG)" \
  385. |sed -e "s#^config \(.*\)#\1=y#" \
  386. >> $(TOPDIR)/all.config; \
  387. fi
  388. @if [ ! -z "$(LIBC)" ];then \
  389. grep "^config" target/config/Config.in \
  390. |grep -i "$(LIBC)" \
  391. |sed -e "s#^config \(.*\)#\1=y#" \
  392. >> $(TOPDIR)/all.config; \
  393. fi
  394. @if [ ! -z "$(SYSTEM)" ];then \
  395. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  396. grep -h "^config" target/*/Config.in.systems \
  397. |grep -i "$$system" \
  398. |sed -e "s#^config \(.*\)#\1=y#" \
  399. >> $(TOPDIR)/all.config; \
  400. fi
  401. menuconfig: $(CONFIG)/mconf defconfig .menu package/Config.in.auto
  402. @${BASH} ${TOPDIR}/scripts/update-sys
  403. @${BASH} ${TOPDIR}/scripts/update-pkg
  404. @if [ ! -f .config ];then \
  405. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  406. fi
  407. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  408. ${POSTCONFIG}
  409. guiconfig: $(CONFIG)/gconf defconfig .menu package/Config.in.auto
  410. @${BASH} ${TOPDIR}/scripts/update-sys
  411. @${BASH} ${TOPDIR}/scripts/update-pkg
  412. @if [ ! -f .config ];then \
  413. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  414. fi
  415. @$(CONFIG)/gconf $(CONFIG_CONFIG_IN)
  416. ${POSTCONFIG}
  417. _config: $(CONFIG)/conf .menu package/Config.in.auto
  418. -@touch .config
  419. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  420. ${POSTCONFIG}
  421. .NOTPARALLEL: _mconfig
  422. _mconfig: ${CONFIG}/conf _mconfig2 _config
  423. _mconfig2: ${CONFIG}/conf modconfig .menu
  424. @${CONFIG}/conf -m ${RCONFIG} >/dev/null
  425. distclean:
  426. @$(MAKE) -C $(CONFIG) clean
  427. @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \
  428. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  429. @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(TOOLS_BUILD_DIR)
  430. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  431. @rm -f .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  432. .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG
  433. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  434. # build all target architecture and libc combinations (toolchain only)
  435. bulktoolchain:
  436. for libc in uclibc eglibc glibc;do \
  437. while read arch; do \
  438. mkdir -p $(TOPDIR)/bin/toolchain_$${arch}_$$libc; \
  439. ( \
  440. echo === building $$arch $$libc toolchain-$$arch on $$(date); \
  441. $(GMAKE) prereq && \
  442. $(GMAKE) ARCH=$$arch SYSTEM=toolchain-$$arch LIBC=$$libc defconfig; \
  443. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  444. rm .config; \
  445. ) 2>&1 | tee $(TOPDIR)/bin/toolchain_$${arch}_$${libc}/build.log; \
  446. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  447. done <${TOPDIR}/target/arch.lst ;\
  448. done
  449. # build all target architecture, target systems and libc combinations
  450. bulk:
  451. for libc in uclibc eglibc glibc;do \
  452. while read arch; do \
  453. systems=$$(./scripts/getsystems $$arch); \
  454. for system in $$systems;do \
  455. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  456. ( \
  457. echo === building $$arch $$system $$libc on $$(date); \
  458. $(GMAKE) prereq && \
  459. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc defconfig; \
  460. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  461. rm .config; \
  462. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  463. done; \
  464. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  465. done <${TOPDIR}/target/arch.lst ;\
  466. done
  467. bulkall:
  468. for libc in uclibc eglibc glibc;do \
  469. while read arch; do \
  470. systems=$$(./scripts/getsystems $$arch); \
  471. for system in $$systems;do \
  472. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  473. ( \
  474. echo === building $$arch $$system $$libc on $$(date); \
  475. $(GMAKE) prereq && \
  476. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc allconfig; \
  477. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  478. rm .config; \
  479. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  480. done; \
  481. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  482. done <${TOPDIR}/target/arch.lst ;\
  483. done
  484. bulkallmod:
  485. for libc in uclibc eglibc glibc;do \
  486. while read arch; do \
  487. systems=$$(./scripts/getsystems $$arch); \
  488. for system in $$systems;do \
  489. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  490. ( \
  491. echo === building $$arch $$system $$libc on $$(date); \
  492. $(GMAKE) prereq && \
  493. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc allmodconfig; \
  494. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  495. rm .config; \
  496. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  497. done; \
  498. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  499. done <${TOPDIR}/target/arch.lst ;\
  500. done
  501. ${TOPDIR}/bin/tools/pkgmaker: tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
  502. @mkdir -p $(TOPDIR)/bin/tools
  503. @$(HOSTCC) -Wall -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
  504. ${TOPDIR}/bin/tools/pkgrebuild:
  505. @$(HOSTCC) -Wall -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c
  506. package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) ${TOPDIR}/bin/tools/pkgmaker ${TOPDIR}/bin/tools/pkgrebuild
  507. @echo "Generating menu structure ..."
  508. @$(TOPDIR)/bin/tools/pkgmaker
  509. @:>.menu
  510. ${TOPDIR}/bin/tools/depmaker:
  511. $(HOSTCC) -g -o $(TOPDIR)/bin/tools/depmaker $(TOPDIR)/tools/adk/depmaker.c
  512. dep: $(TOPDIR)/bin/tools/depmaker
  513. @echo "Generating dependencies ..."
  514. @$(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk
  515. .PHONY: menu dep
  516. include $(TOPDIR)/toolchain/gcc/Makefile.inc
  517. check:
  518. @-rm tests/adk.exp tests/master.exp
  519. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" tests/adk.exp.in > \
  520. tests/adk.exp
  521. @sed -e "s#@TOPDIR@#$(TOPDIR)#" tests/master.exp.in > \
  522. tests/master.exp
  523. env DEJAGNU=$(TOPDIR)/tests/master.exp \
  524. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-gcc