build.mk 20 KB

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