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