Makefile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. override MAKEFLAGS=
  13. TOOLCHAIN_NAME:=OpenWrt-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. (cd $(BUILD_DIR); \
  51. tar cfj $@ $(TOOLCHAIN_NAME); \
  52. )
  53. download:
  54. prepare:
  55. compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
  56. install: compile
  57. clean:
  58. rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2