[backfire] toolchain: fix paths after relocation from usr/ (#10876)
[openwrt/svn-archive/archive.git] / target / toolchain / Makefile
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
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/kernel.mk
12 include $(INCLUDE_DIR)/host.mk
13
14 override MAKEFLAGS=
15
16 PKG_OS:=$(shell uname -s)
17 PKG_CPU:=$(shell uname -m)
18
19 TOOLCHAIN_NAME:=OpenWrt-Toolchain-$(BOARD)-for-$(ARCH)$(ARCH_SUFFIX)-gcc-$(GCCV)$(DIR_SUFFIX)
20 TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
21 EXCLUDE_DIRS:=*/ccache \
22 */stamp \
23 */stampfiles \
24 */man \
25 */info
26
27 all: compile
28
29 TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
30
31 $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
32 mkdir -p $(TOOLCHAIN_BUILD_DIR)
33 $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \
34 $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
35 toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) | \
36 $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
37
38 $(CP) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
39 $(TOOLCHAIN_BUILD_DIR)/
40
41 $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
42 chmod +x $(TOOLCHAIN_PREFIX)/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
43 (cd $(TOOLCHAIN_PREFIX)/bin; \
44 for app in cc gcc g++ c++ cpp ld as ; do \
45 [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
46 ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
47 done; \
48 )
49 echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
50 find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
51 find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
52 find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
53 (cd $(BUILD_DIR); \
54 tar cfj $@ $(TOOLCHAIN_NAME); \
55 )
56
57 download:
58 prepare:
59 compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
60 install: compile
61
62 clean:
63 rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2