vars.mk 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. ifneq ($(ADK_DEBUG),)
  12. TARGET_DEBUGGING:= -g3 -fno-omit-frame-pointer
  13. else
  14. TARGET_DEBUGGING:= -fomit-frame-pointer
  15. endif
  16. ifeq ($(ADK_SSP),y)
  17. TARGET_SSP:= -fstack-protector-all
  18. endif
  19. TARGET_CFLAGS:= $(TARGET_OPTIMIZATION) $(TARGET_CFLAGS_ARCH) $(TARGET_DEBUGGING) $(TARGET_SSP)
  20. BASE_DIR:= $(TOPDIR)
  21. DISTDIR?= ${BASE_DIR}/dl
  22. BUILD_DIR:= ${BASE_DIR}/build_${CPU_ARCH}
  23. BUILD_DIR_PFX:= $(BASE_DIR)/build_*
  24. STAGING_PARENT:= ${BASE_DIR}/cross_${CPU_ARCH}
  25. STAGING_PARENT_PFX:= ${BASE_DIR}/cross_*
  26. STAGING_TOOLS:= ${STAGING_PARENT}/host
  27. STAGING_DIR:= ${STAGING_PARENT}/target
  28. TOOLCHAIN_BUILD_DIR= $(BASE_DIR)/toolchain_build_${CPU_ARCH}
  29. TOOLCHAIN_BUILD_DIR_PFX=$(BASE_DIR)/toolchain_build_*
  30. TOOLS_BUILD_DIR= $(BASE_DIR)/tools_build
  31. SCRIPT_DIR:= $(BASE_DIR)/scripts
  32. BIN_DIR:= $(BASE_DIR)/bin_${ADK_TARGET}
  33. BIN_DIR_PFX:= $(BASE_DIR)/bin_*
  34. PACKAGE_DIR:= $(BIN_DIR)/packages
  35. TARGET_DIR:= $(BASE_DIR)/root_${ADK_TARGET}
  36. TARGET_DIR_PFX:= $(BASE_DIR)/root_*
  37. TARGET_PATH= ${SCRIPT_DIR}:${STAGING_TOOLS}/bin:${STAGING_DIR}/scripts:${_PATH}
  38. REAL_GNU_TARGET_NAME= $(CPU_ARCH)-linux-$(ADK_TARGET_SUFFIX)
  39. GNU_TARGET_NAME= $(CPU_ARCH)-linux
  40. TOOLCHAIN_SYSROOT:= $(TOOLCHAIN_BUILD_DIR)/libc_dev
  41. ifeq ($(ADK_NATIVE),y)
  42. TARGET_COMPILER_PREFIX?=
  43. TARGET_CROSS:=
  44. else
  45. TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
  46. TARGET_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-$(ADK_TARGET_SUFFIX)-
  47. endif
  48. TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
  49. TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
  50. TARGET_CPPFLAGS+= -I${STAGING_DIR}/usr/include
  51. TARGET_LDFLAGS+= -Wl,-O2
  52. PATCH= ${BASH} $(SCRIPT_DIR)/patch.sh
  53. SED:= sed -i -e
  54. LINUX_DIR:= $(BUILD_DIR)/linux
  55. TARGET_CONFIGURE_OPTS= PATH='${TARGET_PATH}' \
  56. AR=$(TARGET_CROSS)ar \
  57. AS=$(TARGET_CROSS)as \
  58. LD=$(TARGET_CROSS)ld \
  59. NM=$(TARGET_CROSS)nm \
  60. CC="$(TARGET_CC)" \
  61. GCC="$(TARGET_CC)" \
  62. CXX="$(TARGET_CXX)" \
  63. RANLIB=$(TARGET_CROSS)ranlib
  64. HOST_CONFIGURE_OPTS= CC_FOR_BUILD='${HOSTCC}' \
  65. CFLAGS_FOR_BUILD='${HOSTCFLAGS}' \
  66. CPPFLAGS_FOR_BUILD='${HOSTCPPFLAGS}' \
  67. LDFLAGS_FOR_BUILD='${HOSTLDFLAGS}'
  68. PKG_SUFFIX:= $(strip $(subst ",, $(ADK_PACKAGE_SUFFIX)))
  69. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  70. PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/ipkg-build -c -o 0 -g 0
  71. PKG_INSTALL:= IPKG_TMP=$(BUILD_DIR)/tmp \
  72. IPKG_INSTROOT=$(TARGET_DIR) \
  73. IPKG_CONF_DIR=$(STAGING_DIR)/etc \
  74. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  75. ${BASH} ${SCRIPT_DIR}/ipkg \
  76. -force-defaults -force-depends install
  77. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/ipkg
  78. else
  79. PKG_BUILD:= ${BASH} ${SCRIPT_DIR}/tarpkg build
  80. PKG_INSTALL:= INSTROOT=$(TARGET_DIR) \
  81. ${BASH} ${SCRIPT_DIR}/tarpkg install
  82. PKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/pkg
  83. endif
  84. ifeq ($(ADK_NATIVE),y)
  85. RSTRIP:= prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh
  86. else
  87. RSTRIP:= prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh
  88. endif
  89. EXTRACT_CMD= mkdir -p ${WRKDIR}; \
  90. cd ${WRKDIR} && \
  91. for file in ${FULLDISTFILES}; do case $$file in \
  92. *.cpio) \
  93. cat $$file | cpio -i -d --quiet ;; \
  94. *.tar) \
  95. tar -xf $$file ;; \
  96. *.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \
  97. gzip -dc $$file | cpio -i -d --quiet ;; \
  98. *.tar.Z | *.tar.gz | *.taz | *.tgz) \
  99. gzip -dc $$file | tar -xf - ;; \
  100. *.cpio.bz2 | *.cbz) \
  101. bzip2 -dc $$file | cpio -i -d --quiet ;; \
  102. *.tar.bz2 | *.tbz | *.tbz2) \
  103. bzip2 -dc $$file | tar -xf - ;; \
  104. *.zip) \
  105. unzip -qd ${WRKDIR} $$file ;; \
  106. *) \
  107. echo "Cannot extract '$$file'" >&2; \
  108. false ;; \
  109. esac; done
  110. ifeq ($(VERBOSE),1)
  111. QUIET:=
  112. else
  113. QUIET:= --quiet
  114. endif
  115. FETCH_CMD?= wget -t1 --timeout=30 $(QUIET)
  116. include $(TOPDIR)/mk/mirrors.mk