OSDN Git Service

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