Zwischencommit fuer LFS.
[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 =
37
38# Normal build or /tools build.
39#
40ifeq "$(ROOT)" ""
41 TARGET = $(DIR_INFO)/$(THISAPP)
42 EXTRA_CONFIG = --prefix=/usr \
9b0ff0a0
MT
43 --libexecdir=/usr/lib --enable-shared \
44 --enable-threads=posix --enable-__cxa_atexit \
45 --enable-clocale=gnu --enable-languages=c,c++ \
857d9bf2
MT
46 --disable-nls
47 EXTRA_MAKE =
48 EXTRA_INSTALL =
cd1a2927 49else
15679d9f 50ifeq "$(PASS)" "1"
cd1a2927 51 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
dd714b8a
MT
52 EXTRA_CONFIG = --prefix=/tools \
53 --with-local-prefix=/tools --disable-nls --enable-shared \
54 --enable-languages=c
857d9bf2 55 EXTRA_MAKE = bootstrap BOOT_LDFLAGS="-static"
cd1a2927
MT
56 EXTRA_INSTALL =
57else
58 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
dd714b8a
MT
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
cd1a2927
MT
64 EXTRA_MAKE =
65 EXTRA_INSTALL =
66endif
67endif
68
69###############################################################################
70# Top-level Rules
71###############################################################################
dd714b8a 72objects = $(DL_FILE)
cd1a2927 73
857d9bf2 74$(DL_FILE = $(DL_FROM)/$(DL_FILE)
cd1a2927 75
857d9bf2 76$(DL_FILE)_MD5 = 6ff1af12c53cbb3f79b27f2d6a9a3d50
cd1a2927
MT
77
78install : $(TARGET)
79
80check : $(patsubst %,$(DIR_CHK)/%,$(objects))
81
82download :$(patsubst %,$(DIR_DL)/%,$(objects))
83
84md5 : $(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)
dd714b8a 106 @mkdir $(DIR_SRC)/gcc-build
cd1a2927 107ifeq "$(ROOT)" ""
f97be0a6
MT
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
9b0ff0a0
MT
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
dd714b8a 112
f97be0a6
MT
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
9b0ff0a0
MT
116 ln -sfv ../usr/bin/cpp /lib
117 ln -sfv gcc /usr/bin/cc
cd1a2927 118else
15679d9f 119ifeq "$(PASS)" "1"
f97be0a6 120 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
dd714b8a 121 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
cd1a2927 122 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
9b0ff0a0 123 ln -sfv gcc /tools/bin/cc
cd1a2927 124else
dd714b8a
MT
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}
90d372c4
MT
128 cd $(DIR_APP) && sed 's/^XCFLAGS =$\/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
129 > gcc/Makefile.in
9b0ff0a0 130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-specs-1.patch
f97be0a6 131 cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG)
dd714b8a
MT
132 cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE)
133 cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install
cd1a2927 134endif
cd1a2927
MT
135endif
136 @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build
137 @$(POSTBUILD)