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