build.mk 24 KB

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