2
0

Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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)/host.mk
  12. include $(INCLUDE_DIR)/version.mk
  13. override MAKEFLAGS=
  14. TOOLCHAIN_NAME:=$(VERSION_DIST_SANITIZED)-toolchain-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
  15. TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
  16. EXCLUDE_DIRS:=*/ccache \
  17. */initial \
  18. */stamp \
  19. */stampfiles \
  20. */man \
  21. */info
  22. all: compile
  23. TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
  24. $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
  25. mkdir -p $(TOOLCHAIN_BUILD_DIR)
  26. $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \
  27. $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
  28. toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) | \
  29. $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
  30. $(CP) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
  31. $(TOOLCHAIN_BUILD_DIR)/
  32. $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  33. chmod +x $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  34. (cd $(TOOLCHAIN_PREFIX)/bin; \
  35. for app in cc gcc g++ c++ cpp ld as ; do \
  36. [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
  37. ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
  38. done; \
  39. )
  40. @-( \
  41. find \
  42. $(TOOLCHAIN_BUILD_DIR)/*/bin \
  43. $(TOOLCHAIN_BUILD_DIR)/*/*/bin \
  44. $(TOOLCHAIN_BUILD_DIR)/*/libexec \
  45. -type f; \
  46. ) | xargs strip 2>/dev/null >/dev/null
  47. echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
  48. find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
  49. find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
  50. find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
  51. mkdir -p $(BIN_DIR)
  52. (cd $(BUILD_DIR); \
  53. tar cfj $@ $(TOOLCHAIN_NAME); \
  54. )
  55. download:
  56. prepare:
  57. compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
  58. install: compile
  59. clean:
  60. rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2