vars.mk 4.4 KB

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