1
0

build.mk 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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_USE_CCACHE=n \
  15. ADK_PACKAGE_ALSA_UTILS_WITH_ALSAMIXER=n \
  16. ADK_PACKAGE_GRUB=n \
  17. ADK_PACKAGE_BASE_FILES=y \
  18. ADK_PACKAGE_PYTHON=n \
  19. ADK_PKG_LAPTOP=n \
  20. ADK_PKG_DEVELOPMENT=n \
  21. ADK_TOOLCHAIN_GCC_JAVA=n \
  22. ADK_TOOLCHAIN_GCC_OBJC=n \
  23. ADK_TOOLCHAIN_GCC_USE_SSP=n \
  24. ADK_TOOLCHAIN_GCC_USE_LTO=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:
  106. mkdir -p $(DISTDIR) $(BUILD_DIR) $(TARGET_DIR) $(PACKAGE_DIR)/.stamps \
  107. $(TOOLS_DIR) $(TOOLS_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)
  108. ${BASH} ${TOPDIR}/scripts/scan-pkgs.sh
  109. ${BASH} ${TOPDIR}/scripts/update-sys
  110. ${BASH} ${TOPDIR}/scripts/update-pkg
  111. ifeq ($(ADK_NATIVE),y)
  112. $(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
  113. else
  114. ifeq ($(ADK_TOOLCHAIN_ONLY),y)
  115. $(MAKE) -f mk/build.mk toolchain/install tools/install jtools/install package/compile
  116. else
  117. $(MAKE) -f mk/build.mk toolchain/install tools/install jtools/install target/config-prepare target/compile package/compile root_clean package/install target/install package_index
  118. endif
  119. endif
  120. package_index:
  121. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  122. -cd ${PACKAGE_DIR} && \
  123. ${BASH} ${TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  124. endif
  125. ${STAGING_DIR} ${STAGING_DIR}/etc ${STAGING_HOST_DIR}:
  126. mkdir -p ${STAGING_DIR}/{bin,etc,lib,usr/include,usr/lib/pkgconfig} \
  127. ${STAGING_HOST_DIR}/{bin,lib,usr/bin,usr/lib}
  128. ${STAGING_DIR}/etc/ipkg.conf: ${STAGING_DIR}/etc
  129. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  130. echo "dest root /" >${STAGING_DIR}/etc/ipkg.conf
  131. echo "option offline_root ${TARGET_DIR}" >>$(STAGING_DIR)/etc/ipkg.conf
  132. endif
  133. package/%: ${STAGING_DIR}/etc/ipkg.conf ${TOPDIR}/package/Depends.mk
  134. $(MAKE) -C package $(patsubst package/%,%,$@)
  135. target/%:
  136. $(MAKE) -C target $(patsubst target/%,%,$@)
  137. toolchain/%: ${STAGING_DIR}
  138. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  139. tools/%:
  140. $(MAKE) -C tools $(patsubst tools/%,%,$@)
  141. jtools/%:
  142. $(MAKE) -C jtools $(patsubst jtools/%,%,$@)
  143. image:
  144. $(MAKE) -C target image
  145. switch:
  146. if [ -f .config ];then \
  147. echo "Saving configuration for target system: ${ADK_TARGET_SYSTEM} with arch: ${ADK_TARGET_ARCH}";\
  148. cp -p .config .config.${ADK_TARGET_ARCH}_${ADK_TARGET_SYSTEM};\
  149. fi
  150. if [ -f .config.old ];then cp -p .config.old .config.old.${ADK_TARGET_ARCH}_${ADK_TARGET_SYSTEM};fi
  151. if [ -f .config.${ARCH}_${SYSTEM} ];then \
  152. cp -p .config.${ARCH}_${SYSTEM} .config; \
  153. cp -p .config.old.${ARCH}_${SYSTEM} .config.old; \
  154. $(MAKE) dep; rm .rebuild.* 2>/dev/null ; \
  155. echo "Setting configuration to target system: ${SYSTEM} with arch: ${ARCH}"; \
  156. else \
  157. echo "No old target config found" ;\
  158. mv .config .config.bak ; mv .config.old .config.old.bak; rm .rebuild.* 2>/dev/null ; \
  159. if [ ! -z "$(SYSTEM)" ];then \
  160. make ARCH=${ARCH} SYSTEM=${SYSTEM} menuconfig; \
  161. else \
  162. make menuconfig; \
  163. fi \
  164. fi
  165. kernelconfig:
  166. cp $(TOPDIR)/target/$(ADK_TARGET_ARCH)/kernel.config $(BUILD_DIR)/linux/.config
  167. ${KERNEL_MAKE_ENV} ${MAKE} ${KERNEL_MAKE_OPTS} -C $(BUILD_DIR)/linux menuconfig
  168. cp $(BUILD_DIR)/linux/.config $(TOPDIR)/target/$(ADK_TARGET_ARCH)/kernel.config
  169. # create a new package from package/.template
  170. newpackage:
  171. @echo "Creating new package $(PKG)"
  172. $(CP) $(TOPDIR)/package/.template $(TOPDIR)/package/$(PKG)
  173. pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
  174. $(SED) "s#@UPKG@#$$pkg#" $(TOPDIR)/package/$(PKG)/Makefile
  175. $(SED) 's#@PKG@#$(PKG)#' $(TOPDIR)/package/$(PKG)/Makefile
  176. $(SED) 's#@VER@#$(VER)#' $(TOPDIR)/package/$(PKG)/Makefile
  177. @echo "Edit package/$(PKG)/Makefile to complete"
  178. root_clean:
  179. @$(TRACE) root_clean
  180. rm -rf $(TARGET_DIR)
  181. mkdir -p $(TARGET_DIR)
  182. # Do a per-package clean here, too. This way stale headers and
  183. # libraries from target_*/ get wiped away, which keeps
  184. # future package build's configure scripts from returning false
  185. # dependencies information.
  186. clean:
  187. @$(TRACE) clean
  188. $(MAKE) -C $(CONFIG) clean
  189. for d in ${STAGING_PKG_DIR}; do \
  190. for f in $$(ls $$d/[a-z]* 2>/dev/null); do \
  191. while read file ; do \
  192. rm ${STAGING_DIR}/$$file 2>/dev/null;\
  193. done < $$f ; \
  194. rm $$f ; \
  195. done \
  196. done
  197. rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR) \
  198. ${TOPDIR}/package/pkglist.d
  199. rm -f ${TOPDIR}/package/Depends.mk
  200. cleankernel:
  201. @$(TRACE) cleankernel
  202. rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
  203. cleandir:
  204. @$(TRACE) cleandir
  205. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  206. rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) \
  207. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  208. rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  209. rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  210. rm -f .menu .tmpconfig.h .rebuild* ${TOPDIR}/package/Depends.mk ${TOPDIR}/prereq.mk
  211. cleantarget:
  212. @$(TRACE) cleantarget
  213. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  214. rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR)
  215. rm -rf $(TOOLCHAIN_BUILD_DIR) $(STAGING_HOST_DIR) $(STAGING_DIR) $(STAGING_PKG_DIR)
  216. rm -f .tmpconfig.h all.config .defconfig
  217. distclean:
  218. @$(TRACE) distclean
  219. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  220. @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \
  221. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  222. @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR)
  223. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  224. @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  225. .menu ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
  226. else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  227. ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
  228. include ${TOPDIR}/mk/vars.mk
  229. else
  230. include $(TOPDIR)/prereq.mk
  231. export BASH MAKE LANGUAGE LC_ALL OStype PATH CC_FOR_BUILD
  232. endif
  233. all: menuconfig
  234. @echo "Start the build with \"make\" or with \"make v\" to be verbose"
  235. # configuration
  236. # ---------------------------------------------------------------------------
  237. # force entering the subdir, as dependency checking is done there
  238. .PHONY: $(CONFIG)/conf $(CONFIG)/mconf $(CONFIG)/gconf
  239. $(CONFIG)/conf:
  240. @$(MAKE) -C $(CONFIG) conf
  241. $(CONFIG)/mconf:
  242. @$(MAKE) -C $(CONFIG)
  243. $(CONFIG)/gconf:
  244. @$(MAKE) -C $(CONFIG) gconf
  245. defconfig: .menu $(CONFIG)/conf
  246. @${BASH} ${TOPDIR}/scripts/update-sys
  247. @${BASH} ${TOPDIR}/scripts/update-pkg
  248. ifeq (${OStype},Linux)
  249. @echo ADK_HOST_LINUX=y > $(TOPDIR)/.defconfig
  250. endif
  251. ifeq (${OStype},FreeBSD)
  252. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/.defconfig
  253. endif
  254. ifeq (${OStype},MirBSD)
  255. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/.defconfig
  256. endif
  257. ifeq (${OStype},OpenBSD)
  258. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/.defconfig
  259. endif
  260. ifeq (${OStype},NetBSD)
  261. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/.defconfig
  262. endif
  263. ifeq (${OStype},Darwin)
  264. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/.defconfig
  265. endif
  266. ifneq (,$(filter CYGWIN%,${OStype}))
  267. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/.defconfig
  268. endif
  269. ifeq ($(ADKtype),ibm-x40)
  270. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  271. @echo ADK_TARGET_SYSTEM_IBM_X40=y >> $(TOPDIR)/.defconfig
  272. @sed -e "s#config ADK_TARGET#config ADK_NATIVE#" target/$(ARCH_FOR_BUILD)/sys-available/$(ADKtype) > \
  273. target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)
  274. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  275. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  276. @echo "source \"target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  277. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  278. endif
  279. ifeq ($(ADKtype),lemote-yeelong)
  280. @echo ADK_LINUX_NATIVE=y >> $(TOPDIR)/.defconfig
  281. @echo ADK_TARGET_SYSTEM_LEMOTE_YEELONG=y >> $(TOPDIR)/.defconfig
  282. @sed -e "s#config ADK_TARGET#config ADK_NATIVE#" target/$(ARCH_FOR_BUILD)/sys-available/$(ADKtype) > \
  283. target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)
  284. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  285. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  286. @echo "source \"target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  287. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  288. endif
  289. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  290. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  291. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  292. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  293. @if [ ! -z "$(ARCH)" ];then \
  294. grep "^config" target/config/Config.in.arch.choice \
  295. |grep -i "$(ARCH)"\$$ \
  296. |sed -e "s#^config \(.*\)#\1=y#" \
  297. >> $(TOPDIR)/.defconfig; \
  298. fi
  299. @for symbol in ${DEFCONFIG}; do \
  300. echo $$symbol >> $(TOPDIR)/.defconfig; \
  301. done
  302. @if [ ! -z "$(FS)" ];then \
  303. grep "^config" target/config/Config.in \
  304. |grep -i "$(FS)" \
  305. |sed -e "s#^config \(.*\)#\1=y#" \
  306. >> $(TOPDIR)/.defconfig; \
  307. fi
  308. @if [ ! -z "$(PKG)" ];then \
  309. grep "^config" target/config/Config.in \
  310. |grep -i "$(PKG)" \
  311. |sed -e "s#^config \(.*\)#\1=y#" \
  312. >> $(TOPDIR)/.defconfig; \
  313. fi
  314. @if [ ! -z "$(LIBC)" ];then \
  315. grep "^config" target/config/Config.in \
  316. |grep -i "$(LIBC)" \
  317. |sed -e "s#^config \(.*\)#\1=y#" \
  318. >> $(TOPDIR)/.defconfig; \
  319. fi
  320. @if [ ! -z "$(SYSTEM)" ];then \
  321. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  322. grep -h "^config" target/*/Config.in.systems \
  323. |grep -i "$$system$$" \
  324. |sed -e "s#^config \(.*\)#\1=y#" \
  325. >> $(TOPDIR)/.defconfig; \
  326. fi
  327. @if [ ! -z "$(SYSTEM)" ];then \
  328. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  329. fi
  330. modconfig:
  331. ifeq (${OStype},Linux)
  332. @echo ADK_HOST_LINUX=y > $(TOPDIR)/all.config
  333. endif
  334. ifeq (${OStype},FreeBSD)
  335. @echo ADK_HOST_FREEBSD=y > $(TOPDIR)/all.config
  336. endif
  337. ifeq (${OStype},MirBSD)
  338. @echo ADK_HOST_MIRBSD=y > $(TOPDIR)/all.config
  339. endif
  340. ifeq (${OStype},OpenBSD)
  341. @echo ADK_HOST_OPENBSD=y > $(TOPDIR)/all.config
  342. endif
  343. ifeq (${OStype},NetBSD)
  344. @echo ADK_HOST_NETBSD=y > $(TOPDIR)/all.config
  345. endif
  346. ifeq (${OStype},Darwin)
  347. @echo ADK_HOST_DARWIN=y > $(TOPDIR)/all.config
  348. endif
  349. ifneq (,$(filter CYGWIN%,${OStype}))
  350. @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/all.config
  351. endif
  352. ifeq ($(ADKtype),ibmx-40)
  353. @echo ADK_TARGET_SYSTEM_IBM_X40=y >> $(TOPDIR)/all.config
  354. @sed -e "s#TARGET#NATIVE#" target/$(ARCH_FOR_BUILD)/sys-available/$(ADKtype) > \
  355. target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)
  356. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  357. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  358. @echo "source \"target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  359. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  360. endif
  361. ifeq ($(ADKtype),lemote-yeelong)
  362. @echo ADK_TARGET_SYSTEM_LEMOTE_YEELONG=y >> $(TOPDIR)/all.config
  363. @sed -e "s#TARGET#NATIVE#" target/$(ARCH_FOR_BUILD)/sys-available/$(ADKtype) > \
  364. target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)
  365. @echo "choice" > $(TOPDIR)/target/config/Config.in.native
  366. @echo "prompt \"Target system (autodetected)\"" >> $(TOPDIR)/target/config/Config.in.native
  367. @echo "source \"target/$(ARCH_FOR_BUILD)/sys-enabled/.$(ADKtype)\"" >> $(TOPDIR)/target/config/Config.in.native
  368. @echo "endchoice" >> $(TOPDIR)/target/config/Config.in.native
  369. endif
  370. @echo 'source "target/config/Config.in.arch.default"' > target/config/Config.in.arch
  371. @echo 'source "target/config/Config.in.arch.choice"' >> target/config/Config.in.arch
  372. @echo 'source "target/config/Config.in.system.default"' > target/config/Config.in.system
  373. @echo 'source "target/config/Config.in.system.choice"' >> target/config/Config.in.system
  374. @if [ ! -z "$(ARCH)" ];then \
  375. grep "^config" target/config/Config.in.arch.choice \
  376. |grep -i "$(ARCH)"\$$ \
  377. |sed -e "s#^config \(.*\)#\1=y#" \
  378. >> $(TOPDIR)/all.config; \
  379. fi
  380. @for symbol in ${DEFCONFIG}; do \
  381. echo $$symbol >> $(TOPDIR)/all.config; \
  382. done
  383. @if [ ! -z "$(FS)" ];then \
  384. grep "^config" target/config/Config.in \
  385. |grep -i "$(FS)" \
  386. |sed -e "s#^config \(.*\)#\1=y#" \
  387. >> $(TOPDIR)/all.config; \
  388. fi
  389. @if [ ! -z "$(PKG)" ];then \
  390. grep "^config" target/config/Config.in \
  391. |grep -i "$(PKG)" \
  392. |sed -e "s#^config \(.*\)#\1=y#" \
  393. >> $(TOPDIR)/all.config; \
  394. fi
  395. @if [ ! -z "$(LIBC)" ];then \
  396. grep "^config" target/config/Config.in \
  397. |grep -i "$(LIBC)" \
  398. |sed -e "s#^config \(.*\)#\1=y#" \
  399. >> $(TOPDIR)/all.config; \
  400. fi
  401. @if [ ! -z "$(SYSTEM)" ];then \
  402. system=$$(echo "$(SYSTEM)" |sed -e "s/-/_/g"); \
  403. grep -h "^config" target/*/Config.in.systems \
  404. |grep -i "$$system" \
  405. |sed -e "s#^config \(.*\)#\1=y#" \
  406. >> $(TOPDIR)/all.config; \
  407. fi
  408. menuconfig: $(CONFIG)/mconf defconfig .menu package/Config.in.auto
  409. @${BASH} ${TOPDIR}/scripts/update-sys
  410. @${BASH} ${TOPDIR}/scripts/update-pkg
  411. @if [ ! -f .config ];then \
  412. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  413. fi
  414. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  415. ${POSTCONFIG}
  416. guiconfig: $(CONFIG)/gconf defconfig .menu package/Config.in.auto
  417. @${BASH} ${TOPDIR}/scripts/update-sys
  418. @${BASH} ${TOPDIR}/scripts/update-pkg
  419. @if [ ! -f .config ];then \
  420. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  421. fi
  422. @$(CONFIG)/gconf $(CONFIG_CONFIG_IN)
  423. ${POSTCONFIG}
  424. _config: $(CONFIG)/conf .menu package/Config.in.auto
  425. -@touch .config
  426. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  427. ${POSTCONFIG}
  428. .NOTPARALLEL: _mconfig
  429. _mconfig: ${CONFIG}/conf _mconfig2 _config
  430. _mconfig2: ${CONFIG}/conf modconfig .menu
  431. @${CONFIG}/conf -m ${RCONFIG} >/dev/null
  432. distclean:
  433. @$(MAKE) -C $(CONFIG) clean
  434. @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \
  435. ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d
  436. @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(TOOLS_BUILD_DIR)
  437. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  438. @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \
  439. .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG
  440. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  441. # build all target architecture and libc combinations (toolchain only)
  442. bulktoolchain:
  443. for libc in uclibc eglibc glibc;do \
  444. while read arch; do \
  445. mkdir -p $(TOPDIR)/bin/toolchain_$${arch}_$$libc; \
  446. ( \
  447. echo === building $$arch $$libc toolchain-$$arch on $$(date); \
  448. $(GMAKE) prereq && \
  449. $(GMAKE) ARCH=$$arch SYSTEM=toolchain-$$arch LIBC=$$libc defconfig; \
  450. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  451. rm .config; \
  452. ) 2>&1 | tee $(TOPDIR)/bin/toolchain_$${arch}_$${libc}/build.log; \
  453. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  454. done <${TOPDIR}/target/arch.lst ;\
  455. done
  456. # build all target architecture, target systems and libc combinations
  457. bulk:
  458. for libc in uclibc eglibc glibc;do \
  459. while read arch; do \
  460. systems=$$(./scripts/getsystems $$arch); \
  461. for system in $$systems;do \
  462. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  463. ( \
  464. echo === building $$arch $$system $$libc on $$(date); \
  465. $(GMAKE) prereq && \
  466. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc defconfig; \
  467. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  468. rm .config; \
  469. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  470. done; \
  471. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  472. done <${TOPDIR}/target/arch.lst ;\
  473. done
  474. bulkall:
  475. for libc in uclibc eglibc glibc;do \
  476. while read arch; do \
  477. systems=$$(./scripts/getsystems $$arch); \
  478. for system in $$systems;do \
  479. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  480. ( \
  481. echo === building $$arch $$system $$libc on $$(date); \
  482. $(GMAKE) prereq && \
  483. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc allconfig; \
  484. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  485. rm .config; \
  486. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  487. done; \
  488. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  489. done <${TOPDIR}/target/arch.lst ;\
  490. done
  491. bulkallmod:
  492. for libc in uclibc eglibc glibc;do \
  493. while read arch; do \
  494. systems=$$(./scripts/getsystems $$arch); \
  495. for system in $$systems;do \
  496. mkdir -p $(TOPDIR)/bin/$${system}_$${arch}_$$libc; \
  497. ( \
  498. echo === building $$arch $$system $$libc on $$(date); \
  499. $(GMAKE) prereq && \
  500. $(GMAKE) ARCH=$$arch SYSTEM=$$system LIBC=$$libc allmodconfig; \
  501. $(GMAKE) VERBOSE=1 all; if [ $$? -ne 0 ]; then touch .exit;fi; \
  502. rm .config; \
  503. ) 2>&1 | tee $(TOPDIR)/bin/$${system}_$${arch}_$$libc/build.log; \
  504. done; \
  505. if [ -f .exit ];then echo "Bulk build failed!"; rm .exit; exit 1;fi \
  506. done <${TOPDIR}/target/arch.lst ;\
  507. done
  508. ${TOPDIR}/bin/tools/pkgmaker: $(TOPDIR)/tools/adk/pkgmaker.c $(TOPDIR)/tools/adk/sortfile.c $(TOPDIR)/tools/adk/strmap.c
  509. @mkdir -p $(TOPDIR)/bin/tools
  510. @$(CC_FOR_BUILD) -Wall -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c
  511. ${TOPDIR}/bin/tools/pkgrebuild: $(TOPDIR)/tools/adk/pkgrebuild.c $(TOPDIR)/tools/adk/strmap.c
  512. @$(CC_FOR_BUILD) -Wall -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c
  513. package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) ${TOPDIR}/bin/tools/pkgmaker ${TOPDIR}/bin/tools/pkgrebuild
  514. @echo "Generating menu structure ..."
  515. @$(TOPDIR)/bin/tools/pkgmaker
  516. @:>.menu
  517. ${TOPDIR}/bin/tools/depmaker: $(TOPDIR)/tools/adk/depmaker.c
  518. $(CC_FOR_BUILD) -g -o $(TOPDIR)/bin/tools/depmaker $(TOPDIR)/tools/adk/depmaker.c
  519. dep: $(TOPDIR)/bin/tools/depmaker
  520. @echo "Generating dependencies ..."
  521. @$(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk
  522. .PHONY: menu dep
  523. include $(TOPDIR)/toolchain/gcc/Makefile.inc
  524. check:
  525. @-rm tests/adk.exp tests/master.exp
  526. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" tests/adk.exp.in > \
  527. tests/adk.exp
  528. @sed -e "s#@TOPDIR@#$(TOPDIR)#" tests/master.exp.in > \
  529. tests/master.exp
  530. env DEJAGNU=$(TOPDIR)/tests/master.exp \
  531. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-gcc