build.mk 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. ADK_TOPDIR=$(shell pwd)
  4. export ADK_TOPDIR
  5. CONFIG_CONFIG_IN = Config.in
  6. CONFIG = adk/config
  7. DEFCONFIG= ADK_DEBUG=n \
  8. ADK_PACKAGE_BUSYBOX_HIDE=n \
  9. ADK_DISABLE_KERNEL_PATCHES=n \
  10. ADK_DISABLE_TARGET_KERNEL_PATCHES=n \
  11. ADK_WGET_TIMEOUT=180 \
  12. ADK_MAKE_PARALLEL=y \
  13. ADK_MAKE_JOBS=4 \
  14. ADK_LEAVE_ETC_ALONE=n \
  15. ADK_SIMPLE_NETWORK_CONFIG=n \
  16. ADK_USE_CCACHE=n \
  17. ADK_RUNTIME_START_SERVICES=n \
  18. ADK_PACKAGE_BASE_FILES=y \
  19. ADK_PACKAGE_KEXECINIT=n \
  20. ADK_PACKAGE_LM_SENSORS_DETECT=n \
  21. ADK_PACKAGE_CLASSPATH=n \
  22. ADK_PACKAGE_U_BOOT=n \
  23. ADK_PACKAGE_CRYPTINIT=n \
  24. ADK_PACKAGE_VIRTINST=n \
  25. ADK_PACKAGE_URLGRABBER=n \
  26. ADK_PACKAGE_OPENAFS=n \
  27. ADK_KERNEL_ADDON_YAFFS2=n \
  28. ADK_KERNEL_ADDON_GRSEC=n \
  29. ADK_KERNEL_ADDON_MPTCP=n \
  30. ADK_KERNEL_MPTCP=n \
  31. ADK_PKG_XORG=n \
  32. ADK_PKG_CONSOLE=n \
  33. ADK_PKG_TEST=n \
  34. ADK_PKG_MPDBOX=n \
  35. ADK_PKG_KODIBOX=n \
  36. ADK_PKG_DEVELOPMENT=n \
  37. ADK_STATIC_TOOLCHAIN=n \
  38. ADK_TOOLCHAIN_WITH_SSP=n \
  39. ADK_TARGET_USE_SSP=n \
  40. ADK_TOOLCHAIN_WITH_LTO=n \
  41. ADK_TARGET_USE_LTO=n \
  42. ADK_TOOLCHAIN_WITH_GOLD=n \
  43. ADK_TARGET_USE_GOLD=n \
  44. ADK_TARGET_USE_GNU_HASHSTYLE=n \
  45. ADK_TARGET_USE_PIE=n \
  46. ADK_TARGET_USE_STATIC_LIBS=n \
  47. ADK_TARGET_USE_LD_RELRO=n \
  48. ADK_TARGET_USE_LD_BIND_NOW=n \
  49. ADK_TARGET_USE_LD_GC=n \
  50. ADK_LINUX_ARM_WITH_THUMB=n \
  51. BUSYBOX_IFPLUGD=n \
  52. BUSYBOX_EXTRA_COMPAT=n \
  53. BUSYBOX_FEATURE_IFCONFIG_SLIP=n \
  54. BUSYBOX_BBCONFIG=n \
  55. BUSYBOX_SELINUX=n \
  56. BUSYBOX_INSTALL_NO_USR=n \
  57. BUSYBOX_MODPROBE_SMALL=n \
  58. BUSYBOX_EJECT=n \
  59. BUSYBOX_UBIDETACH=n \
  60. BUSYBOX_UBIATTACH=n \
  61. BUSYBOX_BUILD_LIBBUSYBOX=n \
  62. BUSYBOX_FEATURE_2_4_MODULES=n \
  63. BUSYBOX_LOCALE_SUPPORT=n \
  64. BUSYBOX_FEATURE_PREFER_APPLETS=n \
  65. BUSYBOX_FEATURE_SUID=n \
  66. BUSYBOX_SELINUXENABLED=n \
  67. BUSYBOX_FEATURE_INSTALLER=n \
  68. BUSYBOX_PAM=n \
  69. BUSYBOX_FLASH_LOCK=n \
  70. BUSYBOX_FLASH_UNLOCK=n \
  71. BUSYBOX_FLASH_ERASEALL=n \
  72. BUSYBOX_PIE=n \
  73. BUSYBOX_TASKSET=n \
  74. BUSYBOX_DEBUG=n \
  75. BUSYBOX_NOMMU=n \
  76. BUSYBOX_WERROR=n \
  77. BUSYBOX_STATIC=n \
  78. BUSYBOX_FEATURE_AIX_LABEL=n \
  79. BUSYBOX_FEATURE_SUN_LABEL=n \
  80. BUSYBOX_FEATURE_OSF_LABEL=n \
  81. BUSYBOX_FEATURE_SGI_LABEL=n \
  82. BUSYBOX_FEATURE_INETD_RPC=n \
  83. BUSYBOX_FEATURE_MOUNT_NFS=n \
  84. BUSYBOX_FEATURE_VI_REGEX_SEARCH=n \
  85. ADK_KERNEL_RT2X00_DEBUG=n \
  86. ADK_KERNEL_ATH5K_DEBUG=n \
  87. ADK_KERNEL_BUG=n \
  88. ADK_KERNEL_DEBUG_WITH_KGDB=n
  89. noconfig_targets:= menuconfig \
  90. _config \
  91. _mconfig \
  92. distclean \
  93. defconfig
  94. POSTCONFIG= -@\
  95. if [ -f .adkinit ];then rm .adkinit;\
  96. else \
  97. if [ -f .config.old ];then \
  98. $(ADK_TOPDIR)/adk/tools/pkgrebuild;\
  99. rebuild=0; \
  100. cleandir=0; \
  101. if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
  102. touch .rebuild.busybox;\
  103. rebuild=1;\
  104. fi; \
  105. for i in ADK_SIMPLE_NETWORK_CONFIG ADK_RUNTIME_PASSWORD ADK_RUNTIME_TMPFS_SIZE ADK_RUNTIME_HOSTNAME ADK_TARGET_ROOTFS ADK_RUNTIME_CONSOLE ADK_RUNTIME_GETTY ADK_RUNTIME_SHELL;do \
  106. if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
  107. touch .rebuild.base-files;\
  108. rebuild=1;\
  109. fi; \
  110. done; \
  111. if [ "$$(grep ^ADK_RUNTIME_TIMEZONE .config|md5sum)" != "$$(grep ^ADK_RUNTIME_TIMEZONE .config.old|md5sum)" ];then \
  112. touch .rebuild.musl .rebuild.uclibc .rebuild.uclibc-ng .rebuild.glibc;\
  113. rebuild=1;\
  114. fi; \
  115. if [ "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config|md5sum)" != "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config.old|md5sum)" ];then \
  116. touch .rebuild.dropbear .rebuild.openssh;\
  117. rebuild=1;\
  118. fi; \
  119. if [ "$$(grep ^ADK_RUNTIME_KBD_LAYOUT .config|md5sum)" != "$$(grep ^ADK_RUNTIME_KBD_LAYOUT .config.old|md5sum)" ];then \
  120. touch .rebuild.bkeymaps;\
  121. rebuild=1;\
  122. fi; \
  123. if [ "$$(grep ^ADK_TARGET_GPU_MEM .config|md5sum)" != "$$(grep ^ADK_TARGET_GPU_MEM .config.old|md5sum)" ];then \
  124. touch .rebuild.bcm2835-bootloader;\
  125. rebuild=1;\
  126. fi; \
  127. if [ "$$(grep ^ADK_KERNEL_VERSION .config|md5sum)" != "$$(grep ^ADK_KERNEL_VERSION .config.old|md5sum)" ];then \
  128. cleandir=1;\
  129. rebuild=1;\
  130. fi; \
  131. if [ "$$(grep ^ADK_KERNEL_ADDON .config|md5sum)" != "$$(grep ^ADK_KERNEL_ADDON .config.old|md5sum)" ];then \
  132. echo "You should rebuild the kernel with 'make cleankernel'";\
  133. rebuild=1;\
  134. fi; \
  135. if [ "$$(grep ^ADK_TARGET_USE .config|md5sum)" != "$$(grep ^ADK_TARGET_USE .config.old|md5sum)" ];then \
  136. cleandir=1;\
  137. rebuild=1;\
  138. fi; \
  139. if [ "$$(grep ^ADK_TARGET_ARCH .config|md5sum)" != "$$(grep ^ADK_TARGET_ARCH .config.old|md5sum)" ];then \
  140. cleandir=1;\
  141. rebuild=1;\
  142. fi; \
  143. if [ "$$(grep ^ADK_TARGET_SYSTEM .config|md5sum)" != "$$(grep ^ADK_TARGET_SYSTEM .config.old|md5sum)" ];then \
  144. cleandir=1;\
  145. rebuild=1;\
  146. fi; \
  147. if [ $$cleandir -eq 1 ];then \
  148. echo "You should rebuild with 'make cleandir'";\
  149. fi; \
  150. if [ $$rebuild -eq 1 ];then \
  151. cp .config .config.old;\
  152. fi; \
  153. fi; \
  154. fi
  155. # Pull in the user's configuration file
  156. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  157. -include $(ADK_TOPDIR)/.config
  158. endif
  159. ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  160. include $(ADK_TOPDIR)/rules.mk
  161. all: world
  162. ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}/package/*/Makefile) $(ADK_TOPDIR)/adk/tools/depmaker
  163. @echo "Generating dependencies ..."
  164. $(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
  165. .NOTPARALLEL:
  166. .PHONY: all world clean cleandir cleansystem distclean image_clean
  167. world:
  168. @mkdir -p $(DL_DIR) $(HOST_BUILD_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
  169. $(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
  170. ${BASH} ${ADK_TOPDIR}/scripts/scan-pkgs.sh
  171. ifeq ($(ADK_TARGET_TOOLCHAIN),y)
  172. ifeq ($(ADK_TOOLCHAIN_ONLY),y)
  173. $(MAKE) -f mk/build.mk package/hostcompile toolchain/fixup package/compile
  174. else
  175. $(MAKE) -f mk/build.mk package/hostcompile toolchain/fixup package/compile root_clean package/install
  176. endif
  177. else
  178. $(MAKE) -f mk/build.mk package/hostcompile toolchain/fixup target/config-prepare target/compile package/compile root_clean package/install target/install package_index
  179. endif
  180. package_index:
  181. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  182. -cd ${PACKAGE_DIR} && \
  183. ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  184. endif
  185. ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
  186. @mkdir -p ${STAGING_TARGET_DIR}/{bin,etc,lib,usr/bin,usr/include,usr/lib/pkgconfig} \
  187. ${STAGING_HOST_DIR}/{usr/bin,usr/lib,usr/include}
  188. @for i in lib64 lib32 libx32;do \
  189. cd ${STAGING_TARGET_DIR}/; ln -sf lib $$i; \
  190. cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
  191. done
  192. ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
  193. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  194. echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
  195. echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
  196. endif
  197. package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${ADK_TOPDIR}/package/Depends.mk
  198. $(MAKE) -C package $(patsubst package/%,%,$@)
  199. target/%:
  200. $(MAKE) -C target $(patsubst target/%,%,$@)
  201. toolchain/%: ${STAGING_TARGET_DIR}
  202. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  203. image:
  204. $(MAKE) -C target image
  205. targethelp:
  206. $(MAKE) -C target targethelp
  207. kernelconfig:
  208. ${KERNEL_MAKE_ENV} ${MAKE} \
  209. ARCH=$(ADK_TARGET_ARCH) \
  210. ${KERNEL_MAKE_OPTS} \
  211. -C $(BUILD_DIR)/linux menuconfig
  212. # create a new package from package/.template
  213. newpackage:
  214. @echo "Creating new package $(PKG)"
  215. $(CP) $(ADK_TOPDIR)/package/.template$(TYPE) $(ADK_TOPDIR)/package/$(PKG)
  216. pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
  217. $(SED) "s#@UPKG@#$$pkg#" $(ADK_TOPDIR)/package/$(PKG)/Makefile
  218. $(SED) 's#@PKG@#$(PKG)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
  219. $(SED) 's#@VER@#$(VER)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
  220. @echo "Edit package/$(PKG)/Makefile to complete"
  221. root_clean:
  222. @$(TRACE) root_clean
  223. rm -rf $(TARGET_DIR)
  224. mkdir -p $(TARGET_DIR)
  225. touch $(TARGET_DIR)/.adk
  226. # Do a per-package clean here, too. This way stale headers and
  227. # libraries from target_*/ get wiped away, which keeps
  228. # future package build's configure scripts from returning false
  229. # dependencies information.
  230. clean:
  231. @$(TRACE) clean
  232. $(MAKE) -C $(CONFIG) clean
  233. for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
  234. while read file ; do \
  235. rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
  236. done < ${STAGING_PKG_DIR}/$$f ; \
  237. rm ${STAGING_PKG_DIR}/$$f ; \
  238. done
  239. rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  240. ${ADK_TOPDIR}/package/pkglist.d
  241. rm -f ${ADK_TOPDIR}/package/Depends.mk
  242. cleankernel:
  243. @$(TRACE) cleankernel
  244. @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
  245. cleandir:
  246. @$(TRACE) cleandir
  247. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  248. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
  249. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  250. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
  251. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  252. @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
  253. cleansystem:
  254. @$(TRACE) cleansystem
  255. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  256. @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  257. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  258. @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
  259. @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
  260. distclean:
  261. @$(TRACE) distclean
  262. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  263. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR) \
  264. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  265. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
  266. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  267. @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${ADK_TOPDIR}/prereq.mk \
  268. .menu ${ADK_TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.* \
  269. ${ADK_TOPDIR}/target/*/Config.in.{arch*,system*} ${ADK_TOPDIR}/package/Config.in.auto*
  270. else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  271. ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
  272. include ${ADK_TOPDIR}/mk/vars.mk
  273. else
  274. include $(ADK_TOPDIR)/prereq.mk
  275. export HOST_CC HOST_CXX BASH MAKE LANGUAGE LC_ALL OStype PATH QEMU SHELL
  276. endif
  277. all: menuconfig
  278. @echo "Start the build with \"make\" or with \"make v\" to be verbose"
  279. # configuration
  280. # ---------------------------------------------------------------------------
  281. # force entering the subdir, as dependency checking is done there
  282. .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
  283. $(CONFIG)/conf:
  284. @$(MAKE) -C $(CONFIG) conf
  285. $(CONFIG)/mconf:
  286. @$(MAKE) -C $(CONFIG)
  287. defconfig: .menu $(CONFIG)/conf
  288. ifeq (${OStype},Linux)
  289. @echo ADK_HOST_LINUX=y > $(ADK_TOPDIR)/.defconfig
  290. endif
  291. ifeq (${OStype},FreeBSD)
  292. @echo ADK_HOST_FREEBSD=y > $(ADK_TOPDIR)/.defconfig
  293. endif
  294. ifeq (${OStype},MirBSD)
  295. @echo ADK_HOST_MIRBSD=y > $(ADK_TOPDIR)/.defconfig
  296. endif
  297. ifeq (${OStype},OpenBSD)
  298. @echo ADK_HOST_OPENBSD=y > $(ADK_TOPDIR)/.defconfig
  299. endif
  300. ifeq (${OStype},NetBSD)
  301. @echo ADK_HOST_NETBSD=y > $(ADK_TOPDIR)/.defconfig
  302. endif
  303. ifeq (${OStype},Darwin)
  304. @echo ADK_HOST_DARWIN=y > $(ADK_TOPDIR)/.defconfig
  305. endif
  306. ifneq (,$(filter CYGWIN%,${OStype}))
  307. @echo ADK_HOST_CYGWIN=y > $(ADK_TOPDIR)/.defconfig
  308. endif
  309. @if [ ! -z "$(ADK_LIBC_GIT)" ];then \
  310. if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
  311. echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  312. fi; \
  313. if [ "$(ADK_TARGET_LIBC)" = "uclibc" ];then \
  314. echo "ADK_TARGET_LIB_UCLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  315. fi; \
  316. if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
  317. echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  318. fi; \
  319. if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
  320. echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  321. fi; \
  322. fi
  323. @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
  324. echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
  325. fi
  326. @if [ ! -z "$(ADK_TEST_BASE)" ];then \
  327. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  328. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  329. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  330. fi
  331. @if [ ! -z "$(ADK_TEST_LTP)" ];then \
  332. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  333. echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
  334. fi
  335. @if [ ! -z "$(ADK_TEST_UCLIBC_NG_TESTSUITE)" ];then \
  336. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  337. echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  338. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  339. fi
  340. @if [ ! -z "$(ADK_TEST_UCLIBC_TESTSUITE)" ];then \
  341. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  342. echo "ADK_PACKAGE_UCLIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  343. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  344. fi
  345. @if [ ! -z "$(ADK_TEST_MUSL_TESTSUITE)" ];then \
  346. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  347. echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  348. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  349. fi
  350. @if [ ! -z "$(ADK_TEST_GLIBC_TESTSUITE)" ];then \
  351. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  352. echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  353. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  354. fi
  355. @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
  356. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  357. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  358. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  359. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  360. echo "ADK_PACKAGE_UCLIBC_NG_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  361. fi
  362. @if [ ! -z "$(ADK_TEST_UCLIBC_NATIVE)" ];then \
  363. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  364. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  365. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  366. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  367. echo "ADK_PACKAGE_UCLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  368. fi
  369. @if [ ! -z "$(ADK_TEST_MUSL_NATIVE)" ];then \
  370. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  371. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  372. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  373. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  374. echo "ADK_PACKAGE_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  375. fi
  376. @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
  377. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  378. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  379. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  380. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  381. echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  382. fi
  383. @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
  384. grep "^config" target/config/Config.in.arch.choice \
  385. |grep -i "_$(ADK_TARGET_ARCH)$$" \
  386. |sed -e "s#^config \(.*\)#\1=y#" \
  387. >> $(ADK_TOPDIR)/.defconfig; \
  388. fi
  389. @if [ ! -z "$(ADK_TARGET_FS)" ];then \
  390. grep "^config" target/config/Config.in.target \
  391. |grep -i "$(ADK_TARGET_FS)" \
  392. |sed -e "s#^config \(.*\)#\1=y#" \
  393. >> $(ADK_TOPDIR)/.defconfig; \
  394. fi
  395. @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
  396. grep "^config" target/config/Config.in.abi.choice \
  397. |grep -i "$(ADK_TARGET_ABI)$$" \
  398. |sed -e "s#^config \(.*\)#\1=y#" \
  399. >> $(ADK_TOPDIR)/.defconfig; \
  400. fi
  401. @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
  402. grep "^config" target/config/Config.in.endian.choice \
  403. |grep -i "$(ADK_TARGET_ENDIAN)" \
  404. |sed -e "s#^config \(.*\)#\1=y#" \
  405. >> $(ADK_TOPDIR)/.defconfig; \
  406. fi
  407. @if [ ! -z "$(ADK_TARGET_COLLECTION)" ];then \
  408. grep -h "^config" target/collections/* \
  409. |grep -i "$(ADK_TARGET_COLLECTION)" \
  410. |sed -e "s#^config \(.*\)#\1=y#" \
  411. >> $(ADK_TOPDIR)/.defconfig; \
  412. fi
  413. @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
  414. libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
  415. grep "^config" target/config/Config.in.libc.choice \
  416. |grep -i "$$libc$$" \
  417. |sed -e "s#^config \(.*\)#\1=y#" \
  418. >> $(ADK_TOPDIR)/.defconfig; \
  419. fi
  420. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  421. system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
  422. grep -h "^config" target/*/Config.in.systems \
  423. |grep -i "$$system$$" \
  424. |sed -e "s#^config \(.*\)#\1=y#" \
  425. >> $(ADK_TOPDIR)/.defconfig; \
  426. fi
  427. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  428. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  429. fi
  430. modconfig:
  431. ifeq (${OStype},Linux)
  432. @echo ADK_HOST_LINUX=y > $(ADK_TOPDIR)/all.config
  433. endif
  434. ifeq (${OStype},FreeBSD)
  435. @echo ADK_HOST_FREEBSD=y > $(ADK_TOPDIR)/all.config
  436. endif
  437. ifeq (${OStype},MirBSD)
  438. @echo ADK_HOST_MIRBSD=y > $(ADK_TOPDIR)/all.config
  439. endif
  440. ifeq (${OStype},OpenBSD)
  441. @echo ADK_HOST_OPENBSD=y > $(ADK_TOPDIR)/all.config
  442. endif
  443. ifeq (${OStype},NetBSD)
  444. @echo ADK_HOST_NETBSD=y > $(ADK_TOPDIR)/all.config
  445. endif
  446. ifeq (${OStype},Darwin)
  447. @echo ADK_HOST_DARWIN=y > $(ADK_TOPDIR)/all.config
  448. endif
  449. ifneq (,$(filter CYGWIN%,${OStype}))
  450. @echo ADK_HOST_CYGWIN=y > $(ADK_TOPDIR)/all.config
  451. endif
  452. @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
  453. grep "^config" target/config/Config.in.arch.choice \
  454. |grep -i "$(ADK_TARGET_ARCH)"\$$ \
  455. |sed -e "s#^config \(.*\)#\1=y#" \
  456. >> $(ADK_TOPDIR)/all.config; \
  457. fi
  458. @for symbol in ${DEFCONFIG}; do \
  459. echo $$symbol >> $(ADK_TOPDIR)/all.config; \
  460. done
  461. @if [ ! -z "$(ADK_TARGET_FS)" ];then \
  462. grep "^config" target/config/Config.in.target \
  463. |grep -i "$(ADK_TARGET_FS)" \
  464. |sed -e "s#^config \(.*\)#\1=y#" \
  465. >> $(ADK_TOPDIR)/all.config; \
  466. fi
  467. @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
  468. grep "^config" target/config/Config.in.libc.choice \
  469. |grep -i "$(ADK_TARGET_LIBC)" \
  470. |sed -e "s#^config \(.*\)#\1=y#" \
  471. >> $(ADK_TOPDIR)/all.config; \
  472. fi
  473. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  474. system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
  475. grep -h "^config" target/*/Config.in.systems \
  476. |grep -i "$$system" \
  477. |sed -e "s#^config \(.*\)#\1=y#" \
  478. >> $(ADK_TOPDIR)/all.config; \
  479. fi
  480. menuconfig: $(CONFIG)/mconf defconfig .menu
  481. @if [ ! -f .config ];then \
  482. $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \
  483. fi
  484. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  485. ${POSTCONFIG}
  486. _config: $(CONFIG)/conf .menu
  487. -@touch .config
  488. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  489. ${POSTCONFIG}
  490. .NOTPARALLEL: _mconfig
  491. _mconfig: ${CONFIG}/conf _mconfig2 _config
  492. _mconfig2: ${CONFIG}/conf modconfig .menu
  493. @${CONFIG}/conf -m ${RCONFIG} >/dev/null
  494. distclean:
  495. @$(MAKE) -C $(CONFIG) clean
  496. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR) \
  497. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  498. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
  499. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  500. @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${ADK_TOPDIR}/prereq.mk \
  501. .menu .rebuild.* ${ADK_TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG \
  502. ${ADK_TOPDIR}/target/*/Config.in.{arch*,system*} ${ADK_TOPDIR}/package/Config.in.auto*
  503. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  504. buildall:
  505. @mkdir -p firmware
  506. @echo "=== building $(ADK_TARGET_SYSTEM) ($(ADK_TARGET_ARCH)) with $(ADK_TARGET_LIBC) ==="
  507. $(GMAKE) ADK_TARGET_ARCH=$(ADK_TARGET_ARCH) ADK_TARGET_SYSTEM=$(ADK_TARGET_SYSTEM) ADK_TARGET_LIBC=$(ADK_TARGET_LIBC) allmodconfig
  508. $(GMAKE) VERBOSE=1 all 2>&1 | tee firmware/buildall.log
  509. $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
  510. @$(HOST_CC) -O0 -g0 -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
  511. $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
  512. @$(HOST_CC) -O0 -g0 -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
  513. $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
  514. @$(HOST_CC) -O0 -g0 -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
  515. menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard target/*/collections)
  516. @echo "Generating menu structure ..."
  517. @$(BASH) $(ADK_TOPDIR)/scripts/create-menu
  518. @$(ADK_TOPDIR)/adk/tools/pkgmaker
  519. @:>.menu
  520. dep: $(ADK_TOPDIR)/adk/tools/depmaker
  521. @echo "Generating dependencies ..."
  522. @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
  523. .PHONY: menu dep
  524. include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
  525. check-dejagnu:
  526. @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
  527. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
  528. -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
  529. adk/tests/adk.exp.in > adk/tests/adk.exp
  530. @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
  531. adk/tests/master.exp
  532. check-gcc: check-dejagnu
  533. env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
  534. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-gcc
  535. check-g++: check-dejagnu
  536. env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
  537. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc check-g++
  538. check: check-gcc check-g++