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