build.mk 24 KB

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