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