build.mk 23 KB

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