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