]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/gcc
Nochmal ein kleiner Fix fuer die Devel-Version...
[ipfire-2.x.git] / lfs / gcc
1 ###############################################################################
2 # This file is part of the IPCop Firewall. #
3 # #
4 # IPCop is free software; you can redistribute it and/or modify #
5 # it under the terms of the GNU General Public License as published by #
6 # the Free Software Foundation; either version 2 of the License, or #
7 # (at your option) any later version. #
8 # #
9 # IPCop is distributed in the hope that it will be useful, #
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 # GNU General Public License for more details. #
13 # #
14 # You should have received a copy of the GNU General Public License #
15 # along with IPCop; if not, write to the Free Software #
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
17 # #
18 # Makefiles are based on LFSMake, which is #
19 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> #
20 # #
21 ###############################################################################
22
23 ###############################################################################
24 # Definitions
25 ###############################################################################
26
27 include Config
28
29 VER = 4.0.3
30
31 THISAPP = gcc-$(VER)
32 DL_FILE = $(THISAPP).tar.bz2
33 DL_FROM = $(URL_IPFIRE)
34 DIR_APP = $(DIR_SRC)/$(THISAPP)
35 CFLAGS =
36 CXXFLAGS =
37 TARGET_PATH = /opt/$(MACHINE)-uClibc/bin:$(PATH)
38
39 # Normal build or /tools build.
40 #
41 ifeq "$(ROOT)" ""
42 ifeq "$(INST)" "1"
43 TARGET = $(DIR_INFO)/$(THISAPP)-install1
44 EXTRA_CONFIG = --prefix=/opt/$(MACHINE)-uClibc \
45 --build=$(MACHINE)-pc-linux-gnu \
46 --host=$(MACHINE)-pc-linux-gnu \
47 --target=$(MACHINE)-linux-uclibc \
48 --enable-languages=c \
49 --with-sysroot=$(DIR_SRC)/uClibc_dev \
50 --disable-__cxa_atexit \
51 --enable-target-optspace \
52 --with-gnu-ld \
53 --disable-shared \
54 --enable-threads \
55 --enable-multilib \
56 --disable-nls
57 EXTRA_MAKE =
58 EXTRA_INSTALL =
59 else
60 ifeq "$(INST)" "2"
61 TARGET = $(DIR_INFO)/$(THISAPP)-install2
62 EXTRA_CONFIG = --prefix=/opt/$(MACHINE)-uClibc \
63 --build=$(MACHINE)-pc-linux-gnu \
64 --host=$(MACHINE)-pc-linux-gnu \
65 --target=$(MACHINE)-linux-uclibc \
66 --enable-languages=c,c++ \
67 --with-sysroot=$(DIR_SRC)/uClibc_dev \
68 --disable-__cxa_atexit \
69 --enable-target-optspace \
70 --with-gnu-ld \
71 --enable-shared \
72 --disable-nls \
73 --enable-threads \
74 --enable-multilib
75 EXTRA_MAKE =
76 EXTRA_INSTALL =
77 else
78 TARGET = $(DIR_INFO)/$(THISAPP)
79 EXTRA_CONFIG = --prefix=/usr \
80 --libexecdir=/usr/lib \
81 --enable-shared \
82 --enable-threads=posix \
83 --enable-__cxa_atexit \
84 --enable-clocale=gnu \
85 --enable-languages=c,c++ \
86 --disable-nls
87 EXTRA_MAKE =
88 EXTRA_INSTALL =
89 endif
90 endif
91 else
92 ifeq "$(PASS)" "1"
93 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
94 EXTRA_CONFIG = --prefix=/tools \
95 --with-local-prefix=/tools \
96 --disable-nls \
97 --enable-shared \
98 --enable-languages=c
99 EXTRA_MAKE = bootstrap BOOT_LDFLAGS="-static"
100 EXTRA_INSTALL =
101 else
102 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
103 EXTRA_CONFIG = --prefix=/tools \
104 --with-local-prefix=/tools \
105 --enable-clocale=gnu \
106 --enable-shared \
107 --enable-threads=posix \
108 --enable-__cxa_atexit \
109 --enable-languages=c,c++ \
110 --disable-libstdcxx-pch
111 EXTRA_MAKE =
112 EXTRA_INSTALL =
113 endif
114 endif
115
116 ###############################################################################
117 # Top-level Rules
118 ###############################################################################
119 objects = $(DL_FILE)
120
121 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
122
123 $(DL_FILE)_MD5 = 6ff1af12c53cbb3f79b27f2d6a9a3d50
124
125 install : $(TARGET)
126
127 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
128
129 download :$(patsubst %,$(DIR_DL)/%,$(objects))
130
131 md5 : $(subst %,%_MD5,$(objects))
132
133 ###############################################################################
134 # Downloading, checking, md5sum
135 ###############################################################################
136
137 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
138 @$(CHECK)
139
140 $(patsubst %,$(DIR_DL)/%,$(objects)) :
141 @$(LOAD)
142
143 $(subst %,%_MD5,$(objects)) :
144 @$(MD5)
145
146 ###############################################################################
147 # Installation Details
148 ###############################################################################
149
150 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
151 @$(PREBUILD)
152 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
153 @mkdir $(DIR_SRC)/gcc-build
154 ifeq "$(ROOT)" ""
155 ifeq "$(INST)" "1"
156 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-uclibc-conf.patch
157 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
158 cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make $(MAKETUNING) all-gcc
159 cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make install-gcc
160 cd /opt/$(MACHINE)-uClibc/bin && for i in `ls -w1 $(MACHINE)-linux-uclibc-*`; do \
161 ln -svf $$i $(MACHINE)-linux-`echo $$i | cut -c 19-`; \
162 done
163 ln -svf $(MACHINE)-linux-uclibc /opt/$(MACHINE)-uClibc/$(MACHINE)-linux
164 ln -svf gcc /opt/$(MACHINE)-uClibc/$(MACHINE)-linux-uclibc/bin/cc
165 else
166 ifeq "$(INST)" "2"
167 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-uclibc-conf.patch
168 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-uclibc-locale.patch
169 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-libstdc++-pic.patch
170 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-sdk-libstdc++-includes.patch
171 ln -snf ../include /opt/$(MACHINE)-uClibc/$(MACHINE)-linux-uclibc/sys-include
172 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
173 cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make $(MAKETUNING) $(EXTRA_MAKE)
174 cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make install $(EXTRA_INSTALL)
175 cp -f /opt/$(MACHINE)-uClibc/lib/libgcc_s.so /lib
176 cd /lib && ln -sf libgcc_s.so libgcc_s.so.1
177 else
178 cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in
179 cd $(DIR_APP) && sed -i 's/^XCFLAGS =$$/& -fomit-frame-pointer/' gcc/Makefile.in
180 cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
181 cd $(DIR_APP) && sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in
182
183 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
184 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
185 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
186 ln -sfv ../usr/bin/cpp /lib
187 ln -sfv gcc /usr/bin/cc
188 endif
189 endif
190 else
191 ifeq "$(PASS)" "1"
192 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
193 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
194 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
195 ln -sfv gcc /tools/bin/cc
196 else
197 cd $(DIR_APP) && cp -v gcc/Makefile.in{,.orig}
198 cd $(DIR_APP) && sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
199 cd $(DIR_APP) && cp -v gcc/Makefile.in{,.tmp}
200 cd $(DIR_APP) && sed 's/^XCFLAGS =$\/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
201 > gcc/Makefile.in
202 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-specs-1.patch
203 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
204 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
205 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
206 endif
207 endif
208 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build
209 @$(POSTBUILD)