1 [+ AutoGen5 template -*- Mode: Makefile -*-
5 # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
7 # Makefile for directory with subdirs to build.
8 # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
9 # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
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.
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.
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
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 # First, test for a proper version of make, but only where one is required.
29 ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
30 $(error GNU make version 3.80 or newer is required.)
34 # -------------------------------
35 # Standard Autoconf-set variables
36 # -------------------------------
39 build_alias=@build_noncanonical@
40 build_vendor=@build_vendor@
43 host_alias=@host_noncanonical@
44 host_vendor=@host_vendor@
47 target_alias=@target_noncanonical@
48 target_vendor=@target_vendor@
52 program_transform_name = @program_transform_name@
55 exec_prefix = @exec_prefix@
61 libexecdir = @libexecdir@
63 sysconfdir = @sysconfdir@
64 sharedstatedir = @sharedstatedir@
65 localstatedir = @localstatedir@
67 includedir = @includedir@
68 oldincludedir = @oldincludedir@
70 datarootdir = @datarootdir@
75 man1dir = $(mandir)/man1
76 man2dir = $(mandir)/man2
77 man3dir = $(mandir)/man3
78 man4dir = $(mandir)/man4
79 man5dir = $(mandir)/man5
80 man6dir = $(mandir)/man6
81 man7dir = $(mandir)/man7
82 man8dir = $(mandir)/man8
83 man9dir = $(mandir)/man9
86 INSTALL_PROGRAM = @INSTALL_PROGRAM@
87 INSTALL_SCRIPT = @INSTALL_SCRIPT@
88 INSTALL_DATA = @INSTALL_DATA@
92 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
93 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
95 # -------------------------------------------------
96 # Miscellaneous non-standard autoconf-set variables
97 # -------------------------------------------------
99 # The gcc driver likes to know the arguments it was configured with.
100 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
103 build_tooldir = @build_tooldir@
107 # This is the name of the environment variable used for the path to
109 RPATH_ENVVAR = @RPATH_ENVVAR@
111 # On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path
112 # is used instead of the directory itself to avoid including built
113 # executables in PATH.
114 GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
116 # Build programs are put under this directory.
117 BUILD_SUBDIR = @build_subdir@
118 # This is set by the configure script to the arguments to use when configuring
119 # directories built for the build system.
120 BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
122 # This is the list of variables to export in the environment when
123 # configuring any subdirectory. It must also be exported whenever
124 # recursing into a build directory in case that directory's Makefile
127 FLEX="$(FLEX)"; export FLEX; \
128 LEX="$(LEX)"; export LEX; \
129 BISON="$(BISON)"; export BISON; \
130 YACC="$(YACC)"; export YACC; \
131 M4="$(M4)"; export M4; \
132 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
134 # This is the list of variables to export in the environment when
135 # configuring subdirectories for the build system.
138 AR="$(AR_FOR_BUILD)"; export AR; \
139 AS="$(AS_FOR_BUILD)"; export AS; \
140 CC="$(CC_FOR_BUILD)"; export CC; \
141 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
142 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
143 CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
144 CXX="$(CXX_FOR_BUILD)"; export CXX; \
145 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
146 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
147 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
148 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
149 LD="$(LD_FOR_BUILD)"; export LD; \
150 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
151 NM="$(NM_FOR_BUILD)"; export NM; \
152 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
153 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
154 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
156 # These variables must be set on the make command line for directories
157 # built for the build system to override those in BASE_FLAGS_TO_PASS.
158 EXTRA_BUILD_FLAGS = \
159 CFLAGS="$(CFLAGS_FOR_BUILD)" \
160 CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
161 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
163 # This is the list of directories to built for the host system.
164 SUBDIRS = @configdirs@
165 # This is set by the configure script to the arguments to use when configuring
166 # directories built for the host system.
167 HOST_CONFIGARGS = @host_configargs@
168 # Host programs are put under this directory, which is . except if building
170 HOST_SUBDIR = @host_subdir@
171 # This is the list of variables to export in the environment when
172 # configuring subdirectories for the host system. We need to pass
173 # some to the GCC configure because of its hybrid host/target nature.
176 CC="$(CC)"; export CC; \
177 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
178 CFLAGS="$(CFLAGS)"; export CFLAGS; \
179 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
180 CPPFLAGS="$(CPPFLAGS)"; export CPPFLAGS; \
181 CXX="$(CXX)"; export CXX; \
182 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
183 AR="$(AR)"; export AR; \
184 AS="$(AS)"; export AS; \
185 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
186 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
187 LD="$(LD)"; export LD; \
188 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
189 NM="$(NM)"; export NM; \
190 RANLIB="$(RANLIB)"; export RANLIB; \
191 WINDRES="$(WINDRES)"; export WINDRES; \
192 WINDMC="$(WINDMC)"; export WINDMC; \
193 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
194 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
195 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
196 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
197 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
198 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
199 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
200 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
201 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
202 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
203 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
204 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
206 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
208 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
210 # Similar, for later GCC stages.
211 POSTSTAGE1_HOST_EXPORTS = \
213 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
214 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
215 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
216 $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
217 -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
218 -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
219 LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
221 # Target libraries are put under this directory:
222 TARGET_SUBDIR = @target_subdir@
223 # This is set by the configure script to the arguments to use when configuring
224 # directories built for the target.
225 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
226 # This is the list of variables to export in the environment when
227 # configuring subdirectories for the host system.
228 BASE_TARGET_EXPORTS = \
230 AR="$(AR_FOR_TARGET)"; export AR; \
231 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
232 CC="$(CC_FOR_TARGET)"; export CC; \
233 CFLAGS="$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
234 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
235 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
236 CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; \
237 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
238 GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
239 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
240 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
241 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
242 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
243 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
244 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
245 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
246 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
247 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
248 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
249 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
251 RAW_CXX_TARGET_EXPORTS = \
252 $(BASE_TARGET_EXPORTS) \
253 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
254 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
256 NORMAL_TARGET_EXPORTS = \
257 $(BASE_TARGET_EXPORTS) \
258 CXX="$(CXX_FOR_TARGET)"; export CXX;
261 HOST_GMPLIBS = @gmplibs@
262 HOST_GMPINC = @gmpinc@
264 # ----------------------------------------------
265 # Programs producing files for the BUILD machine
266 # ----------------------------------------------
268 SHELL = @config_shell@
270 # pwd command to use. Allow user to override default by setting PWDCMD in
271 # the environment to account for automounters. The make variable must not
272 # be called PWDCMD, otherwise the value set here is passed to make
273 # subprocesses and overrides the setting from the user's environment.
274 # Don't use PWD since it is a common shell environment variable and we
275 # don't want to corrupt it.
276 PWD_COMMAND = $${PWDCMD-pwd}
278 # compilers to use to create programs which must be run in the build
280 AR_FOR_BUILD = @AR_FOR_BUILD@
281 AS_FOR_BUILD = @AS_FOR_BUILD@
282 CC_FOR_BUILD = @CC_FOR_BUILD@
283 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
284 CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
285 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
286 CXX_FOR_BUILD = @CXX_FOR_BUILD@
287 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
288 GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
289 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
290 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
291 LD_FOR_BUILD = @LD_FOR_BUILD@
292 NM_FOR_BUILD = @NM_FOR_BUILD@
293 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
294 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
295 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
297 # Special variables passed down in EXTRA_GCC_FLAGS. They are defined
298 # here so that they can be overridden by Makefile fragments.
299 BUILD_PREFIX = @BUILD_PREFIX@
300 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
302 # Flags to pass to stage2 and later makes. They are defined
303 # here so that they can be overridden by Makefile fragments.
306 BOOT_ADAFLAGS=-gnatpg -gnata
313 MAKEINFO = @MAKEINFO@
317 # This just becomes part of the MAKEINFO definition passed down to
318 # sub-makes. It lets flags be given on the command line while still
319 # using the makeinfo from the object tree.
320 # (Default to avoid splitting info files by setting the threshold high.)
321 MAKEINFOFLAGS = --split-size=5000000
323 # ---------------------------------------------
324 # Programs producing files for the HOST machine
325 # ---------------------------------------------
342 GNATBIND = @GNATBIND@
343 GNATMAKE = @GNATMAKE@
346 CPPFLAGS = @CPPFLAGS@
348 LIBCFLAGS = $(CFLAGS)
349 CXXFLAGS = @CXXFLAGS@
350 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
352 # Only build the C compiler for stage1, because that is the only one that
353 # we can guarantee will build with the native compiler, and also it is the
354 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
355 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
356 # overrideable (for a bootstrap build stage1 also builds gcc.info).
358 STAGE1_CHECKING=@stage1_checking@
359 STAGE1_LANGUAGES=@stage1_languages@
361 STAGE1_CFLAGS=@stage1_cflags@
362 STAGE2_CFLAGS=$(BOOT_CFLAGS)
363 STAGE3_CFLAGS=$(BOOT_CFLAGS)
364 STAGE4_CFLAGS=$(BOOT_CFLAGS)
366 STAGE1_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
367 STAGE2_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
368 STAGE3_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
369 STAGE4_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
371 do-compare = @do_compare@
372 do-compare3 = $(do-compare)
373 do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
375 # -----------------------------------------------
376 # Programs producing files for the TARGET machine
377 # -----------------------------------------------
379 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
381 AR_FOR_TARGET=@AR_FOR_TARGET@
382 AS_FOR_TARGET=@AS_FOR_TARGET@
383 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
385 # If GCC_FOR_TARGET is not overriden on the command line, then this
386 # variable is passed down to the gcc Makefile, where it is used to
387 # build libgcc2.a. We define it here so that it can itself be
388 # overridden on the command line.
389 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
390 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
391 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
392 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
393 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
394 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
395 LD_FOR_TARGET=@LD_FOR_TARGET@
397 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
398 NM_FOR_TARGET=@NM_FOR_TARGET@
399 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
400 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
401 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
402 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
403 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
405 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
406 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
407 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
409 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
410 CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@
411 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
412 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
413 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
415 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
416 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
417 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
419 # ------------------------------------
420 # Miscellaneous targets and flag lists
421 # ------------------------------------
423 # The first rule in the file had better be this one. Don't put any above it.
424 # This lives here to allow makefile fragments to contain dependencies.
427 #### host and target specific makefile fragments come in here.
428 @target_makefile_frag@
434 # This is the list of directories that may be needed in RPATH_ENVVAR
435 # so that prorgams built for the target machine work.
436 TARGET_LIB_PATH = [+ FOR target_modules +][+
437 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
438 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
439 [+ FOR target_modules +][+ IF lib_path +]
440 @if target-[+module+]
441 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
442 @endif target-[+module+]
443 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
446 # This is the list of directories that may be needed in RPATH_ENVVAR
447 # so that programs built for the host machine work.
448 HOST_LIB_PATH = [+ FOR host_modules +][+
449 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
450 ENDFOR host_modules +]
452 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
454 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
457 [+ FOR host_modules +][+ IF lib_path +]
459 HOST_LIB_PATH_[+module+] = \
460 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
461 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
463 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
465 # Flags to pass down to all sub-makes.
466 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
467 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
468 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
469 "CONFIG_SHELL=$(SHELL)" \
470 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
472 # We leave this in just in case, but it is not needed anymore.
473 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
475 # Flags to pass down to most sub-makes, in which we're building with
476 # the host environment.
482 'DLLTOOL=$(DLLTOOL)' \
486 'OBJDUMP=$(OBJDUMP)' \
489 'WINDRES=$(WINDRES)' \
492 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
494 # Flags that are concerned with the location of the X11 include files
497 # NOTE: until the top-level is getting the values via autoconf, it only
498 # causes problems to have this top-level Makefile overriding the autoconf-set
499 # values in child directories. Only variables that don't conflict with
500 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
502 X11_FLAGS_TO_PASS = \
503 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
504 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
506 # Flags to pass to stage2 and later makes.
508 POSTSTAGE1_FLAGS_TO_PASS = \
509 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
510 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
511 LDFLAGS="$(BOOT_LDFLAGS)" \
512 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
514 # Flags to pass down to makes which are built with the target environment.
515 # The double $ decreases the length of the command line; those variables
516 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
517 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
518 # so we expand them here.
519 EXTRA_TARGET_FLAGS = \
520 'AR=$$(AR_FOR_TARGET)' \
521 'AS=$(COMPILER_AS_FOR_TARGET)' \
522 'CC=$$(CC_FOR_TARGET)' \
523 'CFLAGS=$$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
524 'CPPFLAGS=$$(CPPFLAGS_FOR_TARGET)' \
525 'CXX=$$(CXX_FOR_TARGET)' \
526 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
527 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
528 'LD=$(COMPILER_LD_FOR_TARGET)' \
529 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
530 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
531 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
532 'NM=$(COMPILER_NM_FOR_TARGET)' \
533 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
534 'RANLIB=$$(RANLIB_FOR_TARGET)' \
535 'WINDRES=$$(WINDRES_FOR_TARGET)' \
536 'WINDMC=$$(WINDMC_FOR_TARGET)'
538 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
540 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
541 # unfortunately needs the native compiler and the target ar and
543 # If any variables are added here, they must be added to do-*, below.
544 # The BUILD_* variables are a special case, which are used for the gcc
545 # cross-building scheme.
547 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
548 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
549 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
550 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
551 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
552 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
554 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
556 .PHONY: configure-host
558 FOR host_modules +] \
559 maybe-configure-[+module+][+
560 ENDFOR host_modules +]
561 .PHONY: configure-target
563 FOR target_modules +] \
564 maybe-configure-target-[+module+][+
565 ENDFOR target_modules +]
567 # The target built for a native non-bootstrap build.
571 [ -f stage_final ] || echo stage3 > stage_final
572 @r=`${PWD_COMMAND}`; export r; \
573 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
574 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
576 @: $(MAKE); $(unstage)
577 @r=`${PWD_COMMAND}`; export r; \
578 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
579 if [ -f stage_last ]; then \
580 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
582 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
586 [+ FOR build_modules +]
587 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
590 [+ FOR host_modules +][+ IF bootstrap +]
591 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
592 all-host: maybe-all-[+module+][+ IF bootstrap +]
593 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
596 [+ FOR target_modules +][+ IF bootstrap +]
597 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
598 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
599 @endif target-[+module+]-no-bootstrap[+
600 ENDIF bootstrap +][+ ENDFOR target_modules +]
602 # Do a target for all the subdirectories. A ``make do-X'' will do a
603 # ``make X'' in all subdirectories (because, in general, there is a
604 # dependency (below) of X upon do-X, a ``make X'' will also do this,
605 # but it may do additional work as well).
606 [+ FOR recursive_targets +]
607 .PHONY: do-[+make_target+]
609 @: $(MAKE); $(unstage)
610 @r=`${PWD_COMMAND}`; export r; \
611 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
612 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
613 [+make_target+]-target
616 .PHONY: [+make_target+]-host
617 [+ FOR host_modules +]
618 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
620 .PHONY: [+make_target+]-target
621 [+ FOR target_modules +]
622 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
623 [+ ENDFOR recursive_targets +]
625 # Here are the targets which correspond to the do-X targets.
627 .PHONY: info installcheck dvi pdf html
628 .PHONY: install-info install-pdf install-html
629 .PHONY: clean distclean mostlyclean maintainer-clean realclean
630 .PHONY: local-clean local-distclean local-maintainer-clean
632 installcheck: do-installcheck
637 # Make sure makeinfo is built before we do a `make info', if we're
638 # in fact building texinfo.
639 do-info: maybe-all-texinfo
641 install-info: do-install-info dir.info
642 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
643 if [ -f dir.info ] ; then \
644 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
647 install-pdf: do-install-pdf
649 install-html: do-install-html
652 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
655 -rm -f Makefile config.status config.cache mh-frag mt-frag
656 -rm -f maybedep.tmp serdep.tmp
657 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
658 rm -rf $(TARGET_SUBDIR); \
660 -rm -rf $(BUILD_SUBDIR)
661 -if [ "$(HOST_SUBDIR)" != "." ]; then \
662 rm -rf $(HOST_SUBDIR); \
664 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
665 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
666 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
667 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
668 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
670 local-maintainer-clean:
671 @echo "This command is intended for maintainers to use;"
672 @echo "it deletes files that may require special tools to rebuild."
674 clean: do-clean local-clean
675 mostlyclean: do-mostlyclean local-clean
676 distclean: do-distclean local-clean local-distclean
677 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
678 maintainer-clean: local-distclean
679 realclean: maintainer-clean
683 .PHONY: check do-check
686 # Only include modules actually being configured and built.
689 FOR host_modules +] \
690 maybe-check-[+module+][+
691 ENDFOR host_modules +]
695 FOR target_modules +] \
696 maybe-check-target-[+module+][+
697 ENDFOR target_modules +]
700 @: $(MAKE); $(unstage)
701 @r=`${PWD_COMMAND}`; export r; \
702 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
703 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
705 # Automated reporting of test results.
707 warning.log: build.log
708 $(srcdir)/contrib/warn_summary build.log > $@
711 if test x'$(BOOT_CFLAGS)' != x''; then \
712 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
714 $(srcdir)/contrib/test_summary -t >$@
716 echo If you really want to send e-mail, run ./$@ now
718 mail-report-with-warnings.log: warning.log
719 if test x'$(BOOT_CFLAGS)' != x''; then \
720 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
722 $(srcdir)/contrib/test_summary -t -i warning.log >$@
724 echo If you really want to send e-mail, run ./$@ now
726 # Installation targets.
728 .PHONY: install uninstall
730 @: $(MAKE); $(unstage)
731 @r=`${PWD_COMMAND}`; export r; \
732 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
733 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
735 .PHONY: install-host-nogcc
736 install-host-nogcc: [+
737 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
738 maybe-install-[+module+][+ ENDIF +][+
739 ENDFOR host_modules +]
743 FOR host_modules +] \
744 maybe-install-[+module+][+
745 ENDFOR host_modules +]
747 .PHONY: install-target
749 FOR target_modules +] \
750 maybe-install-target-[+module+][+
751 ENDFOR target_modules +]
754 @echo "the uninstall target is not supported in this tree"
757 install.all: install-no-fixedincludes
758 @if [ -f ./gcc/Makefile ] ; then \
759 r=`${PWD_COMMAND}` ; export r ; \
760 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
763 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
768 # install-no-fixedincludes is used because Cygnus can not distribute
769 # the fixed header files.
770 .PHONY: install-no-fixedincludes
771 install-no-fixedincludes: installdirs install-host-nogcc \
772 install-target gcc-no-fixedincludes
774 ### other supporting targets
777 $(DESTDIR)$(prefix) \
778 $(DESTDIR)$(exec_prefix)
780 installdirs: mkinstalldirs
781 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
783 dir.info: do-install-info
784 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
785 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
786 mv -f dir.info.new dir.info ; \
791 @echo "Building a full distribution of this tree isn't done"
792 @echo "via 'make dist'. Check out the etc/ subdirectory"
796 # Right now this just builds TAGS in each subdirectory. emacs19 has the
797 # ability to use several tags files at once, so there is probably no need
798 # to combine them into one big TAGS file (like CVS 1.3 does). We could
799 # (if we felt like it) have this Makefile write a piece of elisp which
800 # the user could load to tell emacs19 where all the TAGS files we just
804 # ------------------------------------
805 # Macros for configure and all targets
806 # ------------------------------------
808 [+ DEFINE configure +]
809 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
810 maybe-configure-[+prefix+][+module+]:
812 configure-[+prefix+][+module+]: stage_current
814 @if [+prefix+][+module+]
815 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
816 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
817 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
818 @r=`${PWD_COMMAND}`; export r; \
819 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
820 [+ IF check_multilibs
821 +]echo "Checking multilib configuration for [+module+]..."; \
822 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
823 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
824 if test -r [+subdir+]/[+module+]/multilib.out; then \
825 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
826 rm -f [+subdir+]/[+module+]/multilib.tmp; \
828 rm -f [+subdir+]/[+module+]/Makefile; \
829 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
832 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
834 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
835 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
837 echo Configuring in [+subdir+]/[+module+]; \
838 cd "[+subdir+]/[+module+]" || exit 1; \
840 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
841 *) topdir=`echo [+subdir+]/[+module+]/ | \
842 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
844 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
845 libsrcdir="$$s/[+module+]"; \
846 [+ IF no-config-site +]rm -f no-such-file || : ; \
847 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
848 [+args+] --build=${build_alias} --host=[+host_alias+] \
849 --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
851 @endif [+prefix+][+module+]
854 [+ FOR bootstrap_stage +]
855 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
856 maybe-configure-stage[+id+]-[+prefix+][+module+]:
857 @if [+prefix+][+module+]-bootstrap
858 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
859 configure-stage[+id+]-[+prefix+][+module+]:
860 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
861 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
862 @r=`${PWD_COMMAND}`; export r; \
863 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
864 [+ IF check_multilibs
865 +]echo "Checking multilib configuration for [+module+]..."; \
866 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
867 if test -r [+subdir+]/[+module+]/multilib.out; then \
868 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
869 rm -f [+subdir+]/[+module+]/multilib.tmp; \
871 rm -f [+subdir+]/[+module+]/Makefile; \
872 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
875 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
877 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
878 [+exports+][+ IF prev +] \
879 [+poststage1_exports+][+ ENDIF prev +] [+ IF prefix +] \
880 CFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
881 CXXFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; [+ ELSE +] \
882 CFLAGS="[+stage_cflags+]"; export CFLAGS; \
883 CXXFLAGS="[+stage_cflags+]"; export CXXFLAGS; [+ ENDIF +] \
884 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
885 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
886 cd [+subdir+]/[+module+] || exit 1; \
888 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
889 *) topdir=`echo [+subdir+]/[+module+]/ | \
890 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
892 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
893 libsrcdir="$$s/[+module+]"; \
894 $(SHELL) $${libsrcdir}/configure \
895 [+args+] --build=${build_alias} --host=[+host_alias+] \
896 --target=[+target_alias+] $${srcdiroption} \
897 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
898 [+stage_configure_flags+] [+extra_configure_flags+]
899 @endif [+prefix+][+module+]-bootstrap
900 [+ ENDFOR bootstrap_stage +]
901 [+ ENDIF bootstrap +]
905 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
906 maybe-all-[+prefix+][+module+]:
908 all-[+prefix+][+module+]: stage_current
910 @if [+prefix+][+module+]
911 TARGET-[+prefix+][+module+]=[+
912 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
913 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
914 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
915 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
916 @r=`${PWD_COMMAND}`; export r; \
917 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
919 (cd [+subdir+]/[+module+] && \
920 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
921 $(TARGET-[+prefix+][+module+]))
922 @endif [+prefix+][+module+]
925 [+ FOR bootstrap_stage +]
926 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
927 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
928 maybe-all-stage[+id+]-[+prefix+][+module+]:
929 maybe-clean-stage[+id+]-[+prefix+][+module+]:
930 @if [+prefix+][+module+]-bootstrap
931 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
932 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
933 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
934 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
935 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
936 @r=`${PWD_COMMAND}`; export r; \
937 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
938 [+exports+][+ IF prev +] \
939 [+poststage1_exports+][+ ENDIF prev +] \
940 cd [+subdir+]/[+module+] && \
941 $(MAKE) $(BASE_FLAGS_TO_PASS) \
942 CFLAGS="[+stage_cflags+]" CXXFLAGS="[+stage_cflags+]" \
943 LIBCFLAGS="[+stage_libcflags+]" \
944 CFLAGS_FOR_TARGET="[+stage_libcflags+]" \
945 CXXFLAGS_FOR_TARGET="[+stage_libcflags+]" [+args+] [+
946 IF prev +][+poststage1_args+][+ ENDIF prev
947 +] [+extra_make_flags+] \
948 $(TARGET-stage[+id+]-[+prefix+][+module+])
950 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
951 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
952 clean-stage[+id+]-[+prefix+][+module+]:
953 @if [ $(current_stage) = stage[+id+] ]; then \
954 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
956 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
957 $(MAKE) stage[+id+]-start; \
959 cd [+subdir+]/[+module+] && \
960 $(MAKE) [+args+] [+ IF prev +] \
961 [+poststage1_args+] [+ ENDIF prev +] \
962 [+extra_make_flags+] clean
963 @endif [+prefix+][+module+]-bootstrap
965 [+ ENDFOR bootstrap_stage +]
966 [+ ENDIF bootstrap +]
969 # --------------------------------------
970 # Modules which run on the build machine
971 # --------------------------------------
972 [+ FOR build_modules +]
973 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
974 host_alias=(get "host" "${build_alias}")
975 target_alias=(get "target" "${target_alias}")
976 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
978 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
979 args="$(EXTRA_BUILD_FLAGS)" +]
980 [+ ENDFOR build_module +]
982 # --------------------------------------
983 # Modules which run on the host machine
984 # --------------------------------------
985 [+ FOR host_modules +]
986 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
987 exports="$(HOST_EXPORTS)"
988 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
989 host_alias=(get "host" "${host_alias}")
990 target_alias=(get "target" "${target_alias}")
991 args="$(HOST_CONFIGARGS)" +]
993 [+ all prefix="" subdir="$(HOST_SUBDIR)"
994 exports="$(HOST_EXPORTS)"
995 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
996 args="$(EXTRA_HOST_FLAGS)"
997 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
999 .PHONY: check-[+module+] maybe-check-[+module+]
1000 maybe-check-[+module+]:
1002 maybe-check-[+module+]: check-[+module+]
1005 [+ ELIF no_check_cross +]
1006 # This module is only tested in a native toolchain.
1008 @: $(MAKE); $(unstage)
1009 @if [ '$(host)' = '$(target)' ] ; then \
1010 r=`${PWD_COMMAND}`; export r; \
1011 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1013 (cd $(HOST_SUBDIR)/[+module+] && \
1014 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
1018 @: $(MAKE); $(unstage)
1019 @r=`${PWD_COMMAND}`; export r; \
1020 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1022 (cd $(HOST_SUBDIR)/[+module+] && \
1023 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
1024 [+ ENDIF no_check +]
1027 .PHONY: install-[+module+] maybe-install-[+module+]
1028 maybe-install-[+module+]:
1030 maybe-install-[+module+]: install-[+module+]
1034 install-[+module+]: installdirs
1035 @: $(MAKE); $(unstage)
1036 @r=`${PWD_COMMAND}`; export r; \
1037 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1039 (cd $(HOST_SUBDIR)/[+module+] && \
1040 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1041 [+ ENDIF no_install +]
1044 # Other targets (info, dvi, pdf, etc.)
1045 [+ FOR recursive_targets +]
1046 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1047 maybe-[+make_target+]-[+module+]:
1049 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1050 [+ IF (match-value? = "missing" (get "make_target") ) +]
1051 # [+module+] doesn't support [+make_target+].
1052 [+make_target+]-[+module+]:
1054 [+make_target+]-[+module+]: [+
1056 [+depend+]-[+module+] [+
1058 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1059 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1060 r=`${PWD_COMMAND}`; export r; \
1061 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1063 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1064 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1066 echo "Doing [+make_target+] in [+module+]" ; \
1067 (cd $(HOST_SUBDIR)/[+module+] && \
1068 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1069 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1070 "RANLIB=$${RANLIB}" \
1071 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1076 [+ ENDFOR recursive_targets +]
1077 [+ ENDFOR host_modules +]
1079 # ---------------------------------------
1080 # Modules which run on the target machine
1081 # ---------------------------------------
1082 [+ FOR target_modules +]
1085 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1086 check_multilibs=true
1087 exports="$(RAW_CXX_TARGET_EXPORTS)"
1088 host_alias=(get "host" "${target_alias}")
1089 target_alias=(get "target" "${target_alias}")
1090 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1092 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1093 exports="$(RAW_CXX_TARGET_EXPORTS)"
1094 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1096 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1097 check_multilibs=true
1098 exports="$(NORMAL_TARGET_EXPORTS)"
1099 host_alias=(get "host" "${target_alias}")
1100 target_alias=(get "target" "${target_alias}")
1101 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1103 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1104 exports="$(NORMAL_TARGET_EXPORTS)"
1105 args="$(EXTRA_TARGET_FLAGS)" +]
1108 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1109 maybe-check-target-[+module+]:
1110 @if target-[+module+]
1111 maybe-check-target-[+module+]: check-target-[+module+]
1113 # Dummy target for uncheckable module.
1114 check-target-[+module+]:
1116 check-target-[+module+]:
1117 @: $(MAKE); $(unstage)
1118 @r=`${PWD_COMMAND}`; export r; \
1119 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1121 $(RAW_CXX_TARGET_EXPORTS) \[+
1123 $(NORMAL_TARGET_EXPORTS) \[+
1125 (cd $(TARGET_SUBDIR)/[+module+] && \
1126 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1128 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1130 +] [+extra_make_flags+] check)
1131 [+ ENDIF no_check +]
1132 @endif target-[+module+]
1134 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1135 maybe-install-target-[+module+]:
1136 @if target-[+module+]
1137 maybe-install-target-[+module+]: install-target-[+module+]
1139 # Dummy target for uninstallable.
1140 install-target-[+module+]:
1142 install-target-[+module+]: installdirs
1143 @: $(MAKE); $(unstage)
1144 @r=`${PWD_COMMAND}`; export r; \
1145 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1147 $(RAW_CXX_TARGET_EXPORTS) \[+
1149 $(NORMAL_TARGET_EXPORTS) \[+
1151 (cd $(TARGET_SUBDIR)/[+module+] && \
1152 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1153 [+ ENDIF no_install +]
1154 @endif target-[+module+]
1156 # Other targets (info, dvi, pdf, etc.)
1157 [+ FOR recursive_targets +]
1158 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1159 maybe-[+make_target+]-target-[+module+]:
1160 @if target-[+module+]
1161 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1162 [+ IF (match-value? = "missing" (get "make_target") ) +]
1163 # [+module+] doesn't support [+make_target+].
1164 [+make_target+]-target-[+module+]:
1166 [+make_target+]-target-[+module+]: [+
1168 [+depend+]-target-[+module+] [+
1170 @: $(MAKE); $(unstage)
1171 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1172 r=`${PWD_COMMAND}`; export r; \
1173 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1175 $(RAW_CXX_TARGET_EXPORTS) \[+
1177 $(NORMAL_TARGET_EXPORTS) \[+
1179 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1180 for flag in $(EXTRA_TARGET_FLAGS); do \
1181 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1183 (cd $(TARGET_SUBDIR)/[+module+] && \
1184 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1185 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1186 "RANLIB=$${RANLIB}" \
1187 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1188 [+extra_make_flags+] [+make_target+]) \
1191 @endif target-[+module+]
1192 [+ ENDFOR recursive_targets +]
1193 [+ ENDFOR target_modules +]
1199 @if gcc-no-bootstrap
1201 cross: all-build all-gas all-ld
1202 @r=`${PWD_COMMAND}`; export r; \
1203 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1205 echo "Building the C and C++ compiler"; \
1206 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1207 @r=`${PWD_COMMAND}`; export r; \
1208 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1209 echo "Building runtime libraries"; \
1210 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1211 @endif gcc-no-bootstrap
1214 .PHONY: check-gcc-c++
1216 @if [ -f ./gcc/Makefile ] ; then \
1217 r=`${PWD_COMMAND}`; export r; \
1218 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1220 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1226 check-c++: check-target-libstdc++-v3 check-gcc-c++
1228 # Install the gcc headers files, but not the fixed include files,
1229 # which Cygnus is not allowed to distribute. This rule is very
1230 # dependent on the workings of the gcc Makefile.in.
1231 .PHONY: gcc-no-fixedincludes
1232 gcc-no-fixedincludes:
1233 @if [ -f ./gcc/Makefile ]; then \
1234 rm -rf gcc/tmp-include; \
1235 mv gcc/include gcc/tmp-include 2>/dev/null; \
1236 mkdir gcc/include; \
1237 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1238 touch gcc/stmp-fixinc gcc/include/fixed; \
1239 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1240 r=`${PWD_COMMAND}`; export r; \
1241 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1244 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1245 rm -rf gcc/include; \
1246 mv gcc/tmp-include gcc/include 2>/dev/null; \
1250 # ---------------------
1251 # GCC bootstrap support
1252 # ---------------------
1254 # We track the current stage (the one in 'gcc') in the stage_current file.
1255 # stage_last instead tracks the stage that was built last. These targets
1256 # are dummy when toplevel bootstrap is not active.
1258 # While making host and target tools, symlinks to the final stage must be
1259 # there, so $(unstage) should be run at various points. To avoid excessive
1260 # recursive invocations of make, we "inline" them using a variable. These
1261 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1262 # to avoid warnings from the GNU Make job server.
1269 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1270 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1271 current_stage = "`cat stage_current 2> /dev/null`"
1272 @endif gcc-bootstrap
1274 .PHONY: unstage stage
1276 @: $(MAKE); $(unstage)
1278 @: $(MAKE); $(stage)
1280 # Disable commands for lean bootstrap.
1283 # We name the build directories for the various stages "stage1-gcc",
1284 # "stage2-gcc","stage3-gcc", etc.
1286 # Since the 'compare' process will fail (on debugging information) if any
1287 # directory names are different, we need to link the gcc directory for
1288 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1289 # the build directories constant as well. For the latter, we use naked names
1290 # like 'gcc', because the scripts in that directory assume it. We use
1291 # mv on platforms where symlinks to directories do not work or are not
1294 # 'touch' doesn't work right on some platforms.
1295 STAMP = echo timestamp >
1297 # We only want to compare .o files, so set this!
1300 [+ FOR bootstrap-stage +]
1301 .PHONY: stage[+id+]-start stage[+id+]-end
1304 @: $(MAKE); $(stage); \
1305 echo stage[+id+] > stage_current ; \
1306 echo stage[+id+] > stage_last; \
1307 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1308 FOR host_modules +][+ IF bootstrap +]
1310 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1311 mkdir stage[+id+]-[+module+]; \
1312 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1313 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1314 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1315 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1316 mkdir stage[+id+]-$(TARGET_SUBDIR); \
1317 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1318 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1320 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1322 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1323 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1324 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1326 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1327 @if test -d $(TARGET_SUBDIR) ; then \
1328 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1329 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1333 # Bubble a bug fix through all the stages up to stage [+id+]. They are
1334 # remade, but not reconfigured. The next stage (if any) will not be
1335 # reconfigured either.
1336 .PHONY: stage[+id+]-bubble
1337 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1338 @r=`${PWD_COMMAND}`; export r; \
1339 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1340 if test -f stage[+id+]-lean [+
1341 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1342 echo Skipping rebuild of stage[+id+] ; \
1344 $(MAKE) stage[+id+]-start; \[+IF lean +]
1346 rm -rf stage[+lean+]-* ; \
1347 $(STAMP) stage[+lean+]-lean ; \
1348 fi; \[+ ENDIF lean +]
1349 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1350 fi[+ IF compare-target +]
1351 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1353 .PHONY: all-stage[+id+] clean-stage[+id+]
1354 do-clean: clean-stage[+id+]
1356 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1357 # only possibility, but now it conflicts with no-bootstrap rules
1359 [+ IF compare-target +]
1361 @r=`${PWD_COMMAND}`; export r; \
1362 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1363 if test -f stage[+prev+]-lean; then \
1364 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1367 : $(MAKE); $(stage); \
1368 rm -f .bad_compare ; \
1369 echo Comparing stages [+prev+] and [+id+] ; \
1370 cd stage[+id+]-gcc; \
1371 files=`find . -name "*$(objext)" -print` ; \
1373 for file in $${files} ; do \
1374 f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1375 $(do-[+compare-target+]) > /dev/null 2>&1; \
1376 if test $$? -eq 1; then \
1378 ./cc*-checksum$(objext) | ./libgcc/* ) \
1379 echo warning: $$file differs ;; \
1381 echo $$file differs >> .bad_compare ;; \
1385 if [ -f .bad_compare ]; then \
1386 echo "Bootstrap comparison failure!"; \
1390 echo Comparison successful.; \
1392 $(STAMP) [+compare-target+][+ IF prev +]
1394 rm -rf stage[+prev+]-*; \
1395 $(STAMP) stage[+prev+]-lean; \
1397 [+ ENDIF compare-target +]
1399 [+ IF bootstrap-target +]
1400 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1401 [+bootstrap-target+]:
1402 echo stage[+id+] > stage_final
1403 @r=`${PWD_COMMAND}`; export r; \
1404 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1405 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1406 @: $(MAKE); $(unstage)
1407 @r=`${PWD_COMMAND}`; export r; \
1408 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1409 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1411 [+bootstrap-target+]-lean:
1412 echo stage[+id+] > stage_final
1413 @r=`${PWD_COMMAND}`; export r; \
1414 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1415 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1416 @: $(MAKE); $(unstage)
1417 @r=`${PWD_COMMAND}`; export r; \
1418 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1419 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1420 [+ ENDIF bootstrap-target +]
1422 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1423 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1424 .PHONY: distclean-stage[+id+]
1425 distclean-stage[+id+]::
1426 @: $(MAKE); $(stage)
1427 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1428 rm -rf stage[+id+]-* [+
1429 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1431 [+ IF cleanstrap-target +]
1432 .PHONY: [+cleanstrap-target+]
1433 [+cleanstrap-target+]: do-distclean local-clean
1434 echo stage[+id+] > stage_final
1435 @r=`${PWD_COMMAND}`; export r; \
1436 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1437 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1438 @: $(MAKE); $(unstage)
1439 @r=`${PWD_COMMAND}`; export r; \
1440 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1441 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1442 [+ ENDIF cleanstrap-target +]
1443 @endif gcc-bootstrap
1445 [+ ENDFOR bootstrap-stage +]
1448 $(MAKE) distclean-stagefeedback
1450 stagefeedback-start::
1451 @r=`${PWD_COMMAND}`; export r; \
1452 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1453 for i in prev-*; do \
1454 j=`echo $$i | sed s/^prev-//` ; \
1456 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1457 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1461 do-distclean: distclean-stage1
1463 # Provide a GCC build when we're building target libraries. This does
1464 # not work as a dependency, just as the minimum necessary to avoid errors.
1466 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1468 # Same as unstage, but not phony and defaulting to stage1-start. We place
1469 # it in the dependency so that for example `make -j3 all-gcc' works.
1471 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1475 @: $(MAKE); $(stage)
1476 rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1477 +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1479 @endif gcc-bootstrap
1481 # --------------------------------------
1482 # Dependencies between different modules
1483 # --------------------------------------
1485 # Generic dependencies for target modules on host stuff, especially gcc
1486 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1487 +][+ FOR bootstrap_stage +]
1488 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1489 ENDFOR +][+ ELSE bootstrap +]
1490 configure-target-[+module+]: stage_last[+
1491 ENDIF bootstrap +][+ ENDFOR target_modules +]
1492 @endif gcc-bootstrap
1494 @if gcc-no-bootstrap[+ FOR target_modules +]
1495 configure-target-[+module+]: maybe-all-gcc[+
1496 ENDFOR target_modules +]
1497 @endif gcc-no-bootstrap
1500 # There are two types of dependencies here: 'hard' dependencies, where one
1501 # module simply won't build without the other; and 'soft' dependencies, where
1502 # if the depended-on module is missing, the depending module will do without
1503 # or find a substitute somewhere (perhaps installed). Soft dependencies
1504 # are made here to depend on a 'maybe-' target. If you're not sure,
1505 # it's safer to use a soft dependency.
1507 [+ ;; These Scheme functions build the bulk of the dependencies.
1508 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1509 ;; where "maybe-" is only included if HARD is not true, and all-gcc
1510 ;; is taken from VAR-NAME.
1511 (define dep-target (lambda (module-kind var-name hard)
1513 (if hard "" "maybe-")
1514 (dep-subtarget var-name)
1516 (dep-module var-name)
1519 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1520 (define make-dep (lambda (module-kind on-kind)
1522 (dep-target module-kind "module" #t) ": "
1523 (dep-target on-kind "on" (exist? "hard")))))
1525 ;; dep-subtarget extracts everything up to the first dash in the given
1526 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1527 (define dep-subtarget (lambda (var-name)
1528 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1530 ;; dep-module extracts everything up to the first dash in the given
1531 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1532 (define dep-module (lambda (var-name)
1533 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1535 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1536 (define dep-stage (lambda ()
1542 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1543 ;; but is written in Scheme.
1544 (define dep-maybe (lambda ()
1545 (if (exist? "hard") "" "maybe-")))
1547 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1548 ;; or if either module is not bootstrapped. It returns "bootstrap" for
1549 ;; configure or build dependencies between bootstrapped modules; it returns
1550 ;; "prebootstrap" for configure or build dependencies of bootstrapped
1551 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
1552 ;; is only necessary for host modules.
1553 (define dep-kind (lambda ()
1554 (if (and (hash-ref boot-modules (dep-module "module"))
1555 (=* (dep-module "on") "build-"))
1558 (if (or (= (dep-subtarget "on") "install-")
1559 (not (hash-ref boot-modules (dep-module "module")))
1560 (not (hash-ref boot-modules (dep-module "on"))))
1564 ;; We now build the hash table that is used by dep-kind.
1565 (define boot-modules (make-hash-table 113))
1568 [+ FOR host_modules +][+
1569 (if (exist? "bootstrap")
1570 (hash-create-handle! boot-modules (get "module") #t))
1571 "" +][+ ENDFOR host_modules +]
1572 [+ FOR target_modules +][+
1573 (if (exist? "bootstrap")
1574 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1575 "" +][+ ENDFOR target_modules +]
1577 # With all the machinery above in place, it is pretty easy to generate
1578 # dependencies. Host dependencies are a bit more complex because we have
1579 # to check for bootstrap/prebootstrap dependencies. To resolve
1580 # prebootstrap dependencies, prebootstrap modules are gathered in
1582 [+ FOR dependencies +][+ (make-dep "" "") +]
1583 [+ CASE (dep-kind) +]
1584 [+ == "prebootstrap"
1585 +][+ FOR bootstrap_stage +]
1586 [+ (make-dep (dep-stage) "") +][+
1587 ENDFOR bootstrap_stage +]
1589 +][+ FOR bootstrap_stage +]
1590 [+ (make-dep (dep-stage) (dep-stage)) +][+
1591 ENDFOR bootstrap_stage +]
1593 ENDFOR dependencies +]
1595 # Dependencies for target modules on other target modules are
1596 # described by lang_env_dependencies; the defaults apply to anything
1597 # not mentioned there.
1599 ;; Predicate for whether LANG was specified in lang_env_dependencies.
1600 (define lang-dep (lambda (lang)
1601 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1603 ;; Build the hash table we will need.
1604 (define lang-env-deps (make-hash-table 7))
1605 +][+ FOR lang_env_dependencies +][+
1607 (hash-create-handle! lang-env-deps
1608 (string-append (get "module") "-" "cxx") #t))
1611 (hash-create-handle! lang-env-deps
1612 (string-append (get "module") "-" "no_c") #t))
1614 (if (exist? "no_gcc")
1615 (hash-create-handle! lang-env-deps
1616 (string-append (get "module") "-" "no_gcc") #t))
1617 "" +][+ ENDFOR lang_env_dependencies +]
1619 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1620 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1621 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1622 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1623 @endif gcc-bootstrap
1625 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1626 configure-target-[+module+]: maybe-all-target-libgcc[+
1627 ENDIF +][+ ENDFOR target_modules +]
1628 @endif gcc-no-bootstrap
1630 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1631 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1632 ENDIF +][+ IF (lang-dep "cxx") +]
1633 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1635 [+ ENDFOR target_modules +]
1637 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1639 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1640 configure-gdb: $(CONFIGURE_GDB_TK)
1641 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1642 install-gdb: $(INSTALL_GDB_TK)
1644 # Serialization dependencies. Host configures don't work well in parallel to
1645 # each other, due to contention over config.cache. Target configures and
1646 # build configures are similar.
1647 @serialization_dependencies@
1649 # --------------------------------
1650 # Regenerating top level configury
1651 # --------------------------------
1653 # Rebuilding Makefile.in, using autogen.
1655 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1656 cd $(srcdir) && $(AUTOGEN) Makefile.def
1658 # Rebuilding Makefile.
1659 Makefile: $(srcdir)/Makefile.in config.status
1660 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1662 config.status: configure
1663 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1665 # Rebuilding configure.
1667 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1668 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
1669 cd $(srcdir) && $(AUTOCONF)
1671 # ------------------------------
1672 # Special directives to GNU Make
1673 # ------------------------------
1675 # Don't pass command-line variables to submakes.
1679 # end of Makefile.in