Root/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
10include $(TOPDIR)/rules.mk
11include $(INCLUDE_DIR)/kernel.mk
12include $(INCLUDE_DIR)/host.mk
13
14override MAKEFLAGS=
15
16PKG_OS:=$(shell uname -s)
17PKG_CPU:=$(shell uname -m)
18
19TOOLCHAIN_NAME:=OpenWrt-Toolchain-$(BOARD)-for-$(ARCH)$(ARCH_SUFFIX)-gcc-$(GCCV)$(DIR_SUFFIX)
20TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
21EXCLUDE_DIRS:=*/ccache \
22    */stamp \
23    */stampfiles \
24    */man \
25    */info
26
27all: compile
28
29TOOLCHAIN_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)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
42    chmod +x $(TOOLCHAIN_PREFIX)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
43    (cd $(TOOLCHAIN_PREFIX)/usr/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
57download:
58prepare:
59compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
60install: compile
61
62clean:
63    rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
64

Archive Download this file



interactive