build.mk 22 KB

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