1
0

build.mk 18 KB

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