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