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