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