1
0

Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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:=*/ccache \
  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.bz2: 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) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
  30. $(TOOLCHAIN_BUILD_DIR)/
  31. $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  32. chmod +x $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  33. (cd $(TOOLCHAIN_PREFIX)/bin; \
  34. for app in cc gcc g++ c++ cpp ld as ; do \
  35. [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
  36. ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
  37. done; \
  38. )
  39. @-( \
  40. find \
  41. $(TOOLCHAIN_BUILD_DIR)/*/bin \
  42. $(TOOLCHAIN_BUILD_DIR)/*/*/bin \
  43. $(TOOLCHAIN_BUILD_DIR)/*/libexec \
  44. -type f; \
  45. ) | xargs strip 2>/dev/null >/dev/null
  46. echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
  47. find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
  48. find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
  49. find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
  50. mkdir -p $(BIN_DIR)
  51. (cd $(BUILD_DIR); \
  52. tar cfj $@ $(TOOLCHAIN_NAME); \
  53. )
  54. download:
  55. prepare:
  56. compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
  57. install: compile
  58. clean:
  59. rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2