1
0

build.mk 20 KB

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