imgtec-ci20: genimage config/ u-boot env
[openadk.git] / mk / build.mk
blob78a3e7709685df7ec8eaa203b9066246205b731c
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 CONFIG_CONFIG_IN = Config.in
5 CONFIG = adk/config
6 DEFCONFIG= ADK_DEBUG=n \
7 ADK_PRELINK=n \
8 ADK_BUILD_WITH_DEBUG=n \
9 ADK_DISABLE_CHECKSUM=n \
10 ADK_APPLIANCE_MPD=n \
11 ADK_APPLIANCE_TOOLCHAIN=n \
12 ADK_APPLIANCE_KODI=n \
13 ADK_APPLIANCE_BRUTEFIR=n \
14 ADK_APPLIANCE_TEST=n \
15 ADK_APPLIANCE_FIREFOX=n \
16 ADK_APPLIANCE_DEVELOPMENT=n \
17 ADK_PACKAGE_BUSYBOX_HIDE=n \
18 ADK_DISABLE_KERNEL_PATCHES=n \
19 ADK_DISABLE_TARGET_KERNEL_PATCHES=n \
20 ADK_MAKE_PARALLEL=y \
21 ADK_MAKE_JOBS=4 \
22 ADK_LEAVE_ETC_ALONE=n \
23 ADK_SIMPLE_NETWORK_CONFIG=n \
24 ADK_USE_CCACHE=n \
25 ADK_RUNTIME_START_SERVICES=n \
26 ADK_PACKAGE_BASE_FILES=y \
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
85 noconfig_targets:= menuconfig \
86 _config \
87 _mconfig \
88 distclean \
89 defconfig
91 POSTCONFIG= -@\
92 if [ ! -f .firstrun ]; then \
93 $(ADK_TOPDIR)/adk/tools/pkgrebuild;\
94 rebuild=0; \
95 cleandir=0; \
96 if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
97 touch .rebuild.busybox;\
98 rebuild=1;\
99 fi; \
100 for i in ADK_SIMPLE_NETWORK_CONFIG ADK_RUNTIME_ ADK_TARGET_ROOTFS;do \
101 if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
102 touch .rebuild.base-files;\
103 rebuild=1;\
104 fi; \
105 done; \
106 for i in ADK_TARGET_GPU_MEM ADK_LINUX_KERNEL_SND_BCM2708;do \
107 if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
108 touch .rebuild.bcm28xx-bootloader;\
109 rebuild=1;\
110 fi; \
111 done; \
112 if [ "$$(grep ^ADK_RUNTIME_TIMEZONE .config|md5sum)" != "$$(grep ^ADK_RUNTIME_TIMEZONE .config.old|md5sum)" ];then \
113 touch .rebuild.musl .rebuild.uclibc-ng .rebuild.glibc;\
114 rebuild=1;\
115 fi; \
116 if [ "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config|md5sum)" != "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config.old|md5sum)" ];then \
117 touch .rebuild.dropbear .rebuild.openssh;\
118 rebuild=1;\
119 fi; \
120 if [ "$$(grep ^ADK_TOOLCHAIN_WITH .config|md5sum)" != "$$(grep ^ADK_TOOLCHAIN_WITH .config.old|md5sum)" ];then \
121 cleandir=1;\
122 rebuild=1;\
123 fi; \
124 if [ "$$(grep ^ADK_TARGET_KERNEL_VERSION .config|md5sum)" != "$$(grep ^ADK_TARGET_KERNEL_VERSION .config.old|md5sum)" ];then \
125 cleandir=1;\
126 rebuild=1;\
127 fi; \
128 if [ "$$(grep ^ADK_RUNTIME_INIT_ .config|md5sum)" != "$$(grep ^ADK_RUNTIME_BASE_ .config.old|md5sum)" ];then \
129 cleandir=1;\
130 rebuild=1;\
131 fi; \
132 if [ "$$(grep ^ADK_RUNTIME_BASE_ .config|md5sum)" != "$$(grep ^ADK_RUNTIME_BASE_ .config.old|md5sum)" ];then \
133 cleandir=1;\
134 rebuild=1;\
135 fi; \
136 if [ "$$(grep ^ADK_TARGET_USE .config|md5sum)" != "$$(grep ^ADK_TARGET_USE .config.old|md5sum)" ];then \
137 cleandir=1;\
138 rebuild=1;\
139 fi; \
140 if [ $$cleandir -eq 1 ];then \
141 echo "You should rebuild with 'make cleansystem'";\
142 fi; \
143 if [ "$$(grep ^ADK_TARGET_KERNEL_USE_DEFCONFIG .config)" ];then \
144 if [ "$$(grep ^ADK_TARGET_KERNEL_DEFCONFIG .config|awk -F= '{print $$2}')" == '""' ];then \
145 echo "custom Linux defconfig name missing";\
146 fi; \
147 fi; \
148 if [ $$rebuild -eq 1 ];then \
149 cp .config .config.old;\
150 fi; \
151 fi; \
152 if [ -f .firstrun ]; then rm .firstrun; fi
154 # Pull in the user's configuration file
155 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
156 -include $(ADK_TOPDIR)/.config
157 endif
159 ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
160 include $(ADK_TOPDIR)/rules.mk
162 include $(ADK_TOPDIR)/mk/kernel-vars.mk
164 all: world
166 ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}/package/*/Makefile) $(ADK_TOPDIR)/adk/tools/depmaker
167 @printf " ---> generating dependencies.. "
168 $(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
169 @printf "done\n"
171 .NOTPARALLEL:
172 .PHONY: all world clean cleandir cleansystem distclean image_clean
174 world:
175 @mkdir -p $(DL_DIR) $(HOST_BUILD_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
176 $(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
177 ifeq ($(ADK_APPLIANCE_TOOLCHAIN),y)
178 $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
179 else
180 ifeq ($(ADK_TARGET_OS_BAREMETAL),y)
181 $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
182 endif
183 ifeq ($(ADK_TARGET_OS_LINUX),y)
184 $(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
185 endif
186 endif
188 package_index:
189 ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
190 -cd ${PACKAGE_DIR} && \
191 ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
192 endif
193 ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
194 -cd ${PACKAGE_DIR} && \
195 ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
196 endif
198 ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
199 @mkdir -p ${STAGING_TARGET_DIR}/lib
200 @mkdir -p ${STAGING_TARGET_DIR}/bin
201 @mkdir -p ${STAGING_TARGET_DIR}/etc
202 @mkdir -p ${STAGING_TARGET_DIR}/usr/bin
203 @mkdir -p ${STAGING_TARGET_DIR}/usr/include
204 @mkdir -p ${STAGING_TARGET_DIR}/usr/lib/pkgconfig
205 @mkdir -p ${STAGING_HOST_DIR}/lib
206 @mkdir -p ${STAGING_HOST_DIR}/usr/bin
207 @mkdir -p ${STAGING_HOST_DIR}/usr/lib
208 @mkdir -p ${STAGING_HOST_DIR}/usr/include
209 @for i in lib64 lib32 libx32; do \
210 cd ${STAGING_TARGET_DIR}; ln -sf lib $$i; \
211 cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
212 cd ${STAGING_HOST_DIR}; ln -sf lib $$i; \
213 cd ${STAGING_HOST_DIR}/usr; ln -sf lib $$i; \
214 done
216 ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
217 echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
218 echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
220 package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${ADK_TOPDIR}/package/Depends.mk
221 $(MAKE) -C package $(patsubst package/%,%,$@)
223 target/%:
224 $(MAKE) -C target $(patsubst target/%,%,$@)
226 toolchain/%: ${STAGING_TARGET_DIR}
227 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
229 image:
230 $(MAKE) -C target image
232 targethelp:
233 $(MAKE) -C target targethelp
235 kernelconfig:
236 ${MAKE} -C "${LINUX_DIR}" \
237 ARCH=$(ADK_TARGET_KARCH) \
238 menuconfig
240 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG),y)
241 savekconfig:
242 @echo "Saving kernel configuration to $(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH)"
243 $(CP) $(LINUX_DIR)/.config $(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH)
244 else
245 savekconfig:
246 @echo "You have to enable ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG to be able to save the current kernel configuration."
247 endif
250 # create a new package from package/.template
251 newpackage:
252 @echo "Creating new package $(PKG)"
253 $(CP) $(ADK_TOPDIR)/package/.template$(TYPE) $(ADK_TOPDIR)/package/$(PKG)
254 pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
255 $(SED) "s#@UPKG@#$$pkg#" $(ADK_TOPDIR)/package/$(PKG)/Makefile
256 $(SED) 's#@PKG@#$(PKG)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
257 $(SED) 's#@VER@#$(VER)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
258 @echo "Edit package/$(PKG)/Makefile to complete"
260 package_clean:
261 rm -rf $(PACKAGE_DIR)
262 mkdir -p $(PACKAGE_DIR)
264 root_clean:
265 rm -rf $(TARGET_DIR)
266 mkdir -p $(TARGET_DIR)
267 touch $(TARGET_DIR)/.adk
269 # Do a per-package clean here, too. This way stale headers and
270 # libraries from target_*/ get wiped away, which keeps
271 # future package build's configure scripts from returning false
272 # dependencies information.
274 clean:
275 @printf " ---> cleaning target build directories and files.. "
276 $(MAKE) -C $(CONFIG) clean
277 for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
278 while read file ; do \
279 rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
280 done < ${STAGING_PKG_DIR}/$$f ; \
281 rm ${STAGING_PKG_DIR}/$$f ; \
282 done
283 rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
284 ${ADK_TOPDIR}/package/pkglist.d
285 rm -f ${ADK_TOPDIR}/package/Depends.mk
286 @printf "done\n"
288 cleankernel:
289 @printf " ---> cleaning kernel build directories.. "
290 @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-$(ADK_TARGET_OS)* $(BUILD_DIR)/$(ADK_TARGET_OS)
291 @printf "done\n"
293 cleandir:
294 @printf " ---> cleaning all build directories and files.. "
295 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
296 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
297 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
298 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
299 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
300 @rm -f .menu .tmpconfig.h .rebuild* make.log
301 @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
302 @printf "done\n"
304 cleansystem:
305 @printf " ---> cleaning system build directories and files .. "
306 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
307 @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
308 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
309 @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
310 @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
311 @printf "done\n"
313 distclean:
314 @printf " ---> cleaning build directories, files and downloads.. "
315 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
316 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
317 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
318 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
319 @rm -rf package/pkglist.d package/pkgconfigs.d
320 @rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk make.log
321 @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
322 @rm -f target/*/Config.in.arch target/*/Config.in.systems target/config/Config.in.tasks
323 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
324 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
325 @rm -f package/Config.in.auto* target/config/Config.in.system
326 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
327 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
328 @printf "done\n"
330 else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
332 ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
333 include ${ADK_TOPDIR}/mk/vars.mk
334 else
335 include $(ADK_TOPDIR)/prereq.mk
336 endif
338 all: menuconfig
339 @echo "Start the build with \"make\" or with \"make v\" to be verbose"
341 # configuration
342 # ---------------------------------------------------------------------------
344 # force entering the subdir, as dependency checking is done there
345 .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
347 $(CONFIG)/conf:
348 @$(MAKE) -C $(CONFIG) conf
350 $(CONFIG)/mconf:
351 @$(MAKE) -C $(CONFIG)
353 defconfig: .menu $(CONFIG)/conf
354 @if [ -f $(ADK_TOPDIR)/.defconfig ]; then rm $(ADK_TOPDIR)/.defconfig;fi
355 @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
356 echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
358 @if [ ! -z "$(ADK_TEST_BASE)" ];then \
359 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
360 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
362 @if [ ! -z "$(ADK_TEST_TOOLCHAIN)" ];then \
363 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
365 @if [ ! -z "$(ADK_TEST_LTP)" ];then \
366 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
367 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
368 echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
370 @if [ ! -z "$(ADK_TEST_MKSH)" ];then \
371 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
372 echo "ADK_PACKAGE_PERL=y" >> $(ADK_TOPDIR)/.defconfig; \
373 echo "ADK_PACKAGE_MKSH_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
375 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_TEST)" ];then \
376 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
377 echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
379 @if [ ! -z "$(ADK_TEST_LIBC_TEST)" ];then \
380 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
381 echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
382 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
384 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
385 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
386 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
387 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
388 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
389 echo "ADK_PACKAGE_UCLIBC_NG_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
391 @if [ ! -z "$(ADK_TEST_MUSL_NATIVE)" ];then \
392 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
393 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
394 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
395 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
396 echo "ADK_PACKAGE_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
398 @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
399 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
400 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
401 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
402 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
403 echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
405 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
406 grep "^config" target/config/Config.in.tasks \
407 |grep -i "_$(ADK_APPLIANCE)$$" \
408 |sed -e "s#^config \(.*\)#\1=y#" \
409 >> $(ADK_TOPDIR)/.defconfig; \
411 @if [ ! -z "$(ADK_TARGET_OS)" ];then \
412 grep "^config" target/config/Config.in.os \
413 |grep -i "_$(ADK_TARGET_OS)$$" \
414 |sed -e "s#^config \(.*\)#\1=y#" \
415 >> $(ADK_TOPDIR)/.defconfig; \
417 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
418 grep "^config" target/config/Config.in.arch.choice \
419 |grep -i "$(ADK_TARGET_OS)_ARCH_$(ADK_TARGET_ARCH)$$" \
420 |sed -e "s#^config \(.*\)#\1=y#" \
421 >> $(ADK_TOPDIR)/.defconfig; \
423 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
424 grep "^config" target/config/Config.in.rootfs \
425 |grep -i "$(ADK_TARGET_FS)" \
426 |sed -e "s#^config \(.*\)#\1=y#" \
427 >> $(ADK_TOPDIR)/.defconfig; \
429 @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
430 grep "^config" target/config/Config.in.abi \
431 |grep -i "$(ADK_TARGET_ABI)$$" \
432 |sed -e "s#^config \(.*\)#\1=y#" \
433 >> $(ADK_TOPDIR)/.defconfig; \
435 @if [ ! -z "$(ADK_TARGET_FLOAT)" ];then \
436 grep "^config" target/config/Config.in.float \
437 |grep -i "$(ADK_TARGET_FLOAT)_" \
438 |sed -e "s#^config \(.*\)#\1=y#" \
439 >> $(ADK_TOPDIR)/.defconfig; \
441 @if [ ! -z "$(ADK_TARGET_BINFMT)" ];then \
442 grep "^config" target/config/Config.in.binfmt \
443 |grep -i "$(ADK_TARGET_BINFMT)$$" \
444 |sed -e "s#^config \(.*\)#\1=y#" \
445 >> $(ADK_TOPDIR)/.defconfig; \
447 @if [ ! -z "$(ADK_TARGET_INSTRUCTION_SET)" ];then \
448 grep "^config" target/config/Config.in.instructions \
449 |grep -i "$(ADK_TARGET_INSTRUCTION_SET)$$" \
450 |sed -e "s#^config \(.*\)#\1=y#" \
451 >> $(ADK_TOPDIR)/.defconfig; \
453 @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
454 grep "^config" target/config/Config.in.endian \
455 |grep -i "$(ADK_TARGET_ENDIAN)" \
456 |sed -e "s#^config \(.*\)#\1=y#" \
457 >> $(ADK_TOPDIR)/.defconfig; \
459 @if [ ! -z "$(ADK_TARGET_MMU)" ];then \
460 printf "# ADK_TARGET_WITH_MMU is not set\n" \
461 >> $(ADK_TOPDIR)/.defconfig; \
462 printf "BUSYBOX_NOMMU=y\n" \
463 >> $(ADK_TOPDIR)/.defconfig; \
465 @if [ ! -z "$(ADK_TARGET_THREADS)" ];then \
466 if [ "$(ADK_TARGET_THREADS)" = "nptl" ];then \
467 printf "ADK_TARGET_WITH_NPTL=y\n" >> $(ADK_TOPDIR)/.defconfig; \
468 fi; \
469 if [ "$(ADK_TARGET_THREADS)" = "lt" ];then \
470 printf "ADK_TARGET_WITH_LT=y\n" >> $(ADK_TOPDIR)/.defconfig; \
471 fi; \
472 if [ "$(ADK_TARGET_THREADS)" = "none" ];then \
473 printf "ADK_TARGET_WITHOUT_THREADS=y\n" >> $(ADK_TOPDIR)/.defconfig; \
474 fi; \
476 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
477 libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
478 grep "^config" target/config/Config.in.libc \
479 |grep -i "$$libc$$" \
480 |sed -e "s#^config \(.*\)#\1=y#" \
481 >> $(ADK_TOPDIR)/.defconfig; \
483 @if [ ! -z "$(ADK_TARGET_CPU)" ];then \
484 cpu=$$(echo "$(ADK_TARGET_CPU)" |sed -e "s/-/_/g"); \
485 grep -h "^config" target/config/Config.in.cpu \
486 |grep -i "$$cpu$$" \
487 |sed -e "s#^config \(.*\)#\1=y#" \
488 >> $(ADK_TOPDIR)/.defconfig; \
490 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
491 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
492 grep -h "^config" target/*/Config.in.systems \
493 |grep -i "$$system$$" \
494 |sed -e "s#^config \(.*\)#\1=y#" \
495 >> $(ADK_TOPDIR)/.defconfig; \
497 @if [ ! -z "$(ADK_TARGET_KERNEL_VERSION)" ];then \
498 kernelversion=$$(echo "$(ADK_TARGET_KERNEL_VERSION)"|sed -e "s/\./_/g"); \
499 grep "^config" target/config/Config.in.kernelversion \
500 |grep -i "$$kernelversion$$" \
501 |sed -e "s#^config \(.*\)#\1=y#" \
502 >> $(ADK_TOPDIR)/.defconfig; \
504 @if [ ! -z "$(ADK_TARGET_LIBC_VERSION)" ];then \
505 libcversion=$$(echo "$(ADK_TARGET_LIBC_VERSION)"|sed -e "s/\./_/g"); \
506 if [ "$$libcversion" = "git" ];then \
507 if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
508 echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
509 fi; \
510 if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
511 echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
512 fi; \
513 if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
514 echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
515 fi; \
516 else \
517 grep "^config" target/config/Config.in.libc \
518 |grep -i "$$libcversion$$" \
519 |sed -e "s#^config \(.*\)#\1=y#" \
520 >> $(ADK_TOPDIR)/.defconfig; \
521 fi; \
523 @if [ ! -z "$(ADK_TOOLCHAIN_BINUTILS_VERSION)" ];then \
524 binutilsversion=$$(echo "$(ADK_TOOLCHAIN_BINUTILS_VERSION)"|sed -e "s/\./_/g"); \
525 if [ "$$binutilsversion" = "git" ];then \
526 echo "ADK_TOOLCHAIN_BINUTILS_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
527 else \
528 grep "^config" target/config/Config.in.binutils \
529 |grep -i "$$binutilsversion$$" \
530 |sed -e "s#^config \(.*\)#\1=y#" \
531 >> $(ADK_TOPDIR)/.defconfig; \
532 fi; \
534 @if [ ! -z "$(ADK_TOOLCHAIN_GCC_VERSION)" ];then \
535 echo "ADK_BUILD_COMPILER_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
536 gccversion=$$(echo "$(ADK_TOOLCHAIN_GCC_VERSION)"|sed -e "s/\./_/g"); \
537 if [ "$$gccversion" = "git" ];then \
538 echo "ADK_TOOLCHAIN_GCC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
539 else \
540 grep "^config" target/config/Config.in.compiler \
541 |grep -i "$$gccversion$$" \
542 |sed -e "s#^config \(.*\)#\1=y#" \
543 >> $(ADK_TOPDIR)/.defconfig; \
544 fi; \
546 @if [ ! -z "$(ADK_TOOLCHAIN_GDB_VERSION)" ];then \
547 gdbversion=$$(echo "$(ADK_TOOLCHAIN_GDB_VERSION)"|sed -e "s/\./_/g"); \
548 if [ "$$gdbversion" = "git" ];then \
549 echo "ADK_TOOLCHAIN_GDB_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
550 else \
551 grep "^config" target/config/Config.in.gdb \
552 |grep -i "$$gdbversion$$" \
553 |sed -e "s#^config \(.*\)#\1=y#" \
554 >> $(ADK_TOPDIR)/.defconfig; \
555 fi; \
557 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
558 $(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
561 allconfig:
562 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
563 grep "^config" target/config/Config.in.tasks \
564 |grep -i "_$(ADK_APPLIANCE)"\$$ \
565 |sed -e "s#^config \(.*\)#\1=y#" \
566 >> $(ADK_TOPDIR)/all.config; \
568 @if [ ! -z "$(ADK_TARGET_OS)" ];then \
569 grep "^config" target/config/Config.in.os \
570 |grep -i "_$(ADK_TARGET_OS)$$" \
571 |sed -e "s#^config \(.*\)#\1=y#" \
572 >> $(ADK_TOPDIR)/all.config; \
574 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
575 grep "^config" target/config/Config.in.arch.choice \
576 |grep -i "$(ADK_TARGET_OS)_ARCH_$(ADK_TARGET_ARCH)$$" \
577 |sed -e "s#^config \(.*\)#\1=y#" \
578 >> $(ADK_TOPDIR)/all.config; \
580 @for symbol in ${DEFCONFIG}; do \
581 echo $$symbol >> $(ADK_TOPDIR)/all.config; \
582 done
583 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
584 grep "^config" target/config/Config.in.rootfs \
585 |grep -i "$(ADK_TARGET_FS)" \
586 |sed -e "s#^config \(.*\)#\1=y#" \
587 >> $(ADK_TOPDIR)/all.config; \
589 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
590 grep "^config" target/config/Config.in.libc \
591 |grep -i "$(ADK_TARGET_LIBC)" \
592 |sed -e "s#^config \(.*\)#\1=y#" \
593 >> $(ADK_TOPDIR)/all.config; \
595 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
596 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
597 grep -h "^config" target/*/Config.in.systems \
598 |grep -i "$$system$$" \
599 |sed -e "s#^config \(.*\)#\1=y#" \
600 >> $(ADK_TOPDIR)/all.config; \
603 menuconfig: $(CONFIG)/mconf defconfig .menu
604 @if [ ! -f .config ];then \
605 $(CONFIG)/conf --olddefconfig $(CONFIG_CONFIG_IN); \
607 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
608 ${POSTCONFIG}
610 _config: $(CONFIG)/conf allconfig .menu
611 -@touch .config
612 @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
613 ${POSTCONFIG}
615 distclean cleandir:
616 @printf " ---> cleaning build directories, files and downloads.. "
617 @$(MAKE) -C $(CONFIG) clean
618 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
619 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
620 @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
621 @rm -rf package/pkglist.d package/pkgconfigs.d
622 @rm -f .config* .defconfig .tmpconfig.h all.config make.log
623 @rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
624 @rm -f target/*/Config.in.arch target/*/Config.in.systems
625 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
626 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
627 @rm -f package/Config.in.auto* target/config/Config.in.system target/config/Config.in.tasks
628 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
629 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
630 @printf "done\n"
632 endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
634 $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
635 @$(HOST_CC) $(HOST_CFLAGS) -w -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
637 $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
638 @$(HOST_CC) $(HOST_CFLAGS) -w -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
640 $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
641 @$(HOST_CC) $(HOST_CFLAGS) -w -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
643 menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard tasks/*)
644 @printf " ---> generating menu structure.. "
645 @$(SHELL) $(ADK_TOPDIR)/scripts/create-menu
646 @$(ADK_TOPDIR)/adk/tools/pkgmaker
647 @:>.menu
648 @printf "done\n"
650 dep: $(ADK_TOPDIR)/adk/tools/depmaker
651 @printf " ---> generating dependencies.. "
652 @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
653 @printf "done\n"
655 .PHONY: menu dep
657 include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
659 check-dejagnu:
660 @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
661 @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
662 -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
663 adk/tests/adk.exp.in > adk/tests/adk.exp
664 @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
665 adk/tests/master.exp
667 check-gcc: check-dejagnu
668 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
669 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c
671 check-g++: check-dejagnu
672 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
673 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c++
675 check: check-gcc check-g++
677 info:
678 @printf -- "---OPENADK-INFO---\n"
679 @printf "ADK_TOPDIR=$(ADK_TOPDIR)\n"
680 @printf "TARGET_COMPILER_PREFIX=${TARGET_COMPILER_PREFIX}\n"
681 @printf "TOOLCHAIN_DIR=$(TOOLCHAIN_DIR)\n"
682 @printf "TARGET_PATH=$(TARGET_PATH)\n"
683 @printf "LINUX_DIR=$(LINUX_DIR)\n"
684 @printf "TARGET_DIR=$(TARGET_DIR)\n"
685 @printf -- "---OPENADK-INFO---\n"