build.mk 24 KB

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