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)/host.mk
  12. include $(INCLUDE_DIR)/version.mk
  13. override MAKEFLAGS=
  14. TOOLCHAIN_NAME:=$(VERSION_DIST)-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. (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