OSDN Git Service

f09be472941240d0eacc215e4980326ea38a9a1f
[pf3gnuchains/gcc-fork.git] / Makefile.in
1 #
2 # Makefile for directory with subdirs to build.
3 #   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #
19
20 srcdir = .
21
22 prefix = /usr/local
23
24 exec_prefix = $(prefix)
25 bindir = $(exec_prefix)/bin
26 libdir = $(exec_prefix)/lib
27 tooldir = $(exec_prefix)/$(target)
28
29 program_transform_name =
30
31 datadir = $(prefix)/share
32 mandir = $(prefix)/man
33 man1dir = $(mandir)/man1
34 man2dir = $(mandir)/man2
35 man3dir = $(mandir)/man3
36 man4dir = $(mandir)/man4
37 man5dir = $(mandir)/man5
38 man6dir = $(mandir)/man6
39 man7dir = $(mandir)/man7
40 man8dir = $(mandir)/man8
41 man9dir = $(mandir)/man9
42 infodir = $(prefix)/info
43 includedir = $(prefix)/include
44 GDB_NLM_DEPS = 
45
46 SHELL = /bin/sh
47
48 # INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
49 # cygwin32 host.
50 INSTALL_PROGRAM_ARGS =
51
52 INSTALL = $(SHELL) $$s/install-sh -c
53 INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_ARGS)
54 INSTALL_SCRIPT = $(INSTALL)
55 INSTALL_DATA = $(INSTALL) -m 644
56
57 INSTALL_DOSREL = install-dosrel-fake
58
59 AS = as
60 AR = ar
61 AR_FLAGS = rc
62 CC = cc
63
64 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
65 # here so that they can be overridden by Makefile fragments.
66 HOST_CC = $(CC_FOR_BUILD)
67 HOST_PREFIX = 
68 HOST_PREFIX_1 = loser-
69
70 # These flag values are normally overridden by the configure script.
71 CFLAGS = -g
72 CXXFLAGS = -g -O2
73
74 LIBCFLAGS = $(CFLAGS)
75 CFLAGS_FOR_TARGET = $(CFLAGS)
76 LDFLAGS_FOR_TARGET = 
77 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
78 PICFLAG = 
79 PICFLAG_FOR_TARGET = 
80
81 CXX = c++
82
83 # Use -O2 to stress test the compiler.
84 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
85 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
86 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
87
88 RANLIB = ranlib
89
90 DLLTOOL = dlltool
91 WINDRES = windres
92
93 NM = nm
94
95 LD = ld
96
97 # Not plain GZIP, since gzip looks there for extra command-line options.
98 GZIPPROG = gzip
99
100 # These values are substituted by configure.
101 DEFAULT_YACC = yacc
102 DEFAULT_LEX = lex
103
104 BISON = `if [ -f $$r/bison/bison ] ; then \
105             echo $$r/bison/bison -L $$s/bison/ ; \
106          else \
107             echo bison ; \
108          fi`
109
110 YACC = `if [ -f $$r/bison/bison ] ; then \
111             echo $$r/bison/bison -y -L $$s/bison/ ; \
112         elif [ -f $$r/byacc/byacc ] ; then \
113             echo $$r/byacc/byacc ; \
114         else \
115             echo ${DEFAULT_YACC} ; \
116         fi`
117
118 LEX = `if [ -f $$r/flex/flex ] ; \
119         then echo $$r/flex/flex ; \
120         else echo ${DEFAULT_LEX} ; fi`
121
122 M4 = `if [ -f $$r/m4/m4 ] ; \
123         then echo $$r/m4/m4 ; \
124         else echo m4 ; fi`
125
126 MAKEINFO = `if [ -f $$r/texinfo/makeinfo/Makefile ] ; \
127         then echo $$r/texinfo/makeinfo/makeinfo ; \
128         else echo makeinfo ; fi`
129
130 # This just becomes part of the MAKEINFO definition passed down to
131 # sub-makes.  It lets flags be given on the command line while still
132 # using the makeinfo from the object tree.
133 MAKEINFOFLAGS =
134
135 EXPECT = `if [ -f $$r/expect/expect ] ; \
136         then echo $$r/expect/expect ; \
137         else echo expect ; fi`
138
139 RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
140         then echo $$s/dejagnu/runtest ; \
141         else echo runtest ; fi`
142
143
144 # compilers to use to create programs which must be run in the build
145 # environment.
146 CC_FOR_BUILD = $(CC)
147 CXX_FOR_BUILD = $(CXX)
148
149 SUBDIRS = "this is set via configure, don't edit this"
150 OTHERS = 
151
152 # This is set by the configure script to the list of directories which
153 # should be built using the target tools.
154 TARGET_CONFIGDIRS = libiberty libgloss newlib libio librx libstdc++ libg++ winsup
155
156 # Target libraries are put under this directory:
157 # Changed by configure to $(target_alias) if cross.
158 TARGET_SUBDIR = .
159
160 # This is set by the configure script to the arguments passed to configure.
161 CONFIG_ARGUMENTS = 
162
163 # This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
164 # was used.
165 SET_LIB_PATH =
166
167 # This is the name of the environment variable used for the path to
168 # the libraries.  This may be changed by configure.in.
169 RPATH_ENVVAR = LD_LIBRARY_PATH
170
171 # configure.in sets SET_LIB_PATH to this if --enable-shared was used.
172 REALLY_SET_LIB_PATH = \
173   $(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes:$$$(RPATH_ENVVAR); \
174   export $(RPATH_ENVVAR);
175
176 ALL = all.normal
177 INSTALL_TARGET = installdirs \
178         install-gcc \
179         $(INSTALL_MODULES) \
180         $(INSTALL_TARGET_MODULES) \
181         $(INSTALL_X11_MODULES) \
182         $(INSTALL_DOSREL)
183
184 INSTALL_TARGET_CROSS = installdirs \
185         install-gcc-cross \
186         $(INSTALL_MODULES) \
187         $(INSTALL_TARGET_MODULES) \
188         $(INSTALL_X11_MODULES) \
189         $(INSTALL_DOSREL)
190
191 CC_FOR_TARGET = ` \
192   if [ -f $$r/gcc/xgcc ] ; then \
193     if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
194       if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
195         echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/newlib/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
196       else \
197         echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
198       fi; \
199     else \
200       echo $$r/gcc/xgcc -B$$r/gcc/; \
201     fi; \
202   else \
203     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
204       echo $(CC); \
205     else \
206       t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
207     fi; \
208   fi`
209
210 # If CC_FOR_TARGET is not overriden on the command line, then this
211 # variable is passed down to the gcc Makefile, where it is used to
212 # build libgcc2.a.  We define it here so that it can itself be
213 # overridden on the command line.
214 GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/
215
216
217 CXX_FOR_TARGET = ` \
218   if [ -f $$r/gcc/xgcc ] ; then \
219     if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
220       if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
221         echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/newlib/ -L$$r/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
222       else \
223         echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
224       fi; \
225     else \
226       echo $$r/gcc/xgcc -B$$r/gcc/; \
227     fi; \
228   else \
229     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
230       echo $(CXX); \
231     else \
232       t='$(program_transform_name)'; echo c++ | sed -e 's/x/x/' $$t; \
233     fi; \
234   fi`
235
236 AS_FOR_TARGET = ` \
237   if [ -f $$r/gas/as-new ] ; then \
238     echo $$r/gas/as-new ; \
239   else \
240     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
241       echo $(AS); \
242     else \
243        t='$(program_transform_name)'; echo as | sed -e 's/x/x/' $$t ; \
244     fi; \
245   fi`
246
247 LD_FOR_TARGET = ` \
248   if [ -f $$r/ld/ld-new ] ; then \
249     echo $$r/ld/ld-new ; \
250   else \
251     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
252       echo $(LD); \
253     else \
254        t='$(program_transform_name)'; echo ld | sed -e 's/x/x/' $$t ; \
255     fi; \
256   fi`
257
258 DLLTOOL_FOR_TARGET = ` \
259   if [ -f $$r/binutils/dlltool ] ; then \
260     echo $$r/binutils/dlltool ; \
261   else \
262     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
263       echo $(DLLTOOL); \
264     else \
265        t='$(program_transform_name)'; echo dlltool | sed -e 's/x/x/' $$t ; \
266     fi; \
267   fi`
268
269 WINDRES_FOR_TARGET = ` \
270   if [ -f $$r/binutils/windres ] ; then \
271     echo $$r/binutils/windres ; \
272   else \
273     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
274       echo $(WINDRES); \
275     else \
276        t='$(program_transform_name)'; echo windres | sed -e 's/x/x/' $$t ; \
277     fi; \
278   fi`
279
280 AR_FOR_TARGET = ` \
281   if [ -f $$r/binutils/ar ] ; then \
282     echo $$r/binutils/ar ; \
283   else \
284     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
285       echo $(AR); \
286     else \
287        t='$(program_transform_name)'; echo ar | sed -e 's/x/x/' $$t ; \
288     fi; \
289   fi`
290
291 RANLIB_FOR_TARGET = ` \
292   if [ -f $$r/binutils/ranlib ] ; then \
293     echo $$r/binutils/ranlib ; \
294   else \
295     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
296       echo $(RANLIB); \
297     else \
298        t='$(program_transform_name)'; echo ranlib | sed -e 's/x/x/' $$t ; \
299     fi; \
300   fi`
301
302 NM_FOR_TARGET = ` \
303   if [ -f $$r/binutils/nm-new ] ; then \
304     echo $$r/binutils/nm-new ; \
305   else \
306     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
307       echo $(NM); \
308     else \
309        t='$(program_transform_name)'; echo nm | sed -e 's/x/x/' $$t ; \
310     fi; \
311   fi`
312
313 #### host and target specific makefile fragments come in here.
314 ###
315
316 # Flags to pass down to all sub-makes.
317 # Please keep these in alphabetical order.
318 BASE_FLAGS_TO_PASS = \
319         "AR_FLAGS=$(AR_FLAGS)" \
320         "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
321         "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
322         "BISON=$(BISON)" \
323         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
324         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
325         "CFLAGS=$(CFLAGS)" \
326         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
327         "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
328         "CXXFLAGS=$(CXXFLAGS)" \
329         "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
330         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
331         "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \
332         "INSTALL=$(INSTALL)" \
333         "INSTALL_DATA=$(INSTALL_DATA)" \
334         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
335         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
336         "LDFLAGS=$(LDFLAGS)" \
337         "LEX=$(LEX)" \
338         "LD_FOR_TARGET=$(LD_FOR_TARGET)" \
339         "LIBCFLAGS=$(LIBCFLAGS)" \
340         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
341         "LIBCXXFLAGS=$(LIBCXXFLAGS)" \
342         "LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
343         "M4=$(M4)" \
344         "MAKE=$(MAKE)" \
345         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
346         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
347         "PICFLAG=$(PICFLAG)" \
348         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
349         "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
350         "SHELL=$(SHELL)" \
351         "EXPECT=$(EXPECT)" \
352         "RUNTEST=$(RUNTEST)" \
353         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
354         "WINDRES_FOR_TARGET=$(WINDRES_FOR_TARGET)" \
355         "YACC=$(YACC)" \
356         "exec_prefix=$(exec_prefix)" \
357         "prefix=$(prefix)" \
358         "tooldir=$(tooldir)" \
359         "gxx_include_dir=$(gxx_include_dir)"
360
361 # Flags to pass down to most sub-makes, in which we're building with
362 # the host environment.
363 # If any variables are added here, they must be added to do-*, below.
364 EXTRA_HOST_FLAGS = \
365         'AR=$(AR)' \
366         'AS=$(AS)' \
367         'CC=$(CC)' \
368         'CXX=$(CXX)' \
369         'DLLTOOL=$(DLLTOOL)' \
370         'LD=$(LD)' \
371         'NM=$(NM)' \
372         'RANLIB=$(RANLIB)' \
373         'WINDRES=$(WINDRES)'
374
375 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
376
377 # Flags that are concerned with the location of the X11 include files
378 # and library files
379 #
380 # NOTE: until the top-level is getting the values via autoconf, it only
381 # causes problems to have this top-level Makefile overriding the autoconf-set
382 # values in child directories.  Only variables that don't conflict with
383 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
384 #
385 X11_FLAGS_TO_PASS = \
386         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
387         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
388
389 # Flags to pass down to makes which are built with the target environment.
390 # The double $ decreases the length of the command line; the variables
391 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
392 # If any variables are added here, they must be added to do-*, below.
393 EXTRA_TARGET_FLAGS = \
394         'AR=$$(AR_FOR_TARGET)' \
395         'AS=$$(AS_FOR_TARGET)' \
396         'CC=$$(CC_FOR_TARGET)' \
397         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
398         'CXX=$$(CXX_FOR_TARGET)' \
399         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
400         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
401         'LD=$$(LD_FOR_TARGET)' \
402         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
403         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
404         'NM=$$(NM_FOR_TARGET)' \
405         'PICFLAG=$$(PICFLAG_FOR_TARGET)' \
406         'RANLIB=$$(RANLIB_FOR_TARGET)' \
407         'WINDRES=$$(WINDRES_FOR_TARGET)'
408
409 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
410
411 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
412 # unfortunately needs the native compiler and the target ar and
413 # ranlib.
414 # If any variables are added here, they must be added to do-*, below.
415 # The HOST_* variables are a special case, which are used for the gcc
416 # cross-building scheme.
417 EXTRA_GCC_FLAGS = \
418         'AR=$$(AR_FOR_TARGET)' \
419         'AS=$(AS)' \
420         'CC=$(CC)' \
421         'CXX=$(CXX)' \
422         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
423         'HOST_CC=$(CC_FOR_BUILD)' \
424         'HOST_PREFIX=$(HOST_PREFIX)' \
425         'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
426         'NM=$(NM)' \
427         'RANLIB=$$(RANLIB_FOR_TARGET)' \
428         'WINDRES=$$(WINDRES_FOR_TARGET)' \
429         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
430         "`if test x'$(LANGUAGES)' != x; then echo 'LANGUAGES=$(LANGUAGES)'; else echo 'XFOO=bar'; fi`" \
431         "`if test x'$(STMP_FIXPROTO)' != x; then echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)'; else echo 'XFOO=bar'; fi`" \
432         "`if test x'$(LIMITS_H_TEST)' != x; then echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)'; else echo 'XFOO=bar'; fi`" \
433         "`if test x'$(LIBGCC1_TEST)' != x; then echo 'LIBGCC1_TEST=$(LIBGCC1_TEST)'; else echo 'XFOO=bar'; fi`" \
434         "`if test x'$(LIBGCC2_CFLAGS)' != x; then echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)'; else echo 'XFOO=bar'; fi`" \
435         "`if test x'$(LIBGCC2_DEBUG_CFLAGS)' != x; then echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)'; else echo 'XFOO=bar'; fi`" \
436         "`if test x'$(LIBGCC2_INCLUDES)' != x; then echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)'; else echo 'XFOO=bar'; fi`" \
437         "`if test x'$(ENQUIRE)' != x; then echo 'ENQUIRE=$(ENQUIRE)'; else echo 'XFOO=bar'; fi`" \
438         "`if test x'$(BOOT_CFLAGS)' != x; then echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)'; else echo 'XFOO=bar'; fi`"
439
440 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
441
442 # This is a list of the targets for all of the modules which are compiled
443 # using $(FLAGS_TO_PASS).
444 ALL_MODULES = \
445         all-apache \
446         all-autoconf \
447         all-automake \
448         all-bash \
449         all-bfd \
450         all-binutils \
451         all-bison \
452         all-byacc \
453         all-cvs \
454         all-db \
455         all-dejagnu \
456         all-diff \
457         all-dosutils \
458         all-etc \
459         all-fileutils \
460         all-findutils \
461         all-find \
462         all-flex \
463         all-gas \
464         all-gawk \
465         all-gnuserv \
466         all-gprof \
467         all-grep \
468         all-grez \
469         all-gzip \
470         all-hello \
471         all-indent \
472         all-inet \
473         all-ispell \
474         all-itcl \
475         all-ld \
476         all-libiberty \
477         all-m4 \
478         all-make \
479         all-mmalloc \
480         all-opcodes \
481         all-patch \
482         all-perl \
483         all-prms \
484         all-rcs \
485         all-readline \
486         all-release \
487         all-recode \
488         all-sed \
489         all-send-pr \
490         all-shellutils \
491         all-sim \
492         all-sn \
493         all-tar \
494         all-tcl \
495         all-texinfo \
496         all-textutils \
497         all-tgas \
498         all-time \
499         all-uudecode \
500         all-wdiff 
501
502 # This is a list of the check targets for all of the modules which are
503 # compiled using $(FLAGS_TO_PASS).
504 #
505 # The list is in two parts.  The first lists those tools which
506 # are tested as part of the host's native tool-chain, and not
507 # tested in a cross configuration.
508 NATIVE_CHECK_MODULES = \
509         check-bison \
510         check-byacc \
511         check-flex
512
513 CROSS_CHECK_MODULES = \
514         check-apache \
515         check-autoconf \
516         check-automake \
517         check-bash \
518         check-bfd \
519         check-binutils \
520         check-cvs \
521         check-db \
522         check-dejagnu \
523         check-diff \
524         check-etc \
525         check-fileutils \
526         check-findutils \
527         check-find \
528         check-gas \
529         check-gawk \
530         check-gnuserv \
531         check-gprof \
532         check-grep \
533         check-gzip \
534         check-hello \
535         check-indent \
536         check-inet \
537         check-ispell \
538         check-itcl \
539         check-ld \
540         check-libiberty \
541         check-m4 \
542         check-make \
543         check-mmcheckoc \
544         check-opcodes \
545         check-patch \
546         check-perl \
547         check-prms \
548         check-rcs \
549         check-readline \
550         check-recode \
551         check-sed \
552         check-send-pr \
553         check-shellutils \
554         check-sn \
555         check-sim \
556         check-tar \
557         check-tcl \
558         check-texinfo \
559         check-textutils \
560         check-tgas \
561         check-time \
562         check-uudecode \
563         check-wdiff
564
565 CHECK_MODULES=$(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
566
567 # This is a list of the install targets for all of the modules which are
568 # compiled using $(FLAGS_TO_PASS).
569 # We put install-opcodes before install-binutils because the installed
570 # binutils might be on PATH, and they might need the shared opcodes
571 # library.
572 INSTALL_MODULES = \
573         install-apache \
574         install-autoconf \
575         install-automake \
576         install-bash \
577         install-bfd \
578         install-opcodes \
579         install-binutils \
580         install-bison \
581         install-byacc \
582         install-cvs \
583         install-db \
584         install-dejagnu \
585         install-diff \
586         install-dosutils \
587         install-etc \
588         install-fileutils \
589         install-findutils \
590         install-find \
591         install-flex \
592         install-gas \
593         install-gawk \
594         install-gnuserv \
595         install-gprof \
596         install-grep \
597         install-grez \
598         install-gzip \
599         install-hello \
600         install-indent \
601         install-inet \
602         install-ispell \
603         install-itcl \
604         install-ld \
605         install-libiberty \
606         install-m4 \
607         install-make \
608         install-mmalloc \
609         install-patch \
610         install-perl \
611         install-prms \
612         install-rcs \
613         install-readline \
614         install-recode \
615         install-sed \
616         install-send-pr \
617         install-shellutils \
618         install-sim \
619         install-sn \
620         install-tar \
621         install-tcl \
622         install-texinfo \
623         install-textutils \
624         install-tgas \
625         install-time \
626         install-uudecode \
627         install-wdiff
628
629 # This is a list of the targets for all of the modules which are compiled
630 # using $(X11_FLAGS_TO_PASS).
631 ALL_X11_MODULES = \
632         all-emacs \
633         all-emacs19 \
634         all-gdb \
635         all-expect \
636         all-gash \
637         all-guile \
638         all-tclX \
639         all-tk \
640         all-tix
641
642 # This is a list of the check targets for all of the modules which are
643 # compiled using $(X11_FLAGS_TO_PASS).
644 CHECK_X11_MODULES = \
645         check-emacs \
646         check-gdb \
647         check-guile \
648         check-expect \
649         check-gash \
650         check-tclX \
651         check-tk \
652         check-tix
653
654 # This is a list of the install targets for all the modules which are
655 # compiled using $(X11_FLAGS_TO_PASS).
656 INSTALL_X11_MODULES = \
657         install-emacs \
658         install-emacs19 \
659         install-gdb \
660         install-guile \
661         install-expect \
662         install-gash \
663         install-tclX \
664         install-tk \
665         install-tix
666
667 # This is a list of the targets for all of the modules which are compiled
668 # using $(TARGET_FLAGS_TO_PASS).
669 ALL_TARGET_MODULES = \
670         all-target-libio \
671         all-target-libstdc++ \
672         all-target-librx \
673         all-target-libg++ \
674         all-target-newlib \
675         all-target-winsup \
676         all-target-libgloss \
677         all-target-libiberty \
678         all-target-gperf \
679         all-target-examples
680
681 # This is a list of the configure targets for all of the modules which
682 # are compiled using the target tools.
683 CONFIGURE_TARGET_MODULES = \
684         configure-target-libio \
685         configure-target-libstdc++ \
686         configure-target-librx \
687         configure-target-libg++ \
688         configure-target-newlib \
689         configure-target-winsup \
690         configure-target-libgloss \
691         configure-target-libiberty \
692         configure-target-gperf \
693         configure-target-examples
694
695 # This is a list of the check targets for all of the modules which are
696 # compiled using $(TARGET_FLAGS_TO_PASS).
697 CHECK_TARGET_MODULES = \
698         check-target-libio \
699         check-target-libstdc++ \
700         check-target-libg++ \
701         check-target-newlib \
702         check-target-winsup \
703         check-target-libiberty \
704         check-target-gperf
705
706 # This is a list of the install targets for all of the modules which are
707 # compiled using $(TARGET_FLAGS_TO_PASS).
708 INSTALL_TARGET_MODULES = \
709         install-target-libio \
710         install-target-libstdc++ \
711         install-target-libg++ \
712         install-target-newlib \
713         install-target-winsup \
714         install-target-libgloss \
715         install-target-libiberty \
716         install-target-gperf
717
718 # This is a list of the targets for which we can do a clean-{target}.
719 CLEAN_MODULES = \
720         clean-apache \
721         clean-autoconf \
722         clean-automake \
723         clean-bash \
724         clean-bfd \
725         clean-binutils \
726         clean-bison \
727         clean-byacc \
728         clean-cvs \
729         clean-db \
730         clean-dejagnu \
731         clean-diff \
732         clean-dosutils \
733         clean-etc \
734         clean-fileutils \
735         clean-findutils \
736         clean-find \
737         clean-flex \
738         clean-gas \
739         clean-gawk \
740         clean-gnuserv \
741         clean-gprof \
742         clean-grep \
743         clean-grez \
744         clean-gzip \
745         clean-hello \
746         clean-indent \
747         clean-inet \
748         clean-ispell \
749         clean-itcl \
750         clean-ld \
751         clean-libiberty \
752         clean-m4 \
753         clean-make \
754         clean-mmalloc \
755         clean-opcodes \
756         clean-patch \
757         clean-perl \
758         clean-prms \
759         clean-rcs \
760         clean-readline \
761         clean-release \
762         clean-recode \
763         clean-sed \
764         clean-send-pr \
765         clean-shellutils \
766         clean-sim \
767         clean-sn \
768         clean-tar \
769         clean-tcl \
770         clean-texinfo \
771         clean-textutils \
772         clean-tgas \
773         clean-time \
774         clean-uudecode \
775         clean-wdiff
776
777 # All of the target modules that can be cleaned
778 CLEAN_TARGET_MODULES = \
779         clean-target-libio \
780         clean-target-libstdc++ \
781         clean-target-librx \
782         clean-target-libg++ \
783         clean-target-newlib \
784         clean-target-winsup \
785         clean-target-libgloss \
786         clean-target-libiberty \
787         clean-target-gperf \
788         clean-target-examples
789
790 # All of the x11 modules that can be cleaned
791 CLEAN_X11_MODULES = \
792         clean-emacs \
793         clean-emacs19 \
794         clean-gdb \
795         clean-expect \
796         clean-gash \
797         clean-guile \
798         clean-tclX \
799         clean-tk \
800         clean-tix
801
802 # The first rule in the file had better be this one.  Don't put any above it.
803 all: all.normal
804 .PHONY: all
805
806 # The target built for a native build.
807 .PHONY: all.normal
808 all.normal: \
809         $(ALL_MODULES) \
810         $(ALL_X11_MODULES) \
811         $(ALL_TARGET_MODULES) \
812         all-gcc
813
814 # Do a target for all the subdirectories.  A ``make do-X'' will do a
815 # ``make X'' in all subdirectories (because, in general, there is a
816 # dependency (below) of X upon do-X, a ``make X'' will also do this,
817 # but it may do additional work as well).
818 # This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
819 # because it is so large that it can easily overflow the command line
820 # length limit on some systems.
821 DO_X = \
822         do-clean \
823         do-distclean \
824         do-dvi \
825         do-info \
826         do-install-info \
827         do-installcheck \
828         do-mostlyclean \
829         do-maintainer-clean \
830         do-TAGS
831 .PHONY: $(DO_X)
832 $(DO_X):
833         @target=`echo $@ | sed -e 's/^do-//'`; \
834         r=`pwd`; export r; \
835         s=`cd $(srcdir); pwd`; export s; \
836         $(SET_LIB_PATH) \
837         for i in $(SUBDIRS) -dummy-; do \
838           if [ -f ./$$i/Makefile ]; then \
839             case $$i in \
840             gcc) \
841               for flag in $(EXTRA_GCC_FLAGS); do \
842                 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
843               done; \
844               ;; \
845             *) \
846               for flag in $(EXTRA_HOST_FLAGS); do \
847                 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
848               done; \
849               ;; \
850             esac ; \
851             export AR AS CC CXX LD NM RANLIB DLLTOOL WINDRES; \
852             if (cd ./$$i; \
853                 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
854                         "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
855                         "RANLIB=$${RANLIB}" \
856                         "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
857                         $${target}); \
858             then true; else exit 1; fi; \
859           else true; fi; \
860         done
861         @target=`echo $@ | sed -e 's/^do-//'`; \
862         r=`pwd`; export r; \
863         s=`cd $(srcdir); pwd`; export s; \
864         $(SET_LIB_PATH) \
865         for i in $(TARGET_CONFIGDIRS) -dummy-; do \
866           if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \
867             for flag in $(EXTRA_TARGET_FLAGS); do \
868                 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
869             done; \
870             export AR AS CC CXX LD NM RANLIB DLLTOOL WINDRES; \
871             if (cd $(TARGET_SUBDIR)/$$i; \
872                 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
873                         "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
874                         "RANLIB=$${RANLIB}" \
875                         "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
876                         $${target}); \
877             then true; else exit 1; fi; \
878           else true; fi; \
879         done
880
881 # Here are the targets which correspond to the do-X targets.
882
883 .PHONY: info installcheck dvi install-info
884 .PHONY: clean distclean mostlyclean maintainer-clean realclean
885 .PHONY: local-clean local-distclean local-maintainer-clean
886 info: do-info
887 installcheck: do-installcheck
888 dvi: do-dvi
889
890 # Make sure makeinfo is built before we do a `make info'.
891 do-info: all-texinfo
892
893 install-info: do-install-info dir.info
894         s=`cd $(srcdir); pwd`; export s; \
895         if [ -f dir.info ] ; then \
896           $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
897         else true ; fi
898
899 local-clean:
900         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
901
902 local-distclean:
903         -rm -f Makefile config.status config.cache mh-frag mt-frag
904         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
905           rm -rf $(TARGET_SUBDIR); \
906         else true; fi
907
908 local-maintainer-clean:
909         @echo "This command is intended for maintainers to use;"
910         @echo "it deletes files that may require special tools to rebuild."
911
912 clean: do-clean local-clean
913 mostlyclean: do-mostlyclean local-clean
914 distclean: do-distclean local-clean local-distclean
915 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
916 maintainer-clean: local-distclean
917 realclean: maintainer-clean
918
919 # This rule is used to clean specific modules.
920 .PHONY: $(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc
921 $(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc:
922         @dir=`echo $@ | sed -e 's/clean-//'`; \
923         if [ -f ./$${dir}/Makefile ] ; then \
924           r=`pwd`; export r; \
925           s=`cd $(srcdir); pwd`; export s; \
926           $(SET_LIB_PATH) \
927           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) clean); \
928         else \
929           true; \
930         fi
931
932 .PHONY: $(CLEAN_TARGET_MODULES)
933 $(CLEAN_TARGET_MODULES):
934         @dir=`echo $@ | sed -e 's/clean-target-//'`; \
935         rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
936         if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
937           r=`pwd`; export r; \
938           s=`cd $(srcdir); pwd`; export s; \
939           $(SET_LIB_PATH) \
940           (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \
941         else \
942           true; \
943         fi
944
945 clean-target: $(CLEAN_TARGET_MODULES)
946
947 # Check target.
948
949 .PHONY: check
950 check: $(CHECK_MODULES) \
951         $(CHECK_TARGET_MODULES) \
952         $(CHECK_X11_MODULES) \
953         check-gcc
954
955 # Installation targets.
956
957 .PHONY: install install-cross uninstall source-vault binary-vault vault-install
958 install: $(INSTALL_TARGET) 
959 install-cross: $(INSTALL_TARGET_CROSS) 
960
961 uninstall:
962         @echo "the uninstall target is not supported in this tree"
963
964 source-vault:
965         $(MAKE) -f ./release/Build-A-Release \
966                 host=$(host_alias) source-vault
967
968 binary-vault:
969         $(MAKE) -f ./release/Build-A-Release \
970                 host=$(host_alias) target=$(target_alias)
971
972 vault-install:
973         @if [ -f ./release/vault-install ] ; then \
974           ./release/vault-install $(host_alias) $(target_alias) ; \
975         else \
976           true ; \
977         fi
978
979 .PHONY: install.all
980 install.all: install-no-fixedincludes
981         @if [ -f ./gcc/Makefile ] ; then \
982                 r=`pwd` ; export r ; \
983                 $(SET_LIB_PATH) \
984                 (cd ./gcc; \
985                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
986         else \
987                 true ; \
988         fi
989
990 # inet-install is used because the I*Net wants DejaGNU installed but
991 # not built.  Similarly, gzip is built but not installed.
992 inet-install:
993         $(MAKE) INSTALL_MODULES="`echo $(INSTALL_MODULES) | sed -e 's/install-dejagnu//' -e 's/install-gzip//'`" install
994
995 # install-no-fixedincludes is used because Cygnus can not distribute
996 # the fixed header files.
997 .PHONY: install-no-fixedincludes
998 install-no-fixedincludes: \
999         installdirs \
1000         $(INSTALL_MODULES) \
1001         $(INSTALL_TARGET_MODULES) \
1002         $(INSTALL_X11_MODULES) \
1003         gcc-no-fixedincludes 
1004
1005 # Install the gcc headers files, but not the fixed include files,
1006 # which Cygnus is not allowed to distribute.  This rule is very
1007 # dependent on the workings of the gcc Makefile.in.
1008 .PHONY: gcc-no-fixedincludes
1009 gcc-no-fixedincludes:
1010         @if [ -f ./gcc/Makefile ]; then \
1011           rm -rf gcc/tmp-include; \
1012           mv gcc/include gcc/tmp-include 2>/dev/null; \
1013           mkdir gcc/include; \
1014           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1015           touch gcc/stmp-fixinc gcc/include/fixed; \
1016           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1017           r=`pwd`; export r; \
1018           s=`cd $(srcdir); pwd` ; export s; \
1019           $(SET_LIB_PATH) \
1020           (cd ./gcc; \
1021            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1022           rm -rf gcc/include; \
1023           mv gcc/tmp-include gcc/include 2>/dev/null; \
1024         else true; fi
1025
1026 # This rule is used to build the modules which use FLAGS_TO_PASS.  To
1027 # build a target all-X means to cd to X and make all.
1028 #
1029 # all-gui, and all-libproc are handled specially because
1030 # they are still experimental, and if they fail to build, that
1031 # shouldn't stop "make all".
1032 .PHONY: $(ALL_MODULES) all-gui all-libproc
1033 $(ALL_MODULES) all-gui all-libproc:
1034         @dir=`echo $@ | sed -e 's/all-//'`; \
1035         if [ -f ./$${dir}/Makefile ] ; then \
1036           r=`pwd`; export r; \
1037           s=`cd $(srcdir); pwd`; export s; \
1038           $(SET_LIB_PATH) \
1039           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
1040         else \
1041           true; \
1042         fi
1043
1044 # These rules are used to check the modules which use FLAGS_TO_PASS.
1045 # To build a target check-X means to cd to X and make check.  Some
1046 # modules are only tested in a native toolchain.
1047
1048 .PHONY: $(CHECK_MODULES) $(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
1049 $(NATIVE_CHECK_MODULES):
1050         @if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
1051           dir=`echo $@ | sed -e 's/check-//'`; \
1052           if [ -f ./$${dir}/Makefile ] ; then \
1053             r=`pwd`; export r; \
1054             s=`cd $(srcdir); pwd`; export s; \
1055             $(SET_LIB_PATH) \
1056             (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
1057           else \
1058             true; \
1059           fi; \
1060         fi
1061
1062 $(CROSS_CHECK_MODULES):
1063         @dir=`echo $@ | sed -e 's/check-//'`; \
1064         if [ -f ./$${dir}/Makefile ] ; then \
1065           r=`pwd`; export r; \
1066           s=`cd $(srcdir); pwd`; export s; \
1067           $(SET_LIB_PATH) \
1068           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
1069         else \
1070           true; \
1071         fi
1072
1073 # This rule is used to install the modules which use FLAGS_TO_PASS.
1074 # To build a target install-X means to cd to X and make install.
1075 .PHONY: $(INSTALL_MODULES)
1076 $(INSTALL_MODULES): installdirs
1077         @dir=`echo $@ | sed -e 's/install-//'`; \
1078         if [ -f ./$${dir}/Makefile ] ; then \
1079           r=`pwd`; export r; \
1080           s=`cd $(srcdir); pwd`; export s; \
1081           $(SET_LIB_PATH) \
1082           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
1083         else \
1084           true; \
1085         fi
1086
1087 # This rule is used to configure the modules which are built with the
1088 # target tools.
1089 .PHONY: $(CONFIGURE_TARGET_MODULES)
1090 $(CONFIGURE_TARGET_MODULES):
1091         @dir=`echo $@ | sed -e 's/configure-target-//'`; \
1092         if [ -d $(TARGET_SUBDIR)/$${dir} ]; then \
1093           r=`pwd`; export r; \
1094           $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/$${dir}/tmpmulti.out 2> /dev/null; \
1095           if [ -s $(TARGET_SUBDIR)/$${dir}/tmpmulti.out ]; then \
1096             if [ -f $(TARGET_SUBDIR)/$${dir}/multilib.out ]; then \
1097               if cmp $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out > /dev/null; then \
1098                 rm -f $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
1099               else \
1100                 echo "Multilibs changed for $${dir}, reconfiguring"; \
1101                 rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/Makefile; \
1102                 mv $(TARGET_SUBDIR)/$${dir}/tmpmulti.out $(TARGET_SUBDIR)/$${dir}/multilib.out; \
1103               fi; \
1104             else \
1105               mv $(TARGET_SUBDIR)/$${dir}/tmpmulti.out $(TARGET_SUBDIR)/$${dir}/multilib.out; \
1106             fi; \
1107           fi; \
1108         fi; exit 0      # break command into two pieces
1109         @dir=`echo $@ | sed -e 's/configure-target-//'`; \
1110         if [ ! -d $(TARGET_SUBDIR) ]; then \
1111           true; \
1112         elif [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1113           true; \
1114         elif echo " $(TARGET_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
1115           if [ -d $(srcdir)/$${dir} ]; then \
1116             [ -d $(TARGET_SUBDIR)/$${dir} ] || mkdir $(TARGET_SUBDIR)/$${dir};\
1117             r=`pwd`; export r; \
1118             s=`cd $(srcdir); pwd`; export s; \
1119             $(SET_LIB_PATH) \
1120             AR="$(AR_FOR_TARGET)"; export AR; \
1121             AS="$(AS_FOR_TARGET)"; export AS; \
1122             CC="$(CC_FOR_TARGET)"; export CC; \
1123             CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1124             CXX="$(CXX_FOR_TARGET)"; export CXX; \
1125             CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1126             DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
1127             LD="$(LD_FOR_TARGET)"; export LD; \
1128             LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
1129             NM="$(NM_FOR_TARGET)"; export NM; \
1130             RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
1131             WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
1132             echo Configuring in $(TARGET_SUBDIR)/$${dir}; \
1133             cd $(TARGET_SUBDIR)/$${dir}; \
1134             case $(srcdir) in \
1135             /*) \
1136               topdir=$(srcdir) ;; \
1137             *) \
1138               case "$(TARGET_SUBDIR)" in \
1139               .) topdir="../$(srcdir)" ;; \
1140               *) topdir="../../$(srcdir)" ;; \
1141               esac ;; \
1142             esac; \
1143             if [ "$(srcdir)" = "." ] ; then \
1144               if [ "$(TARGET_SUBDIR)" != "." ] ; then \
1145                 if $(SHELL) $$s/symlink-tree $${topdir}/$${dir} "no-such-file" ; then \
1146                   if [ -f Makefile ]; then \
1147                     if $(MAKE) distclean; then \
1148                       true; \
1149                     else \
1150                       exit 1; \
1151                     fi; \
1152                   else \
1153                     true; \
1154                   fi; \
1155                 else \
1156                   exit 1; \
1157                 fi; \
1158               else \
1159                 true; \
1160               fi; \
1161               srcdiroption="--srcdir=."; \
1162               libsrcdir="."; \
1163             else \
1164               srcdiroption="--srcdir=$${topdir}/$${dir}"; \
1165               libsrcdir="$$s/$${dir}"; \
1166             fi; \
1167             if [ -f $${libsrcdir}/configure ] ; then \
1168               $(SHELL) $${libsrcdir}/configure \
1169                 $(CONFIG_ARGUMENTS) $${srcdiroption} \
1170                 --with-target-subdir="$(TARGET_SUBDIR)"; \
1171             else \
1172               $(SHELL) $$s/configure \
1173                 $(CONFIG_ARGUMENTS) $${srcdiroption} \
1174                 --with-target-subdir="$(TARGET_SUBDIR)"; \
1175             fi; \
1176           else \
1177             true; \
1178           fi; \
1179         else \
1180           true; \
1181         fi
1182
1183 # This rule is used to build the modules which use TARGET_FLAGS_TO_PASS.
1184 # To build a target all-X means to cd to X and make all.
1185 .PHONY: $(ALL_TARGET_MODULES)
1186 $(ALL_TARGET_MODULES):
1187         @dir=`echo $@ | sed -e 's/all-target-//'`; \
1188         if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1189           r=`pwd`; export r; \
1190           s=`cd $(srcdir); pwd`; export s; \
1191           $(SET_LIB_PATH) \
1192           (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
1193         else \
1194           true; \
1195         fi
1196
1197 # This rule is used to check the modules which use TARGET_FLAGS_TO_PASS.
1198 # To build a target install-X means to cd to X and make install.
1199 .PHONY: $(CHECK_TARGET_MODULES)
1200 $(CHECK_TARGET_MODULES):
1201         @dir=`echo $@ | sed -e 's/check-target-//'`; \
1202         if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1203           r=`pwd`; export r; \
1204           s=`cd $(srcdir); pwd`; export s; \
1205           $(SET_LIB_PATH) \
1206           (cd $(TARGET_SUBDIR)/$${dir};$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\
1207         else \
1208           true; \
1209         fi
1210
1211 # This rule is used to install the modules which use
1212 # TARGET_FLAGS_TO_PASS.  To build a target install-X means to cd to X
1213 # and make install.
1214 .PHONY: $(INSTALL_TARGET_MODULES)
1215 $(INSTALL_TARGET_MODULES): installdirs
1216         @dir=`echo $@ | sed -e 's/install-target-//'`; \
1217         if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1218           r=`pwd`; export r; \
1219           s=`cd $(srcdir); pwd`; export s; \
1220           $(SET_LIB_PATH) \
1221           (cd $(TARGET_SUBDIR)/$${dir}; \
1222             $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
1223         else \
1224           true; \
1225         fi
1226
1227 # This rule is used to build the modules which use X11_FLAGS_TO_PASS.
1228 # To build a target all-X means to cd to X and make all.
1229 .PHONY: $(ALL_X11_MODULES)
1230 $(ALL_X11_MODULES):
1231         @dir=`echo $@ | sed -e 's/all-//'`; \
1232         if [ -f ./$${dir}/Makefile ] ; then \
1233           r=`pwd`; export r; \
1234           s=`cd $(srcdir); pwd`; export s; \
1235           $(SET_LIB_PATH) \
1236           (cd $${dir}; \
1237            $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
1238         else \
1239           true; \
1240         fi
1241
1242 # This rule is used to check the modules which use X11_FLAGS_TO_PASS.
1243 # To build a target check-X means to cd to X and make all.
1244 .PHONY: $(CHECK_X11_MODULES)
1245 $(CHECK_X11_MODULES):
1246         @dir=`echo $@ | sed -e 's/check-//'`; \
1247         if [ -f ./$${dir}/Makefile ] ; then \
1248           r=`pwd`; export r; \
1249           s=`cd $(srcdir); pwd`; export s; \
1250           $(SET_LIB_PATH) \
1251           (cd $${dir}; \
1252            $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
1253         else \
1254           true; \
1255         fi
1256
1257 # This rule is used to install the modules which use X11_FLAGS_TO_PASS.
1258 # To build a target install-X means to cd to X and make install.
1259 .PHONY: $(INSTALL_X11_MODULES)
1260 $(INSTALL_X11_MODULES): installdirs
1261         @dir=`echo $@ | sed -e 's/install-//'`; \
1262         if [ -f ./$${dir}/Makefile ] ; then \
1263           r=`pwd`; export r; \
1264           s=`cd $(srcdir); pwd`; export s; \
1265           $(SET_LIB_PATH) \
1266           (cd $${dir}; \
1267            $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
1268         else \
1269           true; \
1270         fi
1271
1272 # gcc is the only module which uses GCC_FLAGS_TO_PASS.
1273 .PHONY: all-gcc
1274 all-gcc:
1275         @if [ -f ./gcc/Makefile ] ; then \
1276           r=`pwd`; export r; \
1277           s=`cd $(srcdir); pwd`; export s; \
1278           $(SET_LIB_PATH) \
1279           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
1280         else \
1281           true; \
1282         fi
1283
1284 # Building GCC uses some tools for rebuilding "source" files
1285 # like texinfo, bison/byacc, etc.  So we must depend on those.
1286 #
1287 # While building GCC, it may be necessary to run various target
1288 # programs like the assembler, linker, etc.  So we depend on
1289 # those too.
1290 #
1291 # In theory, on an SMP all those dependencies can be resolved
1292 # in parallel.
1293 #
1294 .PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap3 bootstrap4
1295 bootstrap bootstrap-lean bootstrap2 bootstrap3 bootstrap4: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
1296         @r=`pwd`; export r; \
1297         s=`cd $(srcdir); pwd`; export s; \
1298         $(SET_LIB_PATH) \
1299         echo "Bootstrapping the compiler"; \
1300         cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $@
1301         @r=`pwd`; export r; \
1302         s=`cd $(srcdir); pwd`; export s; \
1303         case "$@" in \
1304           *bootstrap4 ) msg="Comparing stage3 and stage4 of the compiler"; \
1305                         compare=compare3 ;; \
1306           *-lean )      msg="Comparing stage2 and stage3 of the compiler"; \
1307                         compare=compare-lean ;; \
1308           * )           msg="Comparing stage2 and stage3 of the compiler"; \
1309                         compare=compare ;; \
1310         esac; \
1311         $(SET_LIB_PATH) \
1312         echo "$$msg"; \
1313         cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
1314         @echo "Building runtime libraries"; \
1315         $(MAKE) all
1316
1317 .PHONY: cross
1318 cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
1319         @r=`pwd`; export r; \
1320         s=`cd $(srcdir); pwd`; export s; \
1321         $(SET_LIB_PATH) \
1322         echo "Building the C and C++ compiler"; \
1323         cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1324         @echo "Building runtime libraries"; \
1325         $(MAKE) all LANGUAGES="c c++"
1326
1327 .PHONY: check-gcc
1328 check-gcc:
1329         @if [ -f ./gcc/Makefile ] ; then \
1330           r=`pwd`; export r; \
1331           s=`cd $(srcdir); pwd`; export s; \
1332           $(SET_LIB_PATH) \
1333           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
1334         else \
1335           true; \
1336         fi
1337
1338 .PHONY: install-gcc
1339 install-gcc:
1340         @if [ -f ./gcc/Makefile ] ; then \
1341           r=`pwd`; export r; \
1342           s=`cd $(srcdir); pwd`; export s; \
1343           $(SET_LIB_PATH) \
1344           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" install); \
1345         else \
1346           true; \
1347         fi
1348
1349 .PHONY: install-gcc-cross
1350 install-gcc-cross:
1351         @if [ -f ./gcc/Makefile ] ; then \
1352           r=`pwd`; export r; \
1353           s=`cd $(srcdir); pwd`; export s; \
1354           $(SET_LIB_PATH) \
1355           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1356         else \
1357           true; \
1358         fi
1359 # EXPERIMENTAL STUFF
1360 # This rule is used to install the modules which use FLAGS_TO_PASS.
1361 # To build a target install-X means to cd to X and make install.
1362 .PHONY: install-dosrel
1363 install-dosrel: installdirs info
1364         @dir=`echo $@ | sed -e 's/install-//'`; \
1365         if [ -f ./$${dir}/Makefile ] ; then \
1366           r=`pwd`; export r; \
1367           s=`cd $(srcdir); pwd`; export s; \
1368           $(SET_LIB_PATH) \
1369           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
1370         else \
1371           true; \
1372         fi
1373
1374 install-dosrel-fake:
1375
1376
1377 # This is a list of inter-dependencies among modules.
1378 all-apache:
1379 all-autoconf: all-m4 all-texinfo
1380 all-automake:
1381 all-bash:
1382 all-bfd:
1383 all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc
1384 all-bison: all-texinfo
1385 all-byacc:
1386 all-cvs:
1387 all-db:
1388 all-dejagnu: all-tcl all-expect all-tk
1389 all-diff: all-libiberty
1390 all-emacs:
1391 all-emacs19: all-bison all-byacc
1392 all-etc:
1393 configure-target-examples: $(ALL_GCC)
1394 all-target-examples: configure-target-examples
1395 all-expect: all-tcl all-tk
1396 all-fileutils: all-libiberty
1397 all-findutils:
1398 all-find:
1399 all-flex: all-libiberty all-bison all-byacc
1400 all-gas: all-libiberty all-opcodes all-bfd
1401 all-gash: all-tcl
1402 all-gawk:
1403 ALL_GCC = all-gcc
1404 all-gcc: all-bison all-byacc all-binutils all-gas all-ld
1405 GDB_TK = all-tk all-tcl all-itcl all-tix
1406 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
1407 all-gnuserv:
1408 configure-target-gperf: $(ALL_GCC)
1409 all-target-gperf: configure-target-gperf all-target-libiberty all-target-libg++
1410 all-gprof: all-libiberty all-bfd all-opcodes
1411 all-grep: all-libiberty
1412 all-grez: all-libiberty all-bfd all-opcodes
1413 all-gui: all-gdb all-libproc all-target-librx
1414 all-guile:
1415 all-gzip: all-libiberty
1416 all-hello: all-libiberty
1417 all-indent:
1418 all-inet: all-tcl all-send-pr all-perl
1419 all-ispell: all-emacs19
1420 all-itcl: all-tcl all-tk
1421 all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex
1422 configure-target-libg++: $(ALL_GCC) configure-target-librx
1423 all-target-libg++: configure-target-libg++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-librx all-target-libstdc++
1424 configure-target-libgloss: $(ALL_GCC)
1425 all-target-libgloss: configure-target-libgloss configure-target-newlib
1426 configure-target-libio: $(ALL_GCC)
1427 all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
1428 check-target-libio: all-target-libstdc++
1429 all-libiberty:
1430 configure-target-librx: $(ALL_GCC) configure-target-newlib
1431 all-target-librx: configure-target-librx
1432 configure-target-libstdc++: $(ALL_GCC)
1433 all-target-libstdc++: configure-target-libstdc++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
1434 all-m4: all-libiberty
1435 all-make: all-libiberty
1436 all-mmalloc:
1437 configure-target-newlib: $(ALL_GCC)
1438 all-target-newlib: configure-target-newlib all-binutils all-gas all-gcc
1439 all-opcodes: all-bfd all-libiberty
1440 all-patch: all-libiberty
1441 all-perl:
1442 all-prms: all-libiberty
1443 all-rcs:
1444 all-readline:
1445 all-recode: all-libiberty
1446 all-sed: all-libiberty
1447 all-send-pr: all-prms
1448 all-shellutils:
1449 all-sim: all-libiberty all-bfd all-opcodes
1450 all-sn: all-tcl all-tk all-itcl all-db all-grep
1451 all-tar: all-libiberty
1452 all-tcl:
1453 all-tclX: all-tcl all-tk
1454 all-tk: all-tcl
1455 all-texinfo: all-libiberty
1456 all-textutils:
1457 all-tgas: all-libiberty all-bfd all-opcodes
1458 all-time:
1459 all-tix: all-tcl all-tk
1460 all-wdiff:
1461 all-target-winsup: all-target-newlib all-target-libiberty all-target-librx all-target-libio configure-target-winsup 
1462 configure-target-winsup: configure-target-newlib
1463 all-uudecode: all-libiberty
1464 configure-target-libiberty: $(ALL_GCC)
1465 all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
1466 all-target: $(ALL_TARGET_MODULES)
1467 install-target: $(INSTALL_TARGET_MODULES)
1468
1469 ### other supporting targets
1470
1471 MAKEDIRS= \
1472         $(prefix) \
1473         $(exec_prefix)
1474 .PHONY: installdirs
1475 installdirs: mkinstalldirs
1476         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1477
1478 dir.info: do-install-info
1479         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
1480           $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
1481           mv -f dir.info.new dir.info ; \
1482         else true ; \
1483         fi
1484
1485 dist:
1486         @echo "Building a full distribution of this tree isn't done"
1487         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
1488
1489 etags tags: TAGS
1490
1491 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
1492 # ability to use several tags files at once, so there is probably no need
1493 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
1494 # (if we felt like it) have this Makefile write a piece of elisp which
1495 # the user could load to tell emacs19 where all the TAGS files we just
1496 # built are.
1497 TAGS: do-TAGS
1498
1499 # with the gnu make, this is done automatically.
1500
1501 Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
1502         $(SHELL) ./config.status
1503
1504 #
1505 # Support for building net releases
1506
1507 # Files in devo used in any net release.
1508 # ChangeLog omitted because it may refer to files which are not in this
1509 # distribution (perhaps it would be better to include it anyway).
1510 DEVO_SUPPORT= README Makefile.in configure configure.in \
1511         config.guess config.sub config move-if-change \
1512         mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install \
1513         COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
1514         mkinstalldirs ltconfig ltmain.sh missing ylwrap
1515
1516 # Files in devo/etc used in any net release.
1517 # ChangeLog omitted because it may refer to files which are not in this
1518 # distribution (perhaps it would be better to include it anyway).
1519 ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
1520         make-stds.texi standards.info*
1521
1522 # When you use `make setup-dirs' or `make taz' you should always redefine
1523 # this macro.
1524 SUPPORT_FILES = list-of-support-files-for-tool-in-question
1525
1526 .PHONY: taz
1527
1528 taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
1529   texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1530         # Take out texinfo from a few places; make simple BISON=bison line.
1531         sed -e '/^all\.normal: /s/\all-texinfo //' \
1532             -e '/^      install-texinfo /d' \
1533         <Makefile.in >tmp
1534         mv -f tmp Makefile.in
1535         #
1536         ./configure sun4
1537         [ -z "$(CONFIGURE_TARGET_MODULES)" ] \
1538           || $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
1539             CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
1540         # Make links, and run "make diststuff" or "make info" when needed.
1541         rm -rf proto-toplev ; mkdir proto-toplev
1542         set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
1543         for d in $$dirs ; do \
1544           if [ -d $$d ]; then \
1545             if [ ! -f $$d/Makefile ] ; then true ; \
1546             elif grep '^diststuff:' $$d/Makefile >/dev/null ; then \
1547                 (cd $$d ; $(MAKE) diststuff ) || exit 1 ; \
1548             elif grep '^info:' $$d/Makefile >/dev/null ; then \
1549                 (cd $$d ; $(MAKE) info ) || exit 1 ; \
1550             fi ; \
1551             if [ -d $$d/proto-$$d.dir ]; then \
1552               ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
1553             else \
1554               ln -s ../$$d proto-toplev/$$d ; \
1555             fi ; \
1556           else ln -s ../$$d proto-toplev/$$d ; fi ; \
1557         done
1558         cd etc ; $(MAKE) info
1559         $(MAKE) distclean
1560         #
1561         mkdir proto-toplev/etc
1562         (cd proto-toplev/etc; \
1563          for i in $(ETC_SUPPORT); do \
1564                 ln -s ../../etc/$$i . ; \
1565          done)
1566         #
1567         # Take out texinfo from configurable dirs
1568         rm proto-toplev/configure.in
1569         sed -e '/^host_tools=/s/texinfo //' \
1570             <configure.in >proto-toplev/configure.in
1571         #
1572         mkdir proto-toplev/texinfo
1573         ln -s ../../texinfo/texinfo.tex         proto-toplev/texinfo/
1574         ln -s ../../texinfo/gpl.texinfo         proto-toplev/texinfo/
1575         ln -s ../../texinfo/lgpl.texinfo        proto-toplev/texinfo/
1576         if test -r texinfo/util/tex3patch ; then \
1577           mkdir proto-toplev/texinfo/util && \
1578           ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util ; \
1579         else true; fi
1580         chmod og=u `find . -print`
1581         if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
1582           ver=`sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'`; \
1583         else \
1584           ver=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
1585         fi; \
1586         $(MAKE) -f Makefile.in do-tar-gz TOOL=$(TOOL) VER=$$ver
1587
1588 do-tar-gz:
1589         echo "==> Making $(TOOL)-$(VER).tar.gz"
1590         -rm -f $(TOOL)-$(VER)
1591         ln -s proto-toplev $(TOOL)-$(VER)
1592         tar cfh $(TOOL)-$(VER).tar $(TOOL)-$(VER)
1593         $(GZIPPROG) -v -9 $(TOOL)-$(VER).tar
1594
1595 TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1596 DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
1597
1598 .PHONY: gas.tar.gz
1599 GAS_SUPPORT_DIRS= bfd include libiberty opcodes setup.com makefile.vms
1600 gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
1601         $(MAKE) -f Makefile.in taz TOOL=gas \
1602                 SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
1603
1604 # The FSF "binutils" release includes gprof and ld.
1605 .PHONY: binutils.tar.gz
1606 BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof setup.com makefile.vms
1607 binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
1608         $(MAKE) -f Makefile.in taz TOOL=binutils \
1609                 SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat"
1610
1611 .PHONY: gas+binutils.tar.gz
1612 GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
1613 gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
1614         $(MAKE) -f Makefile.in taz TOOL=gas \
1615                 SUPPORT_FILES="$(GASB_SUPPORT_DIRS) makeall.bat configure.bat"
1616
1617 .PHONY: libg++.tar.gz
1618 LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
1619 libg++.tar.gz: $(DIST_SUPPORT) libg++
1620         $(MAKE) -f Makefile.in taz TOOL=libg++ \
1621                 SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
1622
1623 GNATS_SUPPORT_DIRS=include libiberty send-pr
1624 gnats.tar.gz: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
1625         $(MAKE) -f  Makefile.in taz TOOL=gnats \
1626                 SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
1627
1628 .PHONY: gdb.tar.gz
1629 GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils
1630 GDBTK_SUPPORT_DIRS= `if [ -d tcl -a -d tk ] ; then echo tcl tk ; fi`
1631 gdb.tar.gz: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
1632         $(MAKE) -f Makefile.in taz TOOL=gdb \
1633                 SUPPORT_FILES="$(GDB_SUPPORT_DIRS) $(GDBTK_SUPPORT_DIRS)"
1634
1635 .PHONY: newlib.tar.gz
1636 NEWLIB_SUPPORT_DIRS=libgloss
1637 # taz configures for the sun4 target which won't configure newlib.
1638 # We need newlib configured so that the .info files are made.
1639 # Unfortunately, it is not enough to just configure newlib separately:
1640 # taz will build the .info files but since SUBDIRS won't contain newlib,
1641 # distclean won't be run (leaving Makefile, config.status, and the tmp files
1642 # used in building the .info files, eg: *.def, *.ref).
1643 # The problem isn't solvable however without a lot of extra work because
1644 # target libraries are built in subdir $(target_alias) which gets nuked during
1645 # the make distclean.  For now punt on the issue of shipping newlib info files
1646 # with newlib net releases and wait for a day when some native target (sun4?)
1647 # supports newlib (if only minimally).
1648 newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
1649         $(MAKE) -f Makefile.in taz TOOL=newlib \
1650                 SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
1651                 DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
1652
1653 .NOEXPORT:
1654 MAKEOVERRIDES=
1655
1656
1657 # end of Makefile.in