build.mk 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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. CONFIG_CONFIG_IN = Config.in
  4. CONFIG = adk/config
  5. DEFCONFIG= ADK_DEBUG=n \
  6. ADK_PRELINK=n \
  7. ADK_BUILD_WITH_DEBUG=n \
  8. ADK_DISABLE_CHECKSUM=n \
  9. ADK_APPLIANCE_MPD=n \
  10. ADK_APPLIANCE_TOOLCHAIN=n \
  11. ADK_APPLIANCE_KODI=n \
  12. ADK_APPLIANCE_BRUTEFIR=n \
  13. ADK_APPLIANCE_TEST=n \
  14. ADK_APPLIANCE_FIREFOX=n \
  15. ADK_APPLIANCE_DEVELOPMENT=n \
  16. ADK_PACKAGE_BUSYBOX_HIDE=n \
  17. ADK_DISABLE_KERNEL_PATCHES=n \
  18. ADK_DISABLE_TARGET_KERNEL_PATCHES=n \
  19. ADK_DISABLE_HONOUR_CFLAGS=n \
  20. ADK_KERNEL_FB_CON_DECOR=n \
  21. ADK_MAKE_PARALLEL=y \
  22. ADK_MAKE_JOBS=4 \
  23. ADK_LEAVE_ETC_ALONE=n \
  24. ADK_SIMPLE_NETWORK_CONFIG=n \
  25. ADK_USE_CCACHE=n \
  26. ADK_RUNTIME_START_SERVICES=n \
  27. ADK_PACKAGE_BASE_FILES=y \
  28. ADK_PACKAGE_DBUS_WITH_SYSTEMD=n \
  29. ADK_PACKAGE_KEXECINIT=n \
  30. ADK_PACKAGE_CLASSPATH=n \
  31. ADK_PACKAGE_LM_SENSORS_DETECT=n \
  32. ADK_PACKAGE_CRYPTINIT=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_ONLY=n \
  43. ADK_TARGET_USE_LD_RELRO=n \
  44. ADK_TARGET_USE_LD_BIND_NOW=n \
  45. ADK_TARGET_USE_LD_GC=n \
  46. BUSYBOX_IFPLUGD=n \
  47. BUSYBOX_EXTRA_COMPAT=n \
  48. BUSYBOX_FEATURE_IFCONFIG_SLIP=n \
  49. BUSYBOX_BBCONFIG=n \
  50. BUSYBOX_SELINUX=n \
  51. BUSYBOX_INSTALL_NO_USR=n \
  52. BUSYBOX_MODPROBE_SMALL=n \
  53. BUSYBOX_EJECT=n \
  54. BUSYBOX_UBIDETACH=n \
  55. BUSYBOX_UBIATTACH=n \
  56. BUSYBOX_BUILD_LIBBUSYBOX=n \
  57. BUSYBOX_FEATURE_2_4_MODULES=n \
  58. BUSYBOX_LOCALE_SUPPORT=n \
  59. BUSYBOX_FEATURE_PREFER_APPLETS=n \
  60. BUSYBOX_FEATURE_SUID=n \
  61. BUSYBOX_SELINUXENABLED=n \
  62. BUSYBOX_FEATURE_INSTALLER=n \
  63. BUSYBOX_PAM=n \
  64. BUSYBOX_FLASH_LOCK=n \
  65. BUSYBOX_FLASH_UNLOCK=n \
  66. BUSYBOX_FLASH_ERASEALL=n \
  67. BUSYBOX_PIE=n \
  68. BUSYBOX_TASKSET=n \
  69. BUSYBOX_DEBUG=n \
  70. BUSYBOX_DEBUG_SANITIZE=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 .firstrun ]; then \
  92. $(ADK_TOPDIR)/adk/tools/pkgrebuild;\
  93. rebuild=0; \
  94. cleandir=0; \
  95. if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
  96. touch .rebuild.busybox;\
  97. rebuild=1;\
  98. fi; \
  99. for i in ADK_SIMPLE_NETWORK_CONFIG ADK_RUNTIME_ ADK_TARGET_ROOTFS;do \
  100. if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
  101. touch .rebuild.base-files;\
  102. rebuild=1;\
  103. fi; \
  104. done; \
  105. for i in ADK_TARGET_GPU_MEM ADK_KERNEL_SND_BCM2708;do \
  106. if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
  107. touch .rebuild.bcm28xx-bootloader;\
  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-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_TOOLCHAIN_WITH .config|md5sum)" != "$$(grep ^ADK_TOOLCHAIN_WITH .config.old|md5sum)" ];then \
  120. cleandir=1;\
  121. rebuild=1;\
  122. fi; \
  123. if [ "$$(grep ^ADK_TARGET_KERNEL_VERSION .config|md5sum)" != "$$(grep ^ADK_TARGET_KERNEL_VERSION .config.old|md5sum)" ];then \
  124. cleandir=1;\
  125. rebuild=1;\
  126. fi; \
  127. if [ "$$(grep ^ADK_RUNTIME_INIT_ .config|md5sum)" != "$$(grep ^ADK_RUNTIME_BASE_ .config.old|md5sum)" ];then \
  128. cleandir=1;\
  129. rebuild=1;\
  130. fi; \
  131. if [ "$$(grep ^ADK_RUNTIME_BASE_ .config|md5sum)" != "$$(grep ^ADK_RUNTIME_BASE_ .config.old|md5sum)" ];then \
  132. cleandir=1;\
  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 [ $$cleandir -eq 1 ];then \
  140. echo "You should rebuild with 'make cleansystem'";\
  141. fi; \
  142. if [ $$rebuild -eq 1 ];then \
  143. cp .config .config.old;\
  144. fi; \
  145. fi; \
  146. if [ -f .firstrun ]; then rm .firstrun; fi
  147. # Pull in the user's configuration file
  148. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  149. -include $(ADK_TOPDIR)/.config
  150. endif
  151. ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  152. include $(ADK_TOPDIR)/rules.mk
  153. all: world
  154. ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}/package/*/Makefile) $(ADK_TOPDIR)/adk/tools/depmaker
  155. @printf " ---> generating dependencies.. "
  156. $(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
  157. @printf "done\n"
  158. .NOTPARALLEL:
  159. .PHONY: all world clean cleandir cleansystem distclean image_clean
  160. world:
  161. @mkdir -p $(DL_DIR) $(HOST_BUILD_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
  162. $(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
  163. ifeq ($(ADK_APPLIANCE_TOOLCHAIN),y)
  164. $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
  165. else
  166. ifeq ($(ADK_TARGET_OS_BAREMETAL),y)
  167. $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
  168. endif
  169. ifeq ($(ADK_TARGET_OS_LINUX),y)
  170. $(MAKE) -f mk/build.mk package/hostcompile toolchain/final target/config-prepare target/compile package_clean package/compile root_clean package/install target/install package_index
  171. endif
  172. endif
  173. package_index:
  174. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  175. -cd ${PACKAGE_DIR} && \
  176. ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  177. endif
  178. ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
  179. -cd ${PACKAGE_DIR} && \
  180. ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
  181. endif
  182. ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
  183. @mkdir -p ${STAGING_TARGET_DIR}/lib
  184. @mkdir -p ${STAGING_TARGET_DIR}/bin
  185. @mkdir -p ${STAGING_TARGET_DIR}/etc
  186. @mkdir -p ${STAGING_TARGET_DIR}/usr/bin
  187. @mkdir -p ${STAGING_TARGET_DIR}/usr/include
  188. @mkdir -p ${STAGING_TARGET_DIR}/usr/lib/pkgconfig
  189. @mkdir -p ${STAGING_HOST_DIR}/usr/bin
  190. @mkdir -p ${STAGING_HOST_DIR}/usr/lib
  191. @mkdir -p ${STAGING_HOST_DIR}/usr/include
  192. @for i in lib64 lib32 libx32; do \
  193. cd ${STAGING_TARGET_DIR}; ln -sf lib $$i; \
  194. cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
  195. cd ${STAGING_HOST_DIR}; ln -sf lib $$i; \
  196. cd ${STAGING_HOST_DIR}/usr; ln -sf lib $$i; \
  197. done
  198. ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
  199. echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
  200. echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
  201. package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${ADK_TOPDIR}/package/Depends.mk
  202. $(MAKE) -C package $(patsubst package/%,%,$@)
  203. target/%:
  204. $(MAKE) -C target $(patsubst target/%,%,$@)
  205. toolchain/%: ${STAGING_TARGET_DIR}
  206. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  207. image:
  208. $(MAKE) -C target image
  209. targethelp:
  210. $(MAKE) -C target targethelp
  211. kernelconfig:
  212. ${KERNEL_MAKE_ENV} ${MAKE} -C "${LINUX_DIR}" \
  213. ARCH=$(ADK_TARGET_KARCH) \
  214. ${KERNEL_MAKE_OPTS} \
  215. menuconfig
  216. ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG),y)
  217. savekconfig:
  218. @echo "Saving kernel configuration to $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)"
  219. $(CP) $(LINUX_DIR)/.config $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)
  220. else
  221. savekconfig:
  222. @echo "You have to enable ADK_TARGET_KERNEL_USE_CUSTOMCONFIG to be able to save the current kernel configuration."
  223. endif
  224. # create a new package from package/.template
  225. newpackage:
  226. @echo "Creating new package $(PKG)"
  227. $(CP) $(ADK_TOPDIR)/package/.template$(TYPE) $(ADK_TOPDIR)/package/$(PKG)
  228. pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
  229. $(SED) "s#@UPKG@#$$pkg#" $(ADK_TOPDIR)/package/$(PKG)/Makefile
  230. $(SED) 's#@PKG@#$(PKG)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
  231. $(SED) 's#@VER@#$(VER)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
  232. @echo "Edit package/$(PKG)/Makefile to complete"
  233. package_clean:
  234. rm -rf $(PACKAGE_DIR)
  235. mkdir -p $(PACKAGE_DIR)
  236. root_clean:
  237. rm -rf $(TARGET_DIR)
  238. mkdir -p $(TARGET_DIR)
  239. touch $(TARGET_DIR)/.adk
  240. # Do a per-package clean here, too. This way stale headers and
  241. # libraries from target_*/ get wiped away, which keeps
  242. # future package build's configure scripts from returning false
  243. # dependencies information.
  244. clean:
  245. @printf " ---> cleaning target build directories and files.. "
  246. $(MAKE) -C $(CONFIG) clean
  247. for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
  248. while read file ; do \
  249. rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
  250. done < ${STAGING_PKG_DIR}/$$f ; \
  251. rm ${STAGING_PKG_DIR}/$$f ; \
  252. done
  253. rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  254. ${ADK_TOPDIR}/package/pkglist.d
  255. rm -f ${ADK_TOPDIR}/package/Depends.mk
  256. @printf "done\n"
  257. cleankernel:
  258. @printf " ---> cleaning kernel build directories.. "
  259. @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
  260. @printf "done\n"
  261. cleandir:
  262. @printf " ---> cleaning all build directories and files.. "
  263. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  264. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
  265. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  266. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
  267. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  268. @rm -f .menu .tmpconfig.h .rebuild* make.log
  269. @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
  270. @printf "done\n"
  271. cleansystem:
  272. @printf " ---> cleaning system build directories and files .. "
  273. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  274. @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
  275. ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
  276. @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
  277. @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
  278. @printf "done\n"
  279. distclean:
  280. @printf " ---> cleaning build directories, files and downloads.. "
  281. @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
  282. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
  283. @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  284. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
  285. @rm -rf package/pkglist.d package/pkgconfigs.d
  286. @rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk make.log
  287. @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
  288. @rm -f target/*/Config.in.arch target/*/Config.in.systems target/config/Config.in.tasks
  289. @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
  290. @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
  291. @rm -f package/Config.in.auto* target/config/Config.in.system
  292. @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
  293. @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
  294. @printf "done\n"
  295. else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  296. ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
  297. include ${ADK_TOPDIR}/mk/vars.mk
  298. else
  299. include $(ADK_TOPDIR)/prereq.mk
  300. endif
  301. all: menuconfig
  302. @echo "Start the build with \"make\" or with \"make v\" to be verbose"
  303. # configuration
  304. # ---------------------------------------------------------------------------
  305. # force entering the subdir, as dependency checking is done there
  306. .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
  307. $(CONFIG)/conf:
  308. @$(MAKE) -C $(CONFIG) conf
  309. $(CONFIG)/mconf:
  310. @$(MAKE) -C $(CONFIG)
  311. defconfig: .menu $(CONFIG)/conf
  312. @if [ -f $(ADK_TOPDIR)/.defconfig ]; then rm $(ADK_TOPDIR)/.defconfig;fi
  313. @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
  314. echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
  315. fi
  316. @if [ ! -z "$(ADK_TEST_BASE)" ];then \
  317. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  318. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  319. echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
  320. fi
  321. @if [ ! -z "$(ADK_TEST_TOOLCHAIN)" ];then \
  322. echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
  323. fi
  324. @if [ ! -z "$(ADK_TEST_LTP)" ];then \
  325. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  326. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  327. echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
  328. fi
  329. @if [ ! -z "$(ADK_TEST_MKSH)" ];then \
  330. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  331. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  332. echo "ADK_PACKAGE_PERL=y" >> $(ADK_TOPDIR)/.defconfig; \
  333. echo "ADK_PACKAGE_MKSH_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  334. fi
  335. @if [ ! -z "$(ADK_TEST_UCLIBC_NG_TEST)" ];then \
  336. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  337. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  338. echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  339. fi
  340. @if [ ! -z "$(ADK_TEST_LIBC_TEST)" ];then \
  341. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  342. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  343. echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  344. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  345. fi
  346. @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
  347. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  348. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  349. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  350. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  351. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  352. echo "ADK_PACKAGE_UCLIBC_NG_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  353. fi
  354. @if [ ! -z "$(ADK_TEST_MUSL_NATIVE)" ];then \
  355. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  356. echo "ADK_PACKAGE_FILE=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_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  361. fi
  362. @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
  363. echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
  364. echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
  365. echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  366. echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
  367. echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
  368. echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
  369. fi
  370. @if [ ! -z "$(ADK_APPLIANCE)" ];then \
  371. grep "^config" target/config/Config.in.tasks \
  372. |grep -i "_$(ADK_APPLIANCE)$$" \
  373. |sed -e "s#^config \(.*\)#\1=y#" \
  374. >> $(ADK_TOPDIR)/.defconfig; \
  375. fi
  376. @if [ ! -z "$(ADK_TARGET_OS)" ];then \
  377. grep "^config" target/config/Config.in.os \
  378. |grep -i "_$(ADK_TARGET_OS)$$" \
  379. |sed -e "s#^config \(.*\)#\1=y#" \
  380. >> $(ADK_TOPDIR)/.defconfig; \
  381. fi
  382. @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
  383. grep "^config" target/config/Config.in.arch.choice \
  384. |grep -i "_$(ADK_TARGET_ARCH)$$" \
  385. |sed -e "s#^config \(.*\)#\1=y#" \
  386. >> $(ADK_TOPDIR)/.defconfig; \
  387. fi
  388. @if [ ! -z "$(ADK_TARGET_FS)" ];then \
  389. grep "^config" target/config/Config.in.rootfs \
  390. |grep -i "$(ADK_TARGET_FS)" \
  391. |sed -e "s#^config \(.*\)#\1=y#" \
  392. >> $(ADK_TOPDIR)/.defconfig; \
  393. fi
  394. @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
  395. grep "^config" target/config/Config.in.abi \
  396. |grep -i "$(ADK_TARGET_ABI)$$" \
  397. |sed -e "s#^config \(.*\)#\1=y#" \
  398. >> $(ADK_TOPDIR)/.defconfig; \
  399. fi
  400. @if [ ! -z "$(ADK_TARGET_FLOAT)" ];then \
  401. grep "^config" target/config/Config.in.float \
  402. |grep -i "$(ADK_TARGET_FLOAT)_" \
  403. |sed -e "s#^config \(.*\)#\1=y#" \
  404. >> $(ADK_TOPDIR)/.defconfig; \
  405. fi
  406. @if [ ! -z "$(ADK_TARGET_BINFMT)" ];then \
  407. grep "^config" target/config/Config.in.binfmt \
  408. |grep -i "$(ADK_TARGET_BINFMT)$$" \
  409. |sed -e "s#^config \(.*\)#\1=y#" \
  410. >> $(ADK_TOPDIR)/.defconfig; \
  411. fi
  412. @if [ ! -z "$(ADK_TARGET_INSTRUCTION_SET)" ];then \
  413. grep "^config" target/config/Config.in.archopts \
  414. |grep -i "$(ADK_TARGET_INSTRUCTION_SET)$$" \
  415. |sed -e "s#^config \(.*\)#\1=y#" \
  416. >> $(ADK_TOPDIR)/.defconfig; \
  417. fi
  418. @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
  419. grep "^config" target/config/Config.in.endian \
  420. |grep -i "$(ADK_TARGET_ENDIAN)" \
  421. |sed -e "s#^config \(.*\)#\1=y#" \
  422. >> $(ADK_TOPDIR)/.defconfig; \
  423. fi
  424. @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
  425. libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
  426. grep "^config" target/config/Config.in.libc \
  427. |grep -i "$$libc$$" \
  428. |sed -e "s#^config \(.*\)#\1=y#" \
  429. >> $(ADK_TOPDIR)/.defconfig; \
  430. fi
  431. @if [ ! -z "$(ADK_TARGET_CPU)" ];then \
  432. cpu=$$(echo "$(ADK_TARGET_CPU)" |sed -e "s/-/_/g"); \
  433. grep -h "^config" target/config/Config.in.cpu \
  434. |grep -i "$$cpu$$" \
  435. |sed -e "s#^config \(.*\)#\1=y#" \
  436. >> $(ADK_TOPDIR)/.defconfig; \
  437. fi
  438. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  439. system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
  440. grep -h "^config" target/*/Config.in.systems \
  441. |grep -i "$$system$$" \
  442. |sed -e "s#^config \(.*\)#\1=y#" \
  443. >> $(ADK_TOPDIR)/.defconfig; \
  444. fi
  445. @if [ ! -z "$(ADK_TARGET_KERNEL_VERSION)" ];then \
  446. kernelversion=$$(echo "$(ADK_TARGET_KERNEL_VERSION)"|sed -e "s/\./_/g"); \
  447. grep "^config" target/config/Config.in.kernelversion \
  448. |grep -i "$$kernelversion$$" \
  449. |sed -e "s#^config \(.*\)#\1=y#" \
  450. >> $(ADK_TOPDIR)/.defconfig; \
  451. fi
  452. @if [ ! -z "$(ADK_TARGET_LIBC_VERSION)" ];then \
  453. libcversion=$$(echo "$(ADK_TARGET_LIBC_VERSION)"|sed -e "s/\./_/g"); \
  454. if [ "$$libcversion" = "git" ];then \
  455. if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
  456. echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  457. fi; \
  458. if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
  459. echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  460. fi; \
  461. if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
  462. echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  463. fi; \
  464. else \
  465. grep "^config" target/config/Config.in.libc \
  466. |grep -i "$$libcversion$$" \
  467. |sed -e "s#^config \(.*\)#\1=y#" \
  468. >> $(ADK_TOPDIR)/.defconfig; \
  469. fi; \
  470. fi
  471. @if [ ! -z "$(ADK_TOOLCHAIN_BINUTILS_VERSION)" ];then \
  472. binutilsversion=$$(echo "$(ADK_TOOLCHAIN_BINUTILS_VERSION)"|sed -e "s/\./_/g"); \
  473. if [ "$$binutilsversion" = "git" ];then \
  474. echo "ADK_TOOLCHAIN_BINUTILS_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  475. else \
  476. grep "^config" target/config/Config.in.binutils \
  477. |grep -i "$$binutilsversion$$" \
  478. |sed -e "s#^config \(.*\)#\1=y#" \
  479. >> $(ADK_TOPDIR)/.defconfig; \
  480. fi; \
  481. fi
  482. @if [ ! -z "$(ADK_TOOLCHAIN_GCC_VERSION)" ];then \
  483. echo "ADK_BUILD_COMPILER_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
  484. gccversion=$$(echo "$(ADK_TOOLCHAIN_GCC_VERSION)"|sed -e "s/\./_/g"); \
  485. if [ "$$gccversion" = "git" ];then \
  486. echo "ADK_TOOLCHAIN_GCC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  487. else \
  488. grep "^config" target/config/Config.in.compiler \
  489. |grep -i "$$gccversion$$" \
  490. |sed -e "s#^config \(.*\)#\1=y#" \
  491. >> $(ADK_TOPDIR)/.defconfig; \
  492. fi; \
  493. fi
  494. @if [ ! -z "$(ADK_TOOLCHAIN_GDB_VERSION)" ];then \
  495. gdbversion=$$(echo "$(ADK_TOOLCHAIN_GDB_VERSION)"|sed -e "s/\./_/g"); \
  496. if [ "$$gdbversion" = "git" ];then \
  497. echo "ADK_TOOLCHAIN_GDB_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
  498. else \
  499. grep "^config" target/config/Config.in.gdb \
  500. |grep -i "$$gdbversion$$" \
  501. |sed -e "s#^config \(.*\)#\1=y#" \
  502. >> $(ADK_TOPDIR)/.defconfig; \
  503. fi; \
  504. fi
  505. @if [ ! -z "$(ADK_APPLIANCE)" ];then \
  506. $(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
  507. fi
  508. allconfig:
  509. @if [ ! -z "$(ADK_APPLIANCE)" ];then \
  510. grep "^config" target/config/Config.in.tasks \
  511. |grep -i "_$(ADK_APPLIANCE)"\$$ \
  512. |sed -e "s#^config \(.*\)#\1=y#" \
  513. >> $(ADK_TOPDIR)/all.config; \
  514. fi
  515. @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
  516. grep "^config" target/config/Config.in.arch.choice \
  517. |grep -i "$(ADK_TARGET_ARCH)"\$$ \
  518. |sed -e "s#^config \(.*\)#\1=y#" \
  519. >> $(ADK_TOPDIR)/all.config; \
  520. fi
  521. @for symbol in ${DEFCONFIG}; do \
  522. echo $$symbol >> $(ADK_TOPDIR)/all.config; \
  523. done
  524. @if [ ! -z "$(ADK_TARGET_FS)" ];then \
  525. grep "^config" target/config/Config.in.rootfs \
  526. |grep -i "$(ADK_TARGET_FS)" \
  527. |sed -e "s#^config \(.*\)#\1=y#" \
  528. >> $(ADK_TOPDIR)/all.config; \
  529. fi
  530. @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
  531. grep "^config" target/config/Config.in.libc \
  532. |grep -i "$(ADK_TARGET_LIBC)" \
  533. |sed -e "s#^config \(.*\)#\1=y#" \
  534. >> $(ADK_TOPDIR)/all.config; \
  535. fi
  536. @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
  537. system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
  538. grep -h "^config" target/*/Config.in.systems \
  539. |grep -i "$$system$$" \
  540. |sed -e "s#^config \(.*\)#\1=y#" \
  541. >> $(ADK_TOPDIR)/all.config; \
  542. fi
  543. menuconfig: $(CONFIG)/mconf defconfig .menu
  544. @if [ ! -f .config ];then \
  545. $(CONFIG)/conf --olddefconfig $(CONFIG_CONFIG_IN); \
  546. fi
  547. @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
  548. ${POSTCONFIG}
  549. _config: $(CONFIG)/conf allconfig .menu
  550. -@touch .config
  551. @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
  552. ${POSTCONFIG}
  553. distclean cleandir:
  554. @printf " ---> cleaning build directories, files and downloads.. "
  555. @$(MAKE) -C $(CONFIG) clean
  556. @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
  557. @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
  558. @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
  559. @rm -rf package/pkglist.d package/pkgconfigs.d
  560. @rm -f .config* .defconfig .tmpconfig.h all.config make.log
  561. @rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
  562. @rm -f target/*/Config.in.arch target/*/Config.in.systems
  563. @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
  564. @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
  565. @rm -f package/Config.in.auto* target/config/Config.in.system target/config/Config.in.tasks
  566. @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
  567. @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
  568. @printf "done\n"
  569. endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
  570. $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
  571. @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
  572. $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
  573. @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
  574. $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
  575. @$(HOST_CC) $(HOST_CFLAGS) -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
  576. menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard tasks/*)
  577. @printf " ---> generating menu structure.. "
  578. @$(SHELL) $(ADK_TOPDIR)/scripts/create-menu
  579. @$(ADK_TOPDIR)/adk/tools/pkgmaker
  580. @:>.menu
  581. @printf "done\n"
  582. dep: $(ADK_TOPDIR)/adk/tools/depmaker
  583. @printf " ---> generating dependencies.. "
  584. @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
  585. @printf "done\n"
  586. .PHONY: menu dep
  587. include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
  588. check-dejagnu:
  589. @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
  590. @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
  591. -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
  592. adk/tests/adk.exp.in > adk/tests/adk.exp
  593. @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
  594. adk/tests/master.exp
  595. check-gcc: check-dejagnu
  596. env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
  597. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c
  598. check-g++: check-dejagnu
  599. env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
  600. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c++
  601. check: check-gcc check-g++
  602. info:
  603. @printf -- "---OPENADK-INFO---\n"
  604. @printf "ADK_TOPDIR=$(ADK_TOPDIR)\n"
  605. @printf "TARGET_COMPILER_PREFIX=${TARGET_COMPILER_PREFIX}\n"
  606. @printf "TOOLCHAIN_DIR=$(TOOLCHAIN_DIR)\n"
  607. @printf "TARGET_PATH=$(TARGET_PATH)\n"
  608. @printf "LINUX_DIR=$(LINUX_DIR)\n"
  609. @printf -- "---OPENADK-INFO---\n"