build.mk 24 KB

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