Ticket #7148: Makefile

File Makefile, 2.1 KB (added by anonymous, 8 years ago)
Line 
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)-gcc-$(GCCV)_$(LIBC)-$(LIBCV)
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)_gcc-$(GCCV)$(DIR_SUFFIX)
30
31$(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
32        mkdir -p $(TOOLCHAIN_BUILD_DIR)
33        mkdir -p $(TOOLCHAIN_PREFIX)/usr/bin
34        $(TAR) -cf - -C $(TOPDIR)/staging_dir/  \
35               $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
36               $(BUILD_DIR_BASE)/toolchain-$(ARCH)_gcc-$(GCCV)$(DIR_SUFFIX) | \
37               $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR)
38
39        $(CP)  $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \
40                $(TOOLCHAIN_BUILD_DIR)/
41
42        $(CP) $(TOPDIR)/target/toolchain/files/wrapper.sh $(TOOLCHAIN_PREFIX)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
43        chmod +x $(TOOLCHAIN_PREFIX)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh
44        (cd $(TOOLCHAIN_PREFIX)/usr/bin; \
45                for app in cc gcc g++ c++ cpp ld as ; do \
46                        [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \
47                        ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \
48                done; \
49        )
50        echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk
51        find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf
52        find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf
53        find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
54        (cd $(BUILD_DIR); \
55                tar cfj $@ $(TOOLCHAIN_NAME); \
56        )
57
58download:
59prepare:
60compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
61install: compile
62
63clean:
64        rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2