url for stuff I extracted from linksys tgz, culd be changed in one place now
[openwrt.git] / obsolete-buildroot / make / gcc-uclibc-2.95.mk
1 # Makefile for to build a gcc/uClibc toolchain
2 #
3 # Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
4 # Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 ifeq ($(GCC_2_95_TOOLCHAIN),true)
21
22 GCC_SITE:=http://www.uclibc.org/downloads/toolchain
23 GCC_SOURCE:=gcc-20011006.tar.bz2
24 GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-20011006
25 GCC_CAT:=bzcat
26
27 STLPORT_SITE=http://www.stlport.org/archive
28 STLPORT_SOURCE=STLport-4.5.3.tar.gz
29 STLPORT_DIR=$(TOOL_BUILD_DIR)/STLport-4.5.3
30 GCC_STRIP_HOST_BINARIES:=true
31
32 #############################################################
33 #
34 # Setup some initial stuff
35 #
36 #############################################################
37
38 ifeq ($(INSTALL_LIBSTDCPP),true)
39 TARGET_LANGUAGES:=c,c++
40 STLPORT_TARGET=stlport
41 else
42 TARGET_LANGUAGES:=c
43 STLPORT_TARGET=
44 endif
45
46 #############################################################
47 #
48 # build the first pass gcc compiler
49 #
50 #############################################################
51 GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc2_95-initial
52
53 $(DL_DIR)/$(GCC_SOURCE):
54 $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE)
55
56 $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
57 $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
58 touch $(GCC_DIR)/.unpacked
59
60 $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
61 # Apply any files named gcc-*.patch from the source directory to gcc
62 $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc2.95-mega.patch.bz2
63 $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc2.95-uclibc-conf.patch
64 #$(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc-uclibc2_95*.patch
65 #
66 # We do not wish to build the libstdc++ library provided with gcc,
67 # since it doesn't seem to work at all with uClibc plus gcc 2.95...
68 #
69 mv $(GCC_DIR)/libstdc++ $(GCC_DIR)/libstdc++.orig
70 mv $(GCC_DIR)/libio $(GCC_DIR)/libio.orig
71 #
72 touch $(GCC_DIR)/.patched
73
74 # The --without-headers option stopped working with gcc 3.0 and has never been
75 # # fixed, so we need to actually have working C library header files prior to
76 # # the step or libgcc will not build...
77 $(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
78 mkdir -p $(GCC_BUILD_DIR1)
79 -mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include
80 # Important! Required for limits.h to be fixed.
81 ln -sf include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
82 (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) \
83 $(GCC_DIR)/configure \
84 --prefix=$(STAGING_DIR) \
85 --build=$(GNU_HOST_NAME) \
86 --host=$(GNU_HOST_NAME) \
87 --target=$(REAL_GNU_TARGET_NAME) \
88 --enable-languages=c \
89 --disable-shared \
90 --includedir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include \
91 --with-headers=$(TOOL_BUILD_DIR)/uClibc_dev/usr/include \
92 --disable-__cxa_atexit \
93 --enable-target-optspace \
94 --with-gnu-ld \
95 $(DISABLE_NLS) \
96 $(MULTILIB) \
97 $(SOFT_FLOAT_CONFIG_OPTION) \
98 $(EXTRA_GCC_CONFIG_OPTIONS));
99 touch $(GCC_BUILD_DIR1)/.configured
100
101 $(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
102 PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) all-gcc
103 touch $(GCC_BUILD_DIR1)/.compiled
104
105 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
106 PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) install-gcc
107 #rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov
108 #rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc $(STAGING_DIR)/share/locale
109
110 gcc2_95_initial: uclibc-configured binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc
111
112 gcc2_95_initial-clean:
113 rm -rf $(GCC_BUILD_DIR1)
114 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
115
116 gcc2_95_initial-dirclean:
117 rm -rf $(GCC_BUILD_DIR1)
118
119 #############################################################
120 #
121 # STLport -- an alternative C++ library
122 #
123 #############################################################
124 STLPORT_PATCH=$(SOURCE_DIR)/STLport-4.5.3.patch
125
126 $(DL_DIR)/$(STLPORT_SOURCE):
127 $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE)
128
129 $(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH)
130 zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
131 cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1
132
133 $(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile
134 $(MAKE) ARCH=$(OPTIMIZE_FOR_CPU) PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) -C $(STLPORT_DIR)
135
136 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a
137 $(MAKE) ARCH=$(OPTIMIZE_FOR_CPU) PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) -C $(STLPORT_DIR) install
138
139 stlport: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a
140
141 stlport-source: $(DL_DIR)/$(STLPORT_SOURCE)
142
143 stlport-clean:
144 rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++*
145 rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++*
146 -$(MAKE) -C $(STLPORT_DIR) clean
147
148 stlport-dirclean:
149 rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++*
150 rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/g++-v3*
151 rm -rf $(STLPORT_DIR)
152
153 #############################################################
154 #
155 # second pass compiler build. Build the compiler targeting
156 # the newly built shared uClibc library.
157 #
158 #############################################################
159 GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc2_95-final
160
161 $(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a
162 mkdir -p $(GCC_BUILD_DIR2)
163 (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) \
164 $(GCC_DIR)/configure \
165 --prefix=$(STAGING_DIR) \
166 --build=$(GNU_HOST_NAME) \
167 --host=$(GNU_HOST_NAME) \
168 --target=$(REAL_GNU_TARGET_NAME) \
169 --enable-languages=$(TARGET_LANGUAGES) \
170 --enable-shared \
171 --with-gxx-include-dir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++ \
172 --disable-__cxa_atexit \
173 --enable-target-optspace \
174 --with-gnu-ld \
175 $(DISABLE_NLS) \
176 $(MULTILIB) \
177 $(SOFT_FLOAT_CONFIG_OPTION) \
178 $(EXTRA_GCC_CONFIG_OPTIONS));
179 touch $(GCC_BUILD_DIR2)/.configured
180
181 $(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
182 PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR2) all
183 touch $(GCC_BUILD_DIR2)/.compiled
184
185 $(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled
186 PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR2) install
187 # Strip the host binaries
188 ifeq ($(GCC_STRIP_HOST_BINARIES),true)
189 -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/*
190 endif
191 # Set up the symlinks to enable lying about target name.
192 set -e; \
193 (cd $(STAGING_DIR); \
194 ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
195 cd bin; \
196 for app in $(REAL_GNU_TARGET_NAME)-* ; do \
197 ln -sf $${app} \
198 $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
199 done; \
200 );
201 touch $(GCC_BUILD_DIR2)/.installed
202
203 gcc2_95: uclibc-configured binutils gcc2_95_initial $(LIBFLOAT_TARGET) uclibc \
204 $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) $(STLPORT_TARGET)
205
206 gcc2_95-source: $(DL_DIR)/$(GCC_SOURCE)
207
208 gcc2_95-clean:
209 rm -rf $(GCC_BUILD_DIR2)
210 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
211
212 gcc2_95-dirclean:
213 rm -rf $(GCC_BUILD_DIR2)
214
215 #############################################################
216 #
217 # Next build target gcc compiler
218 #
219 #############################################################
220 GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc2_95-target
221
222 $(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed
223 mkdir -p $(GCC_BUILD_DIR3)
224 (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \
225 $(GCC_DIR)/configure \
226 --prefix=/usr \
227 --build=$(GNU_HOST_NAME) \
228 --host=$(REAL_GNU_TARGET_NAME) \
229 --target=$(REAL_GNU_TARGET_NAME) \
230 --enable-languages=$(TARGET_LANGUAGES) \
231 --enable-shared \
232 --with-gxx-include-dir=/usr/include/c++ \
233 --disable-__cxa_atexit \
234 --enable-target-optspace \
235 --with-gnu-ld \
236 $(DISABLE_NLS) \
237 $(MULTILIB) \
238 $(SOFT_FLOAT_CONFIG_OPTION) \
239 $(EXTRA_GCC_CONFIG_OPTIONS));
240 touch $(GCC_BUILD_DIR3)/.configured
241
242 $(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured
243 PATH=$(TARGET_PATH) \
244 $(MAKE) $(JLEVEL) $(TARGET_GCC_ARGS) -C $(GCC_BUILD_DIR3) all
245 touch $(GCC_BUILD_DIR3)/.compiled
246
247 $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled
248 PATH=$(TARGET_PATH) \
249 $(MAKE) $(JLEVEL) DESTDIR=$(TARGET_DIR) -C $(GCC_BUILD_DIR3) install
250 # Remove broken specs file (cross compile flag is set).
251 rm -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
252 -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1)
253 -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1)
254 -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1)
255 -(cd $(TARGET_DIR)/usr/lib; $(STRIP) libstdc++.so.*.*.* > /dev/null 2>&1)
256 -(cd $(TARGET_DIR)/lib; $(STRIP) libgcc_s.so.*.*.* > /dev/null 2>&1)
257 #
258 rm -f $(TARGET_DIR)/usr/lib/*.la*
259 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
260 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
261 # Work around problem of missing syslimits.h
262 cp -f $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/syslimits.h $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/
263 # These are in /lib, so...
264 #rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so*
265 #touch -c $(TARGET_DIR)/usr/bin/gcc
266
267 gcc2_95_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc
268
269 gcc2_95_target-clean:
270 rm -rf $(GCC_BUILD_DIR3)
271 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
272
273 gcc2_95_target-dirclean:
274 rm -rf $(GCC_BUILD_DIR3)
275
276 endif
This page took 0.058201 seconds and 5 git commands to generate.