build.mk 24 KB

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