gdbserver: needs c++
[openadk.git] / mk / build.mk
blob0b4b9feeeb2f7efa1a3967bc2b99c676e4932763
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_DISABLE_HONOUR_CFLAGS=n \
21 ADK_KERNEL_FB_CON_DECOR=n \
22 ADK_MAKE_PARALLEL=y \
23 ADK_MAKE_JOBS=4 \
24 ADK_LEAVE_ETC_ALONE=n \
25 ADK_SIMPLE_NETWORK_CONFIG=n \
26 ADK_USE_CCACHE=n \
27 ADK_RUNTIME_START_SERVICES=n \
28 ADK_PACKAGE_BASE_FILES=y \
29 ADK_PACKAGE_DBUS_WITH_SYSTEMD=n \
30 ADK_PACKAGE_KEXECINIT=n \
31 ADK_PACKAGE_CLASSPATH=n \
32 ADK_PACKAGE_LM_SENSORS_DETECT=n \
33 ADK_PACKAGE_CRYPTINIT=n \
34 ADK_STATIC_TOOLCHAIN=n \
35 ADK_TOOLCHAIN_WITH_SSP=n \
36 ADK_TARGET_USE_SSP=n \
37 ADK_TOOLCHAIN_WITH_LTO=n \
38 ADK_TARGET_USE_LTO=n \
39 ADK_TOOLCHAIN_WITH_GOLD=n \
40 ADK_TARGET_USE_GOLD=n \
41 ADK_TARGET_USE_GNU_HASHSTYLE=n \
42 ADK_TARGET_USE_PIE=n \
43 ADK_TARGET_USE_STATIC_LIBS_ONLY=n \
44 ADK_TARGET_USE_LD_RELRO=n \
45 ADK_TARGET_USE_LD_BIND_NOW=n \
46 ADK_TARGET_USE_LD_GC=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_DEBUG_SANITIZE=n \
72 BUSYBOX_NOMMU=n \
73 BUSYBOX_WERROR=n \
74 BUSYBOX_STATIC=n \
75 BUSYBOX_FEATURE_AIX_LABEL=n \
76 BUSYBOX_FEATURE_SUN_LABEL=n \
77 BUSYBOX_FEATURE_OSF_LABEL=n \
78 BUSYBOX_FEATURE_SGI_LABEL=n \
79 BUSYBOX_FEATURE_INETD_RPC=n \
80 BUSYBOX_FEATURE_MOUNT_NFS=n \
81 BUSYBOX_FEATURE_VI_REGEX_SEARCH=n \
82 ADK_KERNEL_RT2X00_DEBUG=n \
83 ADK_KERNEL_ATH5K_DEBUG=n \
84 ADK_KERNEL_BUG=n \
85 ADK_KERNEL_DEBUG_WITH_KGDB=n
87 noconfig_targets:= menuconfig \
88 _config \
89 _mconfig \
90 distclean \
91 defconfig
93 POSTCONFIG= -@\
94 if [ ! -f .firstrun ]; then \
95 $(ADK_TOPDIR)/adk/tools/pkgrebuild;\
96 rebuild=0; \
97 cleandir=0; \
98 if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \
99 touch .rebuild.busybox;\
100 rebuild=1;\
101 fi; \
102 for i in ADK_SIMPLE_NETWORK_CONFIG ADK_RUNTIME_ ADK_TARGET_ROOTFS;do \
103 if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
104 touch .rebuild.base-files;\
105 rebuild=1;\
106 fi; \
107 done; \
108 for i in ADK_TARGET_GPU_MEM ADK_KERNEL_SND_BCM2708;do \
109 if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
110 touch .rebuild.bcm28xx-bootloader;\
111 rebuild=1;\
112 fi; \
113 done; \
114 if [ "$$(grep ^ADK_RUNTIME_TIMEZONE .config|md5sum)" != "$$(grep ^ADK_RUNTIME_TIMEZONE .config.old|md5sum)" ];then \
115 touch .rebuild.musl .rebuild.uclibc-ng .rebuild.glibc;\
116 rebuild=1;\
117 fi; \
118 if [ "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config|md5sum)" != "$$(grep ^ADK_RUNTIME_SSH_PUBKEY .config.old|md5sum)" ];then \
119 touch .rebuild.dropbear .rebuild.openssh;\
120 rebuild=1;\
121 fi; \
122 if [ "$$(grep ^ADK_TOOLCHAIN_WITH .config|md5sum)" != "$$(grep ^ADK_TOOLCHAIN_WITH .config.old|md5sum)" ];then \
123 cleandir=1;\
124 rebuild=1;\
125 fi; \
126 if [ "$$(grep ^ADK_TARGET_KERNEL_VERSION .config|md5sum)" != "$$(grep ^ADK_TARGET_KERNEL_VERSION .config.old|md5sum)" ];then \
127 cleandir=1;\
128 rebuild=1;\
129 fi; \
130 if [ "$$(grep ^ADK_RUNTIME_INIT_ .config|md5sum)" != "$$(grep ^ADK_RUNTIME_BASE_ .config.old|md5sum)" ];then \
131 cleandir=1;\
132 rebuild=1;\
133 fi; \
134 if [ "$$(grep ^ADK_RUNTIME_BASE_ .config|md5sum)" != "$$(grep ^ADK_RUNTIME_BASE_ .config.old|md5sum)" ];then \
135 cleandir=1;\
136 rebuild=1;\
137 fi; \
138 if [ "$$(grep ^ADK_TARGET_USE .config|md5sum)" != "$$(grep ^ADK_TARGET_USE .config.old|md5sum)" ];then \
139 cleandir=1;\
140 rebuild=1;\
141 fi; \
142 if [ $$cleandir -eq 1 ];then \
143 echo "You should rebuild with 'make cleansystem'";\
144 fi; \
145 if [ $$rebuild -eq 1 ];then \
146 cp .config .config.old;\
147 fi; \
148 fi; \
149 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
156 ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
157 include $(ADK_TOPDIR)/rules.mk
159 all: world
161 ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}/package/*/Makefile) $(ADK_TOPDIR)/adk/tools/depmaker
162 @printf " ---> generating dependencies.. "
163 $(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
164 @printf "done\n"
166 .NOTPARALLEL:
167 .PHONY: all world clean cleandir cleansystem distclean image_clean
169 world:
170 @mkdir -p $(DL_DIR) $(HOST_BUILD_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
171 $(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
172 ifeq ($(ADK_APPLIANCE_TOOLCHAIN),y)
173 $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
174 else
175 ifeq ($(ADK_TARGET_OS_BAREMETAL),y)
176 $(MAKE) -f mk/build.mk package/hostcompile toolchain/final
177 endif
178 ifeq ($(ADK_TARGET_OS_LINUX),y)
179 $(MAKE) -f mk/build.mk package/hostcompile toolchain/final target/config-prepare target/compile package/compile root_clean package/install target/install package_index
180 endif
181 endif
183 package_index:
184 ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
185 -cd ${PACKAGE_DIR} && \
186 ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
187 endif
188 ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
189 -cd ${PACKAGE_DIR} && \
190 ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
191 endif
193 ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
194 @mkdir -p ${STAGING_TARGET_DIR}/lib
195 @mkdir -p ${STAGING_TARGET_DIR}/bin
196 @mkdir -p ${STAGING_TARGET_DIR}/etc
197 @mkdir -p ${STAGING_TARGET_DIR}/usr/bin
198 @mkdir -p ${STAGING_TARGET_DIR}/usr/include
199 @mkdir -p ${STAGING_TARGET_DIR}/usr/lib/pkgconfig
200 @mkdir -p ${STAGING_HOST_DIR}/usr/bin
201 @mkdir -p ${STAGING_HOST_DIR}/usr/lib
202 @mkdir -p ${STAGING_HOST_DIR}/usr/include
203 @for i in lib64 lib32 libx32; do \
204 cd ${STAGING_TARGET_DIR}; ln -sf lib $$i; \
205 cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
206 cd ${STAGING_HOST_DIR}; ln -sf lib $$i; \
207 cd ${STAGING_HOST_DIR}/usr; ln -sf lib $$i; \
208 done
210 ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
211 echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
212 echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
214 package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${ADK_TOPDIR}/package/Depends.mk
215 $(MAKE) -C package $(patsubst package/%,%,$@)
217 target/%:
218 $(MAKE) -C target $(patsubst target/%,%,$@)
220 toolchain/%: ${STAGING_TARGET_DIR}
221 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
223 image:
224 $(MAKE) -C target image
226 targethelp:
227 $(MAKE) -C target targethelp
229 kernelconfig:
230 ${KERNEL_MAKE_ENV} ${MAKE} -C "${LINUX_DIR}" \
231 ARCH=$(ADK_TARGET_ARCH) \
232 ${KERNEL_MAKE_OPTS} \
233 menuconfig
235 ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG),y)
236 savekconfig:
237 @echo "Saving kernel configuration to $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)"
238 $(CP) $(LINUX_DIR)/.config $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)
239 else
240 savekconfig:
241 @echo "You have to enable ADK_TARGET_KERNEL_USE_CUSTOMCONFIG to be able to save the current kernel configuration."
242 endif
245 # create a new package from package/.template
246 newpackage:
247 @echo "Creating new package $(PKG)"
248 $(CP) $(ADK_TOPDIR)/package/.template$(TYPE) $(ADK_TOPDIR)/package/$(PKG)
249 pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
250 $(SED) "s#@UPKG@#$$pkg#" $(ADK_TOPDIR)/package/$(PKG)/Makefile
251 $(SED) 's#@PKG@#$(PKG)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
252 $(SED) 's#@VER@#$(VER)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
253 @echo "Edit package/$(PKG)/Makefile to complete"
255 root_clean:
256 rm -rf $(TARGET_DIR)
257 mkdir -p $(TARGET_DIR)
258 touch $(TARGET_DIR)/.adk
260 # Do a per-package clean here, too. This way stale headers and
261 # libraries from target_*/ get wiped away, which keeps
262 # future package build's configure scripts from returning false
263 # dependencies information.
265 clean:
266 @printf " ---> cleaning target build directories and files.. "
267 $(MAKE) -C $(CONFIG) clean
268 for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
269 while read file ; do \
270 rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
271 done < ${STAGING_PKG_DIR}/$$f ; \
272 rm ${STAGING_PKG_DIR}/$$f ; \
273 done
274 rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
275 ${ADK_TOPDIR}/package/pkglist.d
276 rm -f ${ADK_TOPDIR}/package/Depends.mk
277 @printf "done\n"
279 cleankernel:
280 @printf " ---> cleaning kernel build directories.. "
281 @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
282 @printf "done\n"
284 cleandir:
285 @printf " ---> cleaning all build directories and files.. "
286 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
287 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
288 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
289 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
290 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
291 @rm -f .menu .tmpconfig.h .rebuild* make.log
292 @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
293 @printf "done\n"
295 cleansystem:
296 @printf " ---> cleaning system build directories and files .. "
297 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
298 @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
299 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
300 @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
301 @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
302 @printf "done\n"
304 distclean:
305 @printf " ---> cleaning build directories, files and downloads.. "
306 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
307 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
308 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
309 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
310 @rm -rf package/pkglist.d package/pkgconfigs.d
311 @rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk make.log
312 @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
313 @rm -f target/*/Config.in.arch target/*/Config.in.systems target/config/Config.in.tasks
314 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
315 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
316 @rm -f package/Config.in.auto* target/config/Config.in.system
317 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
318 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
319 @printf "done\n"
321 else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
323 ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
324 include ${ADK_TOPDIR}/mk/vars.mk
325 else
326 include $(ADK_TOPDIR)/prereq.mk
327 endif
329 all: menuconfig
330 @echo "Start the build with \"make\" or with \"make v\" to be verbose"
332 # configuration
333 # ---------------------------------------------------------------------------
335 # force entering the subdir, as dependency checking is done there
336 .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
338 $(CONFIG)/conf:
339 @$(MAKE) -C $(CONFIG) conf
341 $(CONFIG)/mconf:
342 @$(MAKE) -C $(CONFIG)
344 defconfig: .menu $(CONFIG)/conf
345 @if [ -f $(ADK_TOPDIR)/.defconfig ]; then rm $(ADK_TOPDIR)/.defconfig;fi
346 @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
347 echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
349 @if [ ! -z "$(ADK_TEST_BASE)" ];then \
350 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
351 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
352 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
354 @if [ ! -z "$(ADK_TEST_TOOLCHAIN)" ];then \
355 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
357 @if [ ! -z "$(ADK_TEST_LTP)" ];then \
358 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
359 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
360 echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
362 @if [ ! -z "$(ADK_TEST_MKSH)" ];then \
363 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
364 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
365 echo "ADK_PACKAGE_PERL=y" >> $(ADK_TOPDIR)/.defconfig; \
366 echo "ADK_PACKAGE_MKSH_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
368 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_TEST)" ];then \
369 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
370 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
371 echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
373 @if [ ! -z "$(ADK_TEST_LIBC_TEST)" ];then \
374 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
375 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
376 echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
377 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
379 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
380 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
381 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
382 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
383 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
384 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
385 echo "ADK_PACKAGE_UCLIBC_NG_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
387 @if [ ! -z "$(ADK_TEST_MUSL_NATIVE)" ];then \
388 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
389 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
390 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
391 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
392 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
393 echo "ADK_PACKAGE_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
395 @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
396 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
397 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
398 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
399 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
400 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
401 echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
403 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
404 grep "^config" target/config/Config.in.tasks \
405 |grep -i "_$(ADK_APPLIANCE)$$" \
406 |sed -e "s#^config \(.*\)#\1=y#" \
407 >> $(ADK_TOPDIR)/.defconfig; \
409 @if [ ! -z "$(ADK_TARGET_OS)" ];then \
410 grep "^config" target/config/Config.in.os \
411 |grep -i "_$(ADK_TARGET_OS)$$" \
412 |sed -e "s#^config \(.*\)#\1=y#" \
413 >> $(ADK_TOPDIR)/.defconfig; \
415 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
416 grep "^config" target/config/Config.in.arch.choice \
417 |grep -i "_$(ADK_TARGET_ARCH)$$" \
418 |sed -e "s#^config \(.*\)#\1=y#" \
419 >> $(ADK_TOPDIR)/.defconfig; \
421 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
422 grep "^config" target/config/Config.in.rootfs \
423 |grep -i "$(ADK_TARGET_FS)" \
424 |sed -e "s#^config \(.*\)#\1=y#" \
425 >> $(ADK_TOPDIR)/.defconfig; \
427 @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
428 grep "^config" target/config/Config.in.abi \
429 |grep -i "$(ADK_TARGET_ABI)$$" \
430 |sed -e "s#^config \(.*\)#\1=y#" \
431 >> $(ADK_TOPDIR)/.defconfig; \
433 @if [ ! -z "$(ADK_TARGET_FLOAT)" ];then \
434 grep "^config" target/config/Config.in.float \
435 |grep -i "$(ADK_TARGET_FLOAT)_" \
436 |sed -e "s#^config \(.*\)#\1=y#" \
437 >> $(ADK_TOPDIR)/.defconfig; \
439 @if [ ! -z "$(ADK_TARGET_BINFMT)" ];then \
440 grep "^config" target/config/Config.in.binfmt \
441 |grep -i "$(ADK_TARGET_BINFMT)$$" \
442 |sed -e "s#^config \(.*\)#\1=y#" \
443 >> $(ADK_TOPDIR)/.defconfig; \
445 @if [ ! -z "$(ADK_TARGET_INSTRUCTION_SET)" ];then \
446 grep "^config" target/config/Config.in.archopts \
447 |grep -i "$(ADK_TARGET_INSTRUCTION_SET)$$" \
448 |sed -e "s#^config \(.*\)#\1=y#" \
449 >> $(ADK_TOPDIR)/.defconfig; \
451 @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
452 grep "^config" target/config/Config.in.endian \
453 |grep -i "$(ADK_TARGET_ENDIAN)" \
454 |sed -e "s#^config \(.*\)#\1=y#" \
455 >> $(ADK_TOPDIR)/.defconfig; \
457 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
458 libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
459 grep "^config" target/config/Config.in.libc \
460 |grep -i "$$libc$$" \
461 |sed -e "s#^config \(.*\)#\1=y#" \
462 >> $(ADK_TOPDIR)/.defconfig; \
464 @if [ ! -z "$(ADK_TARGET_CPU)" ];then \
465 cpu=$$(echo "$(ADK_TARGET_CPU)" |sed -e "s/-/_/g"); \
466 grep -h "^config" target/config/Config.in.cpu \
467 |grep -i "$$cpu$$" \
468 |sed -e "s#^config \(.*\)#\1=y#" \
469 >> $(ADK_TOPDIR)/.defconfig; \
471 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
472 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
473 grep -h "^config" target/*/Config.in.systems \
474 |grep -i "$$system$$" \
475 |sed -e "s#^config \(.*\)#\1=y#" \
476 >> $(ADK_TOPDIR)/.defconfig; \
478 @if [ ! -z "$(ADK_TARGET_KERNEL_VERSION)" ];then \
479 kernelversion=$$(echo "$(ADK_TARGET_KERNEL_VERSION)"|sed -e "s/\./_/g"); \
480 grep "^config" target/config/Config.in.kernelversion \
481 |grep -i "$$kernelversion$$" \
482 |sed -e "s#^config \(.*\)#\1=y#" \
483 >> $(ADK_TOPDIR)/.defconfig; \
485 @if [ ! -z "$(ADK_TARGET_LIBC_VERSION)" ];then \
486 libcversion=$$(echo "$(ADK_TARGET_LIBC_VERSION)"|sed -e "s/\./_/g"); \
487 if [ "$$libcversion" = "git" ];then \
488 if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
489 echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
490 fi; \
491 if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
492 echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
493 fi; \
494 if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
495 echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
496 fi; \
497 else \
498 grep "^config" target/config/Config.in.libc \
499 |grep -i "$$libcversion$$" \
500 |sed -e "s#^config \(.*\)#\1=y#" \
501 >> $(ADK_TOPDIR)/.defconfig; \
502 fi; \
504 @if [ ! -z "$(ADK_TOOLCHAIN_BINUTILS_VERSION)" ];then \
505 binutilsversion=$$(echo "$(ADK_TOOLCHAIN_BINUTILS_VERSION)"|sed -e "s/\./_/g"); \
506 if [ "$$binutilsversion" = "git" ];then \
507 echo "ADK_TOOLCHAIN_BINUTILS_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
508 else \
509 grep "^config" target/config/Config.in.binutils \
510 |grep -i "$$binutilsversion$$" \
511 |sed -e "s#^config \(.*\)#\1=y#" \
512 >> $(ADK_TOPDIR)/.defconfig; \
513 fi; \
515 @if [ ! -z "$(ADK_TOOLCHAIN_GCC_VERSION)" ];then \
516 echo "ADK_BUILD_COMPILER_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
517 gccversion=$$(echo "$(ADK_TOOLCHAIN_GCC_VERSION)"|sed -e "s/\./_/g"); \
518 if [ "$$gccversion" = "git" ];then \
519 echo "ADK_TOOLCHAIN_GCC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
520 else \
521 grep "^config" target/config/Config.in.compiler \
522 |grep -i "$$gccversion$$" \
523 |sed -e "s#^config \(.*\)#\1=y#" \
524 >> $(ADK_TOPDIR)/.defconfig; \
525 fi; \
527 @if [ ! -z "$(ADK_TOOLCHAIN_GDB_VERSION)" ];then \
528 gdbversion=$$(echo "$(ADK_TOOLCHAIN_GDB_VERSION)"|sed -e "s/\./_/g"); \
529 if [ "$$gdbversion" = "git" ];then \
530 echo "ADK_TOOLCHAIN_GDB_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
531 else \
532 grep "^config" target/config/Config.in.gdb \
533 |grep -i "$$gdbversion$$" \
534 |sed -e "s#^config \(.*\)#\1=y#" \
535 >> $(ADK_TOPDIR)/.defconfig; \
536 fi; \
538 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
539 $(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
542 allconfig:
543 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
544 grep "^config" target/config/Config.in.tasks \
545 |grep -i "_$(ADK_APPLIANCE)"\$$ \
546 |sed -e "s#^config \(.*\)#\1=y#" \
547 >> $(ADK_TOPDIR)/all.config; \
549 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
550 grep "^config" target/config/Config.in.arch.choice \
551 |grep -i "$(ADK_TARGET_ARCH)"\$$ \
552 |sed -e "s#^config \(.*\)#\1=y#" \
553 >> $(ADK_TOPDIR)/all.config; \
555 @for symbol in ${DEFCONFIG}; do \
556 echo $$symbol >> $(ADK_TOPDIR)/all.config; \
557 done
558 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
559 grep "^config" target/config/Config.in.rootfs \
560 |grep -i "$(ADK_TARGET_FS)" \
561 |sed -e "s#^config \(.*\)#\1=y#" \
562 >> $(ADK_TOPDIR)/all.config; \
564 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
565 grep "^config" target/config/Config.in.libc \
566 |grep -i "$(ADK_TARGET_LIBC)" \
567 |sed -e "s#^config \(.*\)#\1=y#" \
568 >> $(ADK_TOPDIR)/all.config; \
570 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
571 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
572 grep -h "^config" target/*/Config.in.systems \
573 |grep -i "$$system$$" \
574 |sed -e "s#^config \(.*\)#\1=y#" \
575 >> $(ADK_TOPDIR)/all.config; \
578 menuconfig: $(CONFIG)/mconf defconfig .menu
579 @if [ ! -f .config ];then \
580 $(CONFIG)/conf --olddefconfig $(CONFIG_CONFIG_IN); \
582 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
583 ${POSTCONFIG}
585 _config: $(CONFIG)/conf allconfig .menu
586 -@touch .config
587 @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
588 ${POSTCONFIG}
590 distclean cleandir:
591 @printf " ---> cleaning build directories, files and downloads.. "
592 @$(MAKE) -C $(CONFIG) clean
593 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
594 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
595 @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
596 @rm -rf package/pkglist.d package/pkgconfigs.d
597 @rm -f .config* .defconfig .tmpconfig.h all.config make.log
598 @rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
599 @rm -f target/*/Config.in.arch target/*/Config.in.systems
600 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
601 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
602 @rm -f package/Config.in.auto* target/config/Config.in.system target/config/Config.in.tasks
603 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
604 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
605 @printf "done\n"
607 endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
609 $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
610 @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
612 $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
613 @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
615 $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
616 @$(HOST_CC) $(HOST_CFLAGS) -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
618 menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard tasks/*)
619 @printf " ---> generating menu structure.. "
620 @$(SHELL) $(ADK_TOPDIR)/scripts/create-menu
621 @$(ADK_TOPDIR)/adk/tools/pkgmaker
622 @:>.menu
623 @printf "done\n"
625 dep: $(ADK_TOPDIR)/adk/tools/depmaker
626 @printf " ---> generating dependencies.. "
627 @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
628 @printf "done\n"
630 .PHONY: menu dep
632 include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
634 check-dejagnu:
635 @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
636 @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
637 -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
638 adk/tests/adk.exp.in > adk/tests/adk.exp
639 @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
640 adk/tests/master.exp
642 check-gcc: check-dejagnu
643 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
644 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c
646 check-g++: check-dejagnu
647 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
648 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c++
650 check: check-gcc check-g++