]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/gcc
0cfaf72ff730ab8ccabfca4cc5d702d02e2249e0
[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
38 # Normal build or /tools build.
39 #
40 ifeq "$(ROOT)" ""
41 TARGET = $(DIR_INFO)/$(THISAPP)
42 EXTRA_CONFIG = --prefix=/usr \
43 --libexecdir=/usr/lib --enable-shared \
44 --enable-threads=posix --enable-__cxa_atexit \
45 --enable-clocale=gnu --enable-languages=c,c++ \
46 --disable-nls \
47 --host=i686-pc-linux-gnu \
48 --target=$(BUILDTARGET)
49 # This is not taken from the LFS but a fix,
50 # because the compiler tries to do a cross-compile.
51 EXTRA_MAKE = LD_LIBRARY_PATH=/usr/lib
52 EXTRA_INSTALL = LD_LIBRARY_PATH=/usr/lib
53 else
54 ifeq "$(PASS)" "1"
55 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
56 EXTRA_CONFIG = --prefix=/tools \
57 --with-local-prefix=/tools --disable-nls --enable-shared \
58 --enable-languages=c
59 EXTRA_MAKE = bootstrap #BOOT_LDFLAGS="-static"
60 EXTRA_INSTALL =
61 else
62 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
63 EXTRA_CONFIG = --prefix=/tools \
64 --with-local-prefix=/tools --enable-clocale=gnu \
65 --enable-shared --enable-threads=posix \
66 --enable-__cxa_atexit --enable-languages=c,c++ \
67 --disable-libstdcxx-pch
68 EXTRA_MAKE =
69 EXTRA_INSTALL =
70 endif
71 endif
72
73 ###############################################################################
74 # Top-level Rules
75 ###############################################################################
76 objects = $(DL_FILE)
77
78 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
79
80 $(DL_FILE)_MD5 = 6ff1af12c53cbb3f79b27f2d6a9a3d50
81
82 install : $(TARGET)
83
84 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
85
86 download :$(patsubst %,$(DIR_DL)/%,$(objects))
87
88 md5 : $(subst %,%_MD5,$(objects))
89
90 ###############################################################################
91 # Downloading, checking, md5sum
92 ###############################################################################
93
94 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
95 @$(CHECK)
96
97 $(patsubst %,$(DIR_DL)/%,$(objects)) :
98 @$(LOAD)
99
100 $(subst %,%_MD5,$(objects)) :
101 @$(MD5)
102
103 ###############################################################################
104 # Installation Details
105 ###############################################################################
106
107 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
108 @$(PREBUILD)
109 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
110 @mkdir $(DIR_SRC)/gcc-build
111 ifeq "$(ROOT)" ""
112 cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in
113 cd $(DIR_APP) && sed -i 's/^XCFLAGS =$$/& -fomit-frame-pointer/' gcc/Makefile.in
114 cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
115 cd $(DIR_APP) && sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in
116
117 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
118 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
119 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
120 ln -sfv ../usr/bin/cpp /lib
121 ln -sfv gcc /usr/bin/cc
122 else
123 ifeq "$(PASS)" "1"
124 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
125 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
126 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
127 ln -sfv gcc /tools/bin/cc
128 else
129 cd $(DIR_APP) && cp -v gcc/Makefile.in{,.orig}
130 cd $(DIR_APP) && sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
131 cd $(DIR_APP) && cp -v gcc/Makefile.in{,.tmp}
132 cd $(DIR_APP) && sed 's/^XCFLAGS =$\/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
133 > gcc/Makefile.in
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-specs-1.patch
135 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
136 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
137 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
138 endif
139 endif
140 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build
141 @$(POSTBUILD)