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