build.mk 24 KB

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