build.mk 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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 ADK_RUNTIME_CONSOLE;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/$(ARCH)/kernel.config $(BUILD_DIR)/linux/.config
  163. $(MAKE) -C $(BUILD_DIR)/linux/ ARCH=$(ARCH) menuconfig
  164. cp $(BUILD_DIR)/linux/.config $(TOPDIR)/target/$(ARCH)/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),ibm-x40)
  264. @echo ADK_ARCH_CHOICE=y >> $(TOPDIR)/.defconfig
  265. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  266. @echo ADK_HARDWARE_IBM_X40=y >> $(TOPDIR)/.defconfig
  267. endif
  268. ifeq ($(ADKtype),lemote-yeelong)
  269. @echo ADK_HARDWARE_LEMOTE_YEELONG=y >> $(TOPDIR)/.defconfig
  270. endif
  271. @if [ ! -z "$(TARGET)" ];then \
  272. grep "^config" target/Config.in \
  273. |grep -i "$(TARGET)"\$$ \
  274. |sed -e "s#^config \(.*\)#\1=y#" \
  275. >> $(TOPDIR)/.defconfig; \
  276. if [ "$(TARGET)" = "native" ];then \
  277. echo "ADK_ARCH_CHOICE=y" >> $(TOPDIR)/.defconfig; \
  278. fi; \
  279. fi
  280. @for symbol in ${DEFCONFIG}; do \
  281. echo $$symbol >> $(TOPDIR)/.defconfig; \
  282. done
  283. @if [ ! -z "$(FS)" ];then \
  284. grep "^config" target/Config.in \
  285. |grep -i "$(FS)" \
  286. |sed -e "s#^config \(.*\)#\1=y#" \
  287. >> $(TOPDIR)/.defconfig; \
  288. fi
  289. @if [ ! -z "$(PKG)" ];then \
  290. grep "^config" target/Config.in \
  291. |grep -i "$(PKG)" \
  292. |sed -e "s#^config \(.*\)#\1=y#" \
  293. >> $(TOPDIR)/.defconfig; \
  294. fi
  295. @if [ ! -z "$(LIBC)" ];then \
  296. grep "^config" target/Config.in \
  297. |grep -i "$(LIBC)" \
  298. |sed -e "s#^config \(.*\)#\1=y#" \
  299. >> $(TOPDIR)/.defconfig; \
  300. fi
  301. @if [ ! -z "$(HW)" ];then \
  302. hw=$$(echo "$(HW)" |sed -e "s/-/_/g"); \
  303. grep -h "^config" target/Config.in.* \
  304. |grep -i "$$hw" \
  305. |sed -e "s#^config \(.*\)#\1=y#" \
  306. >> $(TOPDIR)/.defconfig; \
  307. echo "ADK_ARCH_CHOICE=y" >> $(TOPDIR)/.defconfig; \
  308. fi
  309. ifneq (,$(filter rb%,${TARGET}))
  310. @echo ADK_LINUX_MIKROTIK=y >> $(TOPDIR)/.defconfig
  311. endif
  312. ifneq (,$(filter alix%,${TARGET}))
  313. @echo ADK_LINUX_ALIX=y >> $(TOPDIR)/.defconfig
  314. endif
  315. @if [ ! -z "$(TARGET)" ];then \
  316. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  317. fi
  318. modconfig:
  319. ifeq (${OStype},Linux)
  320. @echo ADK_HOST_LINUX=y > $(TOPDIR)/all.config
  321. endif
  322. ifeq (${OStype},FreeBSD)
  323. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/all.config
  324. endif
  325. ifeq (${OStype},MirBSD)
  326. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/all.config
  327. endif
  328. ifeq (${OStype},OpenBSD)
  329. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/all.config
  330. endif
  331. ifeq (${OStype},NetBSD)
  332. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/all.config
  333. endif
  334. ifeq (${OStype},Darwin)
  335. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/all.config
  336. endif
  337. ifneq (,$(filter CYGWIN%,${OStype}))
  338. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/all.config
  339. endif
  340. ifeq ($(ADKtype),ibmx-40)
  341. @echo ADK_HARDWARE_IBM_X40=y >> $(TOPDIR)/all.config
  342. endif
  343. ifeq ($(ADKtype),lemote-yeelong)
  344. @echo ADK_HARDWARE_LEMOTE_YEELONG=y >> $(TOPDIR)/all.config
  345. endif
  346. @if [ ! -z "$(TARGET)" ];then \
  347. grep "^config" target/Config.in \
  348. |grep -i "$(TARGET)"\$$ \
  349. |sed -e "s#^config \(.*\)#\1=y#" \
  350. >> $(TOPDIR)/all.config; \
  351. fi
  352. @for symbol in ${DEFCONFIG}; do \
  353. echo $$symbol >> $(TOPDIR)/all.config; \
  354. done
  355. @if [ ! -z "$(FS)" ];then \
  356. grep "^config" target/Config.in \
  357. |grep -i "$(FS)" \
  358. |sed -e "s#^config \(.*\)#\1=y#" \
  359. >> $(TOPDIR)/all.config; \
  360. fi
  361. @if [ ! -z "$(PKG)" ];then \
  362. grep "^config" target/Config.in \
  363. |grep -i "$(PKG)" \
  364. |sed -e "s#^config \(.*\)#\1=y#" \
  365. >> $(TOPDIR)/all.config; \
  366. fi
  367. @if [ ! -z "$(LIBC)" ];then \
  368. grep "^config" target/Config.in \
  369. |grep -i "$(LIBC)" \
  370. |sed -e "s#^config \(.*\)#\1=y#" \
  371. >> $(TOPDIR)/all.config; \
  372. fi
  373. @if [ ! -z "$(HW)" ];then \
  374. hw=$$(echo "$(HW)" |sed -e "s/-/_/g"); \
  375. grep -h "^config" target/Config.in.* \
  376. |grep -i "$$hw" \
  377. |sed -e "s#^config \(.*\)#\1=y#" \
  378. >> $(TOPDIR)/all.config; \
  379. echo "ADK_ARCH_CHOICE=y" >> $(TOPDIR)/all.config; \
  380. fi
  381. ifneq (,$(filter rb%,${TARGET}))
  382. @echo ADK_LINUX_MIKROTIK=y >> $(TOPDIR)/all.config
  383. endif
  384. ifneq (,$(filter alix%,${TARGET}))
  385. @echo ADK_LINUX_ALIX=y >> $(TOPDIR)/all.config
  386. endif
  387. menuconfig: $(CONFIG)/mconf defconfig .menu package/Config.in.auto
  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. @if [ ! -f .config ];then \
  395. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  396. fi
  397. @$(CONFIG)/gconf $(CONFIG_CONFIG_IN)
  398. ${POSTCONFIG}
  399. _config: $(CONFIG)/conf .menu package/Config.in.auto
  400. -@touch .config
  401. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  402. ${POSTCONFIG}
  403. .NOTPARALLEL: _mconfig
  404. _mconfig: ${CONFIG}/conf _mconfig2 _config
  405. _mconfig2: ${CONFIG}/conf modconfig .menu
  406. @${CONFIG}/conf -m ${RCONFIG} >/dev/null
  407. distclean:
  408. @$(MAKE) -C $(CONFIG) clean
  409. @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \
  410. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  411. @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_PARENT_PFX) $(TOOLS_BUILD_DIR)
  412. @rm -f .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  413. .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG
  414. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  415. # build all targets and combinations
  416. bulk:
  417. @while read target libc fs hw; do \
  418. mkdir -p $(TOPDIR)/bin/$${target}_$$libc; \
  419. ( \
  420. echo === building $$target $$hw $$libc $$fs on $$(date); \
  421. $(GMAKE) prereq && \
  422. $(GMAKE) TARGET=$$target HW=$$hw LIBC=$$libc FS=$$fs defconfig; \
  423. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  424. rm .config; \
  425. ) 2>&1 | tee $(TOPDIR)/bin/$${target}_$$libc/$$target-$$libc-$$fs.log; \
  426. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  427. done <${TOPDIR}/target/bulkdef.lst
  428. bulkall:
  429. @while read target libc fs hw; do \
  430. mkdir -p $(TOPDIR)/bin/$${target}_$$libc; \
  431. ( \
  432. echo === building $$target $$hw $$libc $$fs on $$(date); \
  433. $(GMAKE) prereq && \
  434. $(GMAKE) TARGET=$$target HW=$$hw LIBC=$$libc FS=$$fs allconfig; \
  435. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  436. rm .config; \
  437. ) 2>&1 | tee $(TOPDIR)/bin/$${target}_$$libc/$$target-$$libc-$$fs.log; \
  438. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  439. done <${TOPDIR}/target/bulk.lst
  440. bulkallmod:
  441. @while read target libc fs hw; do \
  442. mkdir -p $(TOPDIR)/bin/$${target}_$$libc; \
  443. ( \
  444. echo === building $$target $$hw $$libc $$fs on $$(date); \
  445. $(GMAKE) prereq && \
  446. $(GMAKE) TARGET=$$target HW=$$hw LIBC=$$libc FS=$$fs allmodconfig; \
  447. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  448. rm .config; \
  449. ) 2>&1 | tee $(TOPDIR)/bin/$${target}_$$libc/$$target-$$libc-$$fs.log; \
  450. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  451. done <${TOPDIR}/target/bulk.lst
  452. ${TOPDIR}/bin/tools/pkgmaker:
  453. @mkdir -p $(TOPDIR)/bin/tools
  454. @$(HOSTCC) -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
  455. ${TOPDIR}/bin/tools/pkgrebuild:
  456. @mkdir -p $(TOPDIR)/bin/tools
  457. @$(HOSTCC) -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c
  458. package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) ${TOPDIR}/bin/tools/pkgmaker ${TOPDIR}/bin/tools/pkgrebuild
  459. @echo "Generating menu structure ..."
  460. @$(TOPDIR)/bin/tools/pkgmaker
  461. @:>.menu
  462. $(TOPDIR)/bin/tools:
  463. @mkdir -p $(TOPDIR)/bin/tools
  464. ${TOPDIR}/bin/tools/depmaker: $(TOPDIR)/bin/tools
  465. $(HOSTCC) -o $(TOPDIR)/bin/tools/depmaker $(TOPDIR)/tools/adk/depmaker.c
  466. dep: $(TOPDIR)/bin/tools/depmaker
  467. @echo "Generating dependencies ..."
  468. $(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk
  469. .PHONY: menu dep
  470. include $(TOPDIR)/toolchain/gcc/Makefile.inc
  471. check:
  472. @-rm tests/adk.exp tests/master.exp
  473. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" tests/adk.exp.in > \
  474. tests/adk.exp
  475. @sed -e "s#@TOPDIR@#$(TOPDIR)#" tests/master.exp.in > \
  476. tests/master.exp
  477. env DEJAGNU=$(TOPDIR)/tests/master.exp \
  478. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-gcc