vars.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # $Id$
  2. #-
  3. # This file is part of the OpenADK project. OpenADK is copyrighted
  4. # material, please see the LICENCE file in the top-level directory.
  5. CP= cp -fpR
  6. INSTALL_DIR= install -d -m0755
  7. INSTALL_DATA= install -m0644
  8. INSTALL_BIN= install -m0755
  9. INSTALL_SCRIPT= install -m0755
  10. MAKEFLAGS= $(EXTRA_MAKEFLAGS)
  11. BUILD_USER= $(shell id -un)
  12. BUILD_GROUP= $(shell id -gn)
  13. ifeq ($(DEBUG),1)
  14. TARGET_DEBUGGING:= -g -O0 -fno-omit-frame-pointer
  15. else
  16. TARGET_DEBUGGING:= -fomit-frame-pointer
  17. endif
  18. ifeq ($(ADK_SSP),y)
  19. TARGET_SSP:= -fstack-protector-all
  20. endif
  21. TARGET_CFLAGS:= $(TARGET_OPTIMIZATION) $(TARGET_CFLAGS_ARCH) $(TARGET_DEBUGGING) $(TARGET_SSP)
  22. BASE_DIR:= $(TOPDIR)
  23. DISTDIR?= ${BASE_DIR}/dl
  24. BUILD_DIR:= ${BASE_DIR}/build_${CPU_ARCH}
  25. BUILD_DIR_PFX:= $(BASE_DIR)/build_*
  26. STAGING_PARENT:= ${BASE_DIR}/cross_${CPU_ARCH}
  27. STAGING_PARENT_PFX:= ${BASE_DIR}/cross_*
  28. STAGING_TOOLS:= ${STAGING_PARENT}/host
  29. STAGING_DIR:= ${STAGING_PARENT}/target
  30. TOOLCHAIN_BUILD_DIR= $(BASE_DIR)/toolchain_build_${CPU_ARCH}
  31. TOOLCHAIN_BUILD_DIR_PFX=$(BASE_DIR)/toolchain_build_*
  32. TOOLS_BUILD_DIR= $(BASE_DIR)/tools_build
  33. SCRIPT_DIR:= $(BASE_DIR)/scripts
  34. BIN_DIR:= $(BASE_DIR)/bin_${DEVICE}
  35. BIN_DIR_PFX:= $(BASE_DIR)/bin_*
  36. PACKAGE_DIR:= $(BIN_DIR)/packages
  37. TARGET_DIR:= $(BASE_DIR)/root_${DEVICE}
  38. TARGET_DIR_PFX:= $(BASE_DIR)/root_*
  39. TARGET_PATH= ${SCRIPT_DIR}:${STAGING_TOOLS}/bin:${STAGING_DIR}/scripts:${_PATH}
  40. ifeq ($(ADK_TARGET_LIB_GLIBC),y)
  41. REAL_GNU_TARGET_NAME= $(CPU_ARCH)-linux-gnu
  42. GNU_TARGET_NAME= $(CPU_ARCH)-linux
  43. KERNEL_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-gnu-
  44. TARGET_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-gnu-
  45. else
  46. REAL_GNU_TARGET_NAME= $(CPU_ARCH)-linux-uclibc
  47. GNU_TARGET_NAME= $(CPU_ARCH)-linux
  48. KERNEL_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-uclibc-
  49. TARGET_CROSS:= $(STAGING_TOOLS)/bin/$(CPU_ARCH)-linux-uclibc-
  50. endif
  51. TOOLCHAIN_SYSROOT:= $(TOOLCHAIN_BUILD_DIR)/libc_dev
  52. TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
  53. TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
  54. TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
  55. TARGET_CPPFLAGS+= -I${STAGING_DIR}/usr/include
  56. TARGET_LDFLAGS+= -Wl,-O2
  57. PATCH= ${BASH} $(SCRIPT_DIR)/patch.sh
  58. SED:= sed -i -e
  59. LINUX_DIR:= $(BUILD_DIR)/linux
  60. TARGET_CONFIGURE_OPTS= PATH='${TARGET_PATH}' \
  61. AR=$(TARGET_CROSS)ar \
  62. AS=$(TARGET_CROSS)as \
  63. LD=$(TARGET_CROSS)ld \
  64. NM=$(TARGET_CROSS)nm \
  65. CC="$(TARGET_CC)" \
  66. GCC="$(TARGET_CC)" \
  67. CXX="$(TARGET_CXX)" \
  68. RANLIB=$(TARGET_CROSS)ranlib
  69. HOST_CONFIGURE_OPTS= CC_FOR_BUILD='${HOSTCC}' \
  70. CFLAGS_FOR_BUILD='${HOSTCFLAGS}' \
  71. CPPFLAGS_FOR_BUILD='${HOSTCPPFLAGS}' \
  72. LDFLAGS_FOR_BUILD='${HOSTLDFLAGS}'
  73. # invoke ipkg-build with some default options
  74. IPKG_BUILD:= PATH='${TARGET_PATH}' ${BASH} \
  75. ${TOPDIR}/scripts/ipkg-build -c -o 0 -g 0
  76. # where to build (and put) .ipk packages
  77. IPKG_TARGET_DIR:= $(PACKAGE_DIR)
  78. IPKG:= IPKG_TMP=$(BUILD_DIR)/tmp \
  79. IPKG_INSTROOT=$(TARGET_DIR) \
  80. IPKG_CONF_DIR=$(STAGING_DIR)/etc \
  81. IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
  82. ${BASH} ${SCRIPT_DIR}/ipkg -force-defaults -force-depends
  83. IPKG_STATE_DIR:= $(TARGET_DIR)/usr/lib/ipkg
  84. RSTRIP:= prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh
  85. EXTRACT_CMD= mkdir -p ${WRKDIR}; \
  86. cd ${WRKDIR} && \
  87. for file in ${FULLDISTFILES}; do case $$file in \
  88. *.cpio) \
  89. cat $$file | cpio -i -d --quiet ;; \
  90. *.tar) \
  91. tar -xf $$file ;; \
  92. *.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \
  93. gzip -dc $$file | cpio -i -d --quiet ;; \
  94. *.tar.Z | *.tar.gz | *.taz | *.tgz) \
  95. gzip -dc $$file | tar -xf - ;; \
  96. *.cpio.bz2 | *.cbz) \
  97. bzip2 -dc $$file | cpio -i -d --quiet ;; \
  98. *.tar.bz2 | *.tbz | *.tbz2) \
  99. bzip2 -dc $$file | tar -xf - ;; \
  100. *.zip) \
  101. unzip -d ${WRKDIR} $$file ;; \
  102. *) \
  103. echo "Cannot extract '$$file'" >&2; \
  104. false ;; \
  105. esac; done
  106. ifeq ($(VERBOSE),1)
  107. QUIET:=
  108. else
  109. QUIET:= --quiet
  110. endif
  111. FETCH_CMD?= wget -t1 --timeout=30 $(QUIET)
  112. include $(TOPDIR)/mk/mirrors.mk