1
0

Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #
  2. # Copyright (C) 2008-2009 Industrie Dial Face S.p.A.
  3. # Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>
  4. # Copyright (C) 2006-2008 OpenWrt.org
  5. #
  6. # This is free software, licensed under the GNU General Public License v2.
  7. # See /LICENSE for more information.
  8. #
  9. include $(TOPDIR)/rules.mk
  10. include $(INCLUDE_DIR)/kernel.mk
  11. include $(INCLUDE_DIR)/version.mk
  12. override MAKEFLAGS=
  13. TOOLCHAIN_NAME:=$(VERSION_DIST_SANITIZED)-toolchain-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
  14. TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
  15. EXCLUDE_DIRS:= \
  16. */initial \
  17. */stamp \
  18. */stampfiles \
  19. */man \
  20. */info
  21. all: compile
  22. TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
  23. $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz: clean
  24. mkdir -p $(TOOLCHAIN_BUILD_DIR)
  25. $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \
  26. $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
  27. toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) | \
  28. $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
  29. $(CP) \
  30. $(TOPDIR)/LICENSES \
  31. $(TOPDIR)/COPYING \
  32. ./files/README.TOOLCHAIN \
  33. $(TOOLCHAIN_BUILD_DIR)/
  34. $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  35. chmod +x $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  36. (cd $(TOOLCHAIN_PREFIX)/bin; \
  37. for app in cc gcc g++ c++ cpp ld as ; do \
  38. [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
  39. ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
  40. done; \
  41. )
  42. @-( \
  43. find \
  44. $(TOOLCHAIN_BUILD_DIR)/*/bin \
  45. $(TOOLCHAIN_BUILD_DIR)/*/*/bin \
  46. $(TOOLCHAIN_BUILD_DIR)/*/libexec \
  47. -type f; \
  48. ) | xargs strip 2>/dev/null >/dev/null
  49. echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
  50. find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
  51. find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
  52. find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
  53. mkdir -p $(BIN_DIR)
  54. (cd $(BUILD_DIR); \
  55. tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(TOOLCHAIN_NAME) \
  56. --mtime="$(shell date --date=@$(SOURCE_DATE_EPOCH))"; \
  57. )
  58. download:
  59. prepare:
  60. compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz
  61. install: compile
  62. clean:
  63. rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz