build.mk 24 KB

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