build.mk 21 KB

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