build.mk 21 KB

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