Pakfire laedt die Listen jetzt besser und hat eine veraenderte Oberflaeche bekommen.
[ipfire-2.x.git] / lfs / gcc
CommitLineData
cd1a2927
MT
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# #
cd1a2927
MT
21###############################################################################
22
23###############################################################################
24# Definitions
25###############################################################################
26
27include Config
28
dd714b8a 29VER = 4.0.3
cd1a2927
MT
30
31THISAPP = gcc-$(VER)
dd714b8a
MT
32DL_FILE = $(THISAPP).tar.bz2
33DL_FROM = $(URL_IPFIRE)
cd1a2927
MT
34DIR_APP = $(DIR_SRC)/$(THISAPP)
35CFLAGS =
36CXXFLAGS =
a50d04ab 37TARGET_PATH = /opt/$(MACHINE)-uClibc/bin:$(PATH)
cd1a2927
MT
38
39# Normal build or /tools build.
40#
41ifeq "$(ROOT)" ""
bc9f0c12
MT
42ifeq "$(INST)" "1"
43 TARGET = $(DIR_INFO)/$(THISAPP)-install1
a50d04ab
MT
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 =
bc9f0c12
MT
59else
60ifeq "$(INST)" "2"
61 TARGET = $(DIR_INFO)/$(THISAPP)-install2
a50d04ab
MT
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 =
bc9f0c12 77else
cd1a2927
MT
78 TARGET = $(DIR_INFO)/$(THISAPP)
79 EXTRA_CONFIG = --prefix=/usr \
a50d04ab
MT
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
857d9bf2
MT
87 EXTRA_MAKE =
88 EXTRA_INSTALL =
bc9f0c12
MT
89endif
90endif
cd1a2927 91else
15679d9f 92ifeq "$(PASS)" "1"
cd1a2927 93 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
dd714b8a 94 EXTRA_CONFIG = --prefix=/tools \
a50d04ab
MT
95 --with-local-prefix=/tools \
96 --disable-nls \
97 --enable-shared \
98 --enable-languages=c
857d9bf2 99 EXTRA_MAKE = bootstrap BOOT_LDFLAGS="-static"
cd1a2927
MT
100 EXTRA_INSTALL =
101else
102 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
dd714b8a 103 EXTRA_CONFIG = --prefix=/tools \
a50d04ab
MT
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
cd1a2927
MT
111 EXTRA_MAKE =
112 EXTRA_INSTALL =
113endif
114endif
115
116###############################################################################
117# Top-level Rules
118###############################################################################
dd714b8a 119objects = $(DL_FILE)
cd1a2927 120
41921bd9 121$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
cd1a2927 122
857d9bf2 123$(DL_FILE)_MD5 = 6ff1af12c53cbb3f79b27f2d6a9a3d50
cd1a2927
MT
124
125install : $(TARGET)
126
127check : $(patsubst %,$(DIR_CHK)/%,$(objects))
128
129download :$(patsubst %,$(DIR_DL)/%,$(objects))
130
131md5 : $(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)
dd714b8a 153 @mkdir $(DIR_SRC)/gcc-build
cd1a2927 154ifeq "$(ROOT)" ""
bc9f0c12
MT
155ifeq "$(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)
a50d04ab
MT
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
bc9f0c12
MT
165else
166ifeq "$(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
a50d04ab 171 ln -snf ../include /opt/$(MACHINE)-uClibc/$(MACHINE)-linux-uclibc/sys-include
bc9f0c12 172 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
a50d04ab
MT
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)
bc9f0c12
MT
175 cp -f /opt/$(MACHINE)-uClibc/lib/libgcc_s.so /lib
176 cd /lib && ln -sf libgcc_s.so libgcc_s.so.1
177else
f97be0a6
MT
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
9b0ff0a0
MT
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
dd714b8a 182
f97be0a6
MT
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
9b0ff0a0
MT
186 ln -sfv ../usr/bin/cpp /lib
187 ln -sfv gcc /usr/bin/cc
bc9f0c12
MT
188endif
189endif
cd1a2927 190else
15679d9f 191ifeq "$(PASS)" "1"
f97be0a6 192 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
dd714b8a 193 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
cd1a2927 194 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
9b0ff0a0 195 ln -sfv gcc /tools/bin/cc
cd1a2927 196else
dd714b8a
MT
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}
90d372c4
MT
200 cd $(DIR_APP) && sed 's/^XCFLAGS =$\/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
201 > gcc/Makefile.in
9b0ff0a0 202 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-specs-1.patch
f97be0a6 203 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
dd714b8a
MT
204 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
205 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
cd1a2927 206endif
cd1a2927
MT
207endif
208 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build
209 @$(POSTBUILD)