]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/cleanup-toolchain
Merge branch 'master' into next
[ipfire-2.x.git] / lfs / cleanup-toolchain
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = ipfire
28
29 THISAPP = cleanup-toolchain
30
31 ifeq "$(TOOLCHAIN)" "1"
32 TARGET = $(DIR_INFO)/$(THISAPP)-tools
33 else
34 TARGET = $(DIR_INFO)/$(THISAPP)
35 endif
36
37 GCC_VER = 4.1.2
38
39 ###############################################################################
40 # Top-level Rules
41 ###############################################################################
42
43 objects =
44
45 install : $(TARGET)
46
47 check :
48
49 download :
50
51 md5 :
52
53 ###############################################################################
54 # Installation Details
55 ###############################################################################
56
57 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
58 @$(PREBUILD)
59
60 ifeq "$(TOOLCHAIN)" "1"
61 # Remove the first cross compiler which is not needed anymore.
62 find /tools/ -name "$(CROSSTARGET)*" | xargs rm -rfv
63
64 # Remove man and info pages.
65 rm -rfv /tools/{,share}/{info,man}
66
67 # Strip all binaries.
68 STRIP="/usr/bin/strip" $(DIR_SRC)/src/stripper /tools/
69
70 # Fix ownership of the toolchain.
71 chown -R root:root /tools/
72
73 # Update/create linker cache.
74 /tools/sbin/ldconfig
75
76 # Set a marker when the toolchain was successfully built
77 touch /tools/.toolchain-successful
78 else
79 mv -v /tools/bin/{ld,ld-old}
80 mv -v /tools/$(BUILDTARGET)/bin/{ld,ld-old}
81 mv -v /tools/bin/{ld-new,ld}
82 ln -sv /tools/bin/ld /tools/$(BUILDTARGET)/bin/ld
83
84 gcc -dumpspecs | sed \
85 -e 's@/tools@@g' \
86 -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
87 -e '/\*cpp:/{n;s@$$@ -isystem /usr/include@}' > \
88 $$(dirname $$(gcc -print-libgcc-file-name))/specs
89 endif
90
91 @$(POSTBUILD)