Add a target (CONFIG_MAKE_CONFIG) that creates an exportable toolchain. The toolchain...
[openwrt-10.03/.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)-gcc-$(GCCV)_$(LIBC)-$(LIBCV)
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 $(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)_gcc-$(GCCV)_$(LIBC)-$(LIBCV) | \
34                $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
35
36         $(CP)  $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
37                 $(TOOLCHAIN_BUILD_DIR)/
38
39         echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
40         find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
41         find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
42         find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
43         (cd $(BUILD_DIR); \
44                 tar cfj $@ $(TOOLCHAIN_NAME); \
45         )
46
47 download:
48 prepare:
49 compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
50 install: compile
51
52 clean:
53         rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2