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