1
0

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