vars.mk 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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_TARGET_UCLINUX),y)
  63. ADK_TARGET_LINUXTYPE:= uclinux
  64. else
  65. ADK_TARGET_LINUXTYPE:= linux
  66. endif
  67. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_LINUXTYPE)-$(ADK_TARGET_SUFFIX)
  68. ifeq ($(ADK_TARGET_ARCH_C6X),y)
  69. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_LINUXTYPE)
  70. endif
  71. ifeq ($(ADK_TARGET_ARCH_CSKY),y)
  72. ifeq ($(ADK_TARGET_CPU_CSKY_CK610),y)
  73. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-unknown-$(ADK_TARGET_LINUXTYPE)
  74. else
  75. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-abiv2-$(ADK_TARGET_LINUXTYPE)
  76. endif
  77. endif
  78. ifeq ($(ADK_TARGET_OS_BAREMETAL),y)
  79. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_SUFFIX)
  80. endif
  81. ifeq ($(ADK_TARGET_OS_FROSTED),y)
  82. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_OS)-$(ADK_TARGET_SUFFIX)
  83. endif
  84. ifeq ($(ADK_TARGET_OS_RTEMS),y)
  85. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_OS)
  86. endif
  87. ifeq ($(ADK_TARGET_OS_ZEPHYR),y)
  88. GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_OS)
  89. endif
  90. TARGET_CROSS:= $(TOOLCHAIN_DIR)/usr/bin/$(GNU_TARGET_NAME)-
  91. TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
  92. CONFIGURE_TRIPLE:= --build=${GNU_HOST_NAME} \
  93. --host=${GNU_TARGET_NAME} \
  94. --target=${GNU_TARGET_NAME}
  95. # target tools
  96. ifeq ($(ADK_BUILD_COMPILER_GCC),y)
  97. TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
  98. TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
  99. TARGET_CC_NO_CCACHE:= ${TARGET_CC}
  100. TARGET_CXX_NO_CCACHE:= ${TARGET_CXX}
  101. endif
  102. ifeq ($(ADK_BUILD_COMPILER_LLVM),y)
  103. TARGET_CC:= clang --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
  104. TARGET_CXX:= clang++ --target=${GNU_TARGET_NAME} --sysroot=$(STAGING_TARGET_DIR)
  105. TARGET_LDFLAGS:= -fuse-ld=lld -stdlib=libc++
  106. endif
  107. # gcc specific
  108. ifeq ($(ADK_BUILD_COMPILER_GCC),y)
  109. ifneq ($(strip ${ADK_USE_CCACHE}),)
  110. TARGET_CC:= $(STAGING_HOST_DIR)/usr/bin/ccache ${TARGET_CC_NO_CCACHE}
  111. TARGET_CXX:= $(STAGING_HOST_DIR)/usr/bin/ccache ${TARGET_CXX_NO_CCACHE}
  112. endif
  113. # for x86_64 x32 ABI we need to extend TARGET_CC/TARGET_CXX
  114. ifeq ($(ADK_TARGET_ABI_X32),y)
  115. TARGET_CC+= $(ADK_TARGET_ABI_CFLAGS)
  116. TARGET_CXX+= $(ADK_TARGET_ABI_CFLAGS)
  117. endif
  118. TARGET_LD:= ${TARGET_COMPILER_PREFIX}ld
  119. ifneq ($(ADK_TARGET_USE_LTO),)
  120. TARGET_AR:= ${TARGET_COMPILER_PREFIX}gcc-ar
  121. TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}gcc-ranlib
  122. else
  123. TARGET_AR:= ${TARGET_COMPILER_PREFIX}ar
  124. TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}ranlib
  125. endif
  126. TARGET_CPPFLAGS:=
  127. TARGET_CFLAGS:= -fwrapv -fno-ident
  128. TARGET_CXXFLAGS:= -fwrapv -fno-ident
  129. TARGET_LDFLAGS:= -L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
  130. -Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
  131. -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
  132. # for architectures where gcc --with-cpu matches -mcpu=
  133. ifneq ($(ADK_TARGET_GCC_CPU),)
  134. TARGET_CFLAGS+= -mcpu=$(ADK_TARGET_GCC_CPU)
  135. TARGET_CXXFLAGS+= -mcpu=$(ADK_TARGET_GCC_CPU)
  136. endif
  137. # for archiectures where gcc --with-arch matches -march=
  138. ifneq ($(ADK_TARGET_GCC_ARCH),)
  139. TARGET_CFLAGS+= -march=$(ADK_TARGET_GCC_ARCH)
  140. TARGET_CXXFLAGS+= -march=$(ADK_TARGET_GCC_ARCH)
  141. endif
  142. ifneq ($(ADK_TARGET_CPU_FLAGS),)
  143. TARGET_CFLAGS+= $(ADK_TARGET_CPU_FLAGS)
  144. TARGET_CXXFLAGS+= $(ADK_TARGET_CPU_FLAGS)
  145. TARGET_LDFLAGS+= $(ADK_TARGET_CPU_FLAGS)
  146. endif
  147. ifneq ($(ADK_TARGET_FPU),)
  148. TARGET_CFLAGS+= -mfpu=$(ADK_TARGET_FPU)
  149. TARGET_CXXFLAGS+= -mfpu=$(ADK_TARGET_FPU)
  150. endif
  151. ifneq ($(ADK_TARGET_FLOAT),)
  152. ifeq ($(ADK_TARGET_ARCH_ARM),y)
  153. TARGET_CFLAGS+= -mfloat-abi=$(ADK_TARGET_FLOAT)
  154. TARGET_CXXFLAGS+= -mfloat-abi=$(ADK_TARGET_FLOAT)
  155. endif
  156. ifeq ($(ADK_TARGET_ARCH_MIPS),y)
  157. TARGET_CFLAGS+= -m$(ADK_TARGET_FLOAT)-float
  158. TARGET_CXXFLAGS+= -m$(ADK_TARGET_FLOAT)-float
  159. endif
  160. endif
  161. ifeq ($(ADK_TARGET_BINFMT_FLAT)$(ADK_TARGET_OS_FROSTED),y)
  162. TARGET_LDFLAGS+= -Wl,-elf2flt
  163. TARGET_CFLAGS+= -Wl,-elf2flt
  164. TARGET_CXXFLAGS+= -Wl,-elf2flt
  165. endif
  166. ifeq ($(ADK_TARGET_BINFMT_FLAT_SEP_DATA),y)
  167. TARGET_CFLAGS+= -msep-data
  168. TARGET_CXXFLAGS+= -msep-data
  169. endif
  170. ifeq ($(ADK_TARGET_BINFMT_FLAT_SHARED),y)
  171. TARGET_LDFLAGS+= -mid-shared-library
  172. endif
  173. # security optimization, see http://www.akkadia.org/drepper/dsohowto.pdf
  174. ifneq ($(ADK_TARGET_USE_LD_RELRO),)
  175. TARGET_LDFLAGS+= -Wl,-z,relro
  176. endif
  177. ifneq ($(ADK_TARGET_USE_LD_BIND_NOW),)
  178. TARGET_LDFLAGS+= -Wl,-z,now
  179. endif
  180. # needed for musl ppc
  181. ifeq ($(ADK_TARGET_ARCH_PPC),y)
  182. ifeq ($(ADK_TARGET_LIB_MUSL),y)
  183. TARGET_LDFLAGS+= -Wl,--secure-plt
  184. endif
  185. endif
  186. ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY)$(ADK_TARGET_USE_STATIC_AND_SHARED_LIBS),y)
  187. TARGET_CFLAGS+= -static
  188. TARGET_CXXFLAGS+= -static
  189. TARGET_LDFLAGS+= -static
  190. endif
  191. ifneq ($(ADK_TARGET_USE_SSP),)
  192. TARGET_CFLAGS+= -fstack-protector-all --param=ssp-buffer-size=4
  193. TARGET_CXXFLAGS+= -fstack-protector-all --param=ssp-buffer-size=4
  194. TARGET_LDFLAGS+= -fstack-protector-all
  195. endif
  196. ifneq ($(ADK_TARGET_USE_LD_GC),)
  197. TARGET_CFLAGS+= -fdata-sections -ffunction-sections
  198. TARGET_CXXFLAGS+= -fdata-sections -ffunction-sections
  199. TARGET_LDFLAGS+= -Wl,--gc-sections
  200. endif
  201. ifneq ($(ADK_TARGET_USE_LTO),)
  202. TARGET_CFLAGS+= -flto
  203. TARGET_CXXFLAGS+= -flto
  204. TARGET_LDFLAGS+= -flto
  205. endif
  206. # performance optimization, see http://www.akkadia.org/drepper/dsohowto.pdf
  207. ifneq ($(ADK_TARGET_USE_GNU_HASHSTYLE),)
  208. TARGET_LDFLAGS+= -Wl,--hash-style=gnu
  209. endif
  210. # special operating system flags
  211. ifeq ($(ADK_TARGET_OS_FROSTED),y)
  212. TARGET_CFLAGS+= -fPIC -mlong-calls -fno-common -msingle-pic-base -mno-pic-data-is-text-relative
  213. endif
  214. # special architecture optimization flags
  215. ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
  216. ifeq ($(ADK_TARGET_BIG_ENDIAN),)
  217. ifeq ($(ADK_TARGET_LIB_NEWLIB),)
  218. TARGET_CFLAGS+= -mlongcalls -mauto-litpools
  219. TARGET_CXXFLAGS+= -mlongcalls -mauto-litpools
  220. endif
  221. endif
  222. endif
  223. ifeq ($(ADK_TARGET_ARCH_MICROBLAZE),y)
  224. TARGET_CFLAGS+= -mxl-barrel-shift
  225. TARGET_CXXFLAGS+= -mxl-barrel-shift
  226. endif
  227. endif
  228. # end gcc specific
  229. # add configured compiler flags for optimization
  230. TARGET_CFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
  231. TARGET_CXXFLAGS+= $(ADK_TARGET_CFLAGS_OPT)
  232. # add compiler flags for debug information
  233. ifneq ($(ADK_DEBUG),)
  234. TARGET_CFLAGS+= -g3
  235. TARGET_CXXFLAGS+= -g3
  236. endif
  237. ifneq ($(ADK_DEBUG),)
  238. ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),)
  239. TARGET_CFLAGS+= -fno-omit-frame-pointer
  240. TARGET_CXXFLAGS+= -fno-omit-frame-pointer
  241. endif
  242. TARGET_CFLAGS+= -funwind-tables -fasynchronous-unwind-tables
  243. TARGET_CXXFLAGS+= -funwind-tables -fasynchronous-unwind-tables
  244. else
  245. TARGET_CPPFLAGS+= -DNDEBUG
  246. TARGET_CFLAGS+= -fomit-frame-pointer
  247. TARGET_CXXFLAGS+= -fomit-frame-pointer
  248. # stop generating eh_frame stuff
  249. TARGET_CFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables
  250. TARGET_CXXFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables
  251. ifeq ($(ADK_TARGET_CPU_CF),y)
  252. TARGET_CFLAGS+= -fno-dwarf2-cfi-asm
  253. TARGET_CXXFLAGS+= -fno-dwarf2-cfi-asm
  254. endif
  255. endif
  256. ifeq ($(ADK_TARGET_ARCH_ARM),y)
  257. ifeq ($(ADK_TARGET_ARCH_ARM_WITH_NEON),y)
  258. TARGET_CFLAGS+= -ffast-math
  259. TARGET_CXXFLAGS+= -ffast-math
  260. endif
  261. ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),y)
  262. TARGET_CFLAGS+= -mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork
  263. TARGET_CXXFLAGS+= -mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork
  264. else
  265. TARGET_CFLAGS+= -marm
  266. TARGET_CXXFLAGS+= -marm
  267. endif
  268. endif
  269. # host compiler and linker flags
  270. HOST_CPPFLAGS:= -I$(STAGING_HOST_DIR)/usr/include
  271. ifeq ($(OS_FOR_BUILD),Darwin)
  272. HOST_LDFLAGS:= -L$(STAGING_HOST_DIR)/usr/lib
  273. else
  274. HOST_LDFLAGS:= -L$(STAGING_HOST_DIR)/usr/lib -Wl,-rpath -Wl,${STAGING_HOST_DIR}/usr/lib
  275. endif
  276. ifneq (${ADK_UPDATE_PATCHES_GIT},)
  277. PATCH= PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/patch_git.sh
  278. else
  279. PATCH= PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/patch.sh
  280. endif
  281. PATCHP0= PATH='${HOST_PATH}' patch -p0
  282. ifeq ($(ADK_STATIC_TOOLCHAIN),y)
  283. HOST_STATIC_CFLAGS:= -static -Wl,-static
  284. HOST_STATIC_CXXFLAGS:= -static -Wl,-static
  285. HOST_STATIC_LDFLAGS:= -Wl,-static
  286. endif
  287. SED:= PATH='${HOST_PATH}' sed -i -e
  288. XZ:= PATH='${HOST_PATH}' xz
  289. CPIO:= PATH='${HOST_PATH}' cpio
  290. LINUX_DIR:= $(BUILD_DIR)/linux
  291. KERNEL_MODULE_FLAGS:= ARCH=${ADK_TARGET_KARCH} \
  292. PREFIX=/usr \
  293. KERNEL_PATH=${LINUX_DIR} \
  294. KERNELDIR=${LINUX_DIR} \
  295. KERNEL_DIR=${LINUX_DIR} \
  296. CROSS_COMPILE="${TARGET_CROSS}" \
  297. V=1
  298. COMMON_ENV= CONFIG_SHELL='$(strip ${SHELL})' \
  299. AUTOM4TE='${STAGING_HOST_DIR}/usr/bin/autom4te' \
  300. M4='${STAGING_HOST_DIR}/usr/bin/m4' \
  301. LIBTOOLIZE='${STAGING_HOST_DIR}/usr/bin/libtoolize'
  302. ifneq ($(ADK_TARGET_USE_LTO),)
  303. TOOLS_ENV= AR='$(TARGET_CROSS)gcc-ar' \
  304. RANLIB='$(TARGET_CROSS)gcc-ranlib' \
  305. NM='$(TARGET_CROSS)gcc-nm'
  306. else
  307. TOOLS_ENV= AR='$(TARGET_CROSS)ar' \
  308. RANLIB='$(TARGET_CROSS)ranlib' \
  309. NM='$(TARGET_CROSS)nm'
  310. endif
  311. TARGET_ENV= $(TOOLS_ENV) \
  312. AS='$(TARGET_CROSS)as' \
  313. LD='$(TARGET_CROSS)ld' \
  314. STRIP='$(TARGET_CROSS)strip' \
  315. OBJCOPY='$(TARGET_CROSS)objcopy' \
  316. CC='$(TARGET_CC)' \
  317. GCC='$(TARGET_CC)' \
  318. CXX='$(TARGET_CXX)' \
  319. CROSS='$(TARGET_CROSS)' \
  320. CROSS_COMPILE='$(TARGET_CROSS)' \
  321. CFLAGS='$(TARGET_CFLAGS)' \
  322. CXXFLAGS='$(TARGET_CXXFLAGS)' \
  323. CPPFLAGS='$(TARGET_CPPFLAGS)' \
  324. LDFLAGS='$(TARGET_LDFLAGS)' \
  325. CC_FOR_BUILD='$(HOST_CC)' \
  326. CXX_FOR_BUILD='$(HOST_CXX)' \
  327. CPPFLAGS_FOR_BUILD='$(HOST_CPPFLAGS)' \
  328. CFLAGS_FOR_BUILD='$(HOST_CFLAGS)' \
  329. CXXFLAGS_FOR_BUILD='$(HOST_CXXFLAGS)' \
  330. LDFLAGS_FOR_BUILD='$(HOST_LDFLAGS)' \
  331. LIBS_FOR_BUILD='$(HOST_LIBS)'
  332. HOST_ENV= CC='$(HOST_CC)' \
  333. CXX='$(HOST_CXX)' \
  334. CPPFLAGS='$(HOST_CPPFLAGS)' \
  335. CFLAGS='$(HOST_CFLAGS)' \
  336. CXXFLAGS='$(HOST_CXXFLAGS)' \
  337. LDFLAGS='$(HOST_LDFLAGS)' \
  338. CC_FOR_BUILD='$(HOST_CC)' \
  339. CFLAGS_FOR_BUILD='$(HOST_CFLAGS)'
  340. PKG_SUFFIX:= $(strip $(subst ",, $(ADK_PACKAGE_SUFFIX)))
  341. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  342. PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/ipkg-build
  343. PKG_INSTALL:= PATH='${HOST_PATH}' \
  344. IPKG_TMP=$(BUILD_DIR)/tmp \
  345. IPKG_INSTROOT=$(TARGET_DIR) \
  346. IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
  347. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  348. BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
  349. ${BASH} ${SCRIPT_DIR}/ipkg \
  350. -force-defaults -force-depends install
  351. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/ipkg
  352. endif
  353. ifeq ($(ADK_TARGET_PACKAGE_OPKG),y)
  354. PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/ipkg-build
  355. PKG_INSTALL:= PATH='${HOST_PATH}' \
  356. IPKG_TMP=$(BUILD_DIR)/tmp \
  357. IPKG_INSTROOT=$(TARGET_DIR) \
  358. IPKG_CONF_DIR=$(STAGING_TARGET_DIR)/etc \
  359. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  360. BIN_DIR=$(STAGING_HOST_DIR)/usr/bin \
  361. ${BASH} ${SCRIPT_DIR}/ipkg \
  362. -force-defaults -force-depends install
  363. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/opkg
  364. endif
  365. ifeq ($(ADK_TARGET_PACKAGE_TXZ),y)
  366. PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/tarpkg build
  367. PKG_INSTALL:= PKG_INSTROOT='$(TARGET_DIR)' \
  368. PATH='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/tarpkg install
  369. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/pkg
  370. endif
  371. RSTRIP:= PATH="$(TARGET_PATH)" prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh
  372. STATCMD:=$(shell if stat -qs .>/dev/null 2>&1; then echo 'stat -f %z';else echo 'stat -c %s';fi)
  373. EXTRACT_CMD= PATH='${HOST_PATH}'; mkdir -p ${WRKDIR}; \
  374. cd ${WRKDIR} && \
  375. for file in ${FULLDISTFILES}; do case $$file in \
  376. *.cpio) \
  377. cat $$file | cpio -i -d ;; \
  378. *.tar) \
  379. tar -xf $$file ;; \
  380. *.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \
  381. gzip -dc $$file | cpio -i -d ;; \
  382. *.tar.xz | *.txz) \
  383. xz -dc $$file | tar -xf - ;; \
  384. *.tar.Z | *.tar.gz | *.taz | *.tgz) \
  385. gzip -dc $$file | tar -xf - ;; \
  386. *.cpio.bz2 | *.cbz) \
  387. bzip2 -dc $$file | cpio -i -d ;; \
  388. *.tar.bz2 | *.tbz | *.tbz2) \
  389. bzip2 -dc $$file | tar -xf - ;; \
  390. *.tar.lz | *.tlz) \
  391. lzip -dc $$file | tar -xf - ;; \
  392. *.zip) \
  393. unzip -d ${WRKDIR} $$file ;; \
  394. *.arm|*.jar|*.ids.gz) \
  395. mkdir ${WRKBUILD}; cp $$file ${WRKBUILD} ;; \
  396. *.bin) \
  397. sh $$file --force --auto-accept ;; \
  398. *) \
  399. echo "Cannot extract '$$file'" >&2; \
  400. false ;; \
  401. esac; done
  402. ifneq (,$(filter CYGWIN%,${OS_FOR_BUILD}))
  403. EXEEXT:= .exe
  404. endif
  405. include $(ADK_TOPDIR)/mk/mirrors.mk