build.mk 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  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. @${BASH} ${TOPDIR}/scripts/update-sys
  250. @${BASH} ${TOPDIR}/scripts/update-pkg
  251. ifeq (${OStype},Linux)
  252. @echo ADK_HOST_LINUX=y > $(TOPDIR)/.defconfig
  253. endif
  254. ifeq (${OStype},FreeBSD)
  255. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/.defconfig
  256. endif
  257. ifeq (${OStype},MirBSD)
  258. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/.defconfig
  259. endif
  260. ifeq (${OStype},OpenBSD)
  261. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/.defconfig
  262. endif
  263. ifeq (${OStype},NetBSD)
  264. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/.defconfig
  265. endif
  266. ifeq (${OStype},Darwin)
  267. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/.defconfig
  268. endif
  269. ifneq (,$(filter CYGWIN%,${OStype}))
  270. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/.defconfig
  271. endif
  272. ifeq ($(ADKtype),ibm-x40)
  273. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  274. @echo ADK_TARGET_SYSTEM_IBM_X40=y >> $(TOPDIR)/.defconfig
  275. @sed -e "s#TARGET#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. ifeq ($(ADKtype),lemote-yeelong)
  283. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  284. @echo ADK_TARGET_SYSTEM_LEMOTE_YEELONG=y >> $(TOPDIR)/.defconfig
  285. @sed -e "s#TARGET#NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  286. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  287. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  288. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  289. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  290. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  291. endif
  292. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  293. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  294. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  295. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  296. @if [ ! -z "$(ARCH)" ];then \
  297. grep "^config" target/config/Config.in.arch.choice \
  298. |grep -i "$(ARCH)"\$$ \
  299. |sed -e "s#^config \(.*\)#\1=y#" \
  300. >> $(TOPDIR)/.defconfig; \
  301. fi
  302. @for symbol in ${DEFCONFIG}; do \
  303. echo $$symbol >> $(TOPDIR)/.defconfig; \
  304. done
  305. @if [ ! -z "$(FS)" ];then \
  306. grep "^config" target/config/Config.in \
  307. |grep -i "$(FS)" \
  308. |sed -e "s#^config \(.*\)#\1=y#" \
  309. >> $(TOPDIR)/.defconfig; \
  310. fi
  311. @if [ ! -z "$(PKG)" ];then \
  312. grep "^config" target/config/Config.in \
  313. |grep -i "$(PKG)" \
  314. |sed -e "s#^config \(.*\)#\1=y#" \
  315. >> $(TOPDIR)/.defconfig; \
  316. fi
  317. @if [ ! -z "$(LIBC)" ];then \
  318. grep "^config" target/config/Config.in \
  319. |grep -i "$(LIBC)" \
  320. |sed -e "s#^config \(.*\)#\1=y#" \
  321. >> $(TOPDIR)/.defconfig; \
  322. fi
  323. @if [ ! -z "$(SYSTEM)" ];then \
  324. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  325. grep -h "^config" target/*/Config.in.systems \
  326. |grep -i "$$system" \
  327. |sed -e "s#^config \(.*\)#\1=y#" \
  328. >> $(TOPDIR)/.defconfig; \
  329. fi
  330. @if [ ! -z "$(SYSTEM)" ];then \
  331. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  332. fi
  333. modconfig:
  334. ifeq (${OStype},Linux)
  335. @echo ADK_HOST_LINUX=y > $(TOPDIR)/all.config
  336. endif
  337. ifeq (${OStype},FreeBSD)
  338. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/all.config
  339. endif
  340. ifeq (${OStype},MirBSD)
  341. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/all.config
  342. endif
  343. ifeq (${OStype},OpenBSD)
  344. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/all.config
  345. endif
  346. ifeq (${OStype},NetBSD)
  347. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/all.config
  348. endif
  349. ifeq (${OStype},Darwin)
  350. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/all.config
  351. endif
  352. ifneq (,$(filter CYGWIN%,${OStype}))
  353. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/all.config
  354. endif
  355. ifeq ($(ADKtype),ibmx-40)
  356. @echo ADK_TARGET_SYSTEM_IBM_X40=y >> $(TOPDIR)/all.config
  357. @sed -e "s#TARGET#NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  358. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  359. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  360. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  361. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  362. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  363. endif
  364. ifeq ($(ADKtype),lemote-yeelong)
  365. @echo ADK_TARGET_SYSTEM_LEMOTE_YEELONG=y >> $(TOPDIR)/all.config
  366. @sed -e "s#TARGET#NATIVE#" target/$(HOSTARCH)/sys-available/$(ADKtype) > \
  367. target/$(HOSTARCH)/sys-enabled/.$(ADKtype)
  368. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  369. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  370. @echo "source \"target/$(HOSTARCH)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  371. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  372. endif
  373. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  374. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  375. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  376. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  377. @if [ ! -z "$(ARCH)" ];then \
  378. grep "^config" target/config/Config.in.arch.choice \
  379. |grep -i "$(ARCH)"\$$ \
  380. |sed -e "s#^config \(.*\)#\1=y#" \
  381. >> $(TOPDIR)/all.config; \
  382. fi
  383. @for symbol in ${DEFCONFIG}; do \
  384. echo $$symbol >> $(TOPDIR)/all.config; \
  385. done
  386. @if [ ! -z "$(FS)" ];then \
  387. grep "^config" target/config/Config.in \
  388. |grep -i "$(FS)" \
  389. |sed -e "s#^config \(.*\)#\1=y#" \
  390. >> $(TOPDIR)/all.config; \
  391. fi
  392. @if [ ! -z "$(PKG)" ];then \
  393. grep "^config" target/config/Config.in \
  394. |grep -i "$(PKG)" \
  395. |sed -e "s#^config \(.*\)#\1=y#" \
  396. >> $(TOPDIR)/all.config; \
  397. fi
  398. @if [ ! -z "$(LIBC)" ];then \
  399. grep "^config" target/config/Config.in \
  400. |grep -i "$(LIBC)" \
  401. |sed -e "s#^config \(.*\)#\1=y#" \
  402. >> $(TOPDIR)/all.config; \
  403. fi
  404. @if [ ! -z "$(SYSTEM)" ];then \
  405. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  406. grep -h "^config" target/*/Config.in.systems \
  407. |grep -i "$$system" \
  408. |sed -e "s#^config \(.*\)#\1=y#" \
  409. >> $(TOPDIR)/all.config; \
  410. fi
  411. menuconfig: $(CONFIG)/mconf defconfig .menu package/Config.in.auto
  412. @${BASH} ${TOPDIR}/scripts/update-sys
  413. @${BASH} ${TOPDIR}/scripts/update-pkg
  414. @if [ ! -f .config ];then \
  415. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  416. fi
  417. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  418. ${POSTCONFIG}
  419. guiconfig: $(CONFIG)/gconf defconfig .menu package/Config.in.auto
  420. @${BASH} ${TOPDIR}/scripts/update-sys
  421. @${BASH} ${TOPDIR}/scripts/update-pkg
  422. @if [ ! -f .config ];then \
  423. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  424. fi
  425. @$(CONFIG)/gconf $(CONFIG_CONFIG_IN)
  426. ${POSTCONFIG}
  427. _config: $(CONFIG)/conf .menu package/Config.in.auto
  428. -@touch .config
  429. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  430. ${POSTCONFIG}
  431. .NOTPARALLEL: _mconfig
  432. _mconfig: ${CONFIG}/conf _mconfig2 _config
  433. _mconfig2: ${CONFIG}/conf modconfig .menu
  434. @${CONFIG}/conf -m ${RCONFIG} >/dev/null
  435. distclean:
  436. @$(MAKE) -C $(CONFIG) clean
  437. @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \
  438. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  439. @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(TOOLS_BUILD_DIR)
  440. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  441. @rm -f .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  442. .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG
  443. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  444. # build all target architecture and libc combinations (toolchain only)
  445. bulktoolchain:
  446. for libc in uclibc eglibc glibc;do \
  447. while read arch; do \
  448. ( \
  449. mkdir -p $(TOPDIR)/bin/toolchain_$${arch}_$$libc; \
  450. echo === building $$arch $$libc toolchain on $$(date); \
  451. $(GMAKE) prereq && \
  452. $(GMAKE) ARCH=$$arch SYSTEM=toolchain LIBC=$$libc defconfig; \
  453. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  454. rm .config; \
  455. ) 2>&1 | tee $(TOPDIR)/bin/toolchain_$${arch}_$${libc}/build.log; \
  456. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  457. done <${TOPDIR}/target/arch.lst ;\
  458. done
  459. # build all target architecture, target systems and libc combinations
  460. bulk:
  461. for libc in uclibc eglibc glibc;do \
  462. while read arch; do \
  463. systems=$$(./scripts/getsystems $$arch); \
  464. for system in $$systems;do \
  465. ( \
  466. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  467. echo === building $$arch $$system $$libc on $$(date); \
  468. $(GMAKE) prereq && \
  469. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc defconfig; \
  470. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  471. rm .config; \
  472. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  473. done; \
  474. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  475. done <${TOPDIR}/target/arch.lst ;\
  476. done
  477. bulkall:
  478. for libc in uclibc eglibc glibc;do \
  479. while read arch; do \
  480. systems=$$(./scripts/getsystems $$arch); \
  481. for system in $$systems;do \
  482. ( \
  483. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  484. echo === building $$arch $$system $$libc on $$(date); \
  485. $(GMAKE) prereq && \
  486. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc allconfig; \
  487. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  488. rm .config; \
  489. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  490. done; \
  491. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  492. done <${TOPDIR}/target/arch.lst ;\
  493. done
  494. bulkallmod:
  495. for libc in uclibc eglibc glibc;do \
  496. while read arch; do \
  497. systems=$$(./scripts/getsystems $$arch); \
  498. for system in $$systems;do \
  499. ( \
  500. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  501. echo === building $$arch $$system $$libc on $$(date); \
  502. $(GMAKE) prereq && \
  503. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc allmodconfig; \
  504. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  505. rm .config; \
  506. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  507. done; \
  508. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  509. done <${TOPDIR}/target/arch.lst ;\
  510. done
  511. ${TOPDIR}/bin/tools/pkgmaker:
  512. @mkdir -p $(TOPDIR)/bin/tools
  513. @$(HOSTCC) -Wall -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
  514. ${TOPDIR}/bin/tools/pkgrebuild:
  515. @mkdir -p $(TOPDIR)/bin/tools
  516. @$(HOSTCC) -Wall -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c
  517. package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) ${TOPDIR}/bin/tools/pkgmaker ${TOPDIR}/bin/tools/pkgrebuild
  518. @echo "Generating menu structure ..."
  519. $(TOPDIR)/bin/tools/pkgmaker
  520. @:>.menu
  521. $(TOPDIR)/bin/tools:
  522. @mkdir -p $(TOPDIR)/bin/tools
  523. ${TOPDIR}/bin/tools/depmaker: $(TOPDIR)/bin/tools
  524. $(HOSTCC) -g -o $(TOPDIR)/bin/tools/depmaker $(TOPDIR)/tools/adk/depmaker.c
  525. dep: $(TOPDIR)/bin/tools/depmaker
  526. @echo "Generating dependencies ..."
  527. $(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk
  528. .PHONY: menu dep
  529. include $(TOPDIR)/toolchain/gcc/Makefile.inc
  530. check:
  531. @-rm tests/adk.exp tests/master.exp
  532. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" tests/adk.exp.in > \
  533. tests/adk.exp
  534. @sed -e "s#@TOPDIR@#$(TOPDIR)#" tests/master.exp.in > \
  535. tests/master.exp
  536. env DEJAGNU=$(TOPDIR)/tests/master.exp \
  537. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-gcc