easy-rsa: update, but declare as broken. does not work with libressl openssl tool
[openadk.git] / mk / build.mk
blob67a53896ad72cbe84144578206f2bfa860a0511f
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_FROSTED),y)
179 $(MAKE) -f mk/build.mk package/hostcompile toolchain/final target/config-prepare target/compile target/install
180 endif
181 ifeq ($(ADK_TARGET_OS_LINUX),y)
182 $(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
183 endif
184 endif
186 package_index:
187 ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
188 -cd ${PACKAGE_DIR} && \
189 ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
190 endif
191 ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
192 -cd ${PACKAGE_DIR} && \
193 ${BASH} ${ADK_TOPDIR}/scripts/ipkg-make-index.sh . >Packages
194 endif
196 ${STAGING_TARGET_DIR} ${STAGING_TARGET_DIR}/etc ${STAGING_HOST_DIR}:
197 @mkdir -p ${STAGING_TARGET_DIR}/lib
198 @mkdir -p ${STAGING_TARGET_DIR}/bin
199 @mkdir -p ${STAGING_TARGET_DIR}/etc
200 @mkdir -p ${STAGING_TARGET_DIR}/usr/bin
201 @mkdir -p ${STAGING_TARGET_DIR}/usr/include
202 @mkdir -p ${STAGING_TARGET_DIR}/usr/lib/pkgconfig
203 @mkdir -p ${STAGING_HOST_DIR}/usr/bin
204 @mkdir -p ${STAGING_HOST_DIR}/usr/lib
205 @mkdir -p ${STAGING_HOST_DIR}/usr/include
206 @for i in lib64 lib32 libx32; do \
207 cd ${STAGING_TARGET_DIR}; ln -sf lib $$i; \
208 cd ${STAGING_TARGET_DIR}/usr; ln -sf lib $$i; \
209 cd ${STAGING_HOST_DIR}; ln -sf lib $$i; \
210 cd ${STAGING_HOST_DIR}/usr; ln -sf lib $$i; \
211 done
213 ${STAGING_TARGET_DIR}/etc/ipkg.conf: ${STAGING_TARGET_DIR}/etc
214 echo "dest root /" >${STAGING_TARGET_DIR}/etc/ipkg.conf
215 echo "option offline_root ${TARGET_DIR}" >>$(STAGING_TARGET_DIR)/etc/ipkg.conf
217 package/%: ${STAGING_TARGET_DIR}/etc/ipkg.conf ${ADK_TOPDIR}/package/Depends.mk
218 $(MAKE) -C package $(patsubst package/%,%,$@)
220 target/%:
221 $(MAKE) -C target $(patsubst target/%,%,$@)
223 toolchain/%: ${STAGING_TARGET_DIR}
224 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
226 image:
227 $(MAKE) -C target image
229 targethelp:
230 $(MAKE) -C target targethelp
232 kernelconfig:
233 ${KERNEL_MAKE_ENV} ${MAKE} -C "${LINUX_DIR}" \
234 ARCH=$(ADK_TARGET_KARCH) \
235 ${KERNEL_MAKE_OPTS} \
236 menuconfig
238 ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG),y)
239 savekconfig:
240 @echo "Saving kernel configuration to $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)"
241 $(CP) $(LINUX_DIR)/.config $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)
242 else
243 savekconfig:
244 @echo "You have to enable ADK_TARGET_KERNEL_USE_CUSTOMCONFIG to be able to save the current kernel configuration."
245 endif
248 # create a new package from package/.template
249 newpackage:
250 @echo "Creating new package $(PKG)"
251 $(CP) $(ADK_TOPDIR)/package/.template$(TYPE) $(ADK_TOPDIR)/package/$(PKG)
252 pkg=$$(echo $(PKG)|tr '[:lower:]-' '[:upper:]_'); \
253 $(SED) "s#@UPKG@#$$pkg#" $(ADK_TOPDIR)/package/$(PKG)/Makefile
254 $(SED) 's#@PKG@#$(PKG)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
255 $(SED) 's#@VER@#$(VER)#' $(ADK_TOPDIR)/package/$(PKG)/Makefile
256 @echo "Edit package/$(PKG)/Makefile to complete"
258 package_clean:
259 rm -rf $(PACKAGE_DIR)
260 mkdir -p $(PACKAGE_DIR)
262 root_clean:
263 rm -rf $(TARGET_DIR)
264 mkdir -p $(TARGET_DIR)
265 touch $(TARGET_DIR)/.adk
267 # Do a per-package clean here, too. This way stale headers and
268 # libraries from target_*/ get wiped away, which keeps
269 # future package build's configure scripts from returning false
270 # dependencies information.
272 clean:
273 @printf " ---> cleaning target build directories and files.. "
274 $(MAKE) -C $(CONFIG) clean
275 for f in $$(ls ${STAGING_PKG_DIR}/ 2>/dev/null |grep -v [A-Z]|grep -v stamps 2>/dev/null); do \
276 while read file ; do \
277 rm ${STAGING_TARGET_DIR}/$$file 2>/dev/null;\
278 done < ${STAGING_PKG_DIR}/$$f ; \
279 rm ${STAGING_PKG_DIR}/$$f ; \
280 done
281 rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
282 ${ADK_TOPDIR}/package/pkglist.d
283 rm -f ${ADK_TOPDIR}/package/Depends.mk
284 @printf "done\n"
286 cleankernel:
287 @printf " ---> cleaning kernel build directories.. "
288 @rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
289 @printf "done\n"
291 cleandir:
292 @printf " ---> cleaning all build directories and files.. "
293 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
294 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
295 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
296 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
297 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
298 @rm -f .menu .tmpconfig.h .rebuild* make.log
299 @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
300 @printf "done\n"
302 cleansystem:
303 @printf " ---> cleaning system build directories and files .. "
304 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
305 @rm -rf $(BUILD_DIR) $(FW_DIR) $(TARGET_DIR) \
306 ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
307 @rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
308 @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
309 @printf "done\n"
311 distclean:
312 @printf " ---> cleaning build directories, files and downloads.. "
313 @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
314 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
315 @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
316 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
317 @rm -rf package/pkglist.d package/pkgconfigs.d
318 @rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk make.log
319 @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
320 @rm -f target/*/Config.in.arch target/*/Config.in.systems target/config/Config.in.tasks
321 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
322 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
323 @rm -f package/Config.in.auto* target/config/Config.in.system
324 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
325 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
326 @printf "done\n"
328 else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
330 ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
331 include ${ADK_TOPDIR}/mk/vars.mk
332 else
333 include $(ADK_TOPDIR)/prereq.mk
334 endif
336 all: menuconfig
337 @echo "Start the build with \"make\" or with \"make v\" to be verbose"
339 # configuration
340 # ---------------------------------------------------------------------------
342 # force entering the subdir, as dependency checking is done there
343 .PHONY: $(CONFIG)/conf $(CONFIG)/mconf
345 $(CONFIG)/conf:
346 @$(MAKE) -C $(CONFIG) conf
348 $(CONFIG)/mconf:
349 @$(MAKE) -C $(CONFIG)
351 defconfig: .menu $(CONFIG)/conf
352 @if [ -f $(ADK_TOPDIR)/.defconfig ]; then rm $(ADK_TOPDIR)/.defconfig;fi
353 @if [ ! -z "$(ADK_NO_CHECKSUM)" ];then \
354 echo "ADK_DISABLE_CHECKSUM=y" >> $(ADK_TOPDIR)/.defconfig; \
356 @if [ ! -z "$(ADK_TEST_BASE)" ];then \
357 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
358 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
359 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
361 @if [ ! -z "$(ADK_TEST_TOOLCHAIN)" ];then \
362 echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
364 @if [ ! -z "$(ADK_TEST_LTP)" ];then \
365 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
366 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
367 echo "ADK_PACKAGE_LTP=y" >> $(ADK_TOPDIR)/.defconfig; \
369 @if [ ! -z "$(ADK_TEST_MKSH)" ];then \
370 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
371 echo "ADK_PACKAGE_FILE=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_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
378 echo "ADK_PACKAGE_UCLIBC_NG_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
380 @if [ ! -z "$(ADK_TEST_LIBC_TEST)" ];then \
381 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
382 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
383 echo "ADK_PACKAGE_LIBC_TEST=y" >> $(ADK_TOPDIR)/.defconfig; \
384 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
386 @if [ ! -z "$(ADK_TEST_UCLIBC_NG_NATIVE)" ];then \
387 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
388 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
389 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
390 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
391 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
392 echo "ADK_PACKAGE_UCLIBC_NG_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
394 @if [ ! -z "$(ADK_TEST_MUSL_NATIVE)" ];then \
395 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
396 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
397 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
398 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
399 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
400 echo "ADK_PACKAGE_MUSL_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
402 @if [ ! -z "$(ADK_TEST_GLIBC_NATIVE)" ];then \
403 echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
404 echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
405 echo "ADK_PACKAGE_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
406 echo "ADK_PACKAGE_BINUTILS=y" >> $(ADK_TOPDIR)/.defconfig; \
407 echo "ADK_PACKAGE_MAKE=y" >> $(ADK_TOPDIR)/.defconfig; \
408 echo "ADK_PACKAGE_GLIBC_DEV=y" >> $(ADK_TOPDIR)/.defconfig; \
410 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
411 grep "^config" target/config/Config.in.tasks \
412 |grep -i "_$(ADK_APPLIANCE)$$" \
413 |sed -e "s#^config \(.*\)#\1=y#" \
414 >> $(ADK_TOPDIR)/.defconfig; \
416 @if [ ! -z "$(ADK_TARGET_OS)" ];then \
417 grep "^config" target/config/Config.in.os \
418 |grep -i "_$(ADK_TARGET_OS)$$" \
419 |sed -e "s#^config \(.*\)#\1=y#" \
420 >> $(ADK_TOPDIR)/.defconfig; \
422 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
423 grep "^config" target/config/Config.in.arch.choice \
424 |grep -i "_$(ADK_TARGET_ARCH)$$" \
425 |sed -e "s#^config \(.*\)#\1=y#" \
426 >> $(ADK_TOPDIR)/.defconfig; \
428 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
429 grep "^config" target/config/Config.in.rootfs \
430 |grep -i "$(ADK_TARGET_FS)" \
431 |sed -e "s#^config \(.*\)#\1=y#" \
432 >> $(ADK_TOPDIR)/.defconfig; \
434 @if [ ! -z "$(ADK_TARGET_ABI)" ];then \
435 grep "^config" target/config/Config.in.abi \
436 |grep -i "$(ADK_TARGET_ABI)$$" \
437 |sed -e "s#^config \(.*\)#\1=y#" \
438 >> $(ADK_TOPDIR)/.defconfig; \
440 @if [ ! -z "$(ADK_TARGET_FLOAT)" ];then \
441 grep "^config" target/config/Config.in.float \
442 |grep -i "$(ADK_TARGET_FLOAT)_" \
443 |sed -e "s#^config \(.*\)#\1=y#" \
444 >> $(ADK_TOPDIR)/.defconfig; \
446 @if [ ! -z "$(ADK_TARGET_BINFMT)" ];then \
447 grep "^config" target/config/Config.in.binfmt \
448 |grep -i "$(ADK_TARGET_BINFMT)$$" \
449 |sed -e "s#^config \(.*\)#\1=y#" \
450 >> $(ADK_TOPDIR)/.defconfig; \
452 @if [ ! -z "$(ADK_TARGET_INSTRUCTION_SET)" ];then \
453 grep "^config" target/config/Config.in.archopts \
454 |grep -i "$(ADK_TARGET_INSTRUCTION_SET)$$" \
455 |sed -e "s#^config \(.*\)#\1=y#" \
456 >> $(ADK_TOPDIR)/.defconfig; \
458 @if [ ! -z "$(ADK_TARGET_ENDIAN)" ];then \
459 grep "^config" target/config/Config.in.endian \
460 |grep -i "$(ADK_TARGET_ENDIAN)" \
461 |sed -e "s#^config \(.*\)#\1=y#" \
462 >> $(ADK_TOPDIR)/.defconfig; \
464 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
465 libc=$$(echo "$(ADK_TARGET_LIBC)"|sed -e "s/-/_/"); \
466 grep "^config" target/config/Config.in.libc \
467 |grep -i "$$libc$$" \
468 |sed -e "s#^config \(.*\)#\1=y#" \
469 >> $(ADK_TOPDIR)/.defconfig; \
471 @if [ ! -z "$(ADK_TARGET_CPU)" ];then \
472 cpu=$$(echo "$(ADK_TARGET_CPU)" |sed -e "s/-/_/g"); \
473 grep -h "^config" target/config/Config.in.cpu \
474 |grep -i "$$cpu$$" \
475 |sed -e "s#^config \(.*\)#\1=y#" \
476 >> $(ADK_TOPDIR)/.defconfig; \
478 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
479 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
480 grep -h "^config" target/*/Config.in.systems \
481 |grep -i "$$system$$" \
482 |sed -e "s#^config \(.*\)#\1=y#" \
483 >> $(ADK_TOPDIR)/.defconfig; \
485 @if [ ! -z "$(ADK_TARGET_KERNEL_VERSION)" ];then \
486 kernelversion=$$(echo "$(ADK_TARGET_KERNEL_VERSION)"|sed -e "s/\./_/g"); \
487 grep "^config" target/config/Config.in.kernelversion \
488 |grep -i "$$kernelversion$$" \
489 |sed -e "s#^config \(.*\)#\1=y#" \
490 >> $(ADK_TOPDIR)/.defconfig; \
492 @if [ ! -z "$(ADK_TARGET_LIBC_VERSION)" ];then \
493 libcversion=$$(echo "$(ADK_TARGET_LIBC_VERSION)"|sed -e "s/\./_/g"); \
494 if [ "$$libcversion" = "git" ];then \
495 if [ "$(ADK_TARGET_LIBC)" = "glibc" ];then \
496 echo "ADK_TARGET_LIB_GLIBC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
497 fi; \
498 if [ "$(ADK_TARGET_LIBC)" = "uclibc-ng" ];then \
499 echo "ADK_TARGET_LIB_UCLIBC_NG_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
500 fi; \
501 if [ "$(ADK_TARGET_LIBC)" = "musl" ];then \
502 echo "ADK_TARGET_LIB_MUSL_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
503 fi; \
504 else \
505 grep "^config" target/config/Config.in.libc \
506 |grep -i "$$libcversion$$" \
507 |sed -e "s#^config \(.*\)#\1=y#" \
508 >> $(ADK_TOPDIR)/.defconfig; \
509 fi; \
511 @if [ ! -z "$(ADK_TOOLCHAIN_BINUTILS_VERSION)" ];then \
512 binutilsversion=$$(echo "$(ADK_TOOLCHAIN_BINUTILS_VERSION)"|sed -e "s/\./_/g"); \
513 if [ "$$binutilsversion" = "git" ];then \
514 echo "ADK_TOOLCHAIN_BINUTILS_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
515 else \
516 grep "^config" target/config/Config.in.binutils \
517 |grep -i "$$binutilsversion$$" \
518 |sed -e "s#^config \(.*\)#\1=y#" \
519 >> $(ADK_TOPDIR)/.defconfig; \
520 fi; \
522 @if [ ! -z "$(ADK_TOOLCHAIN_GCC_VERSION)" ];then \
523 echo "ADK_BUILD_COMPILER_GCC=y" >> $(ADK_TOPDIR)/.defconfig; \
524 gccversion=$$(echo "$(ADK_TOOLCHAIN_GCC_VERSION)"|sed -e "s/\./_/g"); \
525 if [ "$$gccversion" = "git" ];then \
526 echo "ADK_TOOLCHAIN_GCC_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
527 else \
528 grep "^config" target/config/Config.in.compiler \
529 |grep -i "$$gccversion$$" \
530 |sed -e "s#^config \(.*\)#\1=y#" \
531 >> $(ADK_TOPDIR)/.defconfig; \
532 fi; \
534 @if [ ! -z "$(ADK_TOOLCHAIN_GDB_VERSION)" ];then \
535 gdbversion=$$(echo "$(ADK_TOOLCHAIN_GDB_VERSION)"|sed -e "s/\./_/g"); \
536 if [ "$$gdbversion" = "git" ];then \
537 echo "ADK_TOOLCHAIN_GDB_GIT=y" >> $(ADK_TOPDIR)/.defconfig; \
538 else \
539 grep "^config" target/config/Config.in.gdb \
540 |grep -i "$$gdbversion$$" \
541 |sed -e "s#^config \(.*\)#\1=y#" \
542 >> $(ADK_TOPDIR)/.defconfig; \
543 fi; \
545 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
546 $(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
549 allconfig:
550 @if [ ! -z "$(ADK_APPLIANCE)" ];then \
551 grep "^config" target/config/Config.in.tasks \
552 |grep -i "_$(ADK_APPLIANCE)"\$$ \
553 |sed -e "s#^config \(.*\)#\1=y#" \
554 >> $(ADK_TOPDIR)/all.config; \
556 @if [ ! -z "$(ADK_TARGET_ARCH)" ];then \
557 grep "^config" target/config/Config.in.arch.choice \
558 |grep -i "$(ADK_TARGET_ARCH)"\$$ \
559 |sed -e "s#^config \(.*\)#\1=y#" \
560 >> $(ADK_TOPDIR)/all.config; \
562 @for symbol in ${DEFCONFIG}; do \
563 echo $$symbol >> $(ADK_TOPDIR)/all.config; \
564 done
565 @if [ ! -z "$(ADK_TARGET_FS)" ];then \
566 grep "^config" target/config/Config.in.rootfs \
567 |grep -i "$(ADK_TARGET_FS)" \
568 |sed -e "s#^config \(.*\)#\1=y#" \
569 >> $(ADK_TOPDIR)/all.config; \
571 @if [ ! -z "$(ADK_TARGET_LIBC)" ];then \
572 grep "^config" target/config/Config.in.libc \
573 |grep -i "$(ADK_TARGET_LIBC)" \
574 |sed -e "s#^config \(.*\)#\1=y#" \
575 >> $(ADK_TOPDIR)/all.config; \
577 @if [ ! -z "$(ADK_TARGET_SYSTEM)" ];then \
578 system=$$(echo "$(ADK_TARGET_SYSTEM)" |sed -e "s/-/_/g"); \
579 grep -h "^config" target/*/Config.in.systems \
580 |grep -i "$$system$$" \
581 |sed -e "s#^config \(.*\)#\1=y#" \
582 >> $(ADK_TOPDIR)/all.config; \
585 menuconfig: $(CONFIG)/mconf defconfig .menu
586 @if [ ! -f .config ];then \
587 $(CONFIG)/conf --olddefconfig $(CONFIG_CONFIG_IN); \
589 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
590 ${POSTCONFIG}
592 _config: $(CONFIG)/conf allconfig .menu
593 -@touch .config
594 @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN)
595 ${POSTCONFIG}
597 distclean cleandir:
598 @printf " ---> cleaning build directories, files and downloads.. "
599 @$(MAKE) -C $(CONFIG) clean
600 @rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
601 @rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
602 @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
603 @rm -rf package/pkglist.d package/pkgconfigs.d
604 @rm -f .config* .defconfig .tmpconfig.h all.config make.log
605 @rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
606 @rm -f target/*/Config.in.arch target/*/Config.in.systems
607 @rm -f target/config/Config.in.arch.choice target/config/Config.in.arch.default
608 @rm -f target/config/Config.in.system.choice target/config/Config.in.system.default
609 @rm -f package/Config.in.auto* target/config/Config.in.system target/config/Config.in.tasks
610 @rm -f target/config/Config.in.prereq target/config/Config.in.scripts
611 @rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
612 @printf "done\n"
614 endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
616 $(ADK_TOPDIR)/adk/tools/pkgmaker: $(ADK_TOPDIR)/adk/tools/pkgmaker.c $(ADK_TOPDIR)/adk/tools/sortfile.c $(ADK_TOPDIR)/adk/tools/strmap.c
617 @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgmaker.c adk/tools/sortfile.c adk/tools/strmap.c
619 $(ADK_TOPDIR)/adk/tools/pkgrebuild: $(ADK_TOPDIR)/adk/tools/pkgrebuild.c $(ADK_TOPDIR)/adk/tools/strmap.c
620 @$(HOST_CC) $(HOST_CFLAGS) -o $@ adk/tools/pkgrebuild.c adk/tools/strmap.c
622 $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
623 @$(HOST_CC) $(HOST_CFLAGS) -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
625 menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard tasks/*)
626 @printf " ---> generating menu structure.. "
627 @$(SHELL) $(ADK_TOPDIR)/scripts/create-menu
628 @$(ADK_TOPDIR)/adk/tools/pkgmaker
629 @:>.menu
630 @printf "done\n"
632 dep: $(ADK_TOPDIR)/adk/tools/depmaker
633 @printf " ---> generating dependencies.. "
634 @$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
635 @printf "done\n"
637 .PHONY: menu dep
639 include $(ADK_TOPDIR)/toolchain/gcc/Makefile.inc
641 check-dejagnu:
642 @-rm adk/tests/adk.exp adk/tests/master.exp >/dev/null 2>&1
643 @sed -e "s#@ADK_TARGET_IP@#$(ADK_TARGET_IP)#" \
644 -e "s#@ADK_TARGET_PORT@#$(ADK_TARGET_PORT)#" \
645 adk/tests/adk.exp.in > adk/tests/adk.exp
646 @sed -e "s#@ADK_TOPDIR@#$(ADK_TOPDIR)#" adk/tests/master.exp.in > \
647 adk/tests/master.exp
649 check-gcc: check-dejagnu
650 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
651 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c
653 check-g++: check-dejagnu
654 env DEJAGNU=$(ADK_TOPDIR)/adk/tests/master.exp \
655 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)-final/gcc -k check-c++
657 check: check-gcc check-g++
659 info:
660 @printf -- "---OPENADK-INFO---\n"
661 @printf "ADK_TOPDIR=$(ADK_TOPDIR)\n"
662 @printf "TARGET_COMPILER_PREFIX=${TARGET_COMPILER_PREFIX}\n"
663 @printf "TOOLCHAIN_DIR=$(TOOLCHAIN_DIR)\n"
664 @printf "TARGET_PATH=$(TARGET_PATH)\n"
665 @printf "LINUX_DIR=$(LINUX_DIR)\n"
666 @printf -- "---OPENADK-INFO---\n"