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