Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. PKG_OS:=$(word 2,$(subst -, ,$(shell $(HOSTCC) -dumpmachine)))
  14. PKG_CPU:=$(word 1,$(subst -, ,$(shell $(HOSTCC) -dumpmachine)))
  15. TOOLCHAIN_NAME:=libreCMC-Toolchain-$(BOARD)-for-$(ARCH)$(ARCH_SUFFIX)-gcc-$(GCCV)$(DIR_SUFFIX)
  16. TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
  17. EXCLUDE_DIRS:=*/ccache \
  18. */initial \
  19. */stamp \
  20. */stampfiles \
  21. */man \
  22. */info
  23. all: compile
  24. TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
  25. $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
  26. mkdir -p $(TOOLCHAIN_BUILD_DIR)
  27. $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \
  28. $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
  29. toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) | \
  30. $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
  31. $(CP) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
  32. $(TOOLCHAIN_BUILD_DIR)/
  33. $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  34. chmod +x $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
  35. (cd $(TOOLCHAIN_PREFIX)/bin; \
  36. for app in cc gcc g++ c++ cpp ld as ; do \
  37. [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
  38. ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
  39. done; \
  40. )
  41. @-( \
  42. find \
  43. $(TOOLCHAIN_BUILD_DIR)/*/bin \
  44. $(TOOLCHAIN_BUILD_DIR)/*/*/bin \
  45. $(TOOLCHAIN_BUILD_DIR)/*/libexec \
  46. -type f; \
  47. ) | xargs strip 2>/dev/null >/dev/null
  48. echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
  49. find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
  50. find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
  51. find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
  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