vars.mk 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. CP= cp -fpR
  4. INSTALL_DIR= install -d -m0755
  5. INSTALL_DATA= install -m0644
  6. INSTALL_BIN= install -m0755
  7. INSTALL_SCRIPT= install -m0755
  8. MAKEFLAGS= $(EXTRA_MAKEFLAGS)
  9. BUILD_USER= $(shell id -un)
  10. BUILD_GROUP= $(shell id -gn)
  11. ADK_SUFFIX:= ${ADK_TARGET_SYSTEM}
  12. ifneq ($(ADK_TARGET_LIBC),)
  13. ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_LIBC)
  14. endif
  15. ifneq ($(ADK_TARGET_CPU_TYPE),)
  16. ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_CPU_TYPE)
  17. endif
  18. ifneq ($(ADK_TARGET_ENDIAN_SUFFIX),)
  19. ADK_SUFFIX:= $(ADK_SUFFIX)$(ADK_TARGET_ENDIAN_SUFFIX)
  20. endif
  21. ifneq ($(ADK_TARGET_FLOAT),)
  22. ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_FLOAT)
  23. endif
  24. ifneq ($(ADK_TARGET_ABI),)
  25. ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_ABI)
  26. endif
  27. ifneq ($(ADK_TARGET_BINFMT),)
  28. ADK_SUFFIX:= $(ADK_SUFFIX)_$(ADK_TARGET_BINFMT)
  29. endif
  30. # some global dirs
  31. BASE_DIR:= $(ADK_TOPDIR)
  32. ifeq ($(ADK_DL_DIR),)
  33. DL_DIR?= $(BASE_DIR)/dl
  34. else
  35. DL_DIR?= $(ADK_DL_DIR)
  36. endif
  37. SCRIPT_DIR:= $(BASE_DIR)/scripts
  38. STAGING_HOST_DIR:= ${BASE_DIR}/host_${GNU_HOST_NAME}
  39. HOST_BUILD_DIR:= ${BASE_DIR}/host_build_${GNU_HOST_NAME}
  40. TOOLCHAIN_DIR:= ${BASE_DIR}/toolchain_${ADK_SUFFIX}
  41. # dirs for cleandir
  42. FW_DIR_PFX:= $(BASE_DIR)/firmware
  43. BUILD_DIR_PFX:= $(BASE_DIR)/build_*
  44. STAGING_PKG_DIR_PFX:= ${BASE_DIR}/pkg_*
  45. STAGING_TARGET_DIR_PFX:=${BASE_DIR}/target_*
  46. TOOLCHAIN_DIR_PFX= $(BASE_DIR)/toolchain_*
  47. STAGING_HOST_DIR_PFX:= ${BASE_DIR}/host_*
  48. TARGET_DIR_PFX:= $(BASE_DIR)/root_*
  49. TARGET_DIR:= $(BASE_DIR)/root_${ADK_SUFFIX}
  50. FW_DIR:= $(BASE_DIR)/firmware/${ADK_SUFFIX}
  51. BUILD_DIR:= ${BASE_DIR}/build_${ADK_SUFFIX}
  52. STAGING_TARGET_DIR:= ${BASE_DIR}/target_${ADK_SUFFIX}
  53. STAGING_PKG_DIR:= ${BASE_DIR}/pkg_${ADK_SUFFIX}
  54. STAGING_HOST2TARGET:= ../../target_${ADK_SUFFIX}
  55. TOOLCHAIN_BUILD_DIR= $(BASE_DIR)/toolchain_build_${ADK_SUFFIX}
  56. PACKAGE_DIR:= $(FW_DIR)/packages
  57. SCRIPT_TARGET_DIR:= ${STAGING_TARGET_DIR}/scripts
  58. # PATH variables
  59. TARGET_PATH= ${SCRIPT_DIR}:${STAGING_TARGET_DIR}/scripts:${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH}
  60. HOST_PATH= ${SCRIPT_DIR}:${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/sbin:${_PATH}
  61. AUTOTOOL_PATH= ${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_TARGET_DIR}/scripts:${_PATH}
  62. ifeq ($(ADK_DISABLE_HONOUR_CFLAGS),)
  63. GCC_CHECK:= GCC_HONOUR_COPTS=2
  64. else
  65. GCC_CHECK:=
  66. endif
  67. ifeq ($(ADK_TARGET_UCLINUX),y)
  68. ADK_TARGET_LINUXTYPE:= uclinux
  69. else
  70. ADK_TARGET_LINUXTYPE:= linux
  71. endif
  72. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_LINUXTYPE)-$(ADK_TARGET_SUFFIX)
  73. ifeq ($(ADK_TARGET_ARCH_C6X),y)
  74. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_LINUXTYPE)
  75. endif
  76. ifeq ($(ADK_TARGET_LIB_NEWLIB),y)
  77. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_SUFFIX)
  78. endif
  79. TARGET_CROSS:= $(TOOLCHAIN_DIR)/usr/bin/$(GNU_TARGET_NAME)-
  80. TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
  81. CONFIGURE_TRIPLE:= --build=${GNU_HOST_NAME} \
  82. --host=${GNU_TARGET_NAME} \
  83. --target=${GNU_TARGET_NAME}
  84. ifneq ($(strip ${ADK_USE_CCACHE}),)
  85. TARGET_COMPILER_PREFIX=$(STAGING_HOST_DIR)/usr/bin/ccache ${TARGET_CROSS}
  86. endif
  87. # target tools
  88. ifeq ($(ADK_BUILD_COMPILER_GCC),y)
  89. TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
  90. TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
  91. endif
  92. ifeq ($(ADK_BUILD_COMPILER_LLVM),y)
  93. TARGET_CC:= clang --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
  94. TARGET_CXX:= clang++ --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
  95. endif
  96. # for x86_64 x32 ABI we need to extend TARGET_CC/TARGET_CXX
  97. ifeq ($(ADK_TARGET_ABI_X32),y)
  98. TARGET_CC+= $(ADK_TARGET_ABI_CFLAGS)
  99. TARGET_CXX+= $(ADK_TARGET_ABI_CFLAGS)
  100. endif
  101. TARGET_LD:= ${TARGET_COMPILER_PREFIX}ld
  102. ifneq ($(ADK_TARGET_USE_LTO),)
  103. TARGET_AR:= ${TARGET_COMPILER_PREFIX}gcc-ar
  104. TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}gcc-ranlib
  105. else
  106. TARGET_AR:= ${TARGET_COMPILER_PREFIX}ar
  107. TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}ranlib
  108. endif
  109. TARGET_CPPFLAGS:=
  110. TARGET_CFLAGS:= -fwrapv -fno-ident
  111. TARGET_CXXFLAGS:= -fwrapv -fno-ident
  112. TARGET_LDFLAGS:= -L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
  113. -Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
  114. -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
  115. ifeq ($(ADK_BUILD_COMPILER_GCC),y)
  116. ifeq ($(ADK_DISABLE_HONOUR_CFLAGS),)
  117. TARGET_CFLAGS+= -fhonour-copts
  118. TARGET_CXXFLAGS+= -fhonour-copts
  119. endif
  120. endif
  121. # for architectures where gcc --with-cpu matches -mcpu=
  122. ifneq ($(ADK_TARGET_GCC_CPU),)
  123. TARGET_CFLAGS+= -mcpu=$(ADK_TARGET_GCC_CPU)
  124. TARGET_CXXFLAGS+= -mcpu=$(ADK_TARGET_GCC_CPU)
  125. endif
  126. # for archiectures where gcc --with-arch matches -march=
  127. ifneq ($(ADK_TARGET_GCC_ARCH),)
  128. TARGET_CFLAGS+= -march=$(ADK_TARGET_GCC_ARCH)
  129. TARGET_CXXFLAGS+= -march=$(ADK_TARGET_GCC_ARCH)
  130. endif
  131. ifneq ($(ADK_TARGET_CPU_FLAGS),)
  132. TARGET_CFLAGS+= $(ADK_TARGET_CPU_FLAGS)
  133. TARGET_CXXFLAGS+= $(ADK_TARGET_CPU_FLAGS)
  134. endif
  135. ifneq ($(ADK_TARGET_FPU),)
  136. TARGET_CFLAGS+= -mfpu=$(ADK_TARGET_FPU)
  137. TARGET_CXXFLAGS+= -mfpu=$(ADK_TARGET_FPU)
  138. endif
  139. ifneq ($(ADK_TARGET_FLOAT),)
  140. ifeq ($(ADK_TARGET_ARCH_ARM),y)
  141. TARGET_CFLAGS+= -mfloat-abi=$(ADK_TARGET_FLOAT)
  142. TARGET_CXXFLAGS+= -mfloat-abi=$(ADK_TARGET_FLOAT)
  143. endif
  144. ifeq ($(ADK_TARGET_ARCH_MIPS),y)
  145. TARGET_CFLAGS+= -m$(ADK_TARGET_FLOAT)-float
  146. TARGET_CXXFLAGS+= -m$(ADK_TARGET_FLOAT)-float
  147. endif
  148. endif
  149. ifeq ($(ADK_TARGET_ARCH_H8300),y)
  150. TARGET_CFLAGS+= -mh
  151. TARGET_LDFLAGS+= -mh
  152. endif
  153. ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
  154. TARGET_LDFLAGS+= -Wl,-elf2flt
  155. TARGET_CFLAGS+= -Wl,-elf2flt
  156. TARGET_CXXFLAGS+= -Wl,-elf2flt
  157. endif
  158. ifeq ($(ADK_TARGET_BINFMT_FLAT_SEP_DATA),y)
  159. TARGET_CFLAGS+= -msep-data
  160. TARGET_CXXFLAGS+= -msep-data
  161. endif
  162. ifeq ($(ADK_TARGET_BINFMT_FLAT_SHARED),y)
  163. TARGET_LDFLAGS+= -mid-shared-library
  164. endif
  165. # security optimization, see http://www.akkadia.org/drepper/dsohowto.pdf
  166. ifneq ($(ADK_TARGET_USE_LD_RELRO),)
  167. TARGET_LDFLAGS+= -Wl,-z,relro
  168. endif
  169. ifneq ($(ADK_TARGET_USE_LD_BIND_NOW),)
  170. TARGET_LDFLAGS+= -Wl,-z,now
  171. endif
  172. # needed for musl ppc
  173. ifeq ($(ADK_TARGET_ARCH_PPC),y)
  174. ifeq ($(ADK_TARGET_LIB_MUSL),y)
  175. TARGET_LDFLAGS+= -Wl,--secure-plt
  176. endif
  177. endif
  178. ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
  179. TARGET_CFLAGS+= -static
  180. TARGET_CXXFLAGS+= -static
  181. TARGET_LDFLAGS+= -static
  182. endif
  183. ifneq ($(ADK_TARGET_USE_SSP),)
  184. TARGET_CFLAGS+= -fstack-protector-all --param=ssp-buffer-size=4
  185. TARGET_CXXFLAGS+= -fstack-protector-all --param=ssp-buffer-size=4
  186. TARGET_LDFLAGS+= -fstack-protector-all
  187. endif
  188. ifneq ($(ADK_TARGET_USE_LD_GC),)
  189. TARGET_CFLAGS+= -fdata-sections -ffunction-sections
  190. TARGET_CXXFLAGS+= -fdata-sections -ffunction-sections
  191. TARGET_LDFLAGS+= -Wl,--gc-sections
  192. endif
  193. ifneq ($(ADK_TARGET_USE_LTO),)
  194. TARGET_CFLAGS+= -flto
  195. TARGET_CXXFLAGS+= -flto
  196. TARGET_LDFLAGS+= -flto
  197. endif
  198. # performance optimization, see http://www.akkadia.org/drepper/dsohowto.pdf
  199. ifneq ($(ADK_TARGET_USE_GNU_HASHSTYLE),)
  200. TARGET_LDFLAGS+= -Wl,--hash-style=gnu
  201. endif
  202. # special architecture optimization flags
  203. ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
  204. ifeq ($(ADK_TARGET_BIG_ENDIAN),)
  205. TARGET_CFLAGS+= -mlongcalls -mauto-litpools
  206. TARGET_CXXFLAGS+= -mlongcalls -mauto-litpools
  207. endif
  208. endif
  209. ifeq ($(ADK_TARGET_ARCH_MICROBLAZE),y)
  210. TARGET_CFLAGS+= -mxl-barrel-shift
  211. TARGET_CXXFLAGS+= -mxl-barrel-shift
  212. endif
  213. # add configured compiler flags for optimization
  214. TARGET_CFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
  215. TARGET_CXXFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
  216. # add compiler flags for debug information
  217. ifneq ($(ADK_DEBUG),)
  218. TARGET_CFLAGS+= -g3
  219. TARGET_CXXFLAGS+= -g3
  220. endif
  221. ifneq ($(ADK_DEBUG),)
  222. ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),)
  223. TARGET_CFLAGS+= -fno-omit-frame-pointer
  224. TARGET_CXXFLAGS+= -fno-omit-frame-pointer
  225. endif
  226. TARGET_CFLAGS+= -funwind-tables -fasynchronous-unwind-tables
  227. TARGET_CXXFLAGS+= -funwind-tables -fasynchronous-unwind-tables
  228. else
  229. TARGET_CPPFLAGS+= -DNDEBUG
  230. TARGET_CFLAGS+= -fomit-frame-pointer
  231. TARGET_CXXFLAGS+= -fomit-frame-pointer
  232. # stop generating eh_frame stuff
  233. TARGET_CFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables
  234. TARGET_CXXFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables
  235. ifeq ($(ADK_TARGET_CPU_CF),y)
  236. TARGET_CFLAGS+= -fno-dwarf2-cfi-asm
  237. TARGET_CXXFLAGS+= -fno-dwarf2-cfi-asm
  238. endif
  239. endif
  240. ifeq ($(ADK_TARGET_ARCH_ARM),y)
  241. ifeq ($(ADK_TARGET_ARCH_ARM_WITH_NEON),y)
  242. TARGET_CFLAGS+= -ffast-math
  243. TARGET_CXXFLAGS+= -ffast-math
  244. endif
  245. ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),y)
  246. TARGET_CFLAGS+= -mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork
  247. TARGET_CXXFLAGS+= -mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork
  248. else
  249. TARGET_CFLAGS+= -marm
  250. TARGET_CXXFLAGS+= -marm
  251. endif
  252. endif
  253. # host compiler and linker flags
  254. HOST_CPPFLAGS:= -I$(STAGING_HOST_DIR)/usr/include
  255. HOST_LDFLAGS:= -L$(STAGING_HOST_DIR)/usr/lib -Wl,-rpath -Wl,${STAGING_HOST_DIR}/usr/lib
  256. ifneq (${ADK_UPDATE_PATCHES_GIT},)
  257. PATCH= PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/patch_git.sh
  258. else
  259. PATCH= PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/patch.sh
  260. endif
  261. PATCHP0= PATH='${HOST_PATH}' patch -p0
  262. ifeq ($(ADK_STATIC_TOOLCHAIN),y)
  263. HOST_STATIC_CFLAGS:= -static -Wl,-static
  264. HOST_STATIC_CXXFLAGS:= -static -Wl,-static
  265. HOST_STATIC_LDFLAGS:= -Wl,-static
  266. HOST_STATIC_LLDFLAGS:= -all-static
  267. endif
  268. SED:= PATH='${HOST_PATH}' sed -i -e
  269. XZ:= PATH='${HOST_PATH}' xz
  270. CPIO:= PATH='${HOST_PATH}' cpio
  271. LINUX_DIR:= $(BUILD_DIR)/linux
  272. KERNEL_MODULE_FLAGS:= ARCH=${ADK_TARGET_ARCH} \
  273. PREFIX=/usr \
  274. KERNEL_PATH=${LINUX_DIR} \
  275. KERNELDIR=${LINUX_DIR} \
  276. KERNEL_DIR=${LINUX_DIR} \
  277. CROSS_COMPILE="${TARGET_CROSS}" \
  278. CFLAGS_MODULE="-fhonour-copts" \
  279. V=1
  280. COMMON_ENV= CONFIG_SHELL='$(strip ${SHELL})' \
  281. AUTOM4TE='${STAGING_HOST_DIR}/usr/bin/autom4te' \
  282. M4='${STAGING_HOST_DIR}/usr/bin/m4' \
  283. LIBTOOLIZE='${STAGING_HOST_DIR}/usr/bin/libtoolize'
  284. ifneq ($(ADK_TARGET_USE_LTO),)
  285. TOOLS_ENV= AR='$(TARGET_CROSS)gcc-ar' \
  286. RANLIB='$(TARGET_CROSS)gcc-ranlib' \
  287. NM='$(TARGET_CROSS)gcc-nm'
  288. else
  289. TOOLS_ENV= AR='$(TARGET_CROSS)ar' \
  290. RANLIB='$(TARGET_CROSS)ranlib' \
  291. NM='$(TARGET_CROSS)nm'
  292. endif
  293. TARGET_ENV= $(TOOLS_ENV) \
  294. AS='$(TARGET_CROSS)as' \
  295. LD='$(TARGET_CROSS)ld' \
  296. STRIP='$(TARGET_CROSS)strip' \
  297. OBJCOPY='$(TARGET_CROSS)objcopy' \
  298. CC='$(TARGET_CC)' \
  299. GCC='$(TARGET_CC)' \
  300. CXX='$(TARGET_CXX)' \
  301. CROSS='$(TARGET_CROSS)' \
  302. CROSS_COMPILE='$(TARGET_CROSS)' \
  303. CFLAGS='$(TARGET_CFLAGS)' \
  304. CXXFLAGS='$(TARGET_CXXFLAGS)' \
  305. CPPFLAGS='$(TARGET_CPPFLAGS)' \
  306. LDFLAGS='$(TARGET_LDFLAGS)' \
  307. CC_FOR_BUILD='$(HOST_CC)' \
  308. CXX_FOR_BUILD='$(HOST_CXX)' \
  309. CPPFLAGS_FOR_BUILD='$(HOST_CPPFLAGS)' \
  310. CFLAGS_FOR_BUILD='$(HOST_CFLAGS)' \
  311. CXXFLAGS_FOR_BUILD='$(HOST_CXXFLAGS)' \
  312. LDFLAGS_FOR_BUILD='$(HOST_LDFLAGS)' \
  313. LIBS_FOR_BUILD='$(HOST_LIBS)'
  314. HOST_ENV= CC='$(HOST_CC)' \
  315. CXX='$(HOST_CXX)' \
  316. CPPFLAGS='$(HOST_CPPFLAGS)' \
  317. CFLAGS='$(HOST_CFLAGS)' \
  318. CXXFLAGS='$(HOST_CXXFLAGS)' \
  319. LDFLAGS='$(HOST_LDFLAGS)' \
  320. CC_FOR_BUILD='$(HOST_CC)' \
  321. CFLAGS_FOR_BUILD='$(HOST_CFLAGS)'
  322. PKG_SUFFIX:= $(strip $(subst ",, $(ADK_PACKAGE_SUFFIX)))
  323. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  324. PKG_BUILD:= PATH='${HOST_PATH}' \
  325. ${BASH} ${SCRIPT_DIR}/ipkg-build
  326. PKG_INSTALL:= PATH='${HOST_PATH}' \
  327. IPKG_TMP=$(BUILD_DIR)/tmp \
  328. IPKG_INSTROOT=$(TARGET_DIR) \
  329. IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
  330. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  331. BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
  332. ${BASH} ${SCRIPT_DIR}/ipkg \
  333. -force-defaults -force-depends install
  334. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/ipkg
  335. endif
  336. ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
  337. PKG_BUILD:= PATH='${HOST_PATH}' \
  338. ${BASH} ${SCRIPT_DIR}/ipkg-build
  339. PKG_INSTALL:= PATH='${HOST_PATH}' \
  340. IPKG_TMP=$(BUILD_DIR)/tmp \
  341. IPKG_INSTROOT=$(TARGET_DIR) \
  342. IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
  343. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  344. BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
  345. ${BASH} ${SCRIPT_DIR}/ipkg \
  346. -force-defaults -force-depends install
  347. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/opkg
  348. endif
  349. ifeq ($(ADK_TARGET_PACKAGE_TXZ),y)
  350. PKG_BUILD:= PATH='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/tarpkg build
  351. PKG_INSTALL:= PKG_INSTROOT='$(TARGET_DIR)' \
  352. PATH='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/tarpkg install
  353. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/pkg
  354. endif
  355. RSTRIP:= PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh
  356. STATCMD:=$(shell if stat -qs .>/dev/null 2>&1; then echo 'stat -f %z';else echo 'stat -c %s';fi)
  357. EXTRACT_CMD= PATH='${HOST_PATH}'; mkdir -p ${WRKDIR}; \
  358. cd ${WRKDIR} && \
  359. for file in ${FULLDISTFILES}; do case $$file in \
  360. *.cpio) \
  361. cat $$file | cpio -i -d ;; \
  362. *.tar) \
  363. tar -xf $$file ;; \
  364. *.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \
  365. gzip -dc $$file | cpio -i -d ;; \
  366. *.tar.xz | *.txz) \
  367. xz -dc $$file | tar -xf - ;; \
  368. *.tar.Z | *.tar.gz | *.taz | *.tgz) \
  369. gzip -dc $$file | tar -xf - ;; \
  370. *.cpio.bz2 | *.cbz) \
  371. bzip2 -dc $$file | cpio -i -d ;; \
  372. *.tar.bz2 | *.tbz | *.tbz2) \
  373. bzip2 -dc $$file | tar -xf - ;; \
  374. *.tar.lz | *.tlz) \
  375. lzip -dc $$file | tar -xf - ;; \
  376. *.zip) \
  377. cat $$file | cpio -id -H zip ;; \
  378. *.arm|*.jar|*.ids.gz) \
  379. mkdir ${WRKBUILD}; cp $$file ${WRKBUILD} ;; \
  380. *.bin) \
  381. sh $$file --force --auto-accept ;; \
  382. *) \
  383. echo "Cannot extract '$$file'" >&2; \
  384. false ;; \
  385. esac; done
  386. ifneq (,$(filter CYGWIN%,${OS_FOR_BUILD}))
  387. EXEEXT:= .exe
  388. endif
  389. include $(ADK_TOPDIR)/mk/mirrors.mk