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