vars.mk 3.8 KB

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