* Makefile.in (CXXFLAGS): Add -O.
[platform/upstream/binutils.git] / Makefile.in
1 #
2 # Makefile for directory with subdirs to build.
3 #   Copyright (C) 1990, 1991, 1992, 1993 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., 675 Mass Ave, Cambridge, MA 02139, 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)/lib
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 docdir = $(datadir)/doc
45
46 SHELL = /bin/sh
47
48 INSTALL = $${srcroot}/install.sh -c
49 INSTALL_PROGRAM = $(INSTALL)
50 INSTALL_DATA = $(INSTALL)
51 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
52
53 AS = as
54 AR = ar
55 AR_FLAGS = rc
56 CC = cc
57
58 # We don't specify -g -O because many compilers don't support -g -O,
59 # and/or -O is broken in and of itself.
60 CFLAGS = -g
61
62 # start-sanitize-chill
63 CHILLFLAGS = $(CFLAGS)
64 CHILL_LIB = -lchill
65 # end-sanitize-chill
66 CXX = gcc
67
68 # Use -O to stress test the compiler.
69 CXXFLAGS = -g -O
70
71 RANLIB = ranlib
72 NM = nm
73 MUNCH_NM = $(NM)
74 GZIP = gzip
75
76 # BISON: This line sed'ed to BISON = bison -y for FSF releases, don't remove.
77 BISON = `if [ -f $${rootme}/byacc/byacc ] ; \
78             then echo $${rootme}/byacc/byacc ; \
79             else echo byacc ; \
80         fi`
81
82 LEX = `if [ -f $${rootme}/flex/flex ] ; \
83         then echo $${rootme}/flex/flex ; \
84         else echo flex ; fi`
85
86 M4 = `if [ -f $${rootme}/m4/m4 ] ; \
87         then echo $${rootme}/m4/m4 ; \
88         else echo m4 ; fi`
89
90 MAKEINFO = `if [ -f $${rootme}/texinfo/makeinfo/makeinfo ] ; \
91         then echo $${rootme}/texinfo/makeinfo/makeinfo ; \
92         else echo makeinfo ; fi`
93 # This just becomes part of the MAKEINFO definition passed down to
94 # sub-makes.  It lets flags be given on the command line while still
95 # using the makeinfo from the object tree.
96 MAKEINFOFLAGS =
97
98 EXPECT = `if [ -f $${rootme}/expect/expect ] ; \
99         then echo $${rootme}/expect/expect ; \
100         else echo expect ; fi`
101
102 RUNTEST = `if [ -f $${srcroot}/dejagnu/runtest ] ; \
103         then echo $${srcroot}/dejagnu/runtest ; \
104         else echo runtest ; fi`
105
106
107 # libraries that may need to be augmented on a system-by-system basis
108 X11_LIB = -lX11
109
110 # compilers to use to create programs which must be run in the build
111 # environment.
112 CC_FOR_BUILD = $(CC)
113 CXX_FOR_BUILD = $(CXX)
114
115 SUBDIRS = "this is set via configure, don't edit this"
116 OTHERS = 
117
118 ALL = all.normal
119 INSTALL_TARGET = install-dirs \
120         $(INSTALL_MODULES) \
121         $(INSTALL_TARGET_MODULES) \
122         $(INSTALL_X11_MODULES) \
123         install-gcc
124
125 CC_FOR_TARGET = ` \
126   if [ -f $${rootme}/gcc/Makefile ] ; then \
127     echo $${rootme}/gcc/xgcc -B$${rootme}/gcc/; \
128   else \
129     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
130       echo $(CC); \
131     else \
132       t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
133     fi; \
134   fi`
135
136 # start-sanitize-chill
137 CHILL_FOR_TARGET = ` \
138   if [ -f $${rootme}/gcc/Makefile ] ; then \
139     echo $${rootme}/gcc/xgcc -B$${rootme}/gcc/ -L$${rootme}/chillrt/; \
140   else \
141     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
142       echo $(CC); \
143     else \
144       t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
145     fi; \
146   fi`
147
148 # end-sanitize-chill
149
150 CXX_FOR_TARGET = ` \
151   if [ -f $${rootme}/gcc/Makefile ] ; then \
152     echo $${rootme}/gcc/xgcc -B$${rootme}/gcc/; \
153   else \
154     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
155       echo $(CXX); \
156     else \
157       t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
158     fi; \
159   fi`
160
161 AS_FOR_TARGET = ` \
162   if [ -f $${rootme}/gas/Makefile ] ; then \
163     echo $${rootme}/gas/as.new ; \
164   else \
165     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
166       echo $(AS); \
167     else \
168        t='$(program_transform_name)'; echo as | sed -e '' $$t ; \
169     fi; \
170   fi`
171
172 AR_FOR_TARGET = ` \
173   if [ -f $${rootme}/binutils/ar ] ; then \
174     echo $${rootme}/binutils/ar ; \
175   else \
176     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
177       echo $(AR); \
178     else \
179        t='$(program_transform_name)'; echo ar | sed -e '' $$t ; \
180     fi; \
181   fi`
182
183 RANLIB_FOR_TARGET = ` \
184   if [ -f $${rootme}/binutils/ranlib ] ; then \
185     echo $${rootme}/binutils/ranlib ; \
186   else \
187     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
188       echo $(RANLIB); \
189     else \
190        t='$(program_transform_name)'; echo ranlib | sed -e '' $$t ; \
191     fi; \
192   fi`
193
194 NM_FOR_TARGET = ` \
195   if [ -f $${rootme}/binutils/Makefile ] ; then \
196     echo $${rootme}/binutils/nm ; \
197   else \
198     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
199       echo $(NM); \
200     else \
201        t='$(program_transform_name)'; echo nm | sed -e '' $$t ; \
202     fi; \
203   fi`
204
205 # FIXME: This is badly named.
206 XTRAFLAGS = ` \
207   if [ -f $${rootme}/gcc/Makefile ] ; then \
208     if [ -f $${rootme}/newlib/Makefile ] ; then \
209       echo -I$${rootme}/newlib/targ-include -I$${srcroot}/newlib/libc/include -I$${rootme}/gcc/include -nostdinc ; \
210     else \
211       echo -I$${rootme}/gcc/include ; \
212     fi ; \
213   else \
214      echo ; \
215   fi`
216
217 #### host and target specific makefile fragments come in here.
218 ###
219
220 # Flags to pass down to all sub-makes.
221 # Please keep these in alphabetical order.
222 BASE_FLAGS_TO_PASS = \
223         "AR_FLAGS=$(AR_FLAGS)" \
224         "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
225         "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
226         "BISON=$(BISON)" \
227         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
228         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
229         "CFLAGS=$(CFLAGS)" \
230         $(start-sanitize-chill)\
231         "CHILLFLAGS=$(CHILLFLAGS)" \
232         "CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \
233         "CHILL_LIB=$(CHILL_LIB)" \
234         $(end-sanitize-chill)\
235         "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
236         "CXXFLAGS=$(CXXFLAGS)" \
237         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
238         "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
239         "INSTALL=$(INSTALL)" \
240         "INSTALL_DATA=$(INSTALL_DATA)" \
241         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
242         "INSTALL_XFORM=$(INSTALL_XFORM)" \
243         "LDFLAGS=$(LDFLAGS)" \
244         "LEX=$(LEX)" \
245         "M4=$(M4)" \
246         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
247         "MUNCH_NM=$(MUNCH_NM)" \
248         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
249         "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
250         "EXPECT=$(EXPECT)" \
251         "RUNTEST=$(RUNTEST)" \
252         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
253         "XTRAFLAGS_FOR_TARGET=$(XTRAFLAGS)" \
254         "exec_prefix=$(exec_prefix)" \
255         "prefix=$(prefix)" \
256         "tooldir=$(tooldir)" 
257
258 # Flags to pass down to most sub-makes, in which we're building with
259 # the host environment.
260 # If any variables are added here, they must be added to do-*, below.
261 EXTRA_HOST_FLAGS = \
262         'AR=$(AR)' \
263         'AS=$(AS)' \
264         'CC=$(CC)' \
265         'CXX=$(CXX)' \
266         'NM=$(NM)' \
267         'RANLIB=$(RANLIB)' \
268         'XTRAFLAGS='
269
270 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
271
272 # Flags that are concerned with the location of the X11 include files
273 # and library files
274 X11_FLAGS_TO_PASS = \
275         "X11_INCLUDE_FLAGS=$(X11_INCLUDE_FLAGS)" \
276         "X11_LIB_FLAGS=$(X11_LIB_FLAGS)" \
277         "X11_LIB=$(X11_LIB)"
278
279 # Flags to pass down to makes which are built with the target environment.
280 # The double $ decreases the length of the command line; the variables
281 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
282 # If any variables are added here, they must be added to do-*, below.
283 EXTRA_TARGET_FLAGS = \
284         'AR=$$(AR_FOR_TARGET)' \
285         'AS=$$(AS_FOR_TARGET)' \
286         'CC=$$(CC_FOR_TARGET)' \
287         'CXX=$$(CXX_FOR_TARGET)' \
288         'NM=$$(NM_FOR_TARGET)' \
289         'RANLIB=$$(RANLIB_FOR_TARGET)' \
290         'XTRAFLAGS=$$(XTRAFLAGS_FOR_TARGET)'
291
292 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
293
294 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
295 # unfortunately needs the native compiler and the target ar and
296 # ranlib.
297 # If any variables are added here, they must be added to do-*, below.
298 # The HOST_* variables are a special case, which are used for the gcc
299 # cross-building scheme.
300 HOST_CC = $(CC_FOR_BUILD)
301 HOST_PREFIX = 
302 HOST_PREFIX_1 = loser-
303 EXTRA_GCC_FLAGS = \
304         'AR=$$(AR_FOR_TARGET)' \
305         'AS=$(AS)' \
306         'CC=$(CC)' \
307         'CXX=$(CXX)' \
308         'HOST_CC=$(CC_FOR_BUILD)' \
309         'HOST_PREFIX=$(HOST_PREFIX)' \
310         'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
311         'NM=$(NM)' \
312         'RANLIB=$$(RANLIB_FOR_TARGET)' \
313         'XTRAFLAGS='
314
315 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
316
317 # This is a list of the targets for all of the modules which are compiled
318 # using $(FLAGS_TO_PASS).
319 ALL_MODULES = \
320         all-autoconf \
321         all-bfd \
322         all-binutils \
323         all-byacc \
324         all-cvs \
325         all-dejagnu \
326         all-diff \
327         all-dosutils \
328         all-etc \
329         all-fileutils \
330         all-find \
331         all-flex \
332         all-gas \
333         all-gawk \
334         all-gdb \
335         all-gprof \
336         all-grep \
337         all-gzip \
338         all-hello \
339         all-indent \
340         all-ispell \
341         all-ld \
342         all-libiberty \
343         all-m4 \
344         all-make \
345         all-mmalloc \
346         all-opcodes \
347         all-pagas \
348         all-patch \
349         all-prms \
350         all-rcs \
351         all-readline \
352         all-release \
353         all-recode \
354         all-sed \
355         all-send-pr \
356         all-shellutils \
357         all-sim \
358         all-tar \
359         all-tcl \
360         all-texinfo \
361         all-textutils \
362         all-tgas \
363         all-time \
364         all-uudecode \
365         all-wdiff
366
367 # This is a list of the check targets for all of the modules which are
368 # compiled using $(FLAGS_TO_PASS).
369 CHECK_MODULES = \
370         check-autoconf \
371         check-bfd \
372         check-binutils \
373         check-byacc \
374         check-cvs \
375         check-dejagnu \
376         check-diff \
377         check-etc \
378         check-fileutils \
379         check-find \
380         check-flex \
381         check-gas \
382         check-gawk \
383         check-gdb \
384         check-gprof \
385         check-grep \
386         check-gzip \
387         check-hello \
388         check-indent \
389         check-ispell \
390         check-ld \
391         check-libiberty \
392         check-m4 \
393         check-make \
394         check-mmcheckoc \
395         check-opcodes \
396         check-pagas \
397         check-patch \
398         check-prms \
399         check-rcs \
400         check-readline \
401         check-recode \
402         check-sed \
403         check-send-pr \
404         check-shellutils \
405         check-sim \
406         check-tar \
407         check-tcl \
408         check-texinfo \
409         check-textutils \
410         check-tgas \
411         check-time \
412         check-uudecode \
413         check-wdiff
414
415 # This is a list of the install targets for all of the modules which are
416 # compiled using $(FLAGS_TO_PASS).
417 INSTALL_MODULES = \
418         install-autoconf \
419         install-bfd \
420         install-binutils \
421         install-byacc \
422         install-cvs \
423         install-dejagnu \
424         install-diff \
425         install-etc \
426         install-fileutils \
427         install-find \
428         install-flex \
429         install-gas \
430         install-gawk \
431         install-gdb \
432         install-glob \
433         install-gprof \
434         install-grep \
435         install-gzip \
436         install-hello \
437         install-indent \
438         install-ispell \
439         install-ld \
440         install-libiberty \
441         install-m4 \
442         install-make \
443         install-mmalloc \
444         install-opcodes \
445         install-pagas \
446         install-patch \
447         install-prms \
448         install-rcs \
449         install-readline \
450         install-recode \
451         install-sed \
452         install-send-pr \
453         install-shellutils \
454         install-sim \
455         install-tar \
456         install-tcl \
457         install-texinfo \
458         install-textutils \
459         install-tgas \
460         install-time \
461         install-uudecode \
462         install-wdiff
463
464 # This is a list of the targets for all of the modules which are compiled
465 # using $(X11_FLAGS_TO_PASS).
466 ALL_X11_MODULES = \
467         all-emacs \
468         all-expect \
469         all-gash \
470         all-tclX \
471         all-tk
472
473 # This is a list of the check targets for all of the modules which are
474 # compiled using $(X11_FLAGS_TO_PASS).
475 CHECK_X11_MODULES = \
476         check-emacs \
477         check-expect \
478         check-gash \
479         check-tclX \
480         check-tk
481
482 # This is a list of the install targets for all the modules which are
483 # compiled using $(X11_FLAGS_TO_PASS).
484 INSTALL_X11_MODULES = \
485         install-emacs \
486         install-expect \
487         install-gash \
488         install-tclX \
489         install-tk
490
491 # This is a list of the targets for all of the modules which are compiled
492 # using $(TARGET_FLAGS_TO_PASS).
493 ALL_TARGET_MODULES = \
494         $(start-sanitize-chill) \
495         all-chillrt \
496         $(end-sanitize-chill) \
497         all-libio \
498         all-libg++ \
499         all-newlib \
500         all-xiberty
501
502 # This is a list of the check targets for all of the modules which are
503 # compiled using $(TARGET_FLAGS_TO_PASS).
504 CHECK_TARGET_MODULES = \
505         $(start-sanitize-chill) \
506         check-chillrt \
507         $(end-sanitize-chill) \
508         check-libio \
509         check-libg++ \
510         check-newlib \
511         check-xiberty
512
513 # This is a list of the install targets for all of the modules which are
514 # compiled using $(TARGET_FLAGS_TO_PASS).
515 INSTALL_TARGET_MODULES = \
516         $(start-sanitize-chill) \
517         install-chillrt \
518         $(end-sanitize-chill) \
519         install-libio \
520         install-libg++ \
521         install-newlib \
522         install-xiberty
523
524 # This is a shell case of all modules which are compiled using
525 # $(TARGET_FLAGS_TO_PASS), used in the do-X rule.
526 TARGET_LIBS = libio | libg++ | newlib | xiberty
527 # start-sanitize-chill
528 TARGET_LIBS = chillrt | libio | libg++ | newlib | xiberty
529 # end-sanitize-chill
530
531 # The first rule in the file had better be this one.  Don't put any above it.
532 all: all.normal
533 .PHONY: all
534
535 # The target built for a native build.
536 .PHONY: all.normal
537 all.normal: \
538         $(ALL_MODULES) \
539         $(ALL_TARGET_MODULES) \
540         $(ALL_X11_MODULES) \
541         all-gcc
542
543 # Do a target for all the subdirectories.  A ``make do-X'' will do a
544 # ``make X'' in all subdirectories (because, in general, there is a
545 # dependency (below) of X upon do-X, a ``make X'' will also do this,
546 # but it may do additional work as well).
547 # This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
548 # because it is so large that it can easily overflow the command line
549 # length limit on some systems.
550 DO_X = \
551         do-clean \
552         do-distclean \
553         do-dvi \
554         do-info \
555         do-install-info \
556         do-installcheck \
557         do-mostlyclean \
558         do-realclean
559 .PHONY: $(DO_X)
560 $(DO_X):
561         @target=`echo $@ | sed -e 's/^do-//'`; \
562         rootme=`pwd`; export rootme; \
563         srcroot=`cd $(srcdir); pwd`; export srcroot; \
564         for i in $(SUBDIRS); do \
565           if [ -f ./$$i/Makefile ]; then \
566             case $$i in \
567             $(TARGET_LIBS) ) \
568               for flag in $(EXTRA_TARGET_FLAGS); do \
569                 eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
570               done; \
571               ;; \
572             gcc) \
573               for flag in $(EXTRA_GCC_FLAGS); do \
574                 eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
575               done; \
576               ;; \
577             *) \
578               for flag in $(EXTRA_HOST_FLAGS); do \
579                 eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
580               done; \
581               ;; \
582             esac ; \
583             export AR AS CC CXX NM RANLIB XTRAFLAGS; \
584             if (cd ./$$i; \
585                 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
586                         "CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
587                         "RANLIB=$${RANLIB}" "XTRAFLAGS=$${XTRAFLAGS}" \
588                         $${target}); \
589             then true; else exit 1; fi; \
590           else true; fi; \
591         done
592
593 # Here are the targets which correspond to the do-X targets.
594
595 .PHONY: info installcheck dvi install-info
596 .PHONY: clean distclean mostlyclean realclean local-clean local-distclean
597 info: do-info
598 installcheck: do-installcheck
599 dvi: do-dvi
600
601 install-info: do-install-info dir.info
602         srcroot=`cd $(srcdir); pwd`; export srcroot; \
603         if [ -f dir.info ] ; then \
604           $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
605         else true ; fi
606
607 local-clean:
608         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
609
610 local-distclean:
611         -rm -f Makefile config.status
612
613 clean: do-clean local-clean
614 mostlyclean: do-mostlyclean local-clean
615 distclean: do-distclean local-clean local-distclean
616 realclean: do-realclean local-clean local-distclean
617
618 # Check target.
619
620 .PHONY: check
621 check: $(CHECK_MODULES) \
622         $(CHECK_TARGET_MODULES) \
623         $(CHECK_X11_MODULES) \
624         check-gcc
625
626 # Installation targets.
627
628 .PHONY: install uninstall vault-install
629 install: $(INSTALL_TARGET) 
630
631 uninstall:
632         @echo "the uninstall target is not supported in this tree"
633
634 vault-install:
635         @if [ -f ./release/vault-install ] ; then \
636           ./release/vault-install $(host_alias) $(target_alias) ; \
637         else \
638           true ; \
639         fi
640
641 .PHONY: install.all
642 install.all: install-no-fixedincludes
643         @if [ -f ./gcc/Makefile ] ; then \
644                 rootme=`pwd` ; export rootme ; \
645                 (cd ./gcc; \
646                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
647         else \
648                 true ; \
649         fi
650
651 # install-no-fixedincludes is used because Cygnus can not distribute
652 # the fixed header files.
653 .PHONY: install-no-fixedincludes
654 install-no-fixedincludes: \
655         install-dirs \
656         $(INSTALL_MODULES) \
657         $(INSTALL_TARGET_MODULES) \
658         $(INSTALL_X11_MODULES) \
659         gcc-no-fixedincludes 
660
661 # Install the gcc headers files, but not the fixed include files,
662 # which Cygnus is not allowed to distribute.  This rule is very
663 # dependent on the workings of the gcc Makefile.in.
664 .PHONY: gcc-no-fixedincludes
665 gcc-no-fixedincludes:
666         @if [ -f ./gcc/Makefile ]; then \
667           rm -rf gcc/tmp-include; \
668           mv gcc/include gcc/tmp-include 2>/dev/null; \
669           mkdir gcc/include; \
670           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
671           touch gcc/stmp-fixinc gcc/stmp-fixproto; \
672           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
673           rootme=`pwd`; export rootme; \
674           srcroot=`cd $(srcdir); pwd` ; export srcroot; \
675           (cd ./gcc; \
676            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
677           rm -rf gcc/include; \
678           mv gcc/tmp-include gcc/include 2>/dev/null; \
679         else true; fi
680
681 # This rule is used to build the modules which use FLAGS_TO_PASS.  To
682 # build a target all-X means to cd to X and make all.
683 # all-glob is handled specially because it doesn't actually build.
684 .PHONY: $(ALL_MODULES) all-glob
685 $(ALL_MODULES) all-glob:
686         @dir=`echo $@ | sed -e 's/all-//'`; \
687         if [ -f ./$${dir}/Makefile ] ; then \
688           rootme=`pwd`; export rootme; \
689           srcroot=`cd $(srcdir); pwd`; export srcroot; \
690           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
691         else \
692           true; \
693         fi
694
695 # This rule is used to check the modules which use FLAGS_TO_PASS.  To
696 # build a target check-X means to cd to X and make all.
697 .PHONY: $(CHECK_MODULES) 
698 $(CHECK_MODULES):
699         @dir=`echo $@ | sed -e 's/check-//'`; \
700         if [ -f ./$${dir}/Makefile ] ; then \
701           rootme=`pwd`; export rootme; \
702           srcroot=`cd $(srcdir); pwd`; export srcroot; \
703           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
704         else \
705           true; \
706         fi
707
708 # This rule is used to install the modules which use FLAGS_TO_PASS.
709 # To build a target install-X means to cd to X and make install.
710 .PHONY: $(INSTALL_MODULES)
711 $(INSTALL_MODULES): install-dirs
712         @dir=`echo $@ | sed -e 's/install-//'`; \
713         if [ -f ./$${dir}/Makefile ] ; then \
714           rootme=`pwd`; export rootme; \
715           srcroot=`cd $(srcdir); pwd`; export srcroot; \
716           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
717         else \
718           true; \
719         fi
720
721 # This rule is used to build the modules which use TARGET_FLAGS_TO_PASS.
722 # To build a target all-X means to cd to X and make all.
723 .PHONY: $(ALL_TARGET_MODULES)
724 $(ALL_TARGET_MODULES):
725         @dir=`echo $@ | sed -e 's/all-//'`; \
726         if [ -f ./$${dir}/Makefile ] ; then \
727           rootme=`pwd`; export rootme; \
728           srcroot=`cd $(srcdir); pwd`; export srcroot; \
729           (cd $${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
730         else \
731           true; \
732         fi
733
734 # This rule is used to check the modules which use TARGET_FLAGS_TO_PASS.
735 # To build a target install-X means to cd to X and make install.
736 .PHONY: $(CHECK_TARGET_MODULES)
737 $(CHECK_TARGET_MODULES):
738         @dir=`echo $@ | sed -e 's/check-//'`; \
739         if [ -f ./$${dir}/Makefile ] ; then \
740           rootme=`pwd`; export rootme; \
741           srcroot=`cd $(srcdir); pwd`; export srcroot; \
742           (cd $${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) check); \
743         else \
744           true; \
745         fi
746
747 # This rule is used to install the modules which use
748 # TARGET_FLAGS_TO_PASS.  To build a target install-X means to cd to X
749 # and make install.
750 .PHONY: $(INSTALL_TARGET_MODULES)
751 $(INSTALL_TARGET_MODULES): install-dirs
752         @dir=`echo $@ | sed -e 's/install-//'`; \
753         if [ -f ./$${dir}/Makefile ] ; then \
754           rootme=`pwd`; export rootme; \
755           srcroot=`cd $(srcdir); pwd`; export srcroot; \
756           (cd $${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
757         else \
758           true; \
759         fi
760
761 # This rule is used to build the modules which use X11_FLAGS_TO_PASS.
762 # To build a target all-X means to cd to X and make all.
763 .PHONY: $(ALL_X11_MODULES)
764 $(ALL_X11_MODULES):
765         @dir=`echo $@ | sed -e 's/all-//'`; \
766         if [ -f ./$${dir}/Makefile ] ; then \
767           rootme=`pwd`; export rootme; \
768           srcroot=`cd $(srcdir); pwd`; export srcroot; \
769           (cd $${dir}; \
770            $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
771         else \
772           true; \
773         fi
774
775 # This rule is used to check the modules which use X11_FLAGS_TO_PASS.
776 # To build a target check-X means to cd to X and make all.
777 .PHONY: $(CHECK_X11_MODULES)
778 $(CHECK_X11_MODULES):
779         @dir=`echo $@ | sed -e 's/check-//'`; \
780         if [ -f ./$${dir}/Makefile ] ; then \
781           rootme=`pwd`; export rootme; \
782           srcroot=`cd $(srcdir); pwd`; export srcroot; \
783           (cd $${dir}; \
784            $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
785         else \
786           true; \
787         fi
788
789 # This rule is used to install the modules which use X11_FLAGS_TO_PASS.
790 # To build a target install-X means to cd to X and make install.
791 .PHONY: $(INSTALL_X11_MODULES)
792 $(INSTALL_X11_MODULES):
793         @dir=`echo $@ | sed -e 's/install-//'`; \
794         if [ -f ./$${dir}/Makefile ] ; then \
795           rootme=`pwd`; export rootme; \
796           srcroot=`cd $(srcdir); pwd`; export srcroot; \
797           (cd $${dir}; \
798            $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
799         else \
800           true; \
801         fi
802
803 # gcc is the only module which uses GCC_FLAGS_TO_PASS.
804 .PHONY: all-gcc
805 all-gcc:
806         @if [ -f ./gcc/Makefile ] ; then \
807           rootme=`pwd`; export rootme; \
808           srcroot=`cd $(srcdir); pwd`; export srcroot; \
809           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
810         else \
811           true; \
812         fi
813
814 .PHONY: check-gcc
815 check-gcc:
816         @if [ -f ./gcc/Makefile ] ; then \
817           rootme=`pwd`; export rootme; \
818           srcroot=`cd $(srcdir); pwd`; export srcroot; \
819           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
820         else \
821           true; \
822         fi
823
824 .PHONY: install-gcc
825 install-gcc:
826         @if [ -f ./gcc/Makefile ] ; then \
827           rootme=`pwd`; export rootme; \
828           srcroot=`cd $(srcdir); pwd`; export srcroot; \
829           (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
830         else \
831           true; \
832         fi
833
834 # This is a list of inter-dependencies among modules.
835 all-autoconf: all-m4
836 all-bfd:
837 all-binutils: all-libiberty all-opcodes all-bfd all-flex
838 all-byacc:
839 # start-sanitize-chill
840 all-chillrt: all-binutils all-gas all-gcc all-newlib
841 # end-sanitize-chill
842 all-cvs:
843 all-dejagnu:
844 all-diff: all-libiberty
845 all-emacs:
846 all-etc:
847 all-expect: all-tcl all-tk
848 all-fileutils: all-libiberty
849 all-find:
850 all-flex: all-libiberty all-byacc
851 all-gas: all-libiberty all-opcodes all-bfd
852 all-gash: all-tcl
853 all-gawk:
854 all-gcc: all-libiberty all-byacc all-binutils all-gas all-pagas
855 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-glob all-byacc all-sim
856 all-glob:
857 all-gprof: all-libiberty all-bfd
858 all-grep: all-libiberty
859 all-gzip: all-libiberty
860 all-hello: all-libiberty
861 all-indent:
862 all-ispell: all-emacs
863 all-ld: all-libiberty all-bfd all-byacc all-flex
864 all-libg++: all-gas all-pagas all-ld all-gcc all-xiberty all-newlib all-libio
865 all-libio: all-gas all-pagas all-ld all-gcc all-xiberty all-newlib 
866 all-libiberty:
867 all-m4: all-libiberty
868 all-make: all-libiberty
869 all-mmalloc:
870 all-newlib: all-binutils all-gas all-pagas all-gcc
871 all-opcodes: all-bfd
872 all-patch:
873 all-prms: all-libiberty
874 all-rcs:
875 all-readline:
876 all-recode: all-libiberty
877 all-sed: all-libiberty
878 all-send-pr: all-prms
879 all-shellutils:
880 all-sim: all-libiberty all-bfd
881 all-tar: all-libiberty
882 all-tcl:
883 all-tclX: all-tcl all-tk
884 all-tk: all-tcl
885 all-texinfo: all-libiberty
886 all-textutils:
887 all-tgas: all-libiberty all-bfd
888 all-time:
889 all-wdiff:
890 all-uudecode: all-libiberty
891 all-xiberty: all-gcc all-newlib
892
893 ### other supporting targets
894
895 MAKEDIRS= \
896         $(prefix) \
897         $(exec_prefix) \
898         $(tooldir)
899
900 .PHONY: install-dirs
901 install-dirs:
902         @for i in $(MAKEDIRS) ; do \
903                 echo Making $$i... ; \
904                 parent=`echo $$i | sed -e 's@/[^/]*$$@@' | sed -e 's@^$$@/@'`; \
905                 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi ; \
906                 if [ ! -d $$i ] ; then \
907                         if mkdir $$i ; then \
908                                 true ; \
909                         else \
910                                 exit 1 ; \
911                         fi ; \
912                 else \
913                         true ; \
914                 fi ; \
915         done
916
917
918 dir.info: do-install-info
919         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
920           $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
921           mv -f dir.info.new dir.info ; \
922         else true ; \
923         fi
924
925 dist:
926         @echo "Building a full distribution of this tree isn't done"
927         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
928
929 etags tags: TAGS
930
931 TAGS:
932         etags `$(MAKE) ls`
933
934 ls:
935         @echo Makefile
936         @for i in $(SUBDIRS); \
937         do \
938                 (cd $$i; \
939                         pwd=`pwd`; \
940                         wd=`basename $$pwd`; \
941                         for j in `$(MAKE) ls`; \
942                         do \
943                                 echo $$wd/$$j; \
944                         done) \
945         done
946
947 # with the gnu make, this is done automatically.
948
949 Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
950         $(SHELL) ./config.status
951
952 #
953 # Support for building net releases
954
955 # Files in devo used in any net release.
956 # ChangeLog omitted because it may refer to files which are not in this
957 # distribution (perhaps it would be better to include it anyway).
958 DEVO_SUPPORT= README Makefile.in configure configure.in \
959         config.guess config.sub config move-if-change \
960         COPYING COPYING.LIB install.sh
961
962 # Files in devo/etc used in any net release.
963 # ChangeLog omitted because it may refer to files which are not in this
964 # distribution (perhaps it would be better to include it anyway).
965 ETC_SUPPORT= Makefile.in cfg-paper.texi configure.in configure.man \
966         configure.texi standards.texi make-stds.texi
967
968 GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline glob sim
969 GDB_SUPPORT_FILES= $(GDB_SUPPORT_DIRS)
970
971 .PHONY: setup-dirs-gdb gdb.tar.gz make-gdb.tar.gz
972 setup-dirs-gdb:
973         ./configure sun4
974         $(MAKE) clean
975         ./configure -rm sun4
976         chmod og=u `find etc $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) -print`
977
978 gdb.tar.gz: setup-dirs-gdb
979         (cd gdb; $(MAKE) -f Makefile.in make-proto-gdb.dir BISON="byacc")
980         (cd gdb; $(MAKE) -f Makefile.in make-proto-testsuite.dir)
981         $(MAKE) $(MFLAGS) -f Makefile.in make-gdb.tar.gz
982
983 make-gdb.tar.gz: $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS) gdb texinfo/texinfo.tex
984         rm -rf proto-toplev; mkdir proto-toplev
985         ln -s ../gdb/proto-gdb.dir proto-toplev/gdb
986         (cd proto-toplev; for i in $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS); do \
987                 ln -s ../$$i . ; \
988         done)
989         mkdir proto-toplev/etc
990         (cd proto-toplev/etc; for i in $(ETC_SUPPORT); do \
991                 ln -s ../../etc/$$i . ; \
992         done)
993         # Put only one copy (four hard links) of COPYING in the tar file.
994         rm                          proto-toplev/bfd/COPYING
995         ln proto-toplev/gdb/COPYING proto-toplev/bfd/COPYING
996         rm                          proto-toplev/include/COPYING
997         ln proto-toplev/gdb/COPYING proto-toplev/include/COPYING
998         rm                          proto-toplev/readline/COPYING
999         ln proto-toplev/gdb/COPYING proto-toplev/readline/COPYING
1000
1001         # Change the bug reporting address in configure to bug-gdb
1002         rm proto-toplev/configure
1003         sed -e 's/configure@cygnus.com/bug-gdb@prep.ai.mit.edu/' \
1004             <configure >proto-toplev/configure
1005         chmod a+x proto-toplev/configure
1006
1007         # Take out texinfo and glob from configurable dirs
1008         rm proto-toplev/configure.in
1009         sed -e '/^host_tools=/s/texinfo //' \
1010             -e '/^host_libs=/s/glob //' \
1011             <configure.in >proto-toplev/configure.in
1012
1013         # Take out texinfo from a few places; make simple BISON=bison line.
1014         rm proto-toplev/Makefile.in
1015         sed -e '/^all\.normal: /s/\all-texinfo //' \
1016             -e '/^      install-texinfo /d' \
1017             -e '/^BISON = /,/^$$/d' \
1018             -e '/^# BISON:/s/.*/BISON = bison -y/' \
1019         <Makefile.in >proto-toplev/Makefile.in
1020
1021         mkdir proto-toplev/texinfo
1022         ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
1023         ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
1024         ln -s ../../texinfo/tex3patch   proto-toplev/texinfo/
1025         chmod og=u `find proto-toplev -print`
1026         (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
1027                 echo "==> Making gdb-$$VER.tar.gz"; \
1028                 rm -f gdb-$$VER; ln -s proto-toplev gdb-$$VER; \
1029                 tar cfh - gdb-$$VER \
1030                 | $(GZIP) -v -9 >gdb-$$VER.tar.gz)
1031
1032         # Make the testsuite archive separately.
1033         ln -s ../../gdb/proto-testsuite.dir/testsuite proto-toplev/gdb/testsuite
1034         # Blow away the Chill test that requires a Chill compiled executable,
1035         # since GNU Chill is not yet publically available.
1036         rm -rf proto-toplev/gdb/testsuite/gdb.t31
1037
1038         # Put a copy of COPYING in the tar file.
1039         ln proto-toplev/gdb/COPYING proto-toplev/gdb/testsuite/COPYING
1040         chmod og=u `find proto-toplev/gdb/testsuite -print`
1041         (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
1042                 echo "==> Making gdb-$$VER-testsuite.tar.gz"; \
1043                 tar cfh - gdb-$$VER/configure gdb-$$VER/config.guess \
1044                         gdb-$$VER/config.sub gdb-$$VER/move-if-change \
1045                         gdb-$$VER/gdb/testsuite \
1046                         | $(GZIP) -v -9 >gdb-$$VER-testsuite.tar.gz)
1047
1048 # When you use `make setup-dirs' or `make taz' you should always redefine
1049 # this macro.
1050 SUPPORT_FILES = list-of-support-files-for-tool-in-question
1051 # Directories that might want `make diststuff' run.
1052 DISTSTUFFDIRS= ld gprof gdb libg++ binutils
1053 # Files where "byacc" (Cygnus version) should be changed to "bison -y" (FSF).
1054 DISTBISONFILES= binutils/Makefile.in gas/Makefile.in gdb/Makefile.in
1055
1056 .PHONY: taz
1057
1058 taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex texinfo/gpl.texinfo
1059         # Do this first so "diststuff" files get built properly.
1060         for f in $(DISTBISONFILES) ; do \
1061           if [ -r $$f ]; then \
1062             sed '/^BISON *=.*$$/s/.*/BISON = bison -y/' <$$f >tmp ; \
1063             mv -f tmp $$f ; \
1064           else true; fi ; \
1065         done
1066         #
1067         ./configure sun4
1068         # Make links, and run "make diststuff" when needed.
1069         # The `echo' for setting `p' is to convert all whitespace to spaces.
1070         # Then the `case' further below should tell whether $$d is in
1071         # DISTSTUFFDIRS.
1072         rm -rf proto-toplev ; mkdir proto-toplev
1073         set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
1074         p=" `echo $(DISTSTUFFDIRS)` " ; \
1075         for d in $$dirs ; do \
1076           if [ -d $$d ]; then \
1077             case " $$p " in \
1078             *" $$d "*)  \
1079                 echo making diststuff in $$d ; \
1080                 (cd $$d ; pwd ; $(MAKE) diststuff BISON="bison -y") || exit 1  ;; \
1081             esac ; \
1082             if [ -d $$d/proto-$$d.dir ]; then \
1083               ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
1084             else \
1085               ln -s ../$$d proto-toplev/$$d ; \
1086             fi ; \
1087           else ln -s ../$$d proto-toplev/$$d ; fi ; \
1088         done
1089         $(MAKE) distclean
1090         #
1091         mkdir proto-toplev/etc
1092         (cd proto-toplev/etc; for i in $(ETC_SUPPORT); do \
1093                 ln -s ../../etc/$$i . ; \
1094         done)
1095         #
1096         # Take out texinfo and glob from configurable dirs
1097         rm proto-toplev/configure.in
1098         sed -e '/^host_tools=/s/texinfo //' \
1099             -e '/^host_libs=/s/glob //' \
1100             <configure.in >proto-toplev/configure.in
1101         #
1102         # Take out texinfo from a few places; make simple BISON=bison line.
1103         rm proto-toplev/Makefile.in
1104         sed -e '/^all\.normal: /s/\all-texinfo //' \
1105             -e '/^      install-texinfo /d' \
1106             -e '/^BISON = /,/^$$/d' \
1107             -e '/^# BISON:/s/.*/BISON = bison -y/' \
1108         <Makefile.in >proto-toplev/Makefile.in
1109         #
1110         mkdir proto-toplev/texinfo
1111         ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
1112         ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
1113         ln -s ../../texinfo/tex3patch   proto-toplev/texinfo/
1114         chmod og=u `find . -print`
1115         (VER=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
1116                 echo "==> Making $(TOOL)-$$VER.tar.gz"; \
1117                 rm -f $(TOOL)-$$VER; ln -s proto-toplev $(TOOL)-$$VER; \
1118                 tar cfh - $(TOOL)-$$VER \
1119                 | $(GZIP) -v -9 >$(TOOL)-$$VER.tar.gz)
1120
1121 TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo
1122 DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
1123
1124 .PHONY: gas.tar.gz
1125 GAS_SUPPORT_DIRS= bfd include libiberty opcodes
1126 gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
1127         $(MAKE) -f Makefile.in taz SUPPORT_FILES="$(GAS_SUPPORT_DIRS)" TOOL=gas
1128
1129 # The FSF "binutils" release includes gprof and ld.
1130 .PHONY: binutils.tar.gz
1131 BINUTILS_SUPPORT_DIRS= bfd include libiberty opcodes ld gprof
1132 binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
1133         $(MAKE) -f Makefile.in taz SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)" TOOL=binutils
1134
1135 .PHONY: gas+binutils.tar.gz
1136 GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
1137 gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
1138         $(MAKE) -f Makefile.in taz SUPPORT_FILES="$(GASB_SUPPORT_DIRS)" TOOL=gas
1139
1140 .PHONY: libg++.tar.gz
1141 LIBGXX_SUPPORT_DIRS=include libio libiberty xiberty
1142 libg++.tar.gz: $(DIST_SUPPORT) libg++
1143         $(MAKE) -f Makefile.in taz SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)" TOOL=libg++
1144
1145 .NOEXPORT:
1146 MAKEOVERRIDES=
1147
1148 # start-sanitize-chill
1149 ## This is ugly, but I don't want GNU make to put these variables in
1150 ## the environment.  Older makes will see this as a set of targets
1151 ## with no dependencies and no actions.
1152 unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
1153 # end-sanitize-chill
1154
1155 # end of Makefile.in