018f18f5db4ec7f5bf88d41d23f55163b6a6fcd3
[external/binutils.git] / Makefile.tpl
1 [+ AutoGen5 template -*- Mode: Makefile -*-
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,
9 #   1999, 2000, 2001, 2002, 2003 Free Software Foundation
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
23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #
25
26 # -------------------------------
27 # Standard Autoconf-set variables
28 # -------------------------------
29 VPATH=@srcdir@
30
31 build_alias=@build_alias@
32 build_cpu=@build_cpu@
33 build_vendor=@build_vendor@
34 build_os=@build_os@
35 build_canonical=@build_cpu@-@build_vendor@-@build_os@
36 host_alias=@host_alias@
37 host_cpu=@host_cpu@
38 host_vendor=@host_vendor@
39 host_os=@host_os@
40 host_canonical=@host_cpu@-@host_vendor@-@host_os@
41 target_alias=@target_alias@
42 target_cpu=@target_cpu@
43 target_vendor=@target_vendor@
44 target_os=@target_os@
45 target_canonical=@target_cpu@-@target_vendor@-@target_os@
46
47 program_transform_name = @program_transform_name@
48
49 prefix = @prefix@
50 exec_prefix = @exec_prefix@
51
52 srcdir = @srcdir@
53
54 bindir = @bindir@
55 sbindir = @sbindir@
56 libexecdir = @libexecdir@
57 datadir = @datadir@
58 sysconfdir = @sysconfdir@
59 sharedstatedir = @sharedstatedir@
60 localstatedir = @localstatedir@
61 libdir = @libdir@
62 includedir = @includedir@
63 oldincludedir = @oldincludedir@
64 infodir = @infodir@
65 mandir = @mandir@
66 man1dir = $(mandir)/man1
67 man2dir = $(mandir)/man2
68 man3dir = $(mandir)/man3
69 man4dir = $(mandir)/man4
70 man5dir = $(mandir)/man5
71 man6dir = $(mandir)/man6
72 man7dir = $(mandir)/man7
73 man8dir = $(mandir)/man8
74 man9dir = $(mandir)/man9
75
76 # INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
77 # cygwin host.
78 INSTALL_PROGRAM_ARGS =
79
80 INSTALL = $(SHELL) $$s/install-sh -c
81 INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_ARGS)
82 INSTALL_SCRIPT = $(INSTALL)
83 INSTALL_DATA = $(INSTALL) -m 644
84
85 # -------------------------------------------------
86 # Miscellaneous non-standard autoconf-set variables
87 # -------------------------------------------------
88
89 links=@configlinks@
90 # The file containing GCC's version number.
91 gcc_version_trigger = @gcc_version_trigger@
92 gcc_version = @gcc_version@
93
94 # The gcc driver likes to know the arguments it was configured with.
95 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
96
97 gxx_include_dir = @gxx_include_dir@
98 libstdcxx_incdir = @libstdcxx_incdir@
99
100 tooldir = @tooldir@
101 build_tooldir = @build_tooldir@
102
103 # Directory in which the compiler finds executables, libraries, etc.
104 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
105 GDB_NLM_DEPS = 
106
107 # This is the name of the environment variable used for the path to
108 # the libraries.
109 RPATH_ENVVAR = @RPATH_ENVVAR@
110
111 # This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
112 # was used.
113 SET_LIB_PATH = @SET_LIB_PATH@
114
115 # configure.in sets SET_LIB_PATH to this if --enable-shared was used.
116 # Some platforms don't like blank entries, so we remove duplicate,
117 # leading and trailing colons.
118 REALLY_SET_LIB_PATH = \
119   $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
120
121 # This is the list of directories to be built for the build system.
122 BUILD_CONFIGDIRS = libiberty
123 # Build programs are put under this directory.
124 BUILD_SUBDIR = @build_subdir@
125 # This is set by the configure script to the arguments to use when configuring
126 # directories built for the build system.
127 BUILD_CONFIGARGS = @build_configargs@
128
129 # This is the list of directories to built for the host system.
130 SUBDIRS = @configdirs@
131 # This is set by the configure script to the arguments to use when configuring
132 # directories built for the host system.
133 HOST_CONFIGARGS = @host_configargs@
134
135 # This is set by the configure script to the list of directories which
136 # should be built using the target tools.
137 TARGET_CONFIGDIRS = @target_configdirs@
138 # Target libraries are put under this directory:
139 TARGET_SUBDIR = @target_subdir@
140 # This is set by the configure script to the arguments to use when configuring
141 # directories built for the target.
142 TARGET_CONFIGARGS = @target_configargs@
143
144 # ----------------------------------------------
145 # Programs producing files for the BUILD machine
146 # ----------------------------------------------
147
148 SHELL = @config_shell@
149
150 # pwd command to use.  Allow user to override default by setting PWDCMD in
151 # the environment to account for automounters.  The make variable must not
152 # be called PWDCMD, otherwise the value set here is passed to make
153 # subprocesses and overrides the setting from the user's environment.
154 PWD = $${PWDCMD-pwd}
155
156 # compilers to use to create programs which must be run in the build
157 # environment.
158 CC_FOR_BUILD = @CC_FOR_BUILD@
159 CFLAGS_FOR_BUILD = $(CFLAGS)
160
161 CXX_FOR_BUILD = $(CXX)
162
163 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
164 # here so that they can be overridden by Makefile fragments.
165 BUILD_CC = $(CC_FOR_BUILD)
166 BUILD_PREFIX = @BUILD_PREFIX@
167 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
168
169 BISON=@BISON@
170 USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
171             echo $$r/bison/bison -L $$s/bison/ ; \
172          else \
173             echo bison ; \
174          fi`
175
176 DEFAULT_YACC = @DEFAULT_YACC@
177 YACC=@YACC@
178 USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
179             echo $$r/bison/bison -y -L $$s/bison/ ; \
180         elif [ -f $$r/byacc/byacc ] ; then \
181             echo $$r/byacc/byacc ; \
182         else \
183             echo ${DEFAULT_YACC} ; \
184         fi`
185
186 DEFAULT_LEX = @DEFAULT_LEX@
187 LEX=@LEX@
188 USUAL_LEX = `if [ -f $$r/flex/flex ] ; \
189         then echo $$r/flex/flex ; \
190         else echo ${DEFAULT_LEX} ; fi`
191
192 DEFAULT_M4 = @DEFAULT_M4@
193 M4 = `if [ -f $$r/m4/m4 ] ; \
194         then echo $$r/m4/m4 ; \
195         else echo ${DEFAULT_M4} ; fi`
196
197 # For an installed makeinfo, we require it to be from texinfo 4 or
198 # higher, else we use the "missing" dummy.
199 MAKEINFO=@MAKEINFO@
200 USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
201         then echo $$r/texinfo/makeinfo/makeinfo ; \
202         else if (makeinfo --version \
203           | egrep 'texinfo[^0-9]*([1-3][0-9]|[4-9])') >/dev/null 2>&1; \
204         then echo makeinfo; else echo $$s/missing makeinfo; fi; fi`
205
206 # This just becomes part of the MAKEINFO definition passed down to
207 # sub-makes.  It lets flags be given on the command line while still
208 # using the makeinfo from the object tree.
209 # (Default to avoid splitting info files by setting the threshold high.)
210 MAKEINFOFLAGS = --split-size=5000000
211
212 EXPECT = `if [ -f $$r/expect/expect ] ; \
213         then echo $$r/expect/expect ; \
214         else echo expect ; fi`
215
216 RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
217         then echo $$s/dejagnu/runtest ; \
218         else echo runtest ; fi`
219
220 # ---------------------------------------------
221 # Programs producing files for the HOST machine
222 # ---------------------------------------------
223
224 # This is the list of directories that may be needed in RPATH_ENVVAR
225 # so that programs built for the host machine work.
226 HOST_LIB_PATH = $$r/bfd:$$r/opcodes
227
228 AS = @AS@
229
230 AR = @AR@
231 AR_FLAGS = rc
232
233 CC = @CC@
234 CFLAGS = @CFLAGS@
235 LIBCFLAGS = $(CFLAGS)
236
237 CXX = @CXX@
238 CXXFLAGS = @CXXFLAGS@
239 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
240
241 DLLTOOL = @DLLTOOL@
242
243 NM = @NM@
244
245 LD = @LD@
246 LDFLAGS = 
247
248 RANLIB = @RANLIB@
249
250 WINDRES = @WINDRES@
251
252 PICFLAG = 
253
254 # -----------------------------------------------
255 # Programs producing files for the TARGET machine
256 # -----------------------------------------------
257
258 # This is the list of directories that may be needed in RPATH_ENVVAR
259 # so that prorgams built for the target machine work.
260 TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
261
262 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
263
264 AR_FOR_TARGET=@AR_FOR_TARGET@
265 USUAL_AR_FOR_TARGET = ` \
266   if [ -f $$r/binutils/ar ] ; then \
267     echo $$r/binutils/ar ; \
268   else \
269     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
270       echo $(AR); \
271     else \
272        echo ar | sed '$(program_transform_name)' ; \
273     fi; \
274   fi`
275
276 AS_FOR_TARGET=@AS_FOR_TARGET@
277 USUAL_AS_FOR_TARGET = ` \
278   if [ -f $$r/gas/as-new ] ; then \
279     echo $$r/gas/as-new ; \
280   elif [ -f $$r/gcc/xgcc ]; then \
281     $(CC_FOR_TARGET) -print-prog-name=as ; \
282   else \
283     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
284       echo $(AS); \
285     else \
286        echo as | sed '$(program_transform_name)' ; \
287     fi; \
288   fi`
289
290 CC_FOR_TARGET = @CC_FOR_TARGET@
291 # During gcc bootstrap, if we use some random cc for stage1 then
292 # CFLAGS will be just -g.  We want to ensure that TARGET libraries
293 # (which we know are built with gcc) are built with optimizations so
294 # prepend -O2 when setting CFLAGS_FOR_TARGET.
295 CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
296 # If GCC_FOR_TARGET is not overriden on the command line, then this
297 # variable is passed down to the gcc Makefile, where it is used to
298 # build libgcc2.a.  We define it here so that it can itself be
299 # overridden on the command line.
300 GCC_FOR_TARGET=@GCC_FOR_TARGET@
301 USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
302 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
303
304 CXX_FOR_TARGET = @CXX_FOR_TARGET@
305 RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
306 CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
307 RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
308 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
309 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
310
311 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
312 USUAL_DLLTOOL_FOR_TARGET = ` \
313   if [ -f $$r/binutils/dlltool ] ; then \
314     echo $$r/binutils/dlltool ; \
315   else \
316     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
317       echo $(DLLTOOL); \
318     else \
319        echo dlltool | sed '$(program_transform_name)' ; \
320     fi; \
321   fi`
322
323 GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
324
325 LD_FOR_TARGET=@LD_FOR_TARGET@
326 USUAL_LD_FOR_TARGET = ` \
327   if [ -f $$r/ld/ld-new ] ; then \
328     echo $$r/ld/ld-new ; \
329   elif [ -f $$r/gcc/xgcc ]; then \
330     $(CC_FOR_TARGET) -print-prog-name=ld ; \
331   else \
332     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
333       echo $(LD); \
334     else \
335        echo ld | sed '$(program_transform_name)' ; \
336     fi; \
337   fi`
338
339 LDFLAGS_FOR_TARGET = 
340
341 NM_FOR_TARGET=@NM_FOR_TARGET@
342 USUAL_NM_FOR_TARGET = ` \
343   if [ -f $$r/binutils/nm-new ] ; then \
344     echo $$r/binutils/nm-new ; \
345   elif [ -f $$r/gcc/xgcc ]; then \
346     $(CC_FOR_TARGET) -print-prog-name=nm ; \
347   else \
348     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
349       echo $(NM); \
350     else \
351        echo nm | sed '$(program_transform_name)' ; \
352     fi; \
353   fi`
354
355 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
356 USUAL_RANLIB_FOR_TARGET = ` \
357   if [ -f $$r/binutils/ranlib ] ; then \
358     echo $$r/binutils/ranlib ; \
359   else \
360     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
361       if [ x'$(RANLIB)' != x ]; then \
362          echo $(RANLIB); \
363       else \
364          echo ranlib; \
365       fi; \
366     else \
367        echo ranlib | sed '$(program_transform_name)' ; \
368     fi; \
369   fi`
370
371 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
372 USUAL_WINDRES_FOR_TARGET = ` \
373   if [ -f $$r/binutils/windres ] ; then \
374     echo $$r/binutils/windres ; \
375   else \
376     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
377       echo $(WINDRES); \
378     else \
379        echo windres | sed '$(program_transform_name)' ; \
380     fi; \
381   fi`
382
383 PICFLAG_FOR_TARGET = 
384
385 # ------------------------------------
386 # Miscellaneous targets and flag lists
387 # ------------------------------------
388
389 # The first rule in the file had better be this one.  Don't put any above it.
390 # This lives here to allow makefile fragments to contain dependencies.
391 all: all.normal
392 .PHONY: all
393
394 #### host and target specific makefile fragments come in here.
395 @target_makefile_frag@
396 @alphaieee_frag@
397 @ospace_frag@
398 @host_makefile_frag@
399 ###
400
401 # Flags to pass down to all sub-makes.
402 # Please keep these in alphabetical order.
403 BASE_FLAGS_TO_PASS = \
404         "AR_FLAGS=$(AR_FLAGS)" \
405         "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
406         "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
407         "BISON=$(BISON)" \
408         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
409         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
410         "CFLAGS=$(CFLAGS)" \
411         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
412         "GCJ_FOR_TARGET=$(GCJ_FOR_TARGET)" \
413         "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
414         "CXXFLAGS=$(CXXFLAGS)" \
415         "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
416         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
417         "DESTDIR=$(DESTDIR)" \
418         "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \
419         "INSTALL=$(INSTALL)" \
420         "INSTALL_DATA=$(INSTALL_DATA)" \
421         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
422         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
423         "LDFLAGS=$(LDFLAGS)" \
424         "LEX=$(LEX)" \
425         "LD_FOR_TARGET=$(LD_FOR_TARGET)" \
426         "LIBCFLAGS=$(LIBCFLAGS)" \
427         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
428         "LIBCXXFLAGS=$(LIBCXXFLAGS)" \
429         "LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
430         "M4=$(M4)" \
431         "MAKE=$(MAKE)" \
432         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
433         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
434         "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
435         "RPATH_ENVVAR=$(RPATH_ENVVAR)" \
436         "SHELL=$(SHELL)" \
437         "EXPECT=$(EXPECT)" \
438         "RUNTEST=$(RUNTEST)" \
439         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
440         "TARGET_SUBDIR=$(TARGET_SUBDIR)" \
441         "WINDRES_FOR_TARGET=$(WINDRES_FOR_TARGET)" \
442         "YACC=$(YACC)" \
443         "bindir=$(bindir)" \
444         "datadir=$(datadir)" \
445         "exec_prefix=$(exec_prefix)" \
446         "includedir=$(includedir)" \
447         "infodir=$(infodir)" \
448         "libdir=$(libdir)" \
449         "libexecdir=$(libexecdir)" \
450         "lispdir=$(lispdir)" \
451         "libstdcxx_incdir=$(libstdcxx_incdir)" \
452         "libsubdir=$(libsubdir)" \
453         "localstatedir=$(localstatedir)" \
454         "mandir=$(mandir)" \
455         "oldincludedir=$(oldincludedir)" \
456         "prefix=$(prefix)" \
457         "sbindir=$(sbindir)" \
458         "sharedstatedir=$(sharedstatedir)" \
459         "sysconfdir=$(sysconfdir)" \
460         "tooldir=$(tooldir)" \
461         "build_tooldir=$(build_tooldir)" \
462         "gxx_include_dir=$(gxx_include_dir)" \
463         "gcc_version=$(gcc_version)" \
464         "gcc_version_trigger=$(gcc_version_trigger)" \
465         "target_alias=$(target_alias)" 
466
467 # For any flags above that may contain shell code that varies from one
468 # target library to another.  When doing recursive invocations of the
469 # top-level Makefile, we don't want the outer make to evaluate them,
470 # so we pass these variables down unchanged.  They must not contain
471 # single nor double quotes.
472 RECURSE_FLAGS = \
473         CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
474         RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
475
476 # Flags to pass down to most sub-makes, in which we're building with
477 # the host environment.
478 # If any variables are added here, they must be added to do-*, below.
479 EXTRA_HOST_FLAGS = \
480         'AR=$(AR)' \
481         'AS=$(AS)' \
482         'CC=$(CC)' \
483         'CXX=$(CXX)' \
484         'DLLTOOL=$(DLLTOOL)' \
485         'LD=$(LD)' \
486         'NM=$(NM)' \
487         'RANLIB=$(RANLIB)' \
488         'WINDRES=$(WINDRES)'
489
490 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
491
492 # Flags that are concerned with the location of the X11 include files
493 # and library files
494 #
495 # NOTE: until the top-level is getting the values via autoconf, it only
496 # causes problems to have this top-level Makefile overriding the autoconf-set
497 # values in child directories.  Only variables that don't conflict with
498 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
499 #
500 X11_FLAGS_TO_PASS = \
501         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
502         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
503
504 # Flags to pass down to makes which are built with the target environment.
505 # The double $ decreases the length of the command line; the variables
506 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
507 # If any variables are added here, they must be added to do-*, below.
508 EXTRA_TARGET_FLAGS = \
509         'AR=$$(AR_FOR_TARGET)' \
510         'AS=$$(AS_FOR_TARGET)' \
511         'CC=$$(CC_FOR_TARGET)' \
512         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
513         'CXX=$$(CXX_FOR_TARGET)' \
514         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
515         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
516         'LD=$$(LD_FOR_TARGET)' \
517         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
518         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
519         'NM=$$(NM_FOR_TARGET)' \
520         'RANLIB=$$(RANLIB_FOR_TARGET)' \
521         'WINDRES=$$(WINDRES_FOR_TARGET)'
522
523 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
524
525 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
526 # unfortunately needs the native compiler and the target ar and
527 # ranlib.
528 # If any variables are added here, they must be added to do-*, below.
529 # The HOST_* variables are a special case, which are used for the gcc
530 # cross-building scheme.
531 EXTRA_GCC_FLAGS = \
532         'AR=$(AR)' \
533         'AS=$(AS)' \
534         'CC=$(CC)' \
535         'CXX=$(CXX)' \
536         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
537         'BUILD_CC=$(CC_FOR_BUILD)' \
538         'BUILD_PREFIX=$(BUILD_PREFIX)' \
539         'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
540         'NM=$(NM)' \
541         'RANLIB=$(RANLIB)' \
542         'WINDRES=$$(WINDRES_FOR_TARGET)' \
543         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
544         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
545         "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s/.*=$$/XFOO=/`" \
546         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s/.*=$$/XFOO=/`" \
547         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s/.*=$$/XFOO=/`" \
548         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \
549         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \
550         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s/.*=$$/XFOO=/`" \
551         "`echo 'ENQUIRE=$(ENQUIRE)' | sed -e s/.*=$$/XFOO=/`" \
552         "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \
553         "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s/.*=$$/XFOO=/`"
554
555 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
556
557 configure-host: @configure_host_modules@
558 configure-target: @configure_target_modules@
559
560 # This is a list of the targets for which we can do a clean-{target}.
561 CLEAN_MODULES =[+
562     FOR host_modules +][+
563         IF (not (or (exist? "no_clean") (exist? "with_x"))) +] \
564         clean-[+module+][+
565         ENDIF no_clean +][+
566     ENDFOR host_modules +]
567
568 # All of the target modules that can be cleaned
569 CLEAN_TARGET_MODULES =[+
570     FOR target_modules +][+
571         IF (not (exist? "no_clean")) +] \
572         clean-target-[+module+][+
573         ENDIF no_clean +][+
574     ENDFOR target_modules +]
575
576 # All of the x11 modules that can be cleaned
577 CLEAN_X11_MODULES = [+ FOR host_modules +][+ IF with_x +]\
578         clean-[+module+] [+ ENDIF with_x +][+ ENDFOR host_modules +]
579
580 # The target built for a native build.
581 # This list only includes modules actually being configured and built.
582 .PHONY: all.normal
583 all.normal: @all_build_modules@ \
584         @all_host_modules@ \
585         @all_target_modules@
586
587 all-host: @all_host_modules@
588 all-target: @all_target_modules@
589
590 # Do a target for all the subdirectories.  A ``make do-X'' will do a
591 # ``make X'' in all subdirectories (because, in general, there is a
592 # dependency (below) of X upon do-X, a ``make X'' will also do this,
593 # but it may do additional work as well).
594 # This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
595 # because it is so large that it can easily overflow the command line
596 # length limit on some systems.
597 [+ FOR recursive_targets +]
598 .PHONY: do-[+target+]
599 do-[+target+]:
600         @r=`${PWD}`; export r; \
601         s=`cd $(srcdir); ${PWD}`; export s; \
602         $(SET_LIB_PATH) \
603         for i in $(SUBDIRS) -dummy-; do \
604           if [ -f ./$$i/Makefile ]; then \
605             case $$i in \
606             gcc) \
607               for flag in $(EXTRA_GCC_FLAGS); do \
608                 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
609               done; \
610               ;; \
611             *) \
612               for flag in $(EXTRA_HOST_FLAGS); do \
613                 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
614               done; \
615               ;; \
616             esac ; \
617             (cd ./$$i && \
618                 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
619                         "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
620                         "RANLIB=$${RANLIB}" \
621                         "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
622                         [+target+]) \
623             || exit 1; \
624           else true; fi; \
625         done
626         # Break into two pieces
627         r=`${PWD}`; export r; \
628         s=`cd $(srcdir); ${PWD}`; export s; \
629         $(SET_LIB_PATH) \
630         for i in $(TARGET_CONFIGDIRS) -dummy-; do \
631           if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \
632             for flag in $(EXTRA_TARGET_FLAGS); do \
633                 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
634             done; \
635             (cd $(TARGET_SUBDIR)/$$i && \
636                 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
637                         "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
638                         "RANLIB=$${RANLIB}" \
639                         "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
640                         [+target+]) \
641             || exit 1; \
642           else true; fi; \
643         done
644 [+ ENDFOR recursive_targets +]
645
646
647 # Here are the targets which correspond to the do-X targets.
648
649 .PHONY: info installcheck dvi install-info
650 .PHONY: clean distclean mostlyclean maintainer-clean realclean
651 .PHONY: local-clean local-distclean local-maintainer-clean
652 info: do-info
653 installcheck: do-installcheck
654 dvi: do-dvi
655
656 # Make sure makeinfo is built before we do a `make info', if we're
657 # in fact building texinfo.
658 do-info: maybe-all-texinfo
659
660 install-info: do-install-info dir.info
661         s=`cd $(srcdir); ${PWD}`; export s; \
662         if [ -f dir.info ] ; then \
663           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
664         else true ; fi
665
666 local-clean:
667         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
668
669 local-distclean:
670         -rm -f Makefile config.status config.cache mh-frag mt-frag
671         -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp
672         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
673           rm -rf $(TARGET_SUBDIR); \
674         else true; fi
675         -rm -rf $(BUILD_SUBDIR)
676         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
677         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
678         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
679         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
680         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
681
682 local-maintainer-clean:
683         @echo "This command is intended for maintainers to use;"
684         @echo "it deletes files that may require special tools to rebuild."
685
686 clean: do-clean local-clean
687 mostlyclean: do-mostlyclean local-clean
688 distclean: do-distclean local-clean local-distclean
689 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
690 maintainer-clean: local-distclean
691 realclean: maintainer-clean
692
693 # This rule is used to clean specific modules.
694 .PHONY: $(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc
695 $(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc:
696         @dir=`echo $@ | sed -e 's/clean-//'`; \
697         if [ -f ./$${dir}/Makefile ] ; then \
698           r=`${PWD}`; export r; \
699           s=`cd $(srcdir); ${PWD}`; export s; \
700           $(SET_LIB_PATH) \
701           (cd $${dir} && $(MAKE) $(FLAGS_TO_PASS) clean); \
702         else \
703           true; \
704         fi
705
706 .PHONY: $(CLEAN_TARGET_MODULES)
707 $(CLEAN_TARGET_MODULES):
708         @dir=`echo $@ | sed -e 's/clean-target-//'`; \
709         rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
710         if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
711           r=`${PWD}`; export r; \
712           s=`cd $(srcdir); ${PWD}`; export s; \
713           $(SET_LIB_PATH) \
714           (cd $(TARGET_SUBDIR)/$${dir} && $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \
715         else \
716           true; \
717         fi
718
719 clean-target: $(CLEAN_TARGET_MODULES) clean-target-libgcc
720 clean-target-libgcc:
721         test ! -d gcc/libgcc || \
722         (cd gcc/libgcc && find . -type d -print) | \
723         while read d; do rm -f gcc/$$d/libgcc.a || : ; done
724         -rm -rf gcc/libgcc
725
726 # Check target.
727
728 .PHONY: check do-check
729 check:
730         $(MAKE) do-check NOTPARALLEL=parallel-ok
731
732 # Only include modules actually being configured and built.
733 do-check: @check_host_modules@ \
734         @check_target_modules@
735
736 # Automated reporting of test results.
737
738 warning.log: build.log
739         $(srcdir)/contrib/warn_summary build.log > $@
740
741 mail-report.log:
742         if test x'$(BOOT_CFLAGS)' != x''; then \
743             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
744         fi; \
745         $(srcdir)/contrib/test_summary -t >$@
746         chmod +x $@
747         echo If you really want to send e-mail, run ./$@ now
748
749 mail-report-with-warnings.log: warning.log
750         if test x'$(BOOT_CFLAGS)' != x''; then \
751             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
752         fi; \
753         $(srcdir)/contrib/test_summary -t -i warning.log >$@
754         chmod +x $@
755         echo If you really want to send e-mail, run ./$@ now
756
757 # Installation targets.
758
759 .PHONY: install uninstall
760 install: installdirs @install_host_modules@ @install_target_modules@
761
762 install-target: @install_target_modules@
763
764 uninstall:
765         @echo "the uninstall target is not supported in this tree"
766
767 .PHONY: install.all
768 install.all: install-no-fixedincludes
769         @if [ -f ./gcc/Makefile ] ; then \
770                 r=`${PWD}` ; export r ; \
771                 $(SET_LIB_PATH) \
772                 (cd ./gcc && \
773                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
774         else \
775                 true ; \
776         fi
777
778 # install-no-fixedincludes is used because Cygnus can not distribute
779 # the fixed header files.
780 .PHONY: install-no-fixedincludes
781 install-no-fixedincludes: installdirs @install_host_modules_nogcc@ \
782         @install_target_modules@ gcc-no-fixedincludes
783
784 ### other supporting targets
785
786 MAKEDIRS= \
787         $(DESTDIR)$(prefix) \
788         $(DESTDIR)$(exec_prefix)
789 .PHONY: installdirs
790 installdirs: mkinstalldirs
791         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
792
793 dir.info: do-install-info
794         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
795           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
796           mv -f dir.info.new dir.info ; \
797         else true ; \
798         fi
799
800 dist:
801         @echo "Building a full distribution of this tree isn't done"
802         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
803
804 etags tags: TAGS
805
806 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
807 # ability to use several tags files at once, so there is probably no need
808 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
809 # (if we felt like it) have this Makefile write a piece of elisp which
810 # the user could load to tell emacs19 where all the TAGS files we just
811 # built are.
812 TAGS: do-TAGS
813
814 # --------------------------------------
815 # Modules which run on the build machine
816 # --------------------------------------
817 [+ FOR build_modules +]
818 .PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
819 maybe-configure-build-[+module+]:
820 configure-build-[+module+]:
821         @test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \
822         [ -d $(BUILD_SUBDIR)/[+module+] ] || \
823           mkdir $(BUILD_SUBDIR)/[+module+];\
824         r=`${PWD}`; export r; \
825         s=`cd $(srcdir); ${PWD}`; export s; \
826         AR="$(AR_FOR_BUILD)"; export AR; \
827         AS="$(AS_FOR_BUILD)"; export AS; \
828         CC="$(CC_FOR_BUILD)"; export CC; \
829         CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
830         CXX="$(CXX_FOR_BUILD)"; export CXX; \
831         CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
832         GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
833         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
834         LD="$(LD_FOR_BUILD)"; export LD; \
835         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
836         NM="$(NM_FOR_BUILD)"; export NM; \
837         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
838         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
839         echo Configuring in $(BUILD_SUBDIR)/[+module+]; \
840         cd "$(BUILD_SUBDIR)/[+module+]" || exit 1; \
841         case $(srcdir) in \
842           /* | [A-Za-z]:[\\/]*) \
843             topdir=$(srcdir) ;; \
844           *) \
845             case "$(BUILD_SUBDIR)" in \
846               .) topdir="../$(srcdir)" ;; \
847               *) topdir="../../$(srcdir)" ;; \
848             esac ;; \
849         esac; \
850         if [ "$(srcdir)" = "." ] ; then \
851           if [ "$(BUILD_SUBDIR)" != "." ] ; then \
852             if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
853               if [ -f Makefile ]; then \
854                 if $(MAKE) distclean; then \
855                   true; \
856                 else \
857                   exit 1; \
858                 fi; \
859               else \
860                 true; \
861               fi; \
862             else \
863               exit 1; \
864             fi; \
865           else \
866             true; \
867           fi; \
868           srcdiroption="--srcdir=."; \
869           libsrcdir="."; \
870         else \
871           srcdiroption="--srcdir=$${topdir}/[+module+]"; \
872           libsrcdir="$$s/[+module+]"; \
873         fi; \
874         rm -f no-such-file || : ; \
875         CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
876           $(BUILD_CONFIGARGS) $${srcdiroption} \
877           --with-build-subdir="$(BUILD_SUBDIR)" \
878           || exit 1
879
880 .PHONY: all-build-[+module+] maybe-all-build-[+module+]
881 maybe-all-build-[+module+]:
882 all-build-[+module+]: configure-build-[+module+]
883         @r=`${PWD}`; export r; \
884         s=`cd $(srcdir); ${PWD}`; export s; \
885         (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all)
886 [+ ENDFOR build_modules +]
887
888 # --------------------------------------
889 # Modules which run on the host machine
890 # --------------------------------------
891 [+ FOR host_modules +]
892 .PHONY: configure-[+module+] maybe-configure-[+module+]
893 maybe-configure-[+module+]:
894 configure-[+module+]:
895         @test ! -f [+module+]/Makefile || exit 0; \
896         [ -d [+module+] ] || mkdir [+module+]; \
897         r=`${PWD}`; export r; \
898         s=`cd $(srcdir); ${PWD}`; export s; \
899         CC="$(CC)"; export CC; \
900         CFLAGS="$(CFLAGS)"; export CFLAGS; \
901         CXX="$(CXX)"; export CXX; \
902         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
903         if [ z$(build_canonical) !=  z$(host_canoncial) ] ; then \
904           AR="$(AR)"; export AR; \
905           AS="$(AS)"; export AS; \
906           CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
907           DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
908           LD="$(LD)"; export LD; \
909           NM="$(NM)"; export NM; \
910           RANLIB="$(RANLIB)"; export RANLIB; \
911           WINDRES="$(WINDRES)"; export WINDRES; \
912           OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
913           OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
914         fi; \
915         echo Configuring in [+module+]; \
916         cd [+module+] || exit 1; \
917         case $(srcdir) in \
918           \.) \
919             srcdiroption="--srcdir=."; \
920             libsrcdir=".";; \
921           /* | [A-Za-z]:[\\/]*) \
922             srcdiroption="--srcdir=$(srcdir)/[+module+]"; \
923             libsrcdir="$$s/[+module+]";; \
924           *) \
925             srcdiroption="--srcdir=../$(srcdir)/[+module+]"; \
926             libsrcdir="$$s/[+module+]";; \
927         esac; \
928         $(SHELL) $${libsrcdir}/configure \
929           $(HOST_CONFIGARGS) $${srcdiroption} \
930           || exit 1
931
932 .PHONY: all-[+module+] maybe-all-[+module+]
933 maybe-all-[+module+]:
934 all-[+module+]: configure-[+module+]
935         @r=`${PWD}`; export r; \
936         s=`cd $(srcdir); ${PWD}`; export s; \
937         $(SET_LIB_PATH) \
938         (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
939           IF with_x 
940             +] $(X11_FLAGS_TO_PASS)[+ 
941           ENDIF with_x +] all)
942
943 [+ IF no_check +]
944 .PHONY: check-[+module+]
945 check-[+module+]:
946 [+ ELIF no_check_cross +]
947 .PHONY: check-[+module+]
948 # This module is only tested in a native toolchain.
949 check-[+module+]:
950         @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
951           r=`${PWD}`; export r; \
952           s=`cd $(srcdir); ${PWD}`; export s; \
953           $(SET_LIB_PATH) \
954           (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
955             IF with_x 
956               +] $(X11_FLAGS_TO_PASS)[+ 
957             ENDIF with_x +] check); \
958         fi
959 [+ ELSE check +]
960 .PHONY: check-[+module+]
961 check-[+module+]:
962         @r=`${PWD}`; export r; \
963         s=`cd $(srcdir); ${PWD}`; export s; \
964         $(SET_LIB_PATH) \
965         (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
966           IF with_x 
967             +] $(X11_FLAGS_TO_PASS)[+ 
968           ENDIF with_x +] check)
969 [+ ENDIF no_check +]
970
971 [+ IF no_install +]
972 .PHONY: install-[+module+] maybe-install-[+module+]
973 maybe-install-[+module+]:
974 install-[+module+]:
975 [+ ELSE install +]
976 .PHONY: install-[+module+] maybe-install-[+module+]
977 maybe-install-[+module+]:
978 install-[+module+]: installdirs
979         @r=`${PWD}`; export r; \
980         s=`cd $(srcdir); ${PWD}`; export s; \
981         $(SET_LIB_PATH) \
982         (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
983           IF with_x 
984             +] $(X11_FLAGS_TO_PASS)[+ 
985           ENDIF with_x +] install)
986 [+ ENDIF no_install +]
987 [+ ENDFOR host_modules +]
988
989 # ---------------------------------------
990 # Modules which run on the target machine
991 # ---------------------------------------
992 [+ FOR target_modules +]
993 .PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
994 maybe-configure-target-[+module+]:
995
996 # There's only one multilib.out.  Cleverer subdirs shouldn't need it copied.
997 $(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out
998         @[ -d $(TARGET_SUBDIR)/[+module+] ] || \
999           mkdir $(TARGET_SUBDIR)/[+module+]; \
1000         rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \
1001         cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out
1002
1003 configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out
1004         @test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \
1005         [ -d $(TARGET_SUBDIR)/[+module+] ] || \
1006           mkdir $(TARGET_SUBDIR)/[+module+];\
1007         r=`${PWD}`; export r; \
1008         s=`cd $(srcdir); ${PWD}`; export s; \
1009         $(SET_LIB_PATH) \
1010         AR="$(AR_FOR_TARGET)"; export AR; \
1011         AS="$(AS_FOR_TARGET)"; export AS; \
1012         CC="$(CC_FOR_TARGET)"; export CC; \
1013         CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1014         CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \[+ 
1015 IF raw_cxx +]
1016         CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
1017         CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+ 
1018 ELSE normal_cxx +]
1019         CXX="$(CXX_FOR_TARGET)"; export CXX; \[+ 
1020 ENDIF raw_cxx +]
1021         CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1022         GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
1023         DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
1024         LD="$(LD_FOR_TARGET)"; export LD; \
1025         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
1026         NM="$(NM_FOR_TARGET)"; export NM; \
1027         RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
1028         WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
1029         echo Configuring in $(TARGET_SUBDIR)/[+module+]; \
1030         cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \
1031         case $(srcdir) in \
1032           /* | [A-Za-z]:[\\/]*) \
1033             topdir=$(srcdir) ;; \
1034           *) \
1035             case "$(TARGET_SUBDIR)" in \
1036               .) topdir="../$(srcdir)" ;; \
1037               *) topdir="../../$(srcdir)" ;; \
1038             esac ;; \
1039         esac; \
1040         if [ "$(srcdir)" = "." ] ; then \
1041           if [ "$(TARGET_SUBDIR)" != "." ] ; then \
1042             if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
1043               if [ -f Makefile ]; then \
1044                 if $(MAKE) distclean; then \
1045                   true; \
1046                 else \
1047                   exit 1; \
1048                 fi; \
1049               else \
1050                 true; \
1051               fi; \
1052             else \
1053               exit 1; \
1054             fi; \
1055           else \
1056             true; \
1057           fi; \
1058           srcdiroption="--srcdir=."; \
1059           libsrcdir="."; \
1060         else \
1061           srcdiroption="--srcdir=$${topdir}/[+module+]"; \
1062           libsrcdir="$$s/[+module+]"; \
1063         fi; \
1064         rm -f no-such-file || : ; \
1065         CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
1066           $(TARGET_CONFIGARGS) $${srcdiroption} \
1067           --with-target-subdir="$(TARGET_SUBDIR)" \
1068           || exit 1
1069
1070 .PHONY: all-target-[+module+] maybe-all-target-[+module+]
1071 maybe-all-target-[+module+]:
1072 all-target-[+module+]: configure-target-[+module+]
1073         @r=`${PWD}`; export r; \
1074         s=`cd $(srcdir); ${PWD}`; export s; \
1075         $(SET_LIB_PATH) \
1076         (cd $(TARGET_SUBDIR)/[+module+] && \
1077           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1078             IF raw_cxx 
1079           +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1080             ENDIF raw_cxx 
1081           +] all)
1082 [+ IF no_check +]
1083 # Dummy target for uncheckable module.
1084 .PHONY: check-target-[+module+]
1085 check-target-[+module+]:
1086 [+ ELSE check +]
1087 .PHONY: check-target-[+module+]
1088 check-target-[+module+]:
1089         @r=`${PWD}`; export r; \
1090         s=`cd $(srcdir); ${PWD}`; export s; \
1091         $(SET_LIB_PATH) \
1092         (cd $(TARGET_SUBDIR)/[+module+] && \
1093           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1094             IF raw_cxx 
1095               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1096             ENDIF raw_cxx 
1097           +] check)
1098 [+ ENDIF no_check +]
1099 [+ IF no_install +]
1100 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1101 maybe-install-target-[+module+]:
1102 # Dummy target for uninstallable.
1103 install-target-[+module+]:
1104 [+ ELSE install +]
1105 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1106 maybe-install-target-[+module+]:
1107 install-target-[+module+]: installdirs
1108         @r=`${PWD}`; export r; \
1109         s=`cd $(srcdir); ${PWD}`; export s; \
1110         $(SET_LIB_PATH) \
1111         (cd $(TARGET_SUBDIR)/[+module+] && \
1112           $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
1113 [+ ENDIF no_install +]
1114 [+ ENDFOR target_modules +]
1115
1116 # ----------
1117 # GCC module
1118 # ----------
1119
1120 # Unfortunately, while gcc _should_ be a host module,
1121 # libgcc is a target module, and gen* programs are
1122 # build modules.  So GCC is a sort of hybrid.
1123
1124 # gcc is the only module which uses GCC_FLAGS_TO_PASS.
1125 .PHONY: configure-gcc maybe-configure-gcc
1126 maybe-configure-gcc:
1127 configure-gcc:
1128         @test ! -f gcc/Makefile || exit 0; \
1129         [ -d gcc ] || mkdir gcc; \
1130         r=`${PWD}`; export r; \
1131         s=`cd $(srcdir); ${PWD}`; export s; \
1132         CC="$(CC)"; export CC; \
1133         CFLAGS="$(CFLAGS)"; export CFLAGS; \
1134         CXX="$(CXX)"; export CXX; \
1135         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
1136         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
1137         if [ z$(build_canonical) !=  z$(host_canoncial) ] ; then \
1138           AR="$(AR)"; export AR; \
1139           AS="$(AS)"; export AS; \
1140           CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
1141           DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1142           LD="$(LD)"; export LD; \
1143           NM="$(NM)"; export NM; \
1144           RANLIB="$(RANLIB)"; export RANLIB; \
1145           WINDRES="$(WINDRES)"; export WINDRES; \
1146           OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1147           OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
1148         fi; \
1149         echo Configuring in gcc; \
1150         cd gcc || exit 1; \
1151         case $(srcdir) in \
1152           \.) \
1153             srcdiroption="--srcdir=."; \
1154             libsrcdir=".";; \
1155           /* | [A-Za-z]:[\\/]*) \
1156             srcdiroption="--srcdir=$(srcdir)/gcc"; \
1157             libsrcdir="$$s/gcc";; \
1158           *) \
1159             srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1160             libsrcdir="$$s/gcc";; \
1161         esac; \
1162         $(SHELL) $${libsrcdir}/configure \
1163           $(HOST_CONFIGARGS) $${srcdiroption} \
1164           || exit 1
1165
1166 # Don't 'make all' in gcc if it's already been made by 'bootstrap'; that
1167 # causes trouble.  This wart will be fixed eventually by moving
1168 # the bootstrap behavior to this file.
1169 .PHONY: all-gcc maybe-all-gcc
1170 maybe-all-gcc:
1171 all-gcc: configure-gcc
1172         @if [ -f gcc/stage_last ] ; then \
1173           r=`${PWD}`; export r; \
1174           s=`cd $(srcdir); ${PWD}`; export s; \
1175           $(SET_LIB_PATH) \
1176           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) quickstrap); \
1177         else \
1178           r=`${PWD}`; export r; \
1179           s=`cd $(srcdir); ${PWD}`; export s; \
1180           $(SET_LIB_PATH) \
1181           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
1182         fi
1183
1184 # Building GCC uses some tools for rebuilding "source" files
1185 # like texinfo, bison/byacc, etc.  So we must depend on those.
1186 #
1187 # While building GCC, it may be necessary to run various target
1188 # programs like the assembler, linker, etc.  So we depend on
1189 # those too.
1190 #
1191 # In theory, on an SMP all those dependencies can be resolved
1192 # in parallel.
1193 #
1194 GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1195 .PHONY: $(GCC_STRAP_TARGETS)
1196 $(GCC_STRAP_TARGETS): all-bootstrap configure-gcc
1197         @r=`${PWD}`; export r; \
1198         s=`cd $(srcdir); ${PWD}`; export s; \
1199         $(SET_LIB_PATH) \
1200         echo "Bootstrapping the compiler"; \
1201         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
1202         @r=`${PWD}`; export r; \
1203         s=`cd $(srcdir); ${PWD}`; export s; \
1204         case "$@" in \
1205           *bootstrap4-lean ) \
1206             msg="Comparing stage3 and stage4 of the compiler"; \
1207             compare=compare3-lean ;; \
1208           *bootstrap4 ) \
1209             msg="Comparing stage3 and stage4 of the compiler"; \
1210             compare=compare3 ;; \
1211           *-lean ) \
1212             msg="Comparing stage2 and stage3 of the compiler"; \
1213             compare=compare-lean ;; \
1214           * ) \
1215             msg="Comparing stage2 and stage3 of the compiler"; \
1216             compare=compare ;; \
1217         esac; \
1218         $(SET_LIB_PATH) \
1219         echo "$$msg"; \
1220         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
1221         @r=`${PWD}`; export r; \
1222         s=`cd $(srcdir); ${PWD}` ; export s; \
1223         $(SET_LIB_PATH) \
1224         echo "Building runtime libraries"; \
1225         $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
1226
1227 .PHONY: cross
1228 cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
1229         @r=`${PWD}`; export r; \
1230         s=`cd $(srcdir); ${PWD}`; export s; \
1231         $(SET_LIB_PATH) \
1232         echo "Building the C and C++ compiler"; \
1233         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1234         @r=`${PWD}`; export r; \
1235         s=`cd $(srcdir); ${PWD}` ; export s; \
1236         $(SET_LIB_PATH) \
1237         echo "Building runtime libraries"; \
1238         $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \
1239           LANGUAGES="c c++" all
1240
1241 .PHONY: check-gcc
1242 check-gcc:
1243         @if [ -f ./gcc/Makefile ] ; then \
1244           r=`${PWD}`; export r; \
1245           s=`cd $(srcdir); ${PWD}`; export s; \
1246           $(SET_LIB_PATH) \
1247           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
1248         else \
1249           true; \
1250         fi
1251
1252 .PHONY: check-gcc-c++
1253 check-gcc-c++:
1254         @if [ -f ./gcc/Makefile ] ; then \
1255           r=`${PWD}`; export r; \
1256           s=`cd $(srcdir); ${PWD}`; export s; \
1257           $(SET_LIB_PATH) \
1258           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1259         else \
1260           true; \
1261         fi
1262
1263 .PHONY: check-c++
1264 check-c++:
1265         $(MAKE) check-target-libstdc++-v3 check-gcc-c++ NOTPARALLEL=parallel-ok
1266
1267 .PHONY: install-gcc maybe-install-gcc
1268 maybe-install-gcc:
1269 install-gcc:
1270         @if [ -f ./gcc/Makefile ] ; then \
1271           r=`${PWD}`; export r; \
1272           s=`cd $(srcdir); ${PWD}`; export s; \
1273           $(SET_LIB_PATH) \
1274           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1275         else \
1276           true; \
1277         fi
1278
1279 # Install the gcc headers files, but not the fixed include files,
1280 # which Cygnus is not allowed to distribute.  This rule is very
1281 # dependent on the workings of the gcc Makefile.in.
1282 .PHONY: gcc-no-fixedincludes
1283 gcc-no-fixedincludes:
1284         @if [ -f ./gcc/Makefile ]; then \
1285           rm -rf gcc/tmp-include; \
1286           mv gcc/include gcc/tmp-include 2>/dev/null; \
1287           mkdir gcc/include; \
1288           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1289           touch gcc/stmp-fixinc gcc/include/fixed; \
1290           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1291           r=`${PWD}`; export r; \
1292           s=`cd $(srcdir); ${PWD}` ; export s; \
1293           $(SET_LIB_PATH) \
1294           (cd ./gcc && \
1295            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1296           rm -rf gcc/include; \
1297           mv gcc/tmp-include gcc/include 2>/dev/null; \
1298         else true; fi
1299
1300 # --------------------------------------
1301 # Dependencies between different modules
1302 # --------------------------------------
1303
1304 # There are two types of dependencies here: 'hard' dependencies, where one
1305 # module simply won't build without the other; and 'soft' dependencies, where
1306 # if the depended-on module is missing, the depending module will do without
1307 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1308 # are specified by depending on a 'maybe-' target.  If you're not sure,
1309 # it's safer to use a soft dependency.
1310
1311 # Host modules specific to gcc.
1312 # GCC needs to identify certain tools.
1313 configure-gcc: maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex
1314 all-gcc: maybe-all-libiberty maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib
1315 # This is a slightly kludgy method of getting dependencies on 
1316 # all-build-libiberty correct; it would be better to build it every time.
1317 all-gcc: maybe-all-build-libiberty
1318 all-bootstrap: maybe-all-libiberty maybe-all-texinfo maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib
1319
1320 # Host modules specific to gdb.
1321 # GDB needs to know that the simulator is being built.
1322 configure-gdb: maybe-configure-tcl maybe-configure-tk maybe-configure-sim
1323 GDB_TK = @GDB_TK@
1324 all-gdb: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-mmalloc maybe-all-readline maybe-all-bison maybe-all-byacc maybe-all-sim $(gdbnlmrequirements) $(GDB_TK)
1325 install-gdb: maybe-install-tcl maybe-install-tk maybe-install-itcl maybe-install-tix maybe-install-libgui
1326 configure-libgui: maybe-configure-tcl maybe-configure-tk
1327 all-libgui: maybe-all-tcl maybe-all-tk maybe-all-itcl
1328
1329 # Host modules specific to binutils.
1330 configure-bfd: configure-libiberty
1331 all-bfd: maybe-all-libiberty maybe-all-intl
1332 all-binutils: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-flex maybe-all-bison maybe-all-byacc maybe-all-intl
1333 # We put install-opcodes before install-binutils because the installed
1334 # binutils might be on PATH, and they might need the shared opcodes
1335 # library.
1336 install-binutils: maybe-install-opcodes
1337 all-gas: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-intl
1338 all-gprof: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-intl
1339 all-ld: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-intl
1340 all-opcodes: maybe-all-bfd maybe-all-libiberty
1341
1342 # Other host modules in the 'src' repository.
1343 all-dejagnu: maybe-all-tcl maybe-all-expect maybe-all-tk
1344 configure-expect: maybe-configure-tcl maybe-configure-tk
1345 all-expect: maybe-all-tcl maybe-all-tk
1346 configure-itcl: maybe-configure-tcl maybe-configure-tk
1347 all-itcl: maybe-all-tcl maybe-all-tk
1348 # We put install-tcl before install-itcl because itcl wants to run a
1349 # program on installation which uses the Tcl libraries.
1350 install-itcl: maybe-install-tcl
1351 all-sid: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-tcl maybe-all-tk
1352 install-sid: maybe-install-tcl maybe-install-tk
1353 all-sim: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-readline maybe-configure-gdb
1354 configure-tk: maybe-configure-tcl
1355 all-tk: maybe-all-tcl
1356 configure-tix: maybe-configure-tcl maybe-configure-tk
1357 all-tix: maybe-all-tcl maybe-all-tk
1358 all-texinfo: maybe-all-libiberty
1359
1360 # Other host modules.  Warning, these are not well tested.
1361 all-autoconf: maybe-all-m4 maybe-all-texinfo
1362 all-automake: maybe-all-m4 maybe-all-texinfo
1363 all-bison: maybe-all-texinfo
1364 all-diff: maybe-all-libiberty
1365 all-fastjar: maybe-all-zlib maybe-all-libiberty
1366 all-fileutils: maybe-all-libiberty
1367 all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc
1368 all-gzip: maybe-all-libiberty
1369 all-hello: maybe-all-libiberty
1370 all-m4: maybe-all-libiberty maybe-all-texinfo
1371 all-make: maybe-all-libiberty
1372 all-patch: maybe-all-libiberty
1373 all-prms: maybe-all-libiberty
1374 all-recode: maybe-all-libiberty
1375 all-sed: maybe-all-libiberty
1376 all-send-pr: maybe-all-prms
1377 all-tar: maybe-all-libiberty
1378 all-uudecode: maybe-all-libiberty
1379
1380 ALL_GCC = maybe-all-gcc
1381 ALL_GCC_C = $(ALL_GCC) maybe-all-target-newlib maybe-all-target-libgloss
1382 ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3
1383
1384 # Target modules specific to gcc.
1385 configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads
1386 configure-target-fastjar: maybe-configure-target-zlib
1387 all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty
1388 configure-target-libf2c: $(ALL_GCC_C)
1389 all-target-libf2c: maybe-all-target-libiberty
1390 configure-target-libffi: $(ALL_GCC_C) 
1391 configure-target-libjava: $(ALL_GCC_C) maybe-configure-target-zlib maybe-configure-target-boehm-gc maybe-configure-target-qthreads maybe-configure-target-libffi
1392 all-target-libjava: maybe-all-fastjar maybe-all-target-zlib maybe-all-target-boehm-gc maybe-all-target-qthreads maybe-all-target-libffi
1393 configure-target-libobjc: $(ALL_GCC_C)
1394 all-target-libobjc: maybe-all-target-libiberty
1395 configure-target-libstdc++-v3: $(ALL_GCC_C)
1396 all-target-libstdc++-v3: maybe-all-target-libiberty
1397 configure-target-zlib: $(ALL_GCC_C)
1398
1399 # Target modules in the 'src' repository.
1400 configure-target-examples: $(ALL_GCC_C)
1401 configure-target-libgloss: $(ALL_GCC)
1402 all-target-libgloss: maybe-configure-target-newlib
1403 configure-target-libiberty: $(ALL_GCC_C)
1404 configure-target-libtermcap: $(ALL_GCC_C)
1405 configure-target-newlib: $(ALL_GCC)
1406 configure-target-rda: $(ALL_GCC_C)
1407 configure-target-winsup: $(ALL_GCC_C)
1408 all-target-winsup: maybe-all-target-libiberty maybe-all-target-libtermcap
1409
1410 # Other target modules.  Warning, these are not well tested.
1411 configure-target-gperf: $(ALL_GCC_CXX)
1412 all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3
1413 configure-target-qthreads: $(ALL_GCC_C)
1414
1415 # Dependencies of maybe-foo on foo.  These are used because, for example,
1416 # all-gcc only depends on all-gas if gas is present and being configured.
1417 @maybe_dependencies@
1418
1419 # Serialization dependencies.  Host configures don't work well in parallel to
1420 # each other, due to contention over config.cache.  Target configures and 
1421 # build configures are similar.
1422 @serialization_dependencies@
1423
1424 # --------------------------------
1425 # Regenerating top level configury
1426 # --------------------------------
1427
1428 # Multilib.out tells target dirs what multilibs they should build.
1429 # There is really only one copy.  We use the 'timestamp' method to
1430 # work around various timestamp bugs on some systems.
1431 # We use move-if-change so that it's only considered updated when it
1432 # actually changes, because it has to depend on a phony target.
1433 multilib.out: maybe-all-gcc
1434         @r=`${PWD}`; export r; \
1435         echo "Checking multilib configuration..."; \
1436         $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \
1437         $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \
1438
1439 # Rebuilding Makefile.in, using autogen.
1440 AUTOGEN = autogen
1441 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1442         cd $(srcdir) && $(AUTOGEN) Makefile.def
1443
1444 # Rebuilding Makefile.
1445 Makefile: $(srcdir)/Makefile.in config.status
1446         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1447
1448 config.status: configure $(gcc_version_trigger)
1449         $(SHELL) ./config.status --recheck
1450
1451 # Rebuilding configure.
1452 AUTOCONF = autoconf
1453 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
1454         cd $(srcdir) && $(AUTOCONF)
1455
1456 # ------------------------------
1457 # Special directives to GNU Make
1458 # ------------------------------
1459
1460 # Tell GNU make 3.79 not to run the top level in parallel.  This 
1461 # prevents contention for $builddir/$target/config.cache, as well
1462 # as minimizing scatter in file system caches.
1463 NOTPARALLEL = .NOTPARALLEL
1464 $(NOTPARALLEL):
1465
1466 # Don't pass command-line variables to submakes.
1467 .NOEXPORT:
1468 MAKEOVERRIDES=
1469
1470 # end of Makefile.in