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