Commit | Line | Data |
---|---|---|
52d7cdee | 1 | [+ AutoGen5 template -*- Mode: Makefile -*- |
405ea7a0 NN |
2 | in |
3 | +] | |
4 | ||
5 | # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. | |
6 | # | |
7 | # Makefile for directory with subdirs to build. | |
8 | # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | |
378fce5b | 9 | # 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation |
405ea7a0 NN |
10 | # |
11 | # This file is free software; you can redistribute it and/or modify | |
12 | # it under the terms of the GNU General Public License as published by | |
13 | # the Free Software Foundation; either version 2 of the License, or | |
14 | # (at your option) any later version. | |
15 | # | |
16 | # This program is distributed in the hope that it will be useful, | |
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | # GNU General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with this program; if not, write to the Free Software | |
6e4d0bcb | 23 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
405ea7a0 NN |
24 | # |
25 | ||
50212802 NN |
26 | # ------------------------------- |
27 | # Standard Autoconf-set variables | |
28 | # ------------------------------- | |
583d52d7 | 29 | VPATH=@srcdir@ |
583d52d7 NN |
30 | |
31 | build_alias=@build_alias@ | |
7f121bbf | 32 | build=@build@ |
583d52d7 | 33 | host_alias=@host_alias@ |
7f121bbf | 34 | host=@host@ |
583d52d7 | 35 | target_alias=@target_alias@ |
7f121bbf | 36 | target=@target@ |
583d52d7 | 37 | |
50212802 | 38 | program_transform_name = @program_transform_name@ |
c66d951e NN |
39 | |
40 | prefix = @prefix@ | |
41 | exec_prefix = @exec_prefix@ | |
42 | ||
50212802 NN |
43 | srcdir = @srcdir@ |
44 | ||
c66d951e NN |
45 | bindir = @bindir@ |
46 | sbindir = @sbindir@ | |
47 | libexecdir = @libexecdir@ | |
48 | datadir = @datadir@ | |
49 | sysconfdir = @sysconfdir@ | |
50 | sharedstatedir = @sharedstatedir@ | |
51 | localstatedir = @localstatedir@ | |
52 | libdir = @libdir@ | |
53 | includedir = @includedir@ | |
54 | oldincludedir = @oldincludedir@ | |
55 | infodir = @infodir@ | |
56 | mandir = @mandir@ | |
405ea7a0 NN |
57 | man1dir = $(mandir)/man1 |
58 | man2dir = $(mandir)/man2 | |
59 | man3dir = $(mandir)/man3 | |
60 | man4dir = $(mandir)/man4 | |
61 | man5dir = $(mandir)/man5 | |
62 | man6dir = $(mandir)/man6 | |
63 | man7dir = $(mandir)/man7 | |
64 | man8dir = $(mandir)/man8 | |
65 | man9dir = $(mandir)/man9 | |
405ea7a0 | 66 | |
e5c3f801 NN |
67 | INSTALL = @INSTALL@ |
68 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
69 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | |
70 | INSTALL_DATA = @INSTALL_DATA@ | |
656fdd47 PB |
71 | LN = @LN@ |
72 | LN_S = @LN_S@ | |
405ea7a0 | 73 | |
50212802 NN |
74 | # ------------------------------------------------- |
75 | # Miscellaneous non-standard autoconf-set variables | |
76 | # ------------------------------------------------- | |
405ea7a0 | 77 | |
50212802 NN |
78 | # The gcc driver likes to know the arguments it was configured with. |
79 | TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@ | |
405ea7a0 | 80 | |
50212802 NN |
81 | tooldir = @tooldir@ |
82 | build_tooldir = @build_tooldir@ | |
405ea7a0 | 83 | |
50212802 | 84 | GDB_NLM_DEPS = |
405ea7a0 | 85 | |
50212802 NN |
86 | # This is the name of the environment variable used for the path to |
87 | # the libraries. | |
88 | RPATH_ENVVAR = @RPATH_ENVVAR@ | |
405ea7a0 | 89 | |
50212802 | 90 | # This is the list of directories to be built for the build system. |
be75bbe1 | 91 | BUILD_CONFIGDIRS = libiberty |
50212802 NN |
92 | # Build programs are put under this directory. |
93 | BUILD_SUBDIR = @build_subdir@ | |
94 | # This is set by the configure script to the arguments to use when configuring | |
95 | # directories built for the build system. | |
a7254363 | 96 | BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)" |
6a9cf61e PB |
97 | |
98 | # This is the list of variables to export in the environment when | |
99 | # configuring any subdirectory. It must also be exported whenever | |
100 | # recursing into a build directory in case that directory's Makefile | |
101 | # re-runs configure. | |
102 | BASE_EXPORTS = \ | |
103 | FLEX="$(FLEX)"; export FLEX; \ | |
104 | LEX="$(LEX)"; export LEX; \ | |
105 | BISON="$(BISON)"; export BISON; \ | |
106 | YACC="$(YACC)"; export YACC; \ | |
107 | M4="$(M4)"; export M4; \ | |
108 | MAKEINFO="$(MAKEINFO)"; export MAKEINFO; | |
109 | ||
378fce5b | 110 | # This is the list of variables to export in the environment when |
6a9cf61e | 111 | # configuring subdirectories for the build system. |
378fce5b | 112 | BUILD_EXPORTS = \ |
6a9cf61e | 113 | $(BASE_EXPORTS) \ |
378fce5b DD |
114 | AR="$(AR_FOR_BUILD)"; export AR; \ |
115 | AS="$(AS_FOR_BUILD)"; export AS; \ | |
116 | CC="$(CC_FOR_BUILD)"; export CC; \ | |
117 | CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ | |
118 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
119 | CXX="$(CXX_FOR_BUILD)"; export CXX; \ | |
120 | CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ | |
121 | GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ | |
122 | GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ | |
123 | DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ | |
124 | LD="$(LD_FOR_BUILD)"; export LD; \ | |
125 | LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ | |
126 | NM="$(NM_FOR_BUILD)"; export NM; \ | |
127 | RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ | |
128 | WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; | |
50212802 NN |
129 | |
130 | # This is the list of directories to built for the host system. | |
131 | SUBDIRS = @configdirs@ | |
132 | # This is set by the configure script to the arguments to use when configuring | |
133 | # directories built for the host system. | |
134 | HOST_CONFIGARGS = @host_configargs@ | |
b00612cc PB |
135 | # Host programs are put under this directory, which is . except if building |
136 | # with srcdir=.. | |
137 | HOST_SUBDIR = @host_subdir@ | |
378fce5b | 138 | # This is the list of variables to export in the environment when |
6a9cf61e | 139 | # configuring subdirectories for the host system. |
378fce5b | 140 | HOST_EXPORTS = \ |
6a9cf61e | 141 | $(BASE_EXPORTS) \ |
378fce5b DD |
142 | CC="$(CC)"; export CC; \ |
143 | CFLAGS="$(CFLAGS)"; export CFLAGS; \ | |
144 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
145 | CXX="$(CXX)"; export CXX; \ | |
146 | CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ | |
147 | AR="$(AR)"; export AR; \ | |
148 | AS="$(AS)"; export AS; \ | |
149 | CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ | |
150 | DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ | |
151 | LD="$(LD)"; export LD; \ | |
152 | LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ | |
153 | NM="$(NM)"; export NM; \ | |
154 | RANLIB="$(RANLIB)"; export RANLIB; \ | |
155 | WINDRES="$(WINDRES)"; export WINDRES; \ | |
156 | OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ | |
95b6a1f2 | 157 | OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ |
378fce5b DD |
158 | TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ |
159 | GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ | |
315b3b02 | 160 | GMPINC="$(HOST_GMPINC)"; export GMPINC; \ |
e90269c8 | 161 | $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); |
378fce5b DD |
162 | |
163 | # Similar, for later GCC stages. | |
d545f33b | 164 | POSTSTAGE1_HOST_EXPORTS = \ |
e90269c8 | 165 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ |
7ffa0b57 | 166 | $(HOST_EXPORTS) \ |
b00612cc PB |
167 | CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ |
168 | -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \ | |
169 | CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \ | |
170 | $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ | |
171 | -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ | |
172 | -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; | |
50212802 NN |
173 | |
174 | # This is set by the configure script to the list of directories which | |
175 | # should be built using the target tools. | |
176 | TARGET_CONFIGDIRS = @target_configdirs@ | |
177 | # Target libraries are put under this directory: | |
178 | TARGET_SUBDIR = @target_subdir@ | |
179 | # This is set by the configure script to the arguments to use when configuring | |
180 | # directories built for the target. | |
a7254363 | 181 | TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)" |
378fce5b | 182 | # This is the list of variables to export in the environment when |
6a9cf61e | 183 | # configuring subdirectories for the host system. |
378fce5b | 184 | BASE_TARGET_EXPORTS = \ |
6a9cf61e | 185 | $(BASE_EXPORTS) \ |
378fce5b DD |
186 | AR="$(AR_FOR_TARGET)"; export AR; \ |
187 | AS="$(AS_FOR_TARGET)"; export AS; \ | |
188 | CC="$(CC_FOR_TARGET)"; export CC; \ | |
189 | CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ | |
190 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
06bcb89d | 191 | CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ |
378fce5b DD |
192 | CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ |
193 | GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ | |
194 | GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \ | |
195 | DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ | |
196 | LD="$(LD_FOR_TARGET)"; export LD; \ | |
197 | LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ | |
198 | NM="$(NM_FOR_TARGET)"; export NM; \ | |
199 | RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ | |
315b3b02 | 200 | WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ |
e90269c8 | 201 | $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); |
378fce5b DD |
202 | |
203 | RAW_CXX_TARGET_EXPORTS = \ | |
204 | $(BASE_TARGET_EXPORTS) \ | |
205 | CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ | |
206 | CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; | |
207 | ||
208 | NORMAL_TARGET_EXPORTS = \ | |
209 | $(BASE_TARGET_EXPORTS) \ | |
210 | CXX="$(CXX_FOR_TARGET)"; export CXX; | |
50212802 | 211 | |
4b1cb4fe DD |
212 | # Where to find GMP |
213 | HOST_GMPLIBS = @gmplibs@ | |
214 | HOST_GMPINC = @gmpinc@ | |
215 | ||
50212802 NN |
216 | # ---------------------------------------------- |
217 | # Programs producing files for the BUILD machine | |
218 | # ---------------------------------------------- | |
219 | ||
220 | SHELL = @config_shell@ | |
221 | ||
222 | # pwd command to use. Allow user to override default by setting PWDCMD in | |
223 | # the environment to account for automounters. The make variable must not | |
224 | # be called PWDCMD, otherwise the value set here is passed to make | |
225 | # subprocesses and overrides the setting from the user's environment. | |
b40e3958 L |
226 | # Don't use PWD since it is a common shell environment variable and we |
227 | # don't want to corrupt it. | |
228 | PWD_COMMAND = $${PWDCMD-pwd} | |
50212802 NN |
229 | |
230 | # compilers to use to create programs which must be run in the build | |
231 | # environment. | |
232 | CC_FOR_BUILD = @CC_FOR_BUILD@ | |
5fbad20a | 233 | CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ |
50212802 NN |
234 | |
235 | CXX_FOR_BUILD = $(CXX) | |
236 | ||
237 | # Special variables passed down in EXTRA_GCC_FLAGS. They are defined | |
238 | # here so that they can be overridden by Makefile fragments. | |
50212802 NN |
239 | BUILD_PREFIX = @BUILD_PREFIX@ |
240 | BUILD_PREFIX_1 = @BUILD_PREFIX_1@ | |
405ea7a0 | 241 | |
0df3d27f PB |
242 | # Flags to pass to stage2 and later makes. They are defined |
243 | # here so that they can be overridden by Makefile fragments. | |
244 | BOOT_CFLAGS= -g -O2 | |
245 | ||
6a9cf61e | 246 | CONFIGURED_BISON = @CONFIGURED_BISON@ |
72b2455a PB |
247 | BISON = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \ |
248 | echo $$r/$(BUILD_SUBDIR)/bison/tests/bison ; \ | |
405ea7a0 | 249 | else \ |
6a9cf61e | 250 | echo ${CONFIGURED_BISON} ; \ |
405ea7a0 NN |
251 | fi` |
252 | ||
6a9cf61e | 253 | CONFIGURED_YACC = @CONFIGURED_YACC@ |
72b2455a PB |
254 | YACC = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \ |
255 | echo $$r/$(BUILD_SUBDIR)/bison/tests/bison -y ; \ | |
256 | elif [ -f $$r/$(BUILD_SUBDIR)/byacc/byacc ] ; then \ | |
257 | echo $$r/$(BUILD_SUBDIR)/byacc/byacc ; \ | |
405ea7a0 | 258 | else \ |
6a9cf61e | 259 | echo ${CONFIGURED_YACC} ; \ |
405ea7a0 NN |
260 | fi` |
261 | ||
6a9cf61e | 262 | CONFIGURED_FLEX = @CONFIGURED_FLEX@ |
72b2455a PB |
263 | FLEX = `if [ -f $$r/$(BUILD_SUBDIR)/flex/flex ] ; \ |
264 | then echo $$r/$(BUILD_SUBDIR)/flex/flex ; \ | |
6a9cf61e PB |
265 | else echo ${CONFIGURED_FLEX} ; fi` |
266 | ||
267 | CONFIGURED_LEX = @CONFIGURED_LEX@ | |
72b2455a PB |
268 | LEX = `if [ -f $$r/$(BUILD_SUBDIR)/flex/flex ] ; \ |
269 | then echo $$r/$(BUILD_SUBDIR)/flex/flex ; \ | |
6a9cf61e | 270 | else echo ${CONFIGURED_LEX} ; fi` |
405ea7a0 | 271 | |
6a9cf61e | 272 | CONFIGURED_M4 = @CONFIGURED_M4@ |
72b2455a PB |
273 | M4 = `if [ -f $$r/$(BUILD_SUBDIR)/m4/m4 ] ; \ |
274 | then echo $$r/$(BUILD_SUBDIR)/m4/m4 ; \ | |
6a9cf61e | 275 | else echo ${CONFIGURED_M4} ; fi` |
405ea7a0 | 276 | |
77f7441a | 277 | # For an installed makeinfo, we require it to be from texinfo 4.2 or |
6a9cf61e PB |
278 | # higher, else we use the "missing" dummy. We also pass the subdirectory |
279 | # makeinfo even if only the Makefile is there, because Texinfo builds its | |
280 | # manual when made, and it requires its own version. | |
281 | CONFIGURED_MAKEINFO = @CONFIGURED_MAKEINFO@ | |
72b2455a PB |
282 | MAKEINFO = `if [ -f $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/Makefile ] ; \ |
283 | then echo $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo ; \ | |
6a9cf61e | 284 | else if (${CONFIGURED_MAKEINFO} --version \ |
77f7441a | 285 | | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \ |
6a9cf61e | 286 | then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi` |
405ea7a0 NN |
287 | |
288 | # This just becomes part of the MAKEINFO definition passed down to | |
289 | # sub-makes. It lets flags be given on the command line while still | |
290 | # using the makeinfo from the object tree. | |
62a3fc85 DD |
291 | # (Default to avoid splitting info files by setting the threshold high.) |
292 | MAKEINFOFLAGS = --split-size=5000000 | |
405ea7a0 | 293 | |
b00612cc PB |
294 | # FIXME: expect may become a build tool? |
295 | EXPECT = `if [ -f $$r/$(HOST_SUBDIR)/expect/expect ] ; \ | |
296 | then echo $$r/$(HOST_SUBDIR)/expect/expect ; \ | |
405ea7a0 NN |
297 | else echo expect ; fi` |
298 | ||
299 | RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \ | |
300 | then echo $$s/dejagnu/runtest ; \ | |
301 | else echo runtest ; fi` | |
302 | ||
50212802 NN |
303 | # --------------------------------------------- |
304 | # Programs producing files for the HOST machine | |
305 | # --------------------------------------------- | |
405ea7a0 | 306 | |
50212802 | 307 | AS = @AS@ |
405ea7a0 | 308 | |
50212802 NN |
309 | AR = @AR@ |
310 | AR_FLAGS = rc | |
405ea7a0 | 311 | |
50212802 NN |
312 | CC = @CC@ |
313 | CFLAGS = @CFLAGS@ | |
314 | LIBCFLAGS = $(CFLAGS) | |
405ea7a0 | 315 | |
50212802 NN |
316 | CXX = @CXX@ |
317 | CXXFLAGS = @CXXFLAGS@ | |
318 | LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates | |
405ea7a0 | 319 | |
50212802 | 320 | DLLTOOL = @DLLTOOL@ |
405ea7a0 | 321 | |
50212802 | 322 | NM = @NM@ |
15723a45 | 323 | |
50212802 NN |
324 | LD = @LD@ |
325 | LDFLAGS = | |
15723a45 | 326 | |
50212802 | 327 | RANLIB = @RANLIB@ |
405ea7a0 | 328 | |
50212802 | 329 | WINDRES = @WINDRES@ |
405ea7a0 | 330 | |
50212802 NN |
331 | PICFLAG = |
332 | ||
333 | # ----------------------------------------------- | |
334 | # Programs producing files for the TARGET machine | |
335 | # ----------------------------------------------- | |
405ea7a0 | 336 | |
58daee98 | 337 | FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ |
405ea7a0 | 338 | |
50212802 | 339 | AR_FOR_TARGET=@AR_FOR_TARGET@ |
54752a6b | 340 | CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@ |
50212802 | 341 | USUAL_AR_FOR_TARGET = ` \ |
b00612cc PB |
342 | if [ -f $$r/$(HOST_SUBDIR)/binutils/ar ] ; then \ |
343 | echo $$r/$(HOST_SUBDIR)/binutils/ar ; \ | |
50212802 | 344 | else \ |
7f121bbf | 345 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 NN |
346 | echo $(AR); \ |
347 | else \ | |
54752a6b | 348 | echo $(CONFIGURED_AR_FOR_TARGET) ; \ |
50212802 NN |
349 | fi; \ |
350 | fi` | |
405ea7a0 | 351 | |
852e5f18 | 352 | AS_FOR_TARGET=@AS_FOR_TARGET@ |
54752a6b | 353 | CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@ |
852e5f18 | 354 | USUAL_AS_FOR_TARGET = ` \ |
b00612cc PB |
355 | if [ -f $$r/$(HOST_SUBDIR)/gas/as-new ] ; then \ |
356 | echo $$r/$(HOST_SUBDIR)/gas/as-new ; \ | |
55db4b87 PB |
357 | elif [ -f $$r/$(HOST_SUBDIR)/gcc/as ]; then \ |
358 | echo $$r/$(HOST_SUBDIR)/gcc/as ; \ | |
405ea7a0 | 359 | else \ |
7f121bbf | 360 | if [ '$(host)' = '$(target)' ] ; then \ |
405ea7a0 NN |
361 | echo $(AS); \ |
362 | else \ | |
54752a6b | 363 | echo $(CONFIGURED_AS_FOR_TARGET) ; \ |
405ea7a0 NN |
364 | fi; \ |
365 | fi` | |
366 | ||
55db4b87 PB |
367 | CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET) |
368 | CONFIGURED_CC_FOR_TARGET=@CONFIGURED_CC_FOR_TARGET@ | |
369 | USUAL_CC_FOR_TARGET = ` \ | |
370 | if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \ | |
e1e3d0f5 | 371 | echo $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ ; \ |
55db4b87 PB |
372 | else \ |
373 | if [ '$(host)' = '$(target)' ] ; then \ | |
374 | echo $(CC); \ | |
375 | else \ | |
376 | echo $(CONFIGURED_CC_FOR_TARGET) ; \ | |
377 | fi; \ | |
378 | fi` | |
379 | ||
50212802 NN |
380 | # During gcc bootstrap, if we use some random cc for stage1 then |
381 | # CFLAGS will be just -g. We want to ensure that TARGET libraries | |
382 | # (which we know are built with gcc) are built with optimizations so | |
383 | # prepend -O2 when setting CFLAGS_FOR_TARGET. | |
a19b6204 | 384 | CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) |
55db4b87 PB |
385 | SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ |
386 | ||
50212802 NN |
387 | # If GCC_FOR_TARGET is not overriden on the command line, then this |
388 | # variable is passed down to the gcc Makefile, where it is used to | |
389 | # build libgcc2.a. We define it here so that it can itself be | |
390 | # overridden on the command line. | |
391 | GCC_FOR_TARGET=@GCC_FOR_TARGET@ | |
55db4b87 | 392 | CONFIGURED_GCC_FOR_TARGET=@CONFIGURED_GCC_FOR_TARGET@ |
b00612cc PB |
393 | USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) \ |
394 | $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ $(FLAGS_FOR_TARGET) | |
50212802 NN |
395 | LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) |
396 | ||
55db4b87 PB |
397 | CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) |
398 | CONFIGURED_CXX_FOR_TARGET=@CONFIGURED_CXX_FOR_TARGET@ | |
399 | USUAL_CXX_FOR_TARGET = ` \ | |
400 | if [ -f $$r/$(HOST_SUBDIR)/gcc/g++ ] ; then \ | |
401 | (echo $$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++; \ | |
402 | test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; \ | |
403 | echo -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs) | tr '\015\012' ' '; \ | |
404 | else \ | |
405 | if [ '$(host)' = '$(target)' ] ; then \ | |
406 | echo $(CXX); \ | |
407 | else \ | |
408 | echo $(CONFIGURED_CXX_FOR_TARGET) ; \ | |
409 | fi; \ | |
410 | fi` | |
411 | ||
412 | RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) | |
413 | USUAL_RAW_CXX_FOR_TARGET = ` \ | |
414 | if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \ | |
415 | echo $$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs; \ | |
416 | else \ | |
417 | if [ '$(host)' = '$(target)' ] ; then \ | |
418 | echo $(CXX); \ | |
419 | else \ | |
420 | echo $(CONFIGURED_CXX_FOR_TARGET) ; \ | |
421 | fi; \ | |
422 | fi` | |
423 | ||
a19b6204 | 424 | CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) |
50212802 | 425 | LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates |
405ea7a0 | 426 | |
55db4b87 PB |
427 | GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) |
428 | CONFIGURED_GCJ_FOR_TARGET=@CONFIGURED_GCJ_FOR_TARGET@ | |
429 | USUAL_GCJ_FOR_TARGET = ` \ | |
430 | if [ -f $$r/$(HOST_SUBDIR)/gcc/gcj ] ; then \ | |
431 | echo $$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc ; \ | |
432 | else \ | |
433 | if [ '$(host)' = '$(target)' ] ; then \ | |
434 | echo $(GCJ); \ | |
435 | else \ | |
436 | echo $(CONFIGURED_GCJ_FOR_TARGET) ; \ | |
437 | fi; \ | |
438 | fi` | |
439 | ||
440 | GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET) | |
441 | CONFIGURED_GFORTRAN_FOR_TARGET=@CONFIGURED_GFORTRAN_FOR_TARGET@ | |
442 | USUAL_GFORTRAN_FOR_TARGET = ` \ | |
443 | if [ -f $$r/$(HOST_SUBDIR)/gcc/gfortran ] ; then \ | |
444 | echo $$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc ; \ | |
445 | else \ | |
446 | if [ '$(host)' = '$(target)' ] ; then \ | |
447 | echo $(GFORTRAN); \ | |
448 | else \ | |
449 | echo $(CONFIGURED_GFORTRAN_FOR_TARGET) ; \ | |
450 | fi; \ | |
451 | fi` | |
452 | ||
453 | ||
852e5f18 | 454 | DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ |
54752a6b | 455 | CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@ |
852e5f18 | 456 | USUAL_DLLTOOL_FOR_TARGET = ` \ |
b00612cc PB |
457 | if [ -f $$r/$(HOST_SUBDIR)/binutils/dlltool ] ; then \ |
458 | echo $$r/$(HOST_SUBDIR)/binutils/dlltool ; \ | |
405ea7a0 | 459 | else \ |
7f121bbf | 460 | if [ '$(host)' = '$(target)' ] ; then \ |
405ea7a0 NN |
461 | echo $(DLLTOOL); \ |
462 | else \ | |
54752a6b | 463 | echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \ |
405ea7a0 NN |
464 | fi; \ |
465 | fi` | |
466 | ||
50212802 | 467 | LD_FOR_TARGET=@LD_FOR_TARGET@ |
54752a6b | 468 | CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@ |
50212802 | 469 | USUAL_LD_FOR_TARGET = ` \ |
b00612cc PB |
470 | if [ -f $$r/$(HOST_SUBDIR)/ld/ld-new ] ; then \ |
471 | echo $$r/$(HOST_SUBDIR)/ld/ld-new ; \ | |
55db4b87 PB |
472 | elif [ -f $$r/$(HOST_SUBDIR)/gcc/collect-ld ]; then \ |
473 | echo $$r/$(HOST_SUBDIR)/gcc/collect-ld ; \ | |
405ea7a0 | 474 | else \ |
7f121bbf | 475 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 | 476 | echo $(LD); \ |
405ea7a0 | 477 | else \ |
54752a6b | 478 | echo $(CONFIGURED_LD_FOR_TARGET) ; \ |
405ea7a0 NN |
479 | fi; \ |
480 | fi` | |
481 | ||
50212802 NN |
482 | LDFLAGS_FOR_TARGET = |
483 | ||
484 | NM_FOR_TARGET=@NM_FOR_TARGET@ | |
54752a6b | 485 | CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@ |
50212802 | 486 | USUAL_NM_FOR_TARGET = ` \ |
b00612cc PB |
487 | if [ -f $$r/$(HOST_SUBDIR)/binutils/nm-new ] ; then \ |
488 | echo $$r/$(HOST_SUBDIR)/binutils/nm-new ; \ | |
55db4b87 PB |
489 | elif [ -f $$r/$(HOST_SUBDIR)/gcc/nm ]; then \ |
490 | echo $$r/$(HOST_SUBDIR)/gcc/nm ; \ | |
405ea7a0 | 491 | else \ |
7f121bbf | 492 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 | 493 | echo $(NM); \ |
405ea7a0 | 494 | else \ |
54752a6b | 495 | echo $(CONFIGURED_NM_FOR_TARGET) ; \ |
405ea7a0 NN |
496 | fi; \ |
497 | fi` | |
498 | ||
852e5f18 | 499 | RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@ |
54752a6b | 500 | CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@ |
852e5f18 | 501 | USUAL_RANLIB_FOR_TARGET = ` \ |
b00612cc PB |
502 | if [ -f $$r/$(HOST_SUBDIR)/binutils/ranlib ] ; then \ |
503 | echo $$r/$(HOST_SUBDIR)/binutils/ranlib ; \ | |
405ea7a0 | 504 | else \ |
7f121bbf | 505 | if [ '$(host)' = '$(target)' ] ; then \ |
405ea7a0 NN |
506 | if [ x'$(RANLIB)' != x ]; then \ |
507 | echo $(RANLIB); \ | |
508 | else \ | |
509 | echo ranlib; \ | |
510 | fi; \ | |
511 | else \ | |
54752a6b | 512 | echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \ |
405ea7a0 NN |
513 | fi; \ |
514 | fi` | |
515 | ||
50212802 | 516 | WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@ |
54752a6b | 517 | CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@ |
50212802 | 518 | USUAL_WINDRES_FOR_TARGET = ` \ |
b00612cc PB |
519 | if [ -f $$r/$(HOST_SUBDIR)/binutils/windres ] ; then \ |
520 | echo $$r/$(HOST_SUBDIR)/binutils/windres ; \ | |
405ea7a0 | 521 | else \ |
7f121bbf | 522 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 | 523 | echo $(WINDRES); \ |
405ea7a0 | 524 | else \ |
54752a6b | 525 | echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \ |
405ea7a0 NN |
526 | fi; \ |
527 | fi` | |
528 | ||
50212802 NN |
529 | PICFLAG_FOR_TARGET = |
530 | ||
531 | # ------------------------------------ | |
532 | # Miscellaneous targets and flag lists | |
533 | # ------------------------------------ | |
534 | ||
405ea7a0 NN |
535 | # The first rule in the file had better be this one. Don't put any above it. |
536 | # This lives here to allow makefile fragments to contain dependencies. | |
319cab08 | 537 | @default_target@: |
405ea7a0 | 538 | |
405ea7a0 | 539 | #### host and target specific makefile fragments come in here. |
a0da8069 NN |
540 | @target_makefile_frag@ |
541 | @alphaieee_frag@ | |
542 | @ospace_frag@ | |
543 | @host_makefile_frag@ | |
405ea7a0 NN |
544 | ### |
545 | ||
e90269c8 PB |
546 | # This is the list of directories that may be needed in RPATH_ENVVAR |
547 | # so that prorgams built for the target machine work. | |
548 | TARGET_LIB_PATH = [+ FOR target_modules +][+ | |
549 | IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ | |
550 | ENDFOR target_modules +]$(HOST_LIB_PATH_gcc) | |
551 | [+ FOR target_modules +][+ IF lib_path +] | |
552 | @if target-[+module+] | |
553 | TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]: | |
554 | @endif target-[+module+] | |
555 | [+ ENDIF lib_path +][+ ENDFOR target_modules +] | |
556 | ||
557 | ||
558 | # This is the list of directories that may be needed in RPATH_ENVVAR | |
559 | # so that programs built for the host machine work. | |
560 | HOST_LIB_PATH = [+ FOR host_modules +][+ | |
561 | IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ | |
562 | ENDFOR host_modules +] | |
563 | ||
564 | # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch | |
565 | @if gcc | |
566 | HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc: | |
567 | @endif gcc | |
568 | ||
569 | [+ FOR host_modules +][+ IF lib_path +] | |
570 | @if [+module+] | |
571 | HOST_LIB_PATH_[+module+] = \ | |
572 | $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap | |
573 | +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +] | |
574 | @endif [+module+] | |
575 | [+ ENDIF lib_path +][+ ENDFOR host_modules +] | |
576 | ||
405ea7a0 | 577 | # Flags to pass down to all sub-makes. |
12f0bd74 NN |
578 | BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\ |
579 | "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\ | |
10ecffb9 | 580 | "CONFIG_SHELL=$(SHELL)" \ |
12f0bd74 | 581 | "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" |
405ea7a0 | 582 | |
55db4b87 PB |
583 | # We leave this in just in case, but it is not needed anymore. |
584 | RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) | |
656fdd47 | 585 | |
405ea7a0 NN |
586 | # Flags to pass down to most sub-makes, in which we're building with |
587 | # the host environment. | |
405ea7a0 NN |
588 | EXTRA_HOST_FLAGS = \ |
589 | 'AR=$(AR)' \ | |
590 | 'AS=$(AS)' \ | |
591 | 'CC=$(CC)' \ | |
592 | 'CXX=$(CXX)' \ | |
593 | 'DLLTOOL=$(DLLTOOL)' \ | |
594 | 'LD=$(LD)' \ | |
595 | 'NM=$(NM)' \ | |
b9459e83 | 596 | 'RANLIB=$(RANLIB)' \ |
405ea7a0 NN |
597 | 'WINDRES=$(WINDRES)' |
598 | ||
599 | FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) | |
600 | ||
601 | # Flags that are concerned with the location of the X11 include files | |
602 | # and library files | |
603 | # | |
604 | # NOTE: until the top-level is getting the values via autoconf, it only | |
605 | # causes problems to have this top-level Makefile overriding the autoconf-set | |
606 | # values in child directories. Only variables that don't conflict with | |
607 | # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now. | |
608 | # | |
609 | X11_FLAGS_TO_PASS = \ | |
610 | 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \ | |
611 | 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)' | |
612 | ||
613 | # Flags to pass down to makes which are built with the target environment. | |
614 | # The double $ decreases the length of the command line; the variables | |
615 | # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. | |
405ea7a0 NN |
616 | EXTRA_TARGET_FLAGS = \ |
617 | 'AR=$$(AR_FOR_TARGET)' \ | |
618 | 'AS=$$(AS_FOR_TARGET)' \ | |
619 | 'CC=$$(CC_FOR_TARGET)' \ | |
620 | 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ | |
621 | 'CXX=$$(CXX_FOR_TARGET)' \ | |
622 | 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ | |
623 | 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ | |
624 | 'LD=$$(LD_FOR_TARGET)' \ | |
414e5532 | 625 | 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ |
405ea7a0 NN |
626 | 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \ |
627 | 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \ | |
628 | 'NM=$$(NM_FOR_TARGET)' \ | |
629 | 'RANLIB=$$(RANLIB_FOR_TARGET)' \ | |
630 | 'WINDRES=$$(WINDRES_FOR_TARGET)' | |
631 | ||
632 | TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) | |
633 | ||
634 | # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it | |
635 | # unfortunately needs the native compiler and the target ar and | |
636 | # ranlib. | |
637 | # If any variables are added here, they must be added to do-*, below. | |
2a4cbe27 | 638 | # The BUILD_* variables are a special case, which are used for the gcc |
405ea7a0 NN |
639 | # cross-building scheme. |
640 | EXTRA_GCC_FLAGS = \ | |
405ea7a0 NN |
641 | 'BUILD_PREFIX=$(BUILD_PREFIX)' \ |
642 | 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \ | |
405ea7a0 | 643 | "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ |
3dee29da NN |
644 | "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ |
645 | "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
646 | "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
647 | "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
648 | "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
649 | "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
650 | "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
651 | "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
652 | "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" | |
405ea7a0 | 653 | |
f0b24077 | 654 | GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) |
405ea7a0 | 655 | |
dd12c3a8 | 656 | .PHONY: configure-host |
b813574b | 657 | configure-host: [+ |
dd12c3a8 NN |
658 | FOR host_modules +] \ |
659 | maybe-configure-[+module+][+ | |
660 | ENDFOR host_modules +] | |
661 | .PHONY: configure-target | |
662 | configure-target: [+ | |
663 | FOR target_modules +] \ | |
664 | maybe-configure-target-[+module+][+ | |
665 | ENDFOR target_modules +] | |
405ea7a0 | 666 | |
319cab08 PB |
667 | # The target built for a native non-bootstrap build. |
668 | .PHONY: all | |
72b2455a | 669 | all: unstage all-host all-target stage |
dd12c3a8 | 670 | |
6a9cf61e PB |
671 | .PHONY: all-build |
672 | all-build: [+ | |
673 | FOR build_modules +] \ | |
674 | maybe-all-build-[+module+][+ | |
675 | ENDFOR build_modules +] | |
dd12c3a8 | 676 | .PHONY: all-host |
b813574b | 677 | all-host: [+ |
dd12c3a8 NN |
678 | FOR host_modules +] \ |
679 | maybe-all-[+module+][+ | |
680 | ENDFOR host_modules +] | |
681 | .PHONY: all-target | |
682 | all-target: [+ | |
683 | FOR target_modules +] \ | |
684 | maybe-all-target-[+module+][+ | |
685 | ENDFOR target_modules +] | |
405ea7a0 NN |
686 | |
687 | # Do a target for all the subdirectories. A ``make do-X'' will do a | |
688 | # ``make X'' in all subdirectories (because, in general, there is a | |
689 | # dependency (below) of X upon do-X, a ``make X'' will also do this, | |
690 | # but it may do additional work as well). | |
e393202e | 691 | [+ FOR recursive_targets +] |
27b1cc72 | 692 | .PHONY: do-[+make_target+] |
b813574b | 693 | do-[+make_target+]: unstage [+make_target+]-host [+make_target+]-target stage |
2a4cbe27 NN |
694 | |
695 | .PHONY: [+make_target+]-host | |
b813574b | 696 | [+make_target+]-host: [+ |
2a4cbe27 NN |
697 | FOR host_modules +] \ |
698 | maybe-[+make_target+]-[+module+][+ | |
699 | ENDFOR host_modules +] | |
700 | ||
701 | .PHONY: [+make_target+]-target | |
702 | [+make_target+]-target: [+ | |
703 | FOR target_modules +] \ | |
704 | maybe-[+make_target+]-target-[+module+][+ | |
705 | ENDFOR target_modules +] | |
e393202e NN |
706 | [+ ENDFOR recursive_targets +] |
707 | ||
405ea7a0 NN |
708 | # Here are the targets which correspond to the do-X targets. |
709 | ||
6d389afc | 710 | .PHONY: info installcheck dvi html install-info |
405ea7a0 NN |
711 | .PHONY: clean distclean mostlyclean maintainer-clean realclean |
712 | .PHONY: local-clean local-distclean local-maintainer-clean | |
713 | info: do-info | |
714 | installcheck: do-installcheck | |
715 | dvi: do-dvi | |
6d389afc | 716 | html: do-html |
405ea7a0 | 717 | |
43d92c63 NN |
718 | # Make sure makeinfo is built before we do a `make info', if we're |
719 | # in fact building texinfo. | |
720 | do-info: maybe-all-texinfo | |
405ea7a0 NN |
721 | |
722 | install-info: do-install-info dir.info | |
b40e3958 | 723 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
405ea7a0 | 724 | if [ -f dir.info ] ; then \ |
497f816e | 725 | $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \ |
405ea7a0 NN |
726 | else true ; fi |
727 | ||
728 | local-clean: | |
729 | -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log | |
730 | ||
731 | local-distclean: | |
732 | -rm -f Makefile config.status config.cache mh-frag mt-frag | |
e6bfb94a | 733 | -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp |
405ea7a0 NN |
734 | -if [ "$(TARGET_SUBDIR)" != "." ]; then \ |
735 | rm -rf $(TARGET_SUBDIR); \ | |
736 | else true; fi | |
e4c4d240 | 737 | -rm -rf $(BUILD_SUBDIR) |
b00612cc PB |
738 | -if [ "$(HOST_SUBDIR)" != "." ]; then \ |
739 | rm -rf $(HOST_SUBDIR); \ | |
740 | else true; fi | |
405ea7a0 NN |
741 | -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile |
742 | -rm -f texinfo/doc/Makefile texinfo/po/POTFILES | |
743 | -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null | |
744 | -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null | |
745 | -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null | |
746 | ||
747 | local-maintainer-clean: | |
748 | @echo "This command is intended for maintainers to use;" | |
749 | @echo "it deletes files that may require special tools to rebuild." | |
750 | ||
751 | clean: do-clean local-clean | |
752 | mostlyclean: do-mostlyclean local-clean | |
753 | distclean: do-distclean local-clean local-distclean | |
754 | maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean | |
755 | maintainer-clean: local-distclean | |
756 | realclean: maintainer-clean | |
757 | ||
2a4cbe27 NN |
758 | # Extra dependency for clean-target, owing to the mixed nature of gcc |
759 | clean-target: clean-target-libgcc | |
405ea7a0 NN |
760 | clean-target-libgcc: |
761 | test ! -d gcc/libgcc || \ | |
762 | (cd gcc/libgcc && find . -type d -print) | \ | |
763 | while read d; do rm -f gcc/$$d/libgcc.a || : ; done | |
764 | -rm -rf gcc/libgcc | |
6c8e6ce9 | 765 | -rm -f gcc/stmp-dirs |
405ea7a0 NN |
766 | |
767 | # Check target. | |
768 | ||
769 | .PHONY: check do-check | |
ede4fbe4 | 770 | check: do-check |
405ea7a0 | 771 | |
3866be5d | 772 | # Only include modules actually being configured and built. |
b813574b | 773 | do-check: unstage [+ |
16ae0395 NN |
774 | FOR host_modules +] \ |
775 | maybe-check-[+module+][+ | |
776 | ENDFOR host_modules +][+ | |
777 | FOR target_modules +] \ | |
778 | maybe-check-target-[+module+][+ | |
b813574b | 779 | ENDFOR target_modules +] stage |
405ea7a0 NN |
780 | |
781 | # Automated reporting of test results. | |
782 | ||
783 | warning.log: build.log | |
784 | $(srcdir)/contrib/warn_summary build.log > $@ | |
785 | ||
786 | mail-report.log: | |
787 | if test x'$(BOOT_CFLAGS)' != x''; then \ | |
788 | BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \ | |
789 | fi; \ | |
790 | $(srcdir)/contrib/test_summary -t >$@ | |
791 | chmod +x $@ | |
792 | echo If you really want to send e-mail, run ./$@ now | |
793 | ||
794 | mail-report-with-warnings.log: warning.log | |
795 | if test x'$(BOOT_CFLAGS)' != x''; then \ | |
796 | BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \ | |
797 | fi; \ | |
798 | $(srcdir)/contrib/test_summary -t -i warning.log >$@ | |
799 | chmod +x $@ | |
800 | echo If you really want to send e-mail, run ./$@ now | |
801 | ||
802 | # Installation targets. | |
803 | ||
ae831be5 | 804 | .PHONY: install uninstall |
55db4b87 | 805 | install: installdirs install-host install-target |
dd12c3a8 | 806 | |
16ae0395 NN |
807 | .PHONY: install-host-nogcc |
808 | install-host-nogcc: [+ | |
9e6ce191 PB |
809 | FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \ |
810 | maybe-install-[+module+][+ ENDIF +][+ | |
16ae0395 NN |
811 | ENDFOR host_modules +] |
812 | ||
dd12c3a8 | 813 | .PHONY: install-host |
b813574b | 814 | install-host: [+ |
dd12c3a8 NN |
815 | FOR host_modules +] \ |
816 | maybe-install-[+module+][+ | |
817 | ENDFOR host_modules +] | |
16ae0395 | 818 | |
dd12c3a8 NN |
819 | .PHONY: install-target |
820 | install-target: [+ | |
821 | FOR target_modules +] \ | |
822 | maybe-install-target-[+module+][+ | |
823 | ENDFOR target_modules +] | |
405ea7a0 NN |
824 | |
825 | uninstall: | |
826 | @echo "the uninstall target is not supported in this tree" | |
827 | ||
405ea7a0 NN |
828 | .PHONY: install.all |
829 | install.all: install-no-fixedincludes | |
830 | @if [ -f ./gcc/Makefile ] ; then \ | |
b40e3958 | 831 | r=`${PWD_COMMAND}` ; export r ; \ |
7ffa0b57 | 832 | $(HOST_EXPORTS) \ |
1086bc09 | 833 | (cd ./gcc && \ |
405ea7a0 NN |
834 | $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \ |
835 | else \ | |
836 | true ; \ | |
837 | fi | |
838 | ||
839 | # install-no-fixedincludes is used because Cygnus can not distribute | |
840 | # the fixed header files. | |
841 | .PHONY: install-no-fixedincludes | |
16ae0395 | 842 | install-no-fixedincludes: installdirs install-host-nogcc \ |
dd12c3a8 | 843 | install-target gcc-no-fixedincludes |
405ea7a0 | 844 | |
15723a45 | 845 | ### other supporting targets |
405ea7a0 | 846 | |
15723a45 NN |
847 | MAKEDIRS= \ |
848 | $(DESTDIR)$(prefix) \ | |
849 | $(DESTDIR)$(exec_prefix) | |
850 | .PHONY: installdirs | |
851 | installdirs: mkinstalldirs | |
852 | $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS) | |
853 | ||
854 | dir.info: do-install-info | |
855 | if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \ | |
497f816e | 856 | $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \ |
15723a45 NN |
857 | mv -f dir.info.new dir.info ; \ |
858 | else true ; \ | |
405ea7a0 NN |
859 | fi |
860 | ||
15723a45 NN |
861 | dist: |
862 | @echo "Building a full distribution of this tree isn't done" | |
863 | @echo "via 'make dist'. Check out the etc/ subdirectory" | |
864 | ||
865 | etags tags: TAGS | |
866 | ||
867 | # Right now this just builds TAGS in each subdirectory. emacs19 has the | |
868 | # ability to use several tags files at once, so there is probably no need | |
869 | # to combine them into one big TAGS file (like CVS 1.3 does). We could | |
870 | # (if we felt like it) have this Makefile write a piece of elisp which | |
871 | # the user could load to tell emacs19 where all the TAGS files we just | |
872 | # built are. | |
873 | TAGS: do-TAGS | |
874 | ||
a7254363 PB |
875 | # ------------------------------------ |
876 | # Macros for configure and all targets | |
877 | # ------------------------------------ | |
878 | ||
879 | [+ DEFINE configure +] | |
880 | .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+] | |
881 | maybe-configure-[+prefix+][+module+]: | |
882 | @if [+prefix+][+module+] | |
883 | maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+] | |
884 | configure-[+prefix+][+module+]: [+deps+] | |
885 | @[+ IF bootstrap +]test -f stage_last && exit 0; \ | |
886 | [+ ENDIF bootstrap +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \ | |
887 | $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \ | |
b40e3958 L |
888 | r=`${PWD_COMMAND}`; export r; \ |
889 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
a7254363 PB |
890 | [+exports+] \ |
891 | echo Configuring in [+subdir+]/[+module+]; \ | |
892 | cd "[+subdir+]/[+module+]" || exit 1; \ | |
bba45b8b | 893 | case $(srcdir) in \ |
b00612cc | 894 | /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ |
a7254363 | 895 | *) topdir=`echo [+subdir+]/[+module+]/ | \ |
b00612cc | 896 | sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ |
bba45b8b | 897 | esac; \ |
b00612cc PB |
898 | srcdiroption="--srcdir=$${topdir}/[+module+]"; \ |
899 | libsrcdir="$$s/[+module+]"; \ | |
a7254363 PB |
900 | [+ IF no-config-site +]rm -f no-such-file || : ; \ |
901 | CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \ | |
902 | [+args+] $${srcdiroption} [+extra_configure_flags+] \ | |
bba45b8b | 903 | || exit 1 |
a7254363 | 904 | @endif [+prefix+][+module+] |
d545f33b PB |
905 | |
906 | [+ IF bootstrap +] | |
907 | [+ FOR bootstrap_stage +] | |
908 | .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+] | |
909 | maybe-configure-stage[+id+]-[+prefix+][+module+]: | |
910 | @if [+module+]-bootstrap | |
911 | maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] | |
912 | configure-stage[+id+]-[+prefix+][+module+]: [+deps+] | |
913 | @$(MAKE) stage[+id+]-start | |
914 | @[ -f [+subdir+]/[+module+]/Makefile ] && exit 0 || : ; \ | |
915 | r=`${PWD_COMMAND}`; export r; \ | |
916 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
917 | [+exports+][+ IF prev +] \ | |
918 | [+poststage1_exports+][+ ENDIF prev +] \ | |
919 | echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \ | |
920 | cd [+subdir+]/[+module+] || exit 1; \ | |
921 | case $(srcdir) in \ | |
922 | /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ | |
923 | *) topdir=`echo [+subdir+]/[+module+]/ | \ | |
924 | sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ | |
925 | esac; \ | |
926 | srcdiroption="--srcdir=$${topdir}/[+module+]"; \ | |
927 | libsrcdir="$$s/[+module+]"; \ | |
928 | $(SHELL) $${libsrcdir}/configure \ | |
929 | [+args+] $${srcdiroption} \ | |
930 | [+stage_configure_flags+] [+extra_configure_flags+] | |
931 | @endif [+module+]-bootstrap | |
932 | [+ ENDFOR bootstrap_stage +] | |
933 | [+ ENDIF bootstrap +] | |
a7254363 PB |
934 | [+ ENDDEF +] |
935 | ||
936 | [+ DEFINE all +] | |
937 | .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+] | |
938 | maybe-all-[+prefix+][+module+]: | |
939 | @if [+prefix+][+module+] | |
940 | TARGET-[+prefix+][+module+]=[+ | |
941 | IF target +][+target+][+ ELSE +]all[+ ENDIF target +] | |
942 | maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+] | |
943 | all-[+prefix+][+module+]: configure-[+prefix+][+module+] | |
944 | @[+ IF bootstrap +]test -f stage_last && exit 0; \ | |
945 | [+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \ | |
b40e3958 | 946 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
a7254363 PB |
947 | [+exports+] \ |
948 | (cd [+subdir+]/[+module+] && \ | |
949 | $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+])) | |
950 | @endif [+prefix+][+module+] | |
d545f33b PB |
951 | |
952 | [+ IF bootstrap +] | |
953 | [+ FOR bootstrap_stage +] | |
954 | .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+] | |
955 | .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+] | |
956 | maybe-all-stage[+id+]-[+prefix+][+module+]: | |
957 | maybe-clean-stage[+id+]-[+prefix+][+module+]: | |
958 | @if [+module+]-bootstrap | |
959 | maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+] | |
960 | all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+] | |
961 | all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] | |
962 | @$(MAKE) stage[+id+]-start | |
963 | @r=`${PWD_COMMAND}`; export r; \ | |
964 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
965 | [+exports+][+ IF prev +] \ | |
966 | [+poststage1_exports+][+ ENDIF prev +] \ | |
967 | cd [+subdir+]/[+module+] && \ | |
968 | $(MAKE) [+args+] [+ IF prev | |
969 | +][+poststage1_args+][+ ENDIF prev | |
970 | +] [+stage_make_flags+] [+extra_make_flags+] | |
971 | ||
972 | maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+] | |
973 | clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+] | |
974 | clean-stage[+id+]-[+prefix+][+module+]: | |
975 | @[ -f [+subdir+]/[+module+]/Makefile ] || [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] \ | |
976 | || exit 0 ; \ | |
977 | [ -f [+subdir+]/[+module+]/Makefile ] || $(MAKE) stage[+id+]-start ; \ | |
978 | cd [+subdir+]/[+module+] && \ | |
979 | $(MAKE) [+args+] [+ IF prev +] \ | |
980 | [+poststage1_args+] [+ ENDIF prev +] \ | |
981 | [+stage_make_flags+] [+extra_make_flags+] clean | |
982 | @endif [+module+]-bootstrap | |
983 | ||
984 | [+ ENDFOR bootstrap_stage +] | |
985 | [+ ENDIF bootstrap +] | |
a7254363 PB |
986 | [+ ENDDEF +] |
987 | ||
988 | # -------------------------------------- | |
989 | # Modules which run on the build machine | |
990 | # -------------------------------------- | |
991 | [+ FOR build_modules +] | |
992 | [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" | |
993 | args="$(BUILD_CONFIGARGS)" no-config-site=true +] | |
994 | ||
995 | [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +] | |
996 | [+ ENDFOR build_module +] | |
405ea7a0 | 997 | |
15723a45 NN |
998 | # -------------------------------------- |
999 | # Modules which run on the host machine | |
1000 | # -------------------------------------- | |
3866be5d | 1001 | [+ FOR host_modules +] |
d545f33b PB |
1002 | [+ configure prefix="" subdir="$(HOST_SUBDIR)" |
1003 | exports="$(HOST_EXPORTS)" | |
1004 | poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" | |
a7254363 | 1005 | args="$(HOST_CONFIGARGS)" +] |
e2b9e2dc | 1006 | |
d545f33b PB |
1007 | [+ all prefix="" subdir="$(HOST_SUBDIR)" |
1008 | exports="$(HOST_EXPORTS)" | |
1009 | poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" | |
1010 | args="$(FLAGS_TO_PASS)" | |
1011 | poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +] | |
405ea7a0 | 1012 | |
16ae0395 NN |
1013 | .PHONY: check-[+module+] maybe-check-[+module+] |
1014 | maybe-check-[+module+]: | |
6bd3dfaa PB |
1015 | @if [+module+] |
1016 | maybe-check-[+module+]: check-[+module+] | |
3866be5d | 1017 | [+ IF no_check +] |
3866be5d NN |
1018 | check-[+module+]: |
1019 | [+ ELIF no_check_cross +] | |
3866be5d NN |
1020 | # This module is only tested in a native toolchain. |
1021 | check-[+module+]: | |
7f121bbf | 1022 | @if [ '$(host)' = '$(target)' ] ; then \ |
b40e3958 L |
1023 | r=`${PWD_COMMAND}`; export r; \ |
1024 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1025 | $(HOST_EXPORTS) \ |
b00612cc | 1026 | (cd $(HOST_SUBDIR)/[+module+] && \ |
4cfaf6d5 | 1027 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \ |
bba45b8b NN |
1028 | fi |
1029 | [+ ELSE check +] | |
bba45b8b | 1030 | check-[+module+]: |
b40e3958 L |
1031 | @r=`${PWD_COMMAND}`; export r; \ |
1032 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1033 | $(HOST_EXPORTS) \ |
b00612cc PB |
1034 | (cd $(HOST_SUBDIR)/[+module+] && \ |
1035 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check) | |
3866be5d | 1036 | [+ ENDIF no_check +] |
6bd3dfaa | 1037 | @endif [+module+] |
405ea7a0 | 1038 | |
930314a4 NN |
1039 | .PHONY: install-[+module+] maybe-install-[+module+] |
1040 | maybe-install-[+module+]: | |
6bd3dfaa PB |
1041 | @if [+module+] |
1042 | maybe-install-[+module+]: install-[+module+] | |
16ae0395 | 1043 | [+ IF no_install +] |
3866be5d NN |
1044 | install-[+module+]: |
1045 | [+ ELSE install +] | |
3866be5d | 1046 | install-[+module+]: installdirs |
b40e3958 L |
1047 | @r=`${PWD_COMMAND}`; export r; \ |
1048 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1049 | $(HOST_EXPORTS) \ |
b00612cc | 1050 | (cd $(HOST_SUBDIR)/[+module+] && \ |
2da12f12 | 1051 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install) |
3866be5d | 1052 | [+ ENDIF no_install +] |
6bd3dfaa | 1053 | @endif [+module+] |
4fa63067 NN |
1054 | |
1055 | # Other targets (info, dvi, etc.) | |
1056 | [+ FOR recursive_targets +] | |
1057 | .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+] | |
1058 | maybe-[+make_target+]-[+module+]: | |
6bd3dfaa PB |
1059 | @if [+module+] |
1060 | maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+] | |
4fa63067 NN |
1061 | [+ IF (match-value? = "missing" (get "make_target") ) +] |
1062 | # [+module+] doesn't support [+make_target+]. | |
1063 | [+make_target+]-[+module+]: | |
1064 | [+ ELSE +] | |
1065 | [+make_target+]-[+module+]: [+ | |
1066 | FOR depend +]\ | |
1067 | [+depend+]-[+module+] [+ | |
1068 | ENDFOR depend +] | |
1069 | @[ -f ./[+module+]/Makefile ] || exit 0; \ | |
1070 | r=`${PWD_COMMAND}`; export r; \ | |
1071 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1072 | $(HOST_EXPORTS) \ |
b813574b | 1073 | for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \ |
4fa63067 NN |
1074 | eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ |
1075 | done; \ | |
1076 | echo "Doing [+make_target+] in [+module+]" ; \ | |
b00612cc | 1077 | (cd $(HOST_SUBDIR)/[+module+] && \ |
4fa63067 NN |
1078 | $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ |
1079 | "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ | |
1080 | "RANLIB=$${RANLIB}" \ | |
1081 | "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ | |
b813574b | 1082 | [+make_target+]) \ |
4fa63067 NN |
1083 | || exit 1 |
1084 | [+ ENDIF +] | |
6bd3dfaa | 1085 | @endif [+module+] |
4fa63067 | 1086 | [+ ENDFOR recursive_targets +] |
3866be5d | 1087 | [+ ENDFOR host_modules +] |
405ea7a0 | 1088 | |
15723a45 NN |
1089 | # --------------------------------------- |
1090 | # Modules which run on the target machine | |
1091 | # --------------------------------------- | |
e393202e | 1092 | [+ FOR target_modules +] |
15723a45 | 1093 | |
1086bc09 | 1094 | # There's only one multilib.out. Cleverer subdirs shouldn't need it copied. |
a7254363 | 1095 | @if target-[+module+] |
1086bc09 | 1096 | $(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out |
9175bfc0 | 1097 | $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \ |
e6bfb94a | 1098 | rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \ |
1086bc09 | 1099 | cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out |
a8637a7d | 1100 | @endif target-[+module+] |
e90269c8 | 1101 | |
a7254363 PB |
1102 | [+ IF raw_cxx +] |
1103 | [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1104 | deps=(string-append "$(TARGET_SUBDIR)/" (get "module") "/multilib.out") | |
1105 | exports="$(RAW_CXX_TARGET_EXPORTS)" | |
1106 | args="$(TARGET_CONFIGARGS)" no-config-site=true +] | |
1107 | ||
1108 | [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1109 | exports="$(RAW_CXX_TARGET_EXPORTS)" | |
1110 | args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +] | |
1111 | [+ ELSE +] | |
1112 | [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1113 | deps=(string-append "$(TARGET_SUBDIR)/" (get "module") "/multilib.out") | |
1114 | exports="$(NORMAL_TARGET_EXPORTS)" | |
1115 | args="$(TARGET_CONFIGARGS)" no-config-site=true +] | |
1116 | ||
1117 | [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1118 | exports="$(NORMAL_TARGET_EXPORTS)" | |
1119 | args="$(TARGET_FLAGS_TO_PASS)" +] | |
1120 | [+ ENDIF +] | |
16ae0395 NN |
1121 | |
1122 | .PHONY: check-target-[+module+] maybe-check-target-[+module+] | |
1123 | maybe-check-target-[+module+]: | |
6bd3dfaa PB |
1124 | @if target-[+module+] |
1125 | maybe-check-target-[+module+]: check-target-[+module+] | |
3866be5d NN |
1126 | [+ IF no_check +] |
1127 | # Dummy target for uncheckable module. | |
3866be5d NN |
1128 | check-target-[+module+]: |
1129 | [+ ELSE check +] | |
e393202e | 1130 | check-target-[+module+]: |
b40e3958 | 1131 | @r=`${PWD_COMMAND}`; export r; \ |
e90269c8 | 1132 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
378fce5b DD |
1133 | IF raw_cxx +] |
1134 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1135 | ELSE normal_cxx +] | |
1136 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1137 | ENDIF raw_cxx +] | |
bba45b8b NN |
1138 | (cd $(TARGET_SUBDIR)/[+module+] && \ |
1139 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+ | |
1140 | IF raw_cxx | |
1141 | +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ | |
1142 | ENDIF raw_cxx | |
7ffa0b57 | 1143 | +] [+extra_make_flags+] check) |
e393202e | 1144 | [+ ENDIF no_check +] |
6bd3dfaa | 1145 | @endif target-[+module+] |
16ae0395 | 1146 | |
930314a4 NN |
1147 | .PHONY: install-target-[+module+] maybe-install-target-[+module+] |
1148 | maybe-install-target-[+module+]: | |
6bd3dfaa PB |
1149 | @if target-[+module+] |
1150 | maybe-install-target-[+module+]: install-target-[+module+] | |
16ae0395 | 1151 | [+ IF no_install +] |
930314a4 NN |
1152 | # Dummy target for uninstallable. |
1153 | install-target-[+module+]: | |
1154 | [+ ELSE install +] | |
e393202e | 1155 | install-target-[+module+]: installdirs |
b40e3958 | 1156 | @r=`${PWD_COMMAND}`; export r; \ |
e90269c8 | 1157 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
378fce5b DD |
1158 | IF raw_cxx +] |
1159 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1160 | ELSE normal_cxx +] | |
1161 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1162 | ENDIF raw_cxx +] | |
bba45b8b | 1163 | (cd $(TARGET_SUBDIR)/[+module+] && \ |
7ffa0b57 | 1164 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install) |
e393202e | 1165 | [+ ENDIF no_install +] |
6bd3dfaa | 1166 | @endif target-[+module+] |
4fa63067 NN |
1167 | |
1168 | # Other targets (info, dvi, etc.) | |
1169 | [+ FOR recursive_targets +] | |
1170 | .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+] | |
1171 | maybe-[+make_target+]-target-[+module+]: | |
6bd3dfaa PB |
1172 | @if target-[+module+] |
1173 | maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+] | |
4fa63067 NN |
1174 | [+ IF (match-value? = "missing" (get "make_target") ) +] |
1175 | # [+module+] doesn't support [+make_target+]. | |
1176 | [+make_target+]-target-[+module+]: | |
1177 | [+ ELSE +] | |
1178 | [+make_target+]-target-[+module+]: [+ | |
1179 | FOR depend +]\ | |
1180 | [+depend+]-target-[+module+] [+ | |
1181 | ENDFOR depend +] | |
1182 | @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \ | |
1183 | r=`${PWD_COMMAND}`; export r; \ | |
e90269c8 | 1184 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
378fce5b DD |
1185 | IF raw_cxx +] |
1186 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1187 | ELSE normal_cxx +] | |
1188 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1189 | ENDIF raw_cxx +] | |
4fa63067 NN |
1190 | echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \ |
1191 | for flag in $(EXTRA_TARGET_FLAGS); do \ | |
1192 | eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ | |
1193 | done; \ | |
1194 | (cd $(TARGET_SUBDIR)/[+module+] && \ | |
1195 | $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ | |
1196 | "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ | |
1197 | "RANLIB=$${RANLIB}" \ | |
1198 | "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ | |
7ffa0b57 | 1199 | [+extra_make_flags+] [+make_target+]) \ |
4fa63067 NN |
1200 | || exit 1 |
1201 | [+ ENDIF +] | |
6bd3dfaa | 1202 | @endif target-[+module+] |
4fa63067 | 1203 | [+ ENDFOR recursive_targets +] |
e393202e | 1204 | [+ ENDFOR target_modules +] |
405ea7a0 | 1205 | |
15723a45 NN |
1206 | # ---------- |
1207 | # GCC module | |
1208 | # ---------- | |
1209 | ||
319cab08 | 1210 | @if gcc-no-bootstrap |
b813574b PB |
1211 | # GCC has some more recursive targets, which trigger the old |
1212 | # (but still current, until the toplevel bootstrap project | |
1213 | # is finished) compiler bootstrapping rules. | |
405ea7a0 | 1214 | |
5b474aa8 DD |
1215 | GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap |
1216 | .PHONY: $(GCC_STRAP_TARGETS) | |
9e6ce191 | 1217 | $(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc |
b40e3958 L |
1218 | @r=`${PWD_COMMAND}`; export r; \ |
1219 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1220 | $(HOST_EXPORTS) \ |
405ea7a0 | 1221 | echo "Bootstrapping the compiler"; \ |
e90269c8 | 1222 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ |
405ea7a0 | 1223 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@ |
b40e3958 L |
1224 | @r=`${PWD_COMMAND}`; export r; \ |
1225 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
405ea7a0 NN |
1226 | case "$@" in \ |
1227 | *bootstrap4-lean ) \ | |
bba45b8b NN |
1228 | msg="Comparing stage3 and stage4 of the compiler"; \ |
1229 | compare=compare3-lean ;; \ | |
1230 | *bootstrap4 ) \ | |
1231 | msg="Comparing stage3 and stage4 of the compiler"; \ | |
1232 | compare=compare3 ;; \ | |
1233 | *-lean ) \ | |
1234 | msg="Comparing stage2 and stage3 of the compiler"; \ | |
1235 | compare=compare-lean ;; \ | |
1236 | * ) \ | |
1237 | msg="Comparing stage2 and stage3 of the compiler"; \ | |
1238 | compare=compare ;; \ | |
405ea7a0 | 1239 | esac; \ |
7ffa0b57 | 1240 | $(HOST_EXPORTS) \ |
405ea7a0 NN |
1241 | echo "$$msg"; \ |
1242 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare | |
b40e3958 L |
1243 | @r=`${PWD_COMMAND}`; export r; \ |
1244 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
405ea7a0 | 1245 | echo "Building runtime libraries"; \ |
656fdd47 | 1246 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all |
405ea7a0 | 1247 | |
9e6ce191 | 1248 | profiledbootstrap: all-prebootstrap configure-gcc |
b40e3958 L |
1249 | @r=`${PWD_COMMAND}`; export r; \ |
1250 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1251 | $(HOST_EXPORTS) \ |
e90269c8 | 1252 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ |
3e707e94 | 1253 | echo "Bootstrapping training compiler"; \ |
ec7e0995 | 1254 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build |
b40e3958 | 1255 | @r=`${PWD_COMMAND}`; export r; \ |
b40e3958 | 1256 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
7ffa0b57 | 1257 | $(HOST_EXPORTS) \ |
ec7e0995 NN |
1258 | echo "Building feedback based compiler"; \ |
1259 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build | |
3e707e94 PB |
1260 | @r=`${PWD_COMMAND}`; export r; \ |
1261 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
3e707e94 PB |
1262 | echo "Building runtime libraries"; \ |
1263 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all | |
ec7e0995 | 1264 | |
405ea7a0 | 1265 | .PHONY: cross |
72b2455a | 1266 | cross: all-build all-gas all-ld |
b40e3958 L |
1267 | @r=`${PWD_COMMAND}`; export r; \ |
1268 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1269 | $(HOST_EXPORTS) \ |
405ea7a0 NN |
1270 | echo "Building the C and C++ compiler"; \ |
1271 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" | |
b40e3958 L |
1272 | @r=`${PWD_COMMAND}`; export r; \ |
1273 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
405ea7a0 | 1274 | echo "Building runtime libraries"; \ |
656fdd47 | 1275 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all |
319cab08 | 1276 | @endif gcc-no-bootstrap |
405ea7a0 | 1277 | |
6bd3dfaa | 1278 | @if gcc |
7d695d07 JM |
1279 | .PHONY: check-gcc-c++ |
1280 | check-gcc-c++: | |
405ea7a0 | 1281 | @if [ -f ./gcc/Makefile ] ; then \ |
b40e3958 L |
1282 | r=`${PWD_COMMAND}`; export r; \ |
1283 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1284 | $(HOST_EXPORTS) \ |
1086bc09 | 1285 | (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \ |
405ea7a0 NN |
1286 | else \ |
1287 | true; \ | |
7d695d07 JM |
1288 | fi |
1289 | ||
1290 | .PHONY: check-c++ | |
ede4fbe4 | 1291 | check-c++: check-target-libstdc++-v3 check-gcc-c++ |
405ea7a0 | 1292 | |
15723a45 NN |
1293 | # Install the gcc headers files, but not the fixed include files, |
1294 | # which Cygnus is not allowed to distribute. This rule is very | |
1295 | # dependent on the workings of the gcc Makefile.in. | |
1296 | .PHONY: gcc-no-fixedincludes | |
1297 | gcc-no-fixedincludes: | |
1298 | @if [ -f ./gcc/Makefile ]; then \ | |
1299 | rm -rf gcc/tmp-include; \ | |
1300 | mv gcc/include gcc/tmp-include 2>/dev/null; \ | |
1301 | mkdir gcc/include; \ | |
1302 | cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \ | |
1303 | touch gcc/stmp-fixinc gcc/include/fixed; \ | |
1304 | rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \ | |
b40e3958 L |
1305 | r=`${PWD_COMMAND}`; export r; \ |
1306 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
7ffa0b57 | 1307 | $(HOST_EXPORTS) \ |
1086bc09 | 1308 | (cd ./gcc && \ |
15723a45 NN |
1309 | $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ |
1310 | rm -rf gcc/include; \ | |
1311 | mv gcc/tmp-include gcc/include 2>/dev/null; \ | |
1312 | else true; fi | |
6bd3dfaa | 1313 | @endif gcc |
4fa63067 | 1314 | |
1d39f329 NN |
1315 | # --------------------- |
1316 | # GCC bootstrap support | |
1317 | # --------------------- | |
1318 | ||
b813574b PB |
1319 | # We track the current stage (the one in 'gcc') in the stage_current file. |
1320 | # stage_last instead tracks the stage that was built last. These targets | |
1321 | # are dummy when toplevel bootstrap is not active. | |
1322 | ||
1323 | .PHONY: unstage | |
1324 | unstage: | |
1325 | @if gcc-bootstrap | |
1326 | @[ -f stage_current ] || $(MAKE) `cat stage_last`-start | |
1327 | @endif gcc-bootstrap | |
1328 | ||
1329 | .PHONY: stage | |
1330 | stage: | |
1331 | @if gcc-bootstrap | |
1332 | @$(MAKE) `cat stage_current`-end | |
1333 | @endif gcc-bootstrap | |
1334 | ||
dfdffa2c PB |
1335 | # We name the build directories for the various stages "stage1-gcc", |
1336 | # "stage2-gcc","stage3-gcc", etc. | |
1337 | ||
1338 | # Since the 'compare' process will fail (on debugging information) if any | |
1339 | # directory names are different, we need to link the gcc directory for | |
1340 | # the previous stage to a constant name ('gcc-prev'), and to make the name of | |
1341 | # the build directories constant as well. For the latter, we use naked names | |
1342 | # like 'gcc', because the scripts in that directory assume it. We use | |
1343 | # mv on platforms where symlinks to directories do not work or are not | |
1344 | # reliable. | |
1345 | ||
1346 | # At the end of the bootstrap, a symlink to 'stage3-gcc' named 'gcc' must | |
1347 | # be kept, so that libraries can find it. Ick! | |
1348 | ||
1349 | # It would be best to preinstall gcc into a staging area (and in the | |
1350 | # future, gather there all prebootstrap packages). This would allow | |
1351 | # assemblers and linkers can be bootstrapped as well as the compiler | |
1352 | # (both in a combined tree, or separately). This however requires some | |
1353 | # change to the gcc driver, again in order to avoid comparison failures. | |
1d39f329 | 1354 | |
0df3d27f PB |
1355 | # Bugs: This is crippled when doing parallel make, the `make all-host' |
1356 | # and `make all-target' phases can be parallelized. | |
1357 | ||
1d39f329 NN |
1358 | |
1359 | # 'touch' doesn't work right on some platforms. | |
1360 | STAMP = echo timestamp > | |
1361 | ||
1362 | # Only build the C compiler for stage1, because that is the only one that | |
1363 | # we can guarantee will build with the native compiler, and also it is the | |
1364 | # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS), | |
1365 | # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them | |
1366 | # overrideable (for a bootstrap build stage1 also builds gcc.info). | |
1367 | ||
1368 | STAGE1_CFLAGS=@stage1_cflags@ | |
1369 | STAGE1_LANGUAGES=@stage1_languages@ | |
1370 | ||
dfdffa2c PB |
1371 | # We only want to compare .o files, so set this! |
1372 | objext = .o | |
1d39f329 | 1373 | |
1d39f329 | 1374 | # Flags to pass to stage2 and later makes. |
1d39f329 | 1375 | POSTSTAGE1_FLAGS_TO_PASS = \ |
656fdd47 | 1376 | CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ |
064d0a7c | 1377 | STAGE_PREFIX=$$r/prev-gcc/ \ |
1d39f329 | 1378 | CFLAGS="$(BOOT_CFLAGS)" \ |
a0049f1b | 1379 | ADAC="\$$(CC)" |
1d39f329 | 1380 | |
dfdffa2c PB |
1381 | # For stage 1: |
1382 | # * We force-disable intermodule optimizations, even if | |
1383 | # --enable-intermodule was passed, since the installed compiler probably | |
1384 | # can't handle them. Luckily, autoconf always respects | |
1385 | # the last argument when conflicting --enable arguments are passed. | |
1386 | # * Likewise, we force-disable coverage flags, since the installed compiler | |
1387 | # probably has never heard of them. | |
1388 | # * We build only C (and possibly Ada). | |
1389 | ||
1390 | [+ FOR bootstrap-stage +] | |
319cab08 | 1391 | .PHONY: stage[+id+]-start stage[+id+]-end |
dfdffa2c | 1392 | |
656fdd47 | 1393 | stage[+id+]-start:: |
9cb3fa6f | 1394 | @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \ |
b813574b | 1395 | echo stage[+id+] > stage_current ; \ |
b00612cc | 1396 | echo stage[+id+] > stage_last; \ |
1dc3053f | 1397 | $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) $(TARGET_SUBDIR)[+ |
b00612cc | 1398 | FOR host_modules +][+ IF bootstrap +] |
72b2455a | 1399 | @if [+ module +] |
b00612cc PB |
1400 | @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \ |
1401 | mkdir stage[+id+]-[+module+]; \ | |
1402 | set stage[+id+]-[+module+] [+module+] ; \ | |
1403 | @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1404 | set stage[+prev+]-[+module+] prev-[+module+] ; \ | |
1405 | @CREATE_LINK_TO_DIR@ [+ ENDIF prev +] | |
1dc3053f PB |
1406 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +][+ |
1407 | FOR target_modules +][+ IF bootstrap +] | |
1408 | @if target-[+ module +] | |
1409 | @cd $(TARGET_SUBDIR); [ -d stage[+id+]-[+module+] ] || \ | |
1410 | mkdir stage[+id+]-[+module+]; \ | |
1411 | set stage[+id+]-[+module+] [+module+] ; \ | |
1412 | @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1413 | set stage[+prev+]-[+module+] prev-[+module+] ; \ | |
1414 | @CREATE_LINK_TO_DIR@ [+ ENDIF prev +] | |
1415 | @endif target-[+ module +][+ ENDIF bootstrap +][+ ENDFOR target_modules +] | |
dfdffa2c | 1416 | |
656fdd47 | 1417 | stage[+id+]-end:: |
9cb3fa6f | 1418 | @rm -f stage_current[+ FOR host_modules +][+ IF bootstrap +] |
72b2455a | 1419 | @if [+ module +] |
b00612cc PB |
1420 | @cd $(HOST_SUBDIR); set [+module+] stage[+id+]-[+module+] ; \ |
1421 | @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1422 | set prev-[+module+] stage[+prev+]-[+module+] ; \ | |
1423 | @UNDO_LINK_TO_DIR@ [+ ENDIF prev +] | |
1dc3053f PB |
1424 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +][+ |
1425 | FOR target_modules +][+ IF bootstrap +] | |
1426 | @if target-[+ module +] | |
1427 | @cd $(HOST_SUBDIR); set [+module+] stage[+id+]-[+module+] ; \ | |
1428 | @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1429 | set prev-[+module+] stage[+prev+]-[+module+] ; \ | |
1430 | @UNDO_LINK_TO_DIR@ [+ ENDIF prev +] | |
1431 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR target_modules +] | |
dfdffa2c PB |
1432 | |
1433 | # Bubble a bugfix through all the stages up to stage [+id+]. They | |
1434 | # are remade, but not reconfigured. The next stage (if any) will not | |
1435 | # be reconfigured as well. | |
319cab08 | 1436 | .PHONY: stage[+id+]-bubble |
9cb3fa6f PB |
1437 | stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +][+IF lean +] |
1438 | @bootstrap_lean@-rm -rf stage[+lean+]-* ; $(STAMP) stage[+lean+]-lean[+ ENDIF lean +] | |
1439 | @if test -f stage[+id+]-lean [+ | |
1440 | IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \ | |
1441 | echo Skipping rebuild of stage[+id+] ; \ | |
1442 | else \ | |
0df3d27f | 1443 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) NOTPARALLEL= all-stage[+id+]; \ |
9cb3fa6f | 1444 | fi |
72b2455a | 1445 | |
0df3d27f | 1446 | .PHONY: all-stage[+id+] clean-stage[+id+] |
0df3d27f | 1447 | do-clean: clean-stage[+id+] |
1d39f329 | 1448 | |
72b2455a PB |
1449 | # FIXME: Will not need to be conditional when toplevel bootstrap is the |
1450 | # only possibility, but now it conflicts with no-bootstrap rules | |
1451 | @if gcc-bootstrap | |
dfdffa2c | 1452 | [+ IF compare-target +] |
9cb3fa6f PB |
1453 | [+compare-target+]: |
1454 | @if test -f stage[+prev+]-lean; then \ | |
1455 | echo Cannot compare object files as stage [+prev+] was deleted. ; \ | |
1456 | exit 0 ; \ | |
1457 | fi; \ | |
1458 | [ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \ | |
dfdffa2c | 1459 | @r=`${PWD_COMMAND}`; export r; \ |
1d39f329 NN |
1460 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
1461 | rm -f .bad_compare ; \ | |
dfdffa2c | 1462 | cd stage[+id+]-gcc; \ |
1d39f329 NN |
1463 | files=`find . -name "*$(objext)" -print` ; \ |
1464 | cd .. ; \ | |
1465 | for file in $${files} ; do \ | |
dfdffa2c | 1466 | f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \ |
b8908782 | 1467 | @do_compare@ > /dev/null 2>&1; \ |
1d39f329 NN |
1468 | test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \ |
1469 | done ; \ | |
1470 | if [ -f .bad_compare ]; then \ | |
1471 | echo "Bootstrap comparison failure!"; \ | |
1472 | cat .bad_compare; \ | |
1473 | exit 1; \ | |
1474 | else \ | |
1475 | true; \ | |
1476 | fi ; \ | |
9cb3fa6f PB |
1477 | $(STAMP) [+compare-target+][+ IF prev +] |
1478 | @bootstrap_lean@-rm -rf stage[+prev+]-* ; $(STAMP) stage[+prev+]-lean[+ ENDIF prev +] | |
dfdffa2c PB |
1479 | [+ ENDIF compare-target +] |
1480 | ||
1481 | [+ IF bootstrap-target +] | |
1482 | .PHONY: [+bootstrap-target+] | |
9cb3fa6f | 1483 | [+bootstrap-target+]: stage[+id+]-bubble [+compare-target+] all |
dfdffa2c PB |
1484 | [+ ENDIF bootstrap-target +] |
1485 | ||
0df3d27f | 1486 | # Rules to wipe a stage and all the following ones, also used for cleanstrap |
656fdd47 | 1487 | [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +] |
0df3d27f | 1488 | .PHONY: distclean-stage[+id+] |
656fdd47 | 1489 | distclean-stage[+id+]:: |
b813574b | 1490 | [ -f stage_current ] && $(MAKE) `cat stage_current`-end || : |
9cb3fa6f | 1491 | rm -rf stage[+id+]-* [+ |
dfdffa2c | 1492 | IF compare-target +][+compare-target+] [+ ENDIF compare-target +] |
dfdffa2c PB |
1493 | |
1494 | [+ IF cleanstrap-target +] | |
1495 | .PHONY: [+cleanstrap-target+] | |
0df3d27f | 1496 | [+cleanstrap-target+]: distclean [+bootstrap-target+] |
dfdffa2c | 1497 | [+ ENDIF cleanstrap-target +] |
72b2455a | 1498 | @endif gcc-bootstrap |
dfdffa2c PB |
1499 | |
1500 | [+ ENDFOR bootstrap-stage +] | |
656fdd47 | 1501 | |
7d329e61 PB |
1502 | stageprofile-end:: |
1503 | $(MAKE) distclean-stagefeedback | |
656fdd47 | 1504 | |
7d329e61 | 1505 | stagefeedback-start:: |
656fdd47 PB |
1506 | @r=`${PWD_COMMAND}`; export r; \ |
1507 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7d329e61 PB |
1508 | for i in prev-*; do \ |
1509 | j=`echo $$i | sed s/^prev-//` ; \ | |
1510 | cd $$r/$$i && \ | |
1511 | { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \ | |
1512 | { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \ | |
1513 | done | |
b8908782 | 1514 | |
0df3d27f PB |
1515 | @if gcc-bootstrap |
1516 | NOTPARALLEL = .NOTPARALLEL | |
1517 | $(NOTPARALLEL): | |
1518 | do-distclean: distclean-stage1 | |
1519 | @endif gcc-bootstrap | |
1520 | ||
ae831be5 NN |
1521 | # -------------------------------------- |
1522 | # Dependencies between different modules | |
1523 | # -------------------------------------- | |
405ea7a0 | 1524 | |
9e6ce191 | 1525 | # Generic dependencies for target modules on host stuff, especially gcc |
1dc3053f PB |
1526 | [+ FOR target_modules +][+ IF bootstrap +] |
1527 | @if gcc-bootstrap[+ FOR bootstrap_stage +] | |
1528 | configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+ ENDFOR +] | |
1529 | @endif gcc-bootstrap[+ ENDIF bootstrap +] | |
9e6ce191 PB |
1530 | configure-target-[+module+]: maybe-all-gcc |
1531 | [+ ENDFOR target_modules +] | |
1532 | ||
1533 | [+ FOR lang_env_dependencies +] | |
1534 | configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss | |
1535 | [+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3 | |
1536 | [+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +] | |
1537 | ||
ae831be5 NN |
1538 | # There are two types of dependencies here: 'hard' dependencies, where one |
1539 | # module simply won't build without the other; and 'soft' dependencies, where | |
1540 | # if the depended-on module is missing, the depending module will do without | |
1541 | # or find a substitute somewhere (perhaps installed). Soft dependencies | |
9e6ce191 | 1542 | # are made here to depend on a 'maybe-' target. If you're not sure, |
ae831be5 NN |
1543 | # it's safer to use a soft dependency. |
1544 | ||
9e6ce191 PB |
1545 | [+ ;; These Scheme functions build the bulk of the dependencies. |
1546 | ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc", | |
1547 | ;; where "maybe-" is only included if HARD is true, and all-gcc | |
1548 | ;; is taken from VAR-NAME. | |
1549 | (define dep-target (lambda (module-kind var-name hard) | |
1550 | (string-append | |
1551 | (if hard "" "maybe-") | |
1552 | (dep-subtarget var-name) | |
1553 | module-kind | |
1554 | (dep-module var-name) | |
1555 | ))) | |
1556 | ||
1557 | ;; make-dep builds a dependency from the MODULE and ON AutoGen vars. | |
72b2455a | 1558 | (define make-dep (lambda (module-kind on-kind) |
9e6ce191 PB |
1559 | (string-append |
1560 | (dep-target module-kind "module" #t) ": " | |
72b2455a | 1561 | (dep-target on-kind "on" (exist? "hard"))))) |
9e6ce191 PB |
1562 | |
1563 | ;; dep-subtarget extracts everything up to the first dash in the given | |
1564 | ;; AutoGen variable, for example it extracts "all-" out of "all-gcc". | |
1565 | (define dep-subtarget (lambda (var-name) | |
1566 | (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-))))) | |
1567 | ||
1568 | ;; dep-module extracts everything up to the first dash in the given | |
1569 | ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc". | |
1570 | (define dep-module (lambda (var-name) | |
1571 | (substring (get var-name) (+ 1 (string-index (get var-name) #\-))))) | |
1572 | ||
1573 | ;; dep-stage builds a string for the prefix of a bootstrap stage. | |
1574 | (define dep-stage (lambda () | |
1575 | (string-append | |
1576 | "stage" | |
1577 | (get "id") | |
1578 | "-"))) | |
1579 | ||
1580 | ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'" | |
1581 | ;; but is written in Scheme. | |
1582 | (define dep-maybe (lambda () | |
1583 | (if (exist? "hard") "" "maybe-"))) | |
1584 | ||
21fde4dc DD |
1585 | ;; dep-kind returns "normal" if the dependency is on an "install" target, |
1586 | ;; or if either module is not bootstrapped. It returns "bootstrap" for | |
9e6ce191 PB |
1587 | ;; configure or build dependencies between bootstrapped modules; it returns |
1588 | ;; "prebootstrap" for configure or build dependencies of bootstrapped | |
72b2455a | 1589 | ;; modules on a build module (e.g. all-gcc on all-build-bison). All this |
9e6ce191 PB |
1590 | ;; is only necessary for host modules. |
1591 | (define dep-kind (lambda () | |
72b2455a PB |
1592 | (if (and (hash-ref boot-modules (dep-module "module")) |
1593 | (=* (dep-module "on") "build-")) | |
1594 | "prebootstrap" | |
9e6ce191 | 1595 | |
72b2455a | 1596 | (if (or (= (dep-subtarget "on") "install-") |
21fde4dc DD |
1597 | (not (hash-ref boot-modules (dep-module "module"))) |
1598 | (not (hash-ref boot-modules (dep-module "on")))) | |
72b2455a PB |
1599 | "normal" |
1600 | "bootstrap")))) | |
9e6ce191 PB |
1601 | |
1602 | ;; We now build the hash table that is used by dep-kind. | |
1603 | (define boot-modules (make-hash-table 113)) | |
9e6ce191 PB |
1604 | +] |
1605 | ||
1606 | [+ FOR host_modules +][+ | |
1607 | (if (exist? "bootstrap") | |
1608 | (hash-create-handle! boot-modules (get "module") #t)) | |
1609 | "" +][+ ENDFOR host_modules +] | |
1dc3053f PB |
1610 | [+ FOR target_modules +][+ |
1611 | (if (exist? "bootstrap") | |
1612 | (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t)) | |
1613 | "" +][+ ENDFOR target_modules +] | |
9e6ce191 PB |
1614 | |
1615 | # With all the machinery above in place, it is pretty easy to generate | |
1616 | # dependencies. Host dependencies are a bit more complex because we have | |
1617 | # to check for bootstrap/prebootstrap dependencies. To resolve | |
1618 | # prebootstrap dependencies, prebootstrap modules are gathered in | |
1619 | # a hash table. | |
72b2455a PB |
1620 | [+ FOR dependencies +][+ (make-dep "" "") +] |
1621 | [+ CASE (dep-kind) +] | |
1622 | [+ == "prebootstrap" | |
9e6ce191 | 1623 | +][+ FOR bootstrap_stage +] |
72b2455a PB |
1624 | [+ (make-dep (dep-stage) "") +][+ |
1625 | ENDFOR bootstrap_stage +] | |
1626 | all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +] | |
1627 | [+ == "bootstrap" | |
1628 | +][+ FOR bootstrap_stage +] | |
1629 | [+ (make-dep (dep-stage) (dep-stage)) +][+ | |
9e6ce191 PB |
1630 | ENDFOR bootstrap_stage +] |
1631 | [+ ESAC +][+ | |
1632 | ENDFOR dependencies +] | |
1633 | ||
72b2455a PB |
1634 | # Non-toplevel bootstrap rules must depend on several packages, to be built |
1635 | # before gcc. Another wart that will go away, hopefully soon. | |
9e6ce191 PB |
1636 | @if gcc-no-bootstrap |
1637 | [+ FOR host_modules +][+ | |
1638 | IF (and (not (= (get "module") "gcc")) | |
1639 | (hash-ref boot-modules (get "module"))) +] | |
1640 | all-prebootstrap: maybe-all-[+module+][+ | |
1641 | ENDIF +][+ | |
1642 | ENDFOR host_modules +] | |
1643 | @endif gcc-no-bootstrap | |
1644 | ||
ae831be5 | 1645 | GDB_TK = @GDB_TK@ |
9e6ce191 | 1646 | all-gdb: $(gdbnlmrequirements) $(GDB_TK) |
907a7241 | 1647 | |
a2cc058a NN |
1648 | # Serialization dependencies. Host configures don't work well in parallel to |
1649 | # each other, due to contention over config.cache. Target configures and | |
1650 | # build configures are similar. | |
1651 | @serialization_dependencies@ | |
1652 | ||
15723a45 NN |
1653 | # -------------------------------- |
1654 | # Regenerating top level configury | |
1655 | # -------------------------------- | |
405ea7a0 | 1656 | |
1086bc09 NN |
1657 | # Multilib.out tells target dirs what multilibs they should build. |
1658 | # There is really only one copy. We use the 'timestamp' method to | |
1659 | # work around various timestamp bugs on some systems. | |
1660 | # We use move-if-change so that it's only considered updated when it | |
1661 | # actually changes, because it has to depend on a phony target. | |
e6bfb94a | 1662 | multilib.out: maybe-all-gcc |
b40e3958 | 1663 | @r=`${PWD_COMMAND}`; export r; \ |
1086bc09 NN |
1664 | echo "Checking multilib configuration..."; \ |
1665 | $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \ | |
1666 | $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \ | |
1086bc09 | 1667 | |
405ea7a0 | 1668 | # Rebuilding Makefile.in, using autogen. |
43be203f | 1669 | AUTOGEN = autogen |
6b784d9f | 1670 | $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def |
43be203f | 1671 | cd $(srcdir) && $(AUTOGEN) Makefile.def |
405ea7a0 | 1672 | |
a0da8069 | 1673 | # Rebuilding Makefile. |
43be203f AO |
1674 | Makefile: $(srcdir)/Makefile.in config.status |
1675 | CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status | |
1676 | ||
479759c8 | 1677 | config.status: configure |
10ecffb9 | 1678 | CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck |
405ea7a0 | 1679 | |
a0da8069 | 1680 | # Rebuilding configure. |
43be203f | 1681 | AUTOCONF = autoconf |
6b784d9f | 1682 | $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4 |
43be203f | 1683 | cd $(srcdir) && $(AUTOCONF) |
405ea7a0 | 1684 | |
3728fade NN |
1685 | # ------------------------------ |
1686 | # Special directives to GNU Make | |
1687 | # ------------------------------ | |
1688 | ||
3728fade NN |
1689 | # Don't pass command-line variables to submakes. |
1690 | .NOEXPORT: | |
1691 | MAKEOVERRIDES= | |
1692 | ||
405ea7a0 | 1693 | # end of Makefile.in |