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