build.mk 17 KB

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