build.mk 24 KB

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