linux: update kernels to latest LTS
[openadk.git] / mk / vars.mk
blob672f03d9f751cfc967606da49352481f5a52f9f6
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 CP= cp -fpR
5 INSTALL_DIR= install -d -m0755
6 INSTALL_DATA= install -m0644
7 INSTALL_BIN= install -m0755
8 INSTALL_SCRIPT= install -m0755
9 MAKEFLAGS= $(EXTRA_MAKEFLAGS)
10 BUILD_USER= $(shell id -un)
11 BUILD_GROUP= $(shell id -gn)
12 ADK_SUFFIX:= ${ADK_TARGET_SYSTEM}
13 ifneq ($(ADK_TARGET_LIBC),)
14 ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_LIBC)
15 endif
16 ifneq ($(ADK_TARGET_CPU_TYPE),)
17 ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_CPU_TYPE)
18 endif
19 ifneq ($(ADK_TARGET_ENDIAN_SUFFIX),)
20 ADK_SUFFIX:= $(ADK_SUFFIX)$(ADK_TARGET_ENDIAN_SUFFIX)
21 endif
22 ifneq ($(ADK_TARGET_FLOAT),)
23 ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_FLOAT)
24 endif
25 ifneq ($(ADK_TARGET_ABI),)
26 ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_ABI)
27 endif
28 ifneq ($(ADK_TARGET_BINFMT),)
29 ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_BINFMT)
30 endif
31 ifneq ($(ADK_TARGET_INSTRUCTION_SET),)
32 ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_INSTRUCTION_SET)
33 endif
34 ifeq ($(ADK_TARGET_WITH_MMU),)
35 ADK_SUFFIX:= $(ADK_SUFFIX)_nommu
36 endif
38 # some global dirs
39 BASE_DIR:= $(ADK_TOPDIR)
40 ifeq ($(ADK_DL_DIR),)
41 DL_DIR?= $(BASE_DIR)/dl
42 else
43 DL_DIR?= $(ADK_DL_DIR)
44 endif
45 SCRIPT_DIR:= $(BASE_DIR)/scripts
46 STAGING_HOST_DIR:= ${BASE_DIR}/host_${GNU_HOST_NAME}
47 HOST_BUILD_DIR:= ${BASE_DIR}/host_build_${GNU_HOST_NAME}
48 TOOLCHAIN_DIR:= ${BASE_DIR}/toolchain_${ADK_SUFFIX}
50 # dirs for cleandir
51 FW_DIR_PFX:= $(BASE_DIR)/firmware
52 BUILD_DIR_PFX:= $(BASE_DIR)/build_*
53 STAGING_PKG_DIR_PFX:= ${BASE_DIR}/pkg_*
54 STAGING_TARGET_DIR_PFX:=${BASE_DIR}/target_*
55 TOOLCHAIN_DIR_PFX= $(BASE_DIR)/toolchain_*
56 STAGING_HOST_DIR_PFX:= ${BASE_DIR}/host_*
57 TARGET_DIR_PFX:= $(BASE_DIR)/root_*
59 TARGET_DIR:= $(BASE_DIR)/root_${ADK_SUFFIX}
60 FW_DIR:= $(BASE_DIR)/firmware/${ADK_SUFFIX}
61 BUILD_DIR:= ${BASE_DIR}/build_${ADK_SUFFIX}
62 STAGING_TARGET_DIR:= ${BASE_DIR}/target_${ADK_SUFFIX}
63 STAGING_PKG_DIR:= ${BASE_DIR}/pkg_${ADK_SUFFIX}
64 STAGING_HOST2TARGET:= ../../target_${ADK_SUFFIX}
65 TOOLCHAIN_BUILD_DIR= $(BASE_DIR)/toolchain_build_${ADK_SUFFIX}
66 PACKAGE_DIR:= $(FW_DIR)/packages
67 SCRIPT_TARGET_DIR:= ${STAGING_TARGET_DIR}/scripts
69 # PATH variables
70 TARGET_PATH= ${SCRIPT_DIR}:${STAGING_TARGET_DIR}/scripts:${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH}
71 HOST_PATH= ${SCRIPT_DIR}:${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/sbin:${_PATH}
72 AUTOTOOL_PATH= ${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_TARGET_DIR}/scripts:${_PATH}
74 ifeq ($(ADK_TARGET_UCLINUX),y)
75 ADK_TARGET_LINUXTYPE:= uclinux
76 else
77 ADK_TARGET_LINUXTYPE:= linux
78 endif
80 GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_LINUXTYPE)-$(ADK_TARGET_SUFFIX)
81 ifeq ($(ADK_TARGET_ARCH_C6X),y)
82 GNU_TARGET_NAME:= ti$(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_LINUXTYPE)
83 endif
84 ifeq ($(ADK_TARGET_ARCH_ARM)$(ADK_TARGET_BINFMT_FDPIC),yy)
85 GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_SUFFIX)
86 endif
87 ifeq ($(ADK_TARGET_OS_BAREMETAL),y)
88 GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_SUFFIX)
89 endif
91 TARGET_CROSS:= $(TOOLCHAIN_DIR)/usr/bin/$(GNU_TARGET_NAME)-
92 TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
93 CONFIGURE_TRIPLE:= --build=${GNU_HOST_NAME} \
94 --host=${GNU_TARGET_NAME} \
95 --target=${GNU_TARGET_NAME}
97 # target tools
98 ifeq ($(ADK_BUILD_COMPILER_GCC),y)
99 TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
100 TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
101 TARGET_CC_NO_CCACHE:= ${TARGET_CC}
102 TARGET_CXX_NO_CCACHE:= ${TARGET_CXX}
103 endif
104 ifeq ($(ADK_BUILD_COMPILER_LLVM),y)
105 TARGET_CC:= clang --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
106 TARGET_CXX:= clang++ --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
107 TARGET_LDFLAGS:= -fuse-ld=lld -stdlib=libc++
108 endif
110 # gcc specific
111 ifeq ($(ADK_BUILD_COMPILER_GCC),y)
112 ifneq ($(strip ${ADK_USE_CCACHE}),)
113 TARGET_CC:= $(STAGING_HOST_DIR)/usr/bin/ccache ${TARGET_CC_NO_CCACHE}
114 TARGET_CXX:= $(STAGING_HOST_DIR)/usr/bin/ccache ${TARGET_CXX_NO_CCACHE}
115 endif
117 # for x86_64 x32 ABI we need to extend TARGET_CC/TARGET_CXX
118 ifeq ($(ADK_TARGET_ABI_X32),y)
119 TARGET_CC+= $(ADK_TARGET_ABI_CFLAGS)
120 TARGET_CXX+= $(ADK_TARGET_ABI_CFLAGS)
121 endif
123 TARGET_LD:= ${TARGET_COMPILER_PREFIX}ld
124 ifneq ($(ADK_TARGET_USE_LTO),)
125 TARGET_AR:= ${TARGET_COMPILER_PREFIX}gcc-ar
126 TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}gcc-ranlib
127 else
128 TARGET_AR:= ${TARGET_COMPILER_PREFIX}ar
129 TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}ranlib
130 endif
132 TARGET_CPPFLAGS:=
133 TARGET_CFLAGS:= -fwrapv -fno-ident
134 TARGET_CXXFLAGS:= -fwrapv -fno-ident
135 TARGET_LDFLAGS:= -L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
136 -Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
137 -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
139 # for architectures where gcc --with-cpu matches -mcpu=
140 ifneq ($(ADK_TARGET_GCC_CPU),)
141 TARGET_CFLAGS+= -mcpu=$(ADK_TARGET_GCC_CPU)
142 TARGET_CXXFLAGS+= -mcpu=$(ADK_TARGET_GCC_CPU)
143 endif
145 # for architectures where gcc --with-arch matches -march=
146 ifneq ($(ADK_TARGET_GCC_ARCH),)
147 TARGET_CFLAGS+= -march=$(ADK_TARGET_GCC_ARCH)
148 TARGET_CXXFLAGS+= -march=$(ADK_TARGET_GCC_ARCH)
149 endif
151 ifneq ($(ADK_TARGET_CPU_FLAGS),)
152 TARGET_CFLAGS+= $(ADK_TARGET_CPU_FLAGS)
153 TARGET_CXXFLAGS+= $(ADK_TARGET_CPU_FLAGS)
154 TARGET_LDFLAGS+= $(ADK_TARGET_CPU_FLAGS)
155 endif
157 ifneq ($(ADK_TARGET_FPU),)
158 TARGET_CFLAGS+= -mfpu=$(ADK_TARGET_FPU)
159 TARGET_CXXFLAGS+= -mfpu=$(ADK_TARGET_FPU)
160 endif
162 ifneq ($(ADK_TARGET_FLOAT),)
163 ifeq ($(ADK_TARGET_ARCH_ARM),y)
164 TARGET_CFLAGS+= -mfloat-abi=$(ADK_TARGET_FLOAT)
165 TARGET_CXXFLAGS+= -mfloat-abi=$(ADK_TARGET_FLOAT)
166 endif
167 ifeq ($(ADK_TARGET_ARCH_MIPS),y)
168 TARGET_CFLAGS+= -m$(ADK_TARGET_FLOAT)-float
169 TARGET_CXXFLAGS+= -m$(ADK_TARGET_FLOAT)-float
170 endif
171 endif
173 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
174 TARGET_LDFLAGS+= -Wl,-elf2flt=-r
175 TARGET_CFLAGS+= -Wl,-elf2flt=-r
176 TARGET_CXXFLAGS+= -Wl,-elf2flt=-r
177 endif
179 ifeq ($(ADK_TARGET_BINFMT_FLAT_SEP_DATA),y)
180 TARGET_CFLAGS+= -msep-data
181 TARGET_CXXFLAGS+= -msep-data
182 endif
184 ifeq ($(ADK_TARGET_BINFMT_FLAT_SHARED),y)
185 TARGET_LDFLAGS+= -mid-shared-library
186 endif
188 ifeq ($(ADK_TARGET_BINFMT_DSBT),y)
189 TARGET_CFLAGS+= -mdsbt
190 TARGET_CXXFLAGS+= -mdsbt
191 endif
193 # security optimization, see http://www.akkadia.org/drepper/dsohowto.pdf
194 ifneq ($(ADK_TARGET_USE_LD_RELRO),)
195 TARGET_LDFLAGS+= -Wl,-z,relro
196 endif
197 ifneq ($(ADK_TARGET_USE_LD_BIND_NOW),)
198 TARGET_LDFLAGS+= -Wl,-z,now
199 endif
201 ifeq ($(ADK_TARGET_ARCH_RISCV64)$(ADK_TARGET_ARCH_RISCV32),y)
202 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
203 TARGET_CFLAGS+= -fPIC
204 TARGET_CXXFLAGS+= -fPIC
205 endif
206 endif
208 # needed for musl ppc
209 ifeq ($(ADK_TARGET_ARCH_PPC),y)
210 ifeq ($(ADK_TARGET_LIB_MUSL),y)
211 TARGET_LDFLAGS+= -Wl,--secure-plt
212 endif
213 endif
215 ifneq ($(ADK_TARGET_BINFMT_ELF)$(ADK_TARGET_WITH_MMU),y)
216 ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY)$(ADK_TARGET_USE_STATIC_AND_SHARED_LIBS),y)
217 TARGET_CFLAGS+= -static
218 TARGET_CXXFLAGS+= -static
219 TARGET_LDFLAGS+= -static
220 endif
221 else
222 TARGET_CFLAGS+= -fpie
223 TARGET_CXXFLAGS+= -fpie
224 TARGET_LDFLAGS+= -fpie -pie
225 endif
227 ifneq ($(ADK_TARGET_USE_SSP),)
228 TARGET_CFLAGS+= -fstack-protector-all --param=ssp-buffer-size=4
229 TARGET_CXXFLAGS+= -fstack-protector-all --param=ssp-buffer-size=4
230 TARGET_LDFLAGS+= -fstack-protector-all
231 endif
233 ifneq ($(ADK_TARGET_USE_LD_GC),)
234 TARGET_CFLAGS+= -fdata-sections -ffunction-sections
235 TARGET_CXXFLAGS+= -fdata-sections -ffunction-sections
236 TARGET_LDFLAGS+= -Wl,--gc-sections
237 endif
239 ifneq ($(ADK_TARGET_USE_LTO),)
240 TARGET_CFLAGS+= -flto
241 TARGET_CXXFLAGS+= -flto
242 TARGET_LDFLAGS+= -flto
243 endif
245 # performance optimization, see http://www.akkadia.org/drepper/dsohowto.pdf
246 ifneq ($(ADK_TARGET_USE_GNU_HASHSTYLE),)
247 TARGET_LDFLAGS+= -Wl,--hash-style=gnu
248 endif
250 # special architecture optimization flags
251 ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
252 ifeq ($(ADK_TARGET_LIB_NEWLIB),)
253 TARGET_CFLAGS+= -mlongcalls -mauto-litpools
254 TARGET_CXXFLAGS+= -mlongcalls -mauto-litpools
255 endif
256 endif
257 ifeq ($(ADK_TARGET_ARCH_MICROBLAZE),y)
258 TARGET_CFLAGS+= -mxl-barrel-shift -fno-tree-loop-distribute-patterns
259 TARGET_CXXFLAGS+= -mxl-barrel-shift -fno-tree-loop-distribute-patterns
260 endif
262 endif
263 # end gcc specific
265 # add configured compiler flags for optimization
266 TARGET_CFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
267 TARGET_CXXFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
269 # add compiler flags for debug information
270 ifneq ($(ADK_DEBUG),)
271 TARGET_CFLAGS+= -g3
272 TARGET_CXXFLAGS+= -g3
273 endif
275 ifneq ($(ADK_DEBUG),)
276 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),)
277 TARGET_CFLAGS+= -fno-omit-frame-pointer
278 TARGET_CXXFLAGS+= -fno-omit-frame-pointer
279 endif
280 TARGET_CFLAGS+= -funwind-tables -fasynchronous-unwind-tables
281 TARGET_CXXFLAGS+= -funwind-tables -fasynchronous-unwind-tables
282 else
283 TARGET_CPPFLAGS+= -DNDEBUG
284 TARGET_CFLAGS+= -fomit-frame-pointer
285 TARGET_CXXFLAGS+= -fomit-frame-pointer
286 endif
288 # stop generating eh_frame stuff, do not use it for C++
289 ifeq ($(ADK_TARGET_CFLAGS_DISABLE_EH),y)
290 TARGET_CFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables
291 TARGET_CXXFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables
292 endif
294 # workaround gcc bug for m68k/coldfire
295 ifeq ($(ADK_TARGET_CPU_CF),y)
296 TARGET_CFLAGS+= -fno-dwarf2-cfi-asm -mxgot
297 TARGET_CXXFLAGS+= -fno-dwarf2-cfi-asm -mxgot
298 endif
300 ifeq ($(ADK_TARGET_ARCH_ARM),y)
301 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_NEON),y)
302 TARGET_CFLAGS+= -ffast-math -funsafe-math-optimizations
303 TARGET_CXXFLAGS+= -ffast-math -funsafe-math-optimizations
304 endif
305 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),y)
306 TARGET_CFLAGS+= -mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork
307 TARGET_CXXFLAGS+= -mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork
308 else
309 TARGET_CFLAGS+= -marm
310 TARGET_CXXFLAGS+= -marm
311 endif
312 endif
314 ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
315 TARGET_CFLAGS+= -mfdpic
316 TARGET_CXXFLAGS+= -mfdpic
317 TARGET_LDFLAGS+= -mfdpic
318 endif
320 # host compiler and linker flags
321 HOST_CPPFLAGS:= -I$(STAGING_HOST_DIR)/usr/include
322 ifeq ($(OS_FOR_BUILD),Darwin)
323 HOST_LDFLAGS:= -L$(STAGING_HOST_DIR)/usr/lib
324 else
325 HOST_LDFLAGS:= -L$(STAGING_HOST_DIR)/usr/lib -Wl,-rpath -Wl,${STAGING_HOST_DIR}/usr/lib
326 endif
328 ifneq (${ADK_UPDATE_PATCHES_GIT},)
329 PATCH= PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/patch_git.sh
330 else
331 PATCH= PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/patch.sh
332 endif
333 PATCHP0= PATH='${HOST_PATH}' patch -p0
335 ifeq ($(ADK_STATIC_TOOLCHAIN),y)
336 HOST_STATIC_CFLAGS:= -static -Wl,-static
337 HOST_STATIC_CXXFLAGS:= -static -Wl,-static
338 HOST_STATIC_LDFLAGS:= -Wl,-static
339 endif
341 SED:= PATH='${HOST_PATH}' sed -i -e
342 CPIO:= PATH='${HOST_PATH}' cpio
343 LINUX_DIR:= $(BUILD_DIR)/$(ADK_TARGET_OS)
344 KERNEL_MODULE_FLAGS:= ARCH=${ADK_TARGET_KARCH} \
345 PREFIX=/usr \
346 KERNEL_PATH=${LINUX_DIR} \
347 KERNELDIR=${LINUX_DIR} \
348 CROSS_COMPILE="${TARGET_CROSS}" \
351 COMMON_ENV= CONFIG_SHELL='$(strip ${SHELL})' \
352 AUTOM4TE='${STAGING_HOST_DIR}/usr/bin/autom4te' \
353 M4='${STAGING_HOST_DIR}/usr/bin/m4' \
354 LIBTOOLIZE='${STAGING_HOST_DIR}/usr/bin/libtoolize'
356 ifneq ($(ADK_TARGET_USE_LTO),)
357 TOOLS_ENV= AR='$(TARGET_CROSS)gcc-ar' \
358 RANLIB='$(TARGET_CROSS)gcc-ranlib' \
359 NM='$(TARGET_CROSS)gcc-nm'
360 else
361 TOOLS_ENV= AR='$(TARGET_CROSS)ar' \
362 RANLIB='$(TARGET_CROSS)ranlib' \
363 NM='$(TARGET_CROSS)nm'
364 endif
366 TARGET_ENV= $(TOOLS_ENV) \
367 AS='$(TARGET_CROSS)as' \
368 LD='$(TARGET_CROSS)ld' \
369 STRIP='$(TARGET_CROSS)strip' \
370 OBJCOPY='$(TARGET_CROSS)objcopy' \
371 CC='$(TARGET_CC)' \
372 GCC='$(TARGET_CC)' \
373 CXX='$(TARGET_CXX)' \
374 CROSS='$(TARGET_CROSS)' \
375 CROSS_COMPILE='$(TARGET_CROSS)' \
376 CFLAGS='$(TARGET_CFLAGS)' \
377 CXXFLAGS='$(TARGET_CXXFLAGS)' \
378 CPPFLAGS='$(TARGET_CPPFLAGS)' \
379 LDFLAGS='$(TARGET_LDFLAGS)' \
380 CC_FOR_BUILD='$(HOST_CC)' \
381 CXX_FOR_BUILD='$(HOST_CXX)' \
382 CPPFLAGS_FOR_BUILD='$(HOST_CPPFLAGS)' \
383 CFLAGS_FOR_BUILD='$(HOST_CFLAGS)' \
384 CXXFLAGS_FOR_BUILD='$(HOST_CXXFLAGS)' \
385 LDFLAGS_FOR_BUILD='$(HOST_LDFLAGS)' \
386 LIBS_FOR_BUILD='$(HOST_LIBS)'
388 HOST_ENV= CC='$(HOST_CC)' \
389 CXX='$(HOST_CXX)' \
390 CPPFLAGS='$(HOST_CPPFLAGS)' \
391 CFLAGS='$(HOST_CFLAGS)' \
392 CXXFLAGS='$(HOST_CXXFLAGS)' \
393 LDFLAGS='$(HOST_LDFLAGS)' \
394 CC_FOR_BUILD='$(HOST_CC)' \
395 CFLAGS_FOR_BUILD='$(HOST_CFLAGS)'
397 PKG_SUFFIX:= $(strip $(subst ",, $(ADK_PACKAGE_SUFFIX)))
399 ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
400 PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/ipkg-build
401 PKG_INSTALL:= PATH='${HOST_PATH}' \
402 IPKG_TMP=$(BUILD_DIR)/tmp \
403 IPKG_INSTROOT=$(TARGET_DIR) \
404 IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
405 IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
406 BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
407 ${BASH} ${SCRIPT_DIR}/ipkg \
408 -force-defaults -force-depends install
409 PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/ipkg
410 endif
412 ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
413 PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/ipkg-build
414 PKG_INSTALL:= PATH='${HOST_PATH}' \
415 IPKG_TMP=$(BUILD_DIR)/tmp \
416 IPKG_INSTROOT=$(TARGET_DIR) \
417 IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
418 IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
419 BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
420 ${BASH} ${SCRIPT_DIR}/ipkg \
421 -force-defaults -force-depends install
422 PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/opkg
423 endif
425 ifeq ($(ADK_TARGET_PACKAGE_TGZ),y)
426 PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/tarpkg build
427 PKG_INSTALL:= PKG_INSTROOT='$(TARGET_DIR)' \
428 PATH='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/tarpkg install
429 PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/pkg
430 endif
432 RSTRIP:= PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh
434 STATCMD:=$(shell if stat -qs .>/dev/null 2>&1; then echo 'stat -f %z';else echo 'stat -c %s';fi)
436 EXTRACT_CMD= PATH='${HOST_PATH}'; mkdir -p ${WRKDIR}; \
437 cd ${WRKDIR} && \
438 for file in ${FULLDISTFILES}; do case $$file in \
439 *.cpio) \
440 cat $$file | cpio -i -d ;; \
441 *.tar) \
442 PATH='$(HOST_PATH)' tar -xf $$file ;; \
443 *.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \
444 gzip -dc $$file | cpio -i -d ;; \
445 *.tar.xz | *.txz) \
446 xz -dc $$file | PATH='$(HOST_PATH)' tar -xf - ;; \
447 *.tar.Z | *.tar.gz | *.taz | *.tgz) \
448 gzip -dc $$file | PATH='$(HOST_PATH)' tar -xf - ;; \
449 *.cpio.bz2 | *.cbz) \
450 bzip2 -dc $$file | cpio -i -d ;; \
451 *.tar.bz2 | *.tbz | *.tbz2) \
452 bzip2 -dc $$file | PATH='$(HOST_PATH)' tar -xf - ;; \
453 *.tar.lz | *.tlz) \
454 lzip -dc $$file | PATH='$(HOST_PATH)' tar -xf - ;; \
455 *.zip) \
456 unzip -d ${WRKDIR} $$file ;; \
457 *.arm|*.jar|*.ids.gz) \
458 mkdir ${WRKBUILD}; cp $$file ${WRKBUILD} ;; \
459 *.bin) \
460 sh $$file --force --auto-accept ;; \
461 *) \
462 echo "Cannot extract '$$file'" >&2; \
463 false ;; \
464 esac; done
466 ifneq (,$(filter CYGWIN%,${OS_FOR_BUILD}))
467 EXEEXT:= .exe
468 endif
470 include $(ADK_TOPDIR)/mk/mirrors.mk