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
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/kernel.mk
12 include $(INCLUDE_DIR)/host.mk
16 TOOLCHAIN_NAME:=OpenWrt-Toolchain-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
17 TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
18 EXCLUDE_DIRS:=*/ccache \
27 TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
29 $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
30 mkdir -p $(TOOLCHAIN_BUILD_DIR)
31 $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \
32 $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
33 toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) | \
34 $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
36 $(CP) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
37 $(TOOLCHAIN_BUILD_DIR)/
39 $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
40 chmod +x $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
41 (cd $(TOOLCHAIN_PREFIX)/bin; \
42 for app in cc gcc g++ c++ cpp ld as ; do \
43 [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
44 ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
50 $(TOOLCHAIN_BUILD_DIR)/*/bin \
51 $(TOOLCHAIN_BUILD_DIR)/*/*/bin \
52 $(TOOLCHAIN_BUILD_DIR)/*/libexec \
54 ) | xargs strip 2>/dev/null >/dev/null
56 echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
57 find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
58 find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
59 find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
61 tar cfj $@ $(TOOLCHAIN_NAME); \
66 compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
70 rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2