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