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