linux: fix git sources, match kernel version to avoid kernel module mismatches
[openadk.git] / mk / build.mk
blob3bbcc220de640defd0938924948e39f494128342
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_clean 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_KARCH) \
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 package_clean:
256 rm -rf $(PACKAGE_DIR)
257 mkdir -p $(PACKAGE_DIR)
259 root_clean:
260 rm -rf $(TARGET_DIR)
261 mkdir -p $(TARGET_DIR)
262 touch $(TARGET_DIR)/.adk
264 # Do a per-package clean here, too. This way stale headers and
265 # libraries from target_*/ get wiped away, which keeps
266 # future package build's configure scripts from returning false
267 # dependencies information.
269 clean:
270 @printf " ---> cleaning target build directories and files.. "
271 $(MAKE) -C $(CONFIG) clean
272 for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
273 while read file ; do \
274 rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
275 done < ${STAGING_PKG_DIR}/$$f ; \
276 rm ${STAGING_PKG_DIR}/$$f ; \
277 done
278 rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
279 ${ADK_TOPDIR}/package/pkglist.d
280 rm -f ${ADK_TOPDIR}/package/Depends.mk
281 @printf "done\n"
283 cleankernel:
284 @printf " ---> cleaning kernel build directories.. "
285 @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
286 @printf "done\n"
288 cleandir:
289 @printf " ---> cleaning all build directories and files.. "
290 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
291 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
292 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
293 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
294 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
295 @rm -f .menu .tmpconfig.h .rebuild* make.log
296 @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
297 @printf "done\n"
299 cleansystem:
300 @printf " ---> cleaning system build directories and files .. "
301 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
302 @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
303 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
304 @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
305 @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
306 @printf "done\n"
308 distclean:
309 @printf " ---> cleaning build directories, files and downloads.. "
310 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
311 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
312 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
313 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
314 @rm -rf package/pkglist.d package/pkgconfigs.d
315 @rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk make.log
316 @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
317 @rm -f target/*/Config.in.arch target/*/Config.in.systems target/config/Config.in.tasks
318 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
319 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
320 @rm -f package/Config.in.auto* target/config/Config.in.system
321 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
322 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
323 @printf "done\n"
325 else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
327 ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
328 include ${ADK_TOPDIR}/mk/vars.mk
329 else
330 include $(ADK_TOPDIR)/prereq.mk
331 endif
333 all: menuconfig
334 @echo "Start the build with \"make\" or with \"make v\" to be verbose"
336 # configuration
337 # ---------------------------------------------------------------------------
339 # force entering the subdir, as dependency checking is done there
340 .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
342 $(CONFIG)/conf:
343 @$(MAKE) -C $(CONFIG) conf
345 $(CONFIG)/mconf:
346 @$(MAKE) -C $(CONFIG)
348 defconfig: .menu $(CONFIG)/conf
349 @if [ -f $(ADK_TOPDIR)/.defconfig ]; then rm $(ADK_TOPDIR)/.defconfig;fi
350 @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
351 echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
353 @if [ ! -z "$(ADK_TEST_BASE)" ];then \
354 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
355 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
356 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
358 @if [ ! -z "$(ADK_TEST_TOOLCHAIN)" ];then \
359 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
361 @if [ ! -z "$(ADK_TEST_LTP)" ];then \
362 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
363 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
364 echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
366 @if [ ! -z "$(ADK_TEST_MKSH)" ];then \
367 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
368 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
369 echo "ADK_PACKAGE_PERL=y" >> $(ADK_TOPDIR)/.defconfig; \
370 echo "ADK_PACKAGE_MKSH_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
372 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_TEST)" ];then \
373 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
374 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
375 echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
377 @if [ ! -z "$(ADK_TEST_LIBC_TEST)" ];then \
378 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
379 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
380 echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
381 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
383 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
384 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
385 echo "ADK_PACKAGE_FILE=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_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
394 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
395 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
396 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
397 echo "ADK_PACKAGE_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
399 @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
400 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
401 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
402 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
403 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
404 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
405 echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
407 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
408 grep "^config" target/config/Config.in.tasks \
409 |grep -i "_$(ADK_APPLIANCE)$$" \
410 |sed -e "s#^config \(.*\)#\1=y#" \
411 >> $(ADK_TOPDIR)/.defconfig; \
413 @if [ ! -z "$(ADK_TARGET_OS)" ];then \
414 grep "^config" target/config/Config.in.os \
415 |grep -i "_$(ADK_TARGET_OS)$$" \
416 |sed -e "s#^config \(.*\)#\1=y#" \
417 >> $(ADK_TOPDIR)/.defconfig; \
419 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
420 grep "^config" target/config/Config.in.arch.choice \
421 |grep -i "_$(ADK_TARGET_ARCH)$$" \
422 |sed -e "s#^config \(.*\)#\1=y#" \
423 >> $(ADK_TOPDIR)/.defconfig; \
425 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
426 grep "^config" target/config/Config.in.rootfs \
427 |grep -i "$(ADK_TARGET_FS)" \
428 |sed -e "s#^config \(.*\)#\1=y#" \
429 >> $(ADK_TOPDIR)/.defconfig; \
431 @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
432 grep "^config" target/config/Config.in.abi \
433 |grep -i "$(ADK_TARGET_ABI)$$" \
434 |sed -e "s#^config \(.*\)#\1=y#" \
435 >> $(ADK_TOPDIR)/.defconfig; \
437 @if [ ! -z "$(ADK_TARGET_FLOAT)" ];then \
438 grep "^config" target/config/Config.in.float \
439 |grep -i "$(ADK_TARGET_FLOAT)_" \
440 |sed -e "s#^config \(.*\)#\1=y#" \
441 >> $(ADK_TOPDIR)/.defconfig; \
443 @if [ ! -z "$(ADK_TARGET_BINFMT)" ];then \
444 grep "^config" target/config/Config.in.binfmt \
445 |grep -i "$(ADK_TARGET_BINFMT)$$" \
446 |sed -e "s#^config \(.*\)#\1=y#" \
447 >> $(ADK_TOPDIR)/.defconfig; \
449 @if [ ! -z "$(ADK_TARGET_INSTRUCTION_SET)" ];then \
450 grep "^config" target/config/Config.in.archopts \
451 |grep -i "$(ADK_TARGET_INSTRUCTION_SET)$$" \
452 |sed -e "s#^config \(.*\)#\1=y#" \
453 >> $(ADK_TOPDIR)/.defconfig; \
455 @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
456 grep "^config" target/config/Config.in.endian \
457 |grep -i "$(ADK_TARGET_ENDIAN)" \
458 |sed -e "s#^config \(.*\)#\1=y#" \
459 >> $(ADK_TOPDIR)/.defconfig; \
461 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
462 libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
463 grep "^config" target/config/Config.in.libc \
464 |grep -i "$$libc$$" \
465 |sed -e "s#^config \(.*\)#\1=y#" \
466 >> $(ADK_TOPDIR)/.defconfig; \
468 @if [ ! -z "$(ADK_TARGET_CPU)" ];then \
469 cpu=$$(echo "$(ADK_TARGET_CPU)" |sed -e "s/-/_/g"); \
470 grep -h "^config" target/config/Config.in.cpu \
471 |grep -i "$$cpu$$" \
472 |sed -e "s#^config \(.*\)#\1=y#" \
473 >> $(ADK_TOPDIR)/.defconfig; \
475 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
476 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
477 grep -h "^config" target/*/Config.in.systems \
478 |grep -i "$$system$$" \
479 |sed -e "s#^config \(.*\)#\1=y#" \
480 >> $(ADK_TOPDIR)/.defconfig; \
482 @if [ ! -z "$(ADK_TARGET_KERNEL_VERSION)" ];then \
483 kernelversion=$$(echo "$(ADK_TARGET_KERNEL_VERSION)"|sed -e "s/\./_/g"); \
484 grep "^config" target/config/Config.in.kernelversion \
485 |grep -i "$$kernelversion$$" \
486 |sed -e "s#^config \(.*\)#\1=y#" \
487 >> $(ADK_TOPDIR)/.defconfig; \
489 @if [ ! -z "$(ADK_TARGET_LIBC_VERSION)" ];then \
490 libcversion=$$(echo "$(ADK_TARGET_LIBC_VERSION)"|sed -e "s/\./_/g"); \
491 if [ "$$libcversion" = "git" ];then \
492 if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
493 echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
494 fi; \
495 if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
496 echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
497 fi; \
498 if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
499 echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
500 fi; \
501 else \
502 grep "^config" target/config/Config.in.libc \
503 |grep -i "$$libcversion$$" \
504 |sed -e "s#^config \(.*\)#\1=y#" \
505 >> $(ADK_TOPDIR)/.defconfig; \
506 fi; \
508 @if [ ! -z "$(ADK_TOOLCHAIN_BINUTILS_VERSION)" ];then \
509 binutilsversion=$$(echo "$(ADK_TOOLCHAIN_BINUTILS_VERSION)"|sed -e "s/\./_/g"); \
510 if [ "$$binutilsversion" = "git" ];then \
511 echo "ADK_TOOLCHAIN_BINUTILS_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
512 else \
513 grep "^config" target/config/Config.in.binutils \
514 |grep -i "$$binutilsversion$$" \
515 |sed -e "s#^config \(.*\)#\1=y#" \
516 >> $(ADK_TOPDIR)/.defconfig; \
517 fi; \
519 @if [ ! -z "$(ADK_TOOLCHAIN_GCC_VERSION)" ];then \
520 echo "ADK_BUILD_COMPILER_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
521 gccversion=$$(echo "$(ADK_TOOLCHAIN_GCC_VERSION)"|sed -e "s/\./_/g"); \
522 if [ "$$gccversion" = "git" ];then \
523 echo "ADK_TOOLCHAIN_GCC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
524 else \
525 grep "^config" target/config/Config.in.compiler \
526 |grep -i "$$gccversion$$" \
527 |sed -e "s#^config \(.*\)#\1=y#" \
528 >> $(ADK_TOPDIR)/.defconfig; \
529 fi; \
531 @if [ ! -z "$(ADK_TOOLCHAIN_GDB_VERSION)" ];then \
532 gdbversion=$$(echo "$(ADK_TOOLCHAIN_GDB_VERSION)"|sed -e "s/\./_/g"); \
533 if [ "$$gdbversion" = "git" ];then \
534 echo "ADK_TOOLCHAIN_GDB_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
535 else \
536 grep "^config" target/config/Config.in.gdb \
537 |grep -i "$$gdbversion$$" \
538 |sed -e "s#^config \(.*\)#\1=y#" \
539 >> $(ADK_TOPDIR)/.defconfig; \
540 fi; \
542 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
543 $(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
546 allconfig:
547 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
548 grep "^config" target/config/Config.in.tasks \
549 |grep -i "_$(ADK_APPLIANCE)"\$$ \
550 |sed -e "s#^config \(.*\)#\1=y#" \
551 >> $(ADK_TOPDIR)/all.config; \
553 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
554 grep "^config" target/config/Config.in.arch.choice \
555 |grep -i "$(ADK_TARGET_ARCH)"\$$ \
556 |sed -e "s#^config \(.*\)#\1=y#" \
557 >> $(ADK_TOPDIR)/all.config; \
559 @for symbol in ${DEFCONFIG}; do \
560 echo $$symbol >> $(ADK_TOPDIR)/all.config; \
561 done
562 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
563 grep "^config" target/config/Config.in.rootfs \
564 |grep -i "$(ADK_TARGET_FS)" \
565 |sed -e "s#^config \(.*\)#\1=y#" \
566 >> $(ADK_TOPDIR)/all.config; \
568 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
569 grep "^config" target/config/Config.in.libc \
570 |grep -i "$(ADK_TARGET_LIBC)" \
571 |sed -e "s#^config \(.*\)#\1=y#" \
572 >> $(ADK_TOPDIR)/all.config; \
574 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
575 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
576 grep -h "^config" target/*/Config.in.systems \
577 |grep -i "$$system$$" \
578 |sed -e "s#^config \(.*\)#\1=y#" \
579 >> $(ADK_TOPDIR)/all.config; \
582 menuconfig: $(CONFIG)/mconf defconfig .menu
583 @if [ ! -f .config ];then \
584 $(CONFIG)/conf --olddefconfig $(CONFIG_CONFIG_IN); \
586 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
587 ${POSTCONFIG}
589 _config: $(CONFIG)/conf allconfig .menu
590 -@touch .config
591 @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
592 ${POSTCONFIG}
594 distclean cleandir:
595 @printf " ---> cleaning build directories, files and downloads.. "
596 @$(MAKE) -C $(CONFIG) clean
597 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
598 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
599 @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
600 @rm -rf package/pkglist.d package/pkgconfigs.d
601 @rm -f .config* .defconfig .tmpconfig.h all.config make.log
602 @rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
603 @rm -f target/*/Config.in.arch target/*/Config.in.systems
604 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
605 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
606 @rm -f package/Config.in.auto* target/config/Config.in.system target/config/Config.in.tasks
607 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
608 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
609 @printf "done\n"
611 endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
613 $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
614 @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
616 $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
617 @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
619 $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
620 @$(HOST_CC) $(HOST_CFLAGS) -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
622 menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard tasks/*)
623 @printf " ---> generating menu structure.. "
624 @$(SHELL) $(ADK_TOPDIR)/scripts/create-menu
625 @$(ADK_TOPDIR)/adk/tools/pkgmaker
626 @:>.menu
627 @printf "done\n"
629 dep: $(ADK_TOPDIR)/adk/tools/depmaker
630 @printf " ---> generating dependencies.. "
631 @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
632 @printf "done\n"
634 .PHONY: menu dep
636 include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
638 check-dejagnu:
639 @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
640 @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
641 -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
642 adk/tests/adk.exp.in > adk/tests/adk.exp
643 @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
644 adk/tests/master.exp
646 check-gcc: 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-g++: check-dejagnu
651 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
652 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c++
654 check: check-gcc check-g++