vars.mk 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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_${DEVICE}
  33. BIN_DIR_PFX:= $(BASE_DIR)/bin_*
  34. PACKAGE_DIR:= $(BIN_DIR)/packages
  35. TARGET_DIR:= $(BASE_DIR)/root_${DEVICE}
  36. TARGET_DIR_PFX:= $(BASE_DIR)/root_*
  37. TARGET_PATH= ${SCRIPT_DIR}:${STAGING_TOOLS}/bin:${STAGING_DIR}/scripts:${_PATH}
  38. ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
  39. REAL_GNU_TARGET_NAME= $(CPU_ARCH)-linux-uclibc
  40. GNU_TARGET_NAME= $(CPU_ARCH)-linux
  41. KERNEL_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-uclibc-
  42. TARGET_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-uclibc-
  43. else
  44. REAL_GNU_TARGET_NAME= $(CPU_ARCH)-linux-gnu
  45. GNU_TARGET_NAME= $(CPU_ARCH)-linux
  46. KERNEL_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-gnu-
  47. TARGET_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-gnu-
  48. endif
  49. TOOLCHAIN_SYSROOT:= $(TOOLCHAIN_BUILD_DIR)/libc_dev
  50. TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
  51. TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
  52. TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
  53. TARGET_CPPFLAGS+= -I${STAGING_DIR}/usr/include
  54. TARGET_LDFLAGS+= -Wl,-O2
  55. PATCH= ${BASH} $(SCRIPT_DIR)/patch.sh
  56. SED:= sed -i -e
  57. LINUX_DIR:= $(BUILD_DIR)/linux
  58. TARGET_CONFIGURE_OPTS= PATH='${TARGET_PATH}' \
  59. AR=$(TARGET_CROSS)ar \
  60. AS=$(TARGET_CROSS)as \
  61. LD=$(TARGET_CROSS)ld \
  62. NM=$(TARGET_CROSS)nm \
  63. CC="$(TARGET_CC)" \
  64. GCC="$(TARGET_CC)" \
  65. CXX="$(TARGET_CXX)" \
  66. RANLIB=$(TARGET_CROSS)ranlib
  67. HOST_CONFIGURE_OPTS= CC_FOR_BUILD='${HOSTCC}' \
  68. CFLAGS_FOR_BUILD='${HOSTCFLAGS}' \
  69. CPPFLAGS_FOR_BUILD='${HOSTCPPFLAGS}' \
  70. LDFLAGS_FOR_BUILD='${HOSTLDFLAGS}'
  71. # invoke ipkg-build with some default options
  72. IPKG_BUILD:= PATH='${TARGET_PATH}' ${BASH} \
  73. ${TOPDIR}/scripts/ipkg-build -c -o 0 -g 0
  74. # where to build (and put) .ipk packages
  75. IPKG_TARGET_DIR:= $(PACKAGE_DIR)
  76. IPKG:= IPKG_TMP=$(BUILD_DIR)/tmp \
  77. IPKG_INSTROOT=$(TARGET_DIR) \
  78. IPKG_CONF_DIR=$(STAGING_DIR)/etc \
  79. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  80. ${BASH} ${SCRIPT_DIR}/ipkg -force-defaults -force-depends
  81. IPKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/ipkg
  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