Makefile.in revision 38889
1#
2# Makefile for directory with subdirs to build.
3#   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
4#   Free Software Foundation
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10# 
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15# 
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19#
20
21srcdir = .
22
23prefix = /usr/local
24exec_prefix = $(prefix)
25
26bindir=${exec_prefix}/bin
27sbindir=${exec_prefix}/sbin
28libexecdir=${exec_prefix}/libexec
29datadir=${prefix}/share
30sysconfdir=${prefix}/etc
31sharedstatedir=${prefix}/com
32localstatedir=${prefix}/var
33libdir=${exec_prefix}/lib
34includedir=${prefix}/include
35oldincludedir=/usr/include
36infodir=${prefix}/info
37mandir=${prefix}/man
38
39tooldir = $(exec_prefix)/$(target)
40
41program_transform_name =
42
43man1dir = $(mandir)/man1
44man2dir = $(mandir)/man2
45man3dir = $(mandir)/man3
46man4dir = $(mandir)/man4
47man5dir = $(mandir)/man5
48man6dir = $(mandir)/man6
49man7dir = $(mandir)/man7
50man8dir = $(mandir)/man8
51man9dir = $(mandir)/man9
52GDB_NLM_DEPS = 
53
54SHELL = /bin/sh
55
56# INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
57# cygwin32 host.
58INSTALL_PROGRAM_ARGS =
59
60INSTALL = $(SHELL) $$s/install-sh -c
61INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_ARGS)
62INSTALL_SCRIPT = $(INSTALL)
63INSTALL_DATA = $(INSTALL) -m 644
64
65INSTALL_DOSREL = install-dosrel-fake
66
67AS = as
68AR = ar
69AR_FLAGS = rc
70CC = cc
71
72# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
73# here so that they can be overridden by Makefile fragments.
74HOST_CC = $(CC_FOR_BUILD)
75HOST_PREFIX = 
76HOST_PREFIX_1 = loser-
77
78# These flag values are normally overridden by the configure script.
79CFLAGS = -g
80CXXFLAGS = -g -O2
81
82LIBCFLAGS = $(CFLAGS)
83CFLAGS_FOR_TARGET = $(CFLAGS)
84LDFLAGS_FOR_TARGET = 
85LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
86PICFLAG = 
87PICFLAG_FOR_TARGET = 
88
89CXX = c++
90
91# Use -O2 to stress test the compiler.
92LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
93CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
94LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
95
96RANLIB = ranlib
97
98DLLTOOL = dlltool
99WINDRES = windres
100
101NM = nm
102
103LD = ld
104
105# Not plain GZIP, since gzip looks there for extra command-line options.
106GZIPPROG = gzip
107
108# These values are substituted by configure.
109DEFAULT_YACC = yacc
110DEFAULT_LEX = lex
111
112BISON = `if [ -f $$r/bison/bison ] ; then \
113	    echo $$r/bison/bison -L $$s/bison/ ; \
114	 else \
115	    echo bison ; \
116	 fi`
117
118YACC = `if [ -f $$r/bison/bison ] ; then \
119	    echo $$r/bison/bison -y -L $$s/bison/ ; \
120	elif [ -f $$r/byacc/byacc ] ; then \
121	    echo $$r/byacc/byacc ; \
122	else \
123	    echo ${DEFAULT_YACC} ; \
124	fi`
125
126LEX = `if [ -f $$r/flex/flex ] ; \
127	then echo $$r/flex/flex ; \
128	else echo ${DEFAULT_LEX} ; fi`
129
130M4 = `if [ -f $$r/m4/m4 ] ; \
131	then echo $$r/m4/m4 ; \
132	else echo m4 ; fi`
133
134MAKEINFO = `if [ -f $$r/texinfo/makeinfo/Makefile ] ; \
135	then echo $$r/texinfo/makeinfo/makeinfo ; \
136	else echo makeinfo ; fi`
137
138# This just becomes part of the MAKEINFO definition passed down to
139# sub-makes.  It lets flags be given on the command line while still
140# using the makeinfo from the object tree.
141MAKEINFOFLAGS =
142
143EXPECT = `if [ -f $$r/expect/expect ] ; \
144	then echo $$r/expect/expect ; \
145	else echo expect ; fi`
146
147RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
148	then echo $$s/dejagnu/runtest ; \
149	else echo runtest ; fi`
150
151
152# compilers to use to create programs which must be run in the build
153# environment.
154CC_FOR_BUILD = $(CC)
155CXX_FOR_BUILD = $(CXX)
156
157SUBDIRS = "this is set via configure, don't edit this"
158OTHERS = 
159
160# This is set by the configure script to the list of directories which
161# should be built using the target tools.
162TARGET_CONFIGDIRS = libiberty libgloss newlib libio librx libstdc++ libg++ winsup opcodes cygmon
163
164# Target libraries are put under this directory:
165# Changed by configure to $(target_alias) if cross.
166TARGET_SUBDIR = .
167
168# This is set by the configure script to the arguments passed to configure.
169CONFIG_ARGUMENTS = 
170
171# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
172# was used.
173SET_LIB_PATH =
174
175# This is the name of the environment variable used for the path to
176# the libraries.  This may be changed by configure.in.
177RPATH_ENVVAR = LD_LIBRARY_PATH
178
179# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
180REALLY_SET_LIB_PATH = \
181  $(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes:$$$(RPATH_ENVVAR); \
182  export $(RPATH_ENVVAR);
183
184ALL = all.normal
185INSTALL_TARGET = installdirs \
186	install-gcc \
187	$(INSTALL_MODULES) \
188	$(INSTALL_TARGET_MODULES) \
189	$(INSTALL_X11_MODULES) \
190	$(INSTALL_DOSREL)
191
192
193CC_FOR_TARGET = ` \
194  if [ -f $$r/gcc/xgcc ] ; then \
195    if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
196      if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
197        echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
198      else \
199        echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
200      fi; \
201    else \
202      echo $$r/gcc/xgcc -B$$r/gcc/; \
203    fi; \
204  else \
205    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
206      echo $(CC); \
207    else \
208      t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
209    fi; \
210  fi`
211
212# If CC_FOR_TARGET is not overriden on the command line, then this
213# variable is passed down to the gcc Makefile, where it is used to
214# build libgcc2.a.  We define it here so that it can itself be
215# overridden on the command line.
216GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/
217
218
219CXX_FOR_TARGET = ` \
220  if [ -f $$r/gcc/xgcc ] ; then \
221    if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
222      if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
223        echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
224      else \
225        echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
226      fi; \
227    else \
228      echo $$r/gcc/xgcc -B$$r/gcc/; \
229    fi; \
230  else \
231    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
232      echo $(CXX); \
233    else \
234      t='$(program_transform_name)'; echo c++ | sed -e 's/x/x/' $$t; \
235    fi; \
236  fi`
237
238AS_FOR_TARGET = ` \
239  if [ -f $$r/gas/as-new ] ; then \
240    echo $$r/gas/as-new ; \
241  else \
242    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
243      echo $(AS); \
244    else \
245       t='$(program_transform_name)'; echo as | sed -e 's/x/x/' $$t ; \
246    fi; \
247  fi`
248
249LD_FOR_TARGET = ` \
250  if [ -f $$r/ld/ld-new ] ; then \
251    echo $$r/ld/ld-new ; \
252  else \
253    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
254      echo $(LD); \
255    else \
256       t='$(program_transform_name)'; echo ld | sed -e 's/x/x/' $$t ; \
257    fi; \
258  fi`
259
260DLLTOOL_FOR_TARGET = ` \
261  if [ -f $$r/binutils/dlltool ] ; then \
262    echo $$r/binutils/dlltool ; \
263  else \
264    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
265      echo $(DLLTOOL); \
266    else \
267       t='$(program_transform_name)'; echo dlltool | sed -e 's/x/x/' $$t ; \
268    fi; \
269  fi`
270
271WINDRES_FOR_TARGET = ` \
272  if [ -f $$r/binutils/windres ] ; then \
273    echo $$r/binutils/windres ; \
274  else \
275    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
276      echo $(WINDRES); \
277    else \
278       t='$(program_transform_name)'; echo windres | sed -e 's/x/x/' $$t ; \
279    fi; \
280  fi`
281
282AR_FOR_TARGET = ` \
283  if [ -f $$r/binutils/ar ] ; then \
284    echo $$r/binutils/ar ; \
285  else \
286    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
287      echo $(AR); \
288    else \
289       t='$(program_transform_name)'; echo ar | sed -e 's/x/x/' $$t ; \
290    fi; \
291  fi`
292
293RANLIB_FOR_TARGET = ` \
294  if [ -f $$r/binutils/ranlib ] ; then \
295    echo $$r/binutils/ranlib ; \
296  else \
297    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
298      echo $(RANLIB); \
299    else \
300       t='$(program_transform_name)'; echo ranlib | sed -e 's/x/x/' $$t ; \
301    fi; \
302  fi`
303
304NM_FOR_TARGET = ` \
305  if [ -f $$r/binutils/nm-new ] ; then \
306    echo $$r/binutils/nm-new ; \
307  else \
308    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
309      echo $(NM); \
310    else \
311       t='$(program_transform_name)'; echo nm | sed -e 's/x/x/' $$t ; \
312    fi; \
313  fi`
314
315#### host and target specific makefile fragments come in here.
316###
317
318# Flags to pass down to all sub-makes.
319# Please keep these in alphabetical order.
320BASE_FLAGS_TO_PASS = \
321	"AR_FLAGS=$(AR_FLAGS)" \
322	"AR_FOR_TARGET=$(AR_FOR_TARGET)" \
323	"AS_FOR_TARGET=$(AS_FOR_TARGET)" \
324	"BISON=$(BISON)" \
325	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
326	"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
327	"CFLAGS=$(CFLAGS)" \
328	"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
329	"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
330	"CXXFLAGS=$(CXXFLAGS)" \
331	"CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
332	"CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
333	"DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \
334	"INSTALL=$(INSTALL)" \
335	"INSTALL_DATA=$(INSTALL_DATA)" \
336	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
337	"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
338	"LDFLAGS=$(LDFLAGS)" \
339	"LEX=$(LEX)" \
340	"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
341	"LIBCFLAGS=$(LIBCFLAGS)" \
342	"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
343	"LIBCXXFLAGS=$(LIBCXXFLAGS)" \
344	"LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
345	"M4=$(M4)" \
346	"MAKE=$(MAKE)" \
347	"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
348	"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
349	"PICFLAG=$(PICFLAG)" \
350	"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
351	"RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
352	"RPATH_ENVVAR=$(RPATH_ENVVAR)" \
353	"SHELL=$(SHELL)" \
354	"EXPECT=$(EXPECT)" \
355	"RUNTEST=$(RUNTEST)" \
356	"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
357	"WINDRES_FOR_TARGET=$(WINDRES_FOR_TARGET)" \
358	"YACC=$(YACC)" \
359	"bindir=$(bindir)" \
360	"datadir=$(datadir)" \
361	"exec_prefix=$(exec_prefix)" \
362	"includedir=$(includedir)" \
363	"infodir=$(infodir)" \
364	"libdir=$(libdir)" \
365	"libexecdir=$(libexecdir)" \
366	"lispdir=$(lispdir)" \
367	"localstatedir=$(localstatedir)" \
368	"mandir=$(mandir)" \
369	"oldincludedir=$(oldincludedir)" \
370	"prefix=$(prefix)" \
371	"sbindir=$(sbindir)" \
372	"sharedstatedir=$(sharedstatedir)" \
373	"sysconfdir=$(sysconfdir)" \
374	"tooldir=$(tooldir)"
375
376# Flags to pass down to most sub-makes, in which we're building with
377# the host environment.
378# If any variables are added here, they must be added to do-*, below.
379EXTRA_HOST_FLAGS = \
380	'AR=$(AR)' \
381	'AS=$(AS)' \
382	'CC=$(CC)' \
383	'CXX=$(CXX)' \
384	'DLLTOOL=$(DLLTOOL)' \
385	'LD=$(LD)' \
386	'NM=$(NM)' \
387	'RANLIB=$(RANLIB)' \
388	'WINDRES=$(WINDRES)'
389
390FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
391
392# Flags that are concerned with the location of the X11 include files
393# and library files
394#
395# NOTE: until the top-level is getting the values via autoconf, it only
396# causes problems to have this top-level Makefile overriding the autoconf-set
397# values in child directories.  Only variables that don't conflict with
398# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
399#
400X11_FLAGS_TO_PASS = \
401	'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
402	'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
403
404# Flags to pass down to makes which are built with the target environment.
405# The double $ decreases the length of the command line; the variables
406# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
407# If any variables are added here, they must be added to do-*, below.
408EXTRA_TARGET_FLAGS = \
409	'AR=$$(AR_FOR_TARGET)' \
410	'AS=$$(AS_FOR_TARGET)' \
411	'CC=$$(CC_FOR_TARGET)' \
412	'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
413	'CXX=$$(CXX_FOR_TARGET)' \
414	'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
415	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
416	'LD=$$(LD_FOR_TARGET)' \
417	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
418	'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
419	'NM=$$(NM_FOR_TARGET)' \
420	'PICFLAG=$$(PICFLAG_FOR_TARGET)' \
421	'RANLIB=$$(RANLIB_FOR_TARGET)' \
422	'WINDRES=$$(WINDRES_FOR_TARGET)'
423
424TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
425
426# Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
427# unfortunately needs the native compiler and the target ar and
428# ranlib.
429# If any variables are added here, they must be added to do-*, below.
430# The HOST_* variables are a special case, which are used for the gcc
431# cross-building scheme.
432EXTRA_GCC_FLAGS = \
433	'AR=$$(AR_FOR_TARGET)' \
434	'AS=$(AS)' \
435	'CC=$(CC)' \
436	'CXX=$(CXX)' \
437	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
438	'HOST_CC=$(CC_FOR_BUILD)' \
439	'HOST_PREFIX=$(HOST_PREFIX)' \
440	'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
441	'NM=$(NM)' \
442	'RANLIB=$$(RANLIB_FOR_TARGET)' \
443	'WINDRES=$$(WINDRES_FOR_TARGET)' \
444	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
445	"`if test x'$(LANGUAGES)' != x; then echo 'LANGUAGES=$(LANGUAGES)'; else echo 'XFOO=bar'; fi`" \
446	"`if test x'$(STMP_FIXPROTO)' != x; then echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)'; else echo 'XFOO=bar'; fi`" \
447	"`if test x'$(LIMITS_H_TEST)' != x; then echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)'; else echo 'XFOO=bar'; fi`" \
448	"`if test x'$(LIBGCC1_TEST)' != x; then echo 'LIBGCC1_TEST=$(LIBGCC1_TEST)'; else echo 'XFOO=bar'; fi`" \
449	"`if test x'$(LIBGCC2_CFLAGS)' != x; then echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)'; else echo 'XFOO=bar'; fi`" \
450	"`if test x'$(LIBGCC2_DEBUG_CFLAGS)' != x; then echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)'; else echo 'XFOO=bar'; fi`" \
451	"`if test x'$(LIBGCC2_INCLUDES)' != x; then echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)'; else echo 'XFOO=bar'; fi`" \
452	"`if test x'$(ENQUIRE)' != x; then echo 'ENQUIRE=$(ENQUIRE)'; else echo 'XFOO=bar'; fi`" \
453	"`if test x'$(BOOT_CFLAGS)' != x; then echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)'; else echo 'XFOO=bar'; fi`"
454
455GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
456
457# This is a list of the targets for all of the modules which are compiled
458# using $(FLAGS_TO_PASS).
459ALL_MODULES = \
460	all-apache \
461	all-autoconf \
462	all-automake \
463	all-bash \
464	all-bfd \
465	all-binutils \
466	all-bison \
467	all-byacc \
468	all-cvssrc \
469	all-db \
470	all-dejagnu \
471	all-diff \
472	all-dosutils \
473	all-etc \
474	all-fileutils \
475	all-findutils \
476	all-find \
477	all-flex \
478	all-gas \
479	all-gawk \
480	all-gettext \
481	all-gnuserv \
482	all-gprof \
483	all-grep \
484	all-grez \
485	all-gzip \
486	all-hello \
487	all-indent \
488	all-inet \
489	all-intl \
490	all-ispell \
491	all-itcl \
492	all-ld \
493	all-libgui \
494	all-libiberty \
495	all-m4 \
496	all-make \
497	all-mmalloc \
498	all-opcodes \
499	all-patch \
500	all-perl \
501	all-prms \
502	all-rcs \
503	all-readline \
504	all-release \
505	all-recode \
506	all-sed \
507	all-send-pr \
508	all-shellutils \
509	all-sim \
510	all-snavigator \
511	all-tar \
512	all-tcl \
513	all-texinfo \
514	all-textutils \
515	all-tgas \
516	all-time \
517	all-uudecode \
518	all-wdiff 
519
520# This is a list of the check targets for all of the modules which are
521# compiled using $(FLAGS_TO_PASS).
522#
523# The list is in two parts.  The first lists those tools which
524# are tested as part of the host's native tool-chain, and not
525# tested in a cross configuration.
526NATIVE_CHECK_MODULES = \
527	check-bison \
528	check-byacc \
529	check-flex
530
531CROSS_CHECK_MODULES = \
532	check-apache \
533	check-autoconf \
534	check-automake \
535	check-bash \
536	check-bfd \
537	check-binutils \
538	check-cvssrc \
539	check-db \
540	check-dejagnu \
541	check-diff \
542	check-etc \
543	check-fileutils \
544	check-findutils \
545	check-find \
546	check-gas \
547	check-gawk \
548	check-gettext \
549	check-gnuserv \
550	check-gprof \
551	check-grep \
552	check-gzip \
553	check-hello \
554	check-indent \
555	check-inet \
556	check-intl \
557	check-ispell \
558	check-itcl \
559	check-ld \
560	check-libgui \
561	check-libiberty \
562	check-m4 \
563	check-make \
564	check-mmcheckoc \
565	check-opcodes \
566	check-patch \
567	check-perl \
568	check-prms \
569	check-rcs \
570	check-readline \
571	check-recode \
572	check-sed \
573	check-send-pr \
574	check-shellutils \
575	check-snavigator \
576	check-sim \
577	check-tar \
578	check-tcl \
579	check-texinfo \
580	check-textutils \
581	check-tgas \
582	check-time \
583	check-uudecode \
584	check-wdiff
585
586CHECK_MODULES=$(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
587
588# This is a list of the install targets for all of the modules which are
589# compiled using $(FLAGS_TO_PASS).
590# We put install-opcodes before install-binutils because the installed
591# binutils might be on PATH, and they might need the shared opcodes
592# library.
593# We put install-tcl before install-itcl because itcl wants to run a
594# program on installation which uses the Tcl libraries.
595INSTALL_MODULES = \
596	install-apache \
597	install-autoconf \
598	install-automake \
599	install-bash \
600	install-bfd \
601	install-opcodes \
602	install-binutils \
603	install-bison \
604	install-byacc \
605	install-cvssrc \
606	install-db \
607	install-dejagnu \
608	install-diff \
609	install-dosutils \
610	install-etc \
611	install-fileutils \
612	install-findutils \
613	install-find \
614	install-flex \
615	install-gas \
616	install-gawk \
617	install-gettext \
618	install-gnuserv \
619	install-gprof \
620	install-grep \
621	install-grez \
622	install-gzip \
623	install-hello \
624	install-indent \
625	install-inet \
626	install-intl \
627	install-ispell \
628	install-tcl \
629	install-itcl \
630	install-ld \
631	install-libgui \
632	install-libiberty \
633	install-m4 \
634	install-make \
635	install-mmalloc \
636	install-patch \
637	install-perl \
638	install-prms \
639	install-rcs \
640	install-readline \
641	install-recode \
642	install-sed \
643	install-send-pr \
644	install-shellutils \
645	install-sim \
646	install-snavigator \
647	install-tar \
648	install-textutils \
649	install-tgas \
650	install-time \
651	install-uudecode \
652	install-wdiff
653
654# This is a list of the targets for all of the modules which are compiled
655# using $(X11_FLAGS_TO_PASS).
656ALL_X11_MODULES = \
657	all-emacs \
658	all-emacs19 \
659	all-gdb \
660	all-expect \
661	all-gash \
662	all-guile \
663	all-tclX \
664	all-tk \
665	all-tix
666
667# This is a list of the check targets for all of the modules which are
668# compiled using $(X11_FLAGS_TO_PASS).
669CHECK_X11_MODULES = \
670	check-emacs \
671	check-gdb \
672	check-guile \
673	check-expect \
674	check-gash \
675	check-tclX \
676	check-tk \
677	check-tix
678
679# This is a list of the install targets for all the modules which are
680# compiled using $(X11_FLAGS_TO_PASS).
681INSTALL_X11_MODULES = \
682	install-emacs \
683	install-emacs19 \
684	install-gdb \
685	install-guile \
686	install-expect \
687	install-gash \
688	install-tclX \
689	install-tk \
690	install-tix
691
692# This is a list of the targets for all of the modules which are compiled
693# using $(TARGET_FLAGS_TO_PASS).
694ALL_TARGET_MODULES = \
695	all-target-libio \
696	all-target-libstdc++ \
697	all-target-librx \
698	all-target-libg++ \
699	all-target-newlib \
700	all-target-winsup \
701	all-target-libgloss \
702	all-target-libiberty \
703	all-target-gperf \
704	all-target-examples \
705	all-target-cygmon
706
707# This is a list of the configure targets for all of the modules which
708# are compiled using the target tools.
709CONFIGURE_TARGET_MODULES = \
710	configure-target-libio \
711	configure-target-libstdc++ \
712	configure-target-librx \
713	configure-target-libg++ \
714	configure-target-newlib \
715	configure-target-winsup \
716	configure-target-libgloss \
717	configure-target-libiberty \
718	configure-target-gperf \
719	configure-target-examples \
720	configure-target-cygmon
721
722# This is a list of the check targets for all of the modules which are
723# compiled using $(TARGET_FLAGS_TO_PASS).
724CHECK_TARGET_MODULES = \
725	check-target-libio \
726	check-target-libstdc++ \
727	check-target-libg++ \
728	check-target-newlib \
729	check-target-winsup \
730	check-target-libiberty \
731	check-target-gperf
732
733# This is a list of the install targets for all of the modules which are
734# compiled using $(TARGET_FLAGS_TO_PASS).
735INSTALL_TARGET_MODULES = \
736	install-target-libio \
737	install-target-libstdc++ \
738	install-target-libg++ \
739	install-target-newlib \
740	install-target-winsup \
741	install-target-libgloss \
742	install-target-libiberty \
743	install-target-gperf
744
745# This is a list of the targets for which we can do a clean-{target}.
746CLEAN_MODULES = \
747	clean-apache \
748	clean-autoconf \
749	clean-automake \
750	clean-bash \
751	clean-bfd \
752	clean-binutils \
753	clean-bison \
754	clean-byacc \
755	clean-cvssrc \
756	clean-db \
757	clean-dejagnu \
758	clean-diff \
759	clean-dosutils \
760	clean-etc \
761	clean-fileutils \
762	clean-findutils \
763	clean-find \
764	clean-flex \
765	clean-gas \
766	clean-gawk \
767	clean-gettext \
768	clean-gnuserv \
769	clean-gprof \
770	clean-grep \
771	clean-grez \
772	clean-gzip \
773	clean-hello \
774	clean-indent \
775	clean-inet \
776	clean-intl \
777	clean-ispell \
778	clean-itcl \
779	clean-ld \
780	clean-libgui \
781	clean-libiberty \
782	clean-m4 \
783	clean-make \
784	clean-mmalloc \
785	clean-opcodes \
786	clean-patch \
787	clean-perl \
788	clean-prms \
789	clean-rcs \
790	clean-readline \
791	clean-release \
792	clean-recode \
793	clean-sed \
794	clean-send-pr \
795	clean-shellutils \
796	clean-sim \
797	clean-snavigator \
798	clean-tar \
799	clean-tcl \
800	clean-texinfo \
801	clean-textutils \
802	clean-tgas \
803	clean-time \
804	clean-uudecode \
805	clean-wdiff
806
807# All of the target modules that can be cleaned
808CLEAN_TARGET_MODULES = \
809	clean-target-libio \
810	clean-target-libstdc++ \
811	clean-target-librx \
812	clean-target-libg++ \
813	clean-target-newlib \
814	clean-target-winsup \
815	clean-target-libgloss \
816	clean-target-libiberty \
817	clean-target-gperf \
818	clean-target-examples \
819	clean-target-cygmon
820
821# All of the x11 modules that can be cleaned
822CLEAN_X11_MODULES = \
823	clean-emacs \
824	clean-emacs19 \
825	clean-gdb \
826	clean-expect \
827	clean-gash \
828	clean-guile \
829	clean-tclX \
830	clean-tk \
831	clean-tix
832
833# The first rule in the file had better be this one.  Don't put any above it.
834all: all.normal
835.PHONY: all
836
837# The target built for a native build.
838.PHONY: all.normal
839all.normal: \
840	$(ALL_MODULES) \
841	$(ALL_X11_MODULES) \
842	$(ALL_TARGET_MODULES) \
843	all-gcc
844
845# Do a target for all the subdirectories.  A ``make do-X'' will do a
846# ``make X'' in all subdirectories (because, in general, there is a
847# dependency (below) of X upon do-X, a ``make X'' will also do this,
848# but it may do additional work as well).
849# This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
850# because it is so large that it can easily overflow the command line
851# length limit on some systems.
852DO_X = \
853	do-clean \
854	do-distclean \
855	do-dvi \
856	do-info \
857	do-install-info \
858	do-installcheck \
859	do-mostlyclean \
860	do-maintainer-clean \
861	do-TAGS
862.PHONY: $(DO_X)
863$(DO_X):
864	@target=`echo $@ | sed -e 's/^do-//'`; \
865	r=`pwd`; export r; \
866	s=`cd $(srcdir); pwd`; export s; \
867	$(SET_LIB_PATH) \
868	for i in $(SUBDIRS) -dummy-; do \
869	  if [ -f ./$$i/Makefile ]; then \
870	    case $$i in \
871	    gcc) \
872	      for flag in $(EXTRA_GCC_FLAGS); do \
873		eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
874	      done; \
875	      ;; \
876	    *) \
877	      for flag in $(EXTRA_HOST_FLAGS); do \
878		eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
879	      done; \
880	      ;; \
881	    esac ; \
882	    export AR AS CC CXX LD NM RANLIB DLLTOOL WINDRES; \
883	    if (cd ./$$i; \
884	        $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
885			"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
886			"RANLIB=$${RANLIB}" \
887			"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
888			$${target}); \
889	    then true; else exit 1; fi; \
890	  else true; fi; \
891	done
892	@target=`echo $@ | sed -e 's/^do-//'`; \
893	r=`pwd`; export r; \
894	s=`cd $(srcdir); pwd`; export s; \
895	$(SET_LIB_PATH) \
896	for i in $(TARGET_CONFIGDIRS) -dummy-; do \
897	  if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \
898	    for flag in $(EXTRA_TARGET_FLAGS); do \
899		eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
900	    done; \
901	    export AR AS CC CXX LD NM RANLIB DLLTOOL WINDRES; \
902	    if (cd $(TARGET_SUBDIR)/$$i; \
903	        $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
904			"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
905			"RANLIB=$${RANLIB}" \
906			"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
907			$${target}); \
908	    then true; else exit 1; fi; \
909	  else true; fi; \
910	done
911
912# Here are the targets which correspond to the do-X targets.
913
914.PHONY: info installcheck dvi install-info
915.PHONY: clean distclean mostlyclean maintainer-clean realclean
916.PHONY: local-clean local-distclean local-maintainer-clean
917info: do-info
918installcheck: do-installcheck
919dvi: do-dvi
920
921# Make sure makeinfo is built before we do a `make info'.
922do-info: all-texinfo
923
924install-info: do-install-info dir.info
925	s=`cd $(srcdir); pwd`; export s; \
926	if [ -f dir.info ] ; then \
927	  $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
928	else true ; fi
929
930local-clean:
931	-rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
932
933local-distclean:
934	-rm -f Makefile config.status config.cache
935	-if [ "$(TARGET_SUBDIR)" != "." ]; then \
936	  rm -rf $(TARGET_SUBDIR); \
937	else true; fi
938
939local-maintainer-clean:
940	@echo "This command is intended for maintainers to use;"
941	@echo "it deletes files that may require special tools to rebuild."
942
943clean: do-clean local-clean
944mostlyclean: do-mostlyclean local-clean
945distclean: do-distclean local-clean local-distclean
946maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
947maintainer-clean: local-distclean
948realclean: maintainer-clean
949
950# This rule is used to clean specific modules.
951.PHONY: $(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc
952$(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc:
953	@dir=`echo $@ | sed -e 's/clean-//'`; \
954	if [ -f ./$${dir}/Makefile ] ; then \
955	  r=`pwd`; export r; \
956	  s=`cd $(srcdir); pwd`; export s; \
957	  $(SET_LIB_PATH) \
958	  (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) clean); \
959	else \
960	  true; \
961	fi
962
963.PHONY: $(CLEAN_TARGET_MODULES)
964$(CLEAN_TARGET_MODULES):
965	@dir=`echo $@ | sed -e 's/clean-target-//'`; \
966	rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
967	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
968	  r=`pwd`; export r; \
969	  s=`cd $(srcdir); pwd`; export s; \
970	  $(SET_LIB_PATH) \
971	  (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \
972	else \
973	  true; \
974	fi
975
976clean-target: $(CLEAN_TARGET_MODULES)
977
978# Check target.
979
980.PHONY: check
981check: $(CHECK_MODULES) \
982	$(CHECK_TARGET_MODULES) \
983	$(CHECK_X11_MODULES) \
984	check-gcc
985
986# Installation targets.
987
988.PHONY: install uninstall source-vault binary-vault vault-install
989install: $(INSTALL_TARGET) 
990
991uninstall:
992	@echo "the uninstall target is not supported in this tree"
993
994source-vault:
995	$(MAKE) -f ./release/Build-A-Release \
996		host=$(host_alias) source-vault
997
998binary-vault:
999	$(MAKE) -f ./release/Build-A-Release \
1000		host=$(host_alias) target=$(target_alias)
1001
1002vault-install:
1003	@if [ -f ./release/vault-install ] ; then \
1004	  ./release/vault-install $(host_alias) $(target_alias) ; \
1005	else \
1006	  true ; \
1007	fi
1008
1009.PHONY: install.all
1010install.all: install-no-fixedincludes
1011	@if [ -f ./gcc/Makefile ] ; then \
1012		r=`pwd` ; export r ; \
1013		$(SET_LIB_PATH) \
1014		(cd ./gcc; \
1015		$(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
1016	else \
1017		true ; \
1018	fi
1019
1020# inet-install is used because the I*Net wants DejaGNU installed but
1021# not built.  Similarly, gzip is built but not installed.
1022inet-install:
1023	$(MAKE) INSTALL_MODULES="`echo $(INSTALL_MODULES) | sed -e 's/install-dejagnu//' -e 's/install-gzip//'`" install
1024
1025# install-no-fixedincludes is used because Cygnus can not distribute
1026# the fixed header files.
1027.PHONY: install-no-fixedincludes
1028install-no-fixedincludes: \
1029	installdirs \
1030	$(INSTALL_MODULES) \
1031	$(INSTALL_TARGET_MODULES) \
1032	$(INSTALL_X11_MODULES) \
1033	gcc-no-fixedincludes 
1034
1035# Install the gcc headers files, but not the fixed include files,
1036# which Cygnus is not allowed to distribute.  This rule is very
1037# dependent on the workings of the gcc Makefile.in.
1038.PHONY: gcc-no-fixedincludes
1039gcc-no-fixedincludes:
1040	@if [ -f ./gcc/Makefile ]; then \
1041	  rm -rf gcc/tmp-include; \
1042	  mv gcc/include gcc/tmp-include 2>/dev/null; \
1043	  mkdir gcc/include; \
1044	  cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1045	  touch gcc/stmp-fixinc gcc/include/fixed; \
1046	  rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1047	  r=`pwd`; export r; \
1048	  s=`cd $(srcdir); pwd` ; export s; \
1049	  $(SET_LIB_PATH) \
1050	  (cd ./gcc; \
1051	   $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1052	  rm -rf gcc/include; \
1053	  mv gcc/tmp-include gcc/include 2>/dev/null; \
1054	else true; fi
1055
1056
1057# This rule is used to build the modules which use FLAGS_TO_PASS.  To
1058# build a target all-X means to cd to X and make all.
1059#
1060# all-gui, and all-libproc are handled specially because
1061# they are still experimental, and if they fail to build, that
1062# shouldn't stop "make all".
1063.PHONY: $(ALL_MODULES) all-gui all-libproc
1064$(ALL_MODULES) all-gui all-libproc:
1065	@dir=`echo $@ | sed -e 's/all-//'`; \
1066	if [ -f ./$${dir}/Makefile ] ; then \
1067	  r=`pwd`; export r; \
1068	  s=`cd $(srcdir); pwd`; export s; \
1069	  $(SET_LIB_PATH) \
1070	  (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
1071	else \
1072	  true; \
1073	fi
1074
1075# These rules are used to check the modules which use FLAGS_TO_PASS.
1076# To build a target check-X means to cd to X and make check.  Some
1077# modules are only tested in a native toolchain.
1078
1079.PHONY: $(CHECK_MODULES) $(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
1080$(NATIVE_CHECK_MODULES):
1081	@if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
1082	  dir=`echo $@ | sed -e 's/check-//'`; \
1083	  if [ -f ./$${dir}/Makefile ] ; then \
1084	    r=`pwd`; export r; \
1085	    s=`cd $(srcdir); pwd`; export s; \
1086	    $(SET_LIB_PATH) \
1087	    (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
1088	  else \
1089	    true; \
1090	  fi; \
1091	fi
1092
1093$(CROSS_CHECK_MODULES):
1094	@dir=`echo $@ | sed -e 's/check-//'`; \
1095	if [ -f ./$${dir}/Makefile ] ; then \
1096	  r=`pwd`; export r; \
1097	  s=`cd $(srcdir); pwd`; export s; \
1098	  $(SET_LIB_PATH) \
1099	  (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
1100	else \
1101	  true; \
1102	fi
1103
1104# This rule is used to install the modules which use FLAGS_TO_PASS.
1105# To build a target install-X means to cd to X and make install.
1106.PHONY: $(INSTALL_MODULES)
1107$(INSTALL_MODULES): installdirs
1108	@dir=`echo $@ | sed -e 's/install-//'`; \
1109	if [ -f ./$${dir}/Makefile ] ; then \
1110	  r=`pwd`; export r; \
1111	  s=`cd $(srcdir); pwd`; export s; \
1112	  $(SET_LIB_PATH) \
1113	  (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
1114	else \
1115	  true; \
1116	fi
1117
1118# This rule is used to configure the modules which are built with the
1119# target tools.
1120.PHONY: $(CONFIGURE_TARGET_MODULES)
1121$(CONFIGURE_TARGET_MODULES):
1122	@dir=`echo $@ | sed -e 's/configure-target-//'`; \
1123	if [ -d $(TARGET_SUBDIR)/$${dir} ]; then \
1124	  r=`pwd`; export r; \
1125	  $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/$${dir}/tmpmulti.out 2> /dev/null; \
1126	  if [ -s $(TARGET_SUBDIR)/$${dir}/tmpmulti.out ]; then \
1127	    if [ -f $(TARGET_SUBDIR)/$${dir}/multilib.out ]; then \
1128	      if cmp $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out > /dev/null; then \
1129		rm -f $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
1130	      else \
1131		echo "Multilibs changed for $${dir}, reconfiguring"; \
1132		rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/Makefile; \
1133		mv $(TARGET_SUBDIR)/$${dir}/tmpmulti.out $(TARGET_SUBDIR)/$${dir}/multilib.out; \
1134	      fi; \
1135	    else \
1136	      mv $(TARGET_SUBDIR)/$${dir}/tmpmulti.out $(TARGET_SUBDIR)/$${dir}/multilib.out; \
1137	    fi; \
1138	  fi; \
1139	fi; exit 0	# break command into two pieces
1140	@dir=`echo $@ | sed -e 's/configure-target-//'`; \
1141	if [ ! -d $(TARGET_SUBDIR) ]; then \
1142	  true; \
1143	elif [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1144	  true; \
1145	elif echo " $(TARGET_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
1146	  if [ -d $(srcdir)/$${dir} ]; then \
1147	    [ -d $(TARGET_SUBDIR)/$${dir} ] || mkdir $(TARGET_SUBDIR)/$${dir};\
1148	    r=`pwd`; export r; \
1149	    s=`cd $(srcdir); pwd`; export s; \
1150	    $(SET_LIB_PATH) \
1151	    AR="$(AR_FOR_TARGET)"; export AR; \
1152	    AS="$(AS_FOR_TARGET)"; export AS; \
1153	    CC="$(CC_FOR_TARGET)"; export CC; \
1154	    CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1155	    CXX="$(CXX_FOR_TARGET)"; export CXX; \
1156	    CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1157	    DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
1158	    LD="$(LD_FOR_TARGET)"; export LD; \
1159            LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
1160	    NM="$(NM_FOR_TARGET)"; export NM; \
1161	    RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
1162	    WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
1163	    echo Configuring in $(TARGET_SUBDIR)/$${dir}; \
1164	    cd $(TARGET_SUBDIR)/$${dir}; \
1165	    case $(srcdir) in \
1166	    /*) \
1167	      topdir=$(srcdir) ;; \
1168	    *) \
1169	      case "$(TARGET_SUBDIR)" in \
1170	      .) topdir="../$(srcdir)" ;; \
1171	      *) topdir="../../$(srcdir)" ;; \
1172	      esac ;; \
1173	    esac; \
1174	    if [ "$(srcdir)" = "." ] ; then \
1175	      if [ "$(TARGET_SUBDIR)" != "." ] ; then \
1176		if $(SHELL) $$s/symlink-tree $${topdir}/$${dir} "no-such-file" ; then \
1177		  if [ -f Makefile ]; then \
1178		    if $(MAKE) distclean; then \
1179		      true; \
1180		    else \
1181		      exit 1; \
1182		    fi; \
1183		  else \
1184		    true; \
1185		  fi; \
1186		else \
1187		  exit 1; \
1188		fi; \
1189	      else \
1190		true; \
1191	      fi; \
1192	      srcdiroption="--srcdir=."; \
1193	      libsrcdir="."; \
1194	    else \
1195	      srcdiroption="--srcdir=$${topdir}/$${dir}"; \
1196	      libsrcdir="$$s/$${dir}"; \
1197	    fi; \
1198	    if [ -f $${libsrcdir}/configure ] ; then \
1199	      $(SHELL) $${libsrcdir}/configure \
1200		$(CONFIG_ARGUMENTS) $${srcdiroption} \
1201		--with-target-subdir="$(TARGET_SUBDIR)"; \
1202	    else \
1203	      $(SHELL) $$s/configure \
1204		$(CONFIG_ARGUMENTS) $${srcdiroption} \
1205		--with-target-subdir="$(TARGET_SUBDIR)"; \
1206	    fi; \
1207	  else \
1208	    true; \
1209	  fi; \
1210	else \
1211	  true; \
1212	fi
1213
1214# This rule is used to build the modules which use TARGET_FLAGS_TO_PASS.
1215# To build a target all-X means to cd to X and make all.
1216.PHONY: $(ALL_TARGET_MODULES)
1217$(ALL_TARGET_MODULES):
1218	@dir=`echo $@ | sed -e 's/all-target-//'`; \
1219	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1220	  r=`pwd`; export r; \
1221	  s=`cd $(srcdir); pwd`; export s; \
1222	  $(SET_LIB_PATH) \
1223	  (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
1224	else \
1225	  true; \
1226	fi
1227
1228# This rule is used to check the modules which use TARGET_FLAGS_TO_PASS.
1229# To build a target install-X means to cd to X and make install.
1230.PHONY: $(CHECK_TARGET_MODULES)
1231$(CHECK_TARGET_MODULES):
1232	@dir=`echo $@ | sed -e 's/check-target-//'`; \
1233	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1234	  r=`pwd`; export r; \
1235	  s=`cd $(srcdir); pwd`; export s; \
1236	  $(SET_LIB_PATH) \
1237	  (cd $(TARGET_SUBDIR)/$${dir};$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\
1238	else \
1239	  true; \
1240	fi
1241
1242# This rule is used to install the modules which use
1243# TARGET_FLAGS_TO_PASS.  To build a target install-X means to cd to X
1244# and make install.
1245.PHONY: $(INSTALL_TARGET_MODULES)
1246$(INSTALL_TARGET_MODULES): installdirs
1247	@dir=`echo $@ | sed -e 's/install-target-//'`; \
1248	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
1249	  r=`pwd`; export r; \
1250	  s=`cd $(srcdir); pwd`; export s; \
1251	  $(SET_LIB_PATH) \
1252	  (cd $(TARGET_SUBDIR)/$${dir}; \
1253	    $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
1254	else \
1255	  true; \
1256	fi
1257
1258# This rule is used to build the modules which use X11_FLAGS_TO_PASS.
1259# To build a target all-X means to cd to X and make all.
1260.PHONY: $(ALL_X11_MODULES)
1261$(ALL_X11_MODULES):
1262	@dir=`echo $@ | sed -e 's/all-//'`; \
1263	if [ -f ./$${dir}/Makefile ] ; then \
1264	  r=`pwd`; export r; \
1265	  s=`cd $(srcdir); pwd`; export s; \
1266	  $(SET_LIB_PATH) \
1267	  (cd $${dir}; \
1268	   $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
1269	else \
1270	  true; \
1271	fi
1272
1273# This rule is used to check the modules which use X11_FLAGS_TO_PASS.
1274# To build a target check-X means to cd to X and make all.
1275.PHONY: $(CHECK_X11_MODULES)
1276$(CHECK_X11_MODULES):
1277	@dir=`echo $@ | sed -e 's/check-//'`; \
1278	if [ -f ./$${dir}/Makefile ] ; then \
1279	  r=`pwd`; export r; \
1280	  s=`cd $(srcdir); pwd`; export s; \
1281	  $(SET_LIB_PATH) \
1282	  (cd $${dir}; \
1283	   $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
1284	else \
1285	  true; \
1286	fi
1287
1288# This rule is used to install the modules which use X11_FLAGS_TO_PASS.
1289# To build a target install-X means to cd to X and make install.
1290.PHONY: $(INSTALL_X11_MODULES)
1291$(INSTALL_X11_MODULES): installdirs
1292	@dir=`echo $@ | sed -e 's/install-//'`; \
1293	if [ -f ./$${dir}/Makefile ] ; then \
1294	  r=`pwd`; export r; \
1295	  s=`cd $(srcdir); pwd`; export s; \
1296	  $(SET_LIB_PATH) \
1297	  (cd $${dir}; \
1298	   $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
1299	else \
1300	  true; \
1301	fi
1302
1303# gcc is the only module which uses GCC_FLAGS_TO_PASS.
1304.PHONY: all-gcc
1305all-gcc:
1306	@if [ -f ./gcc/Makefile ] ; then \
1307	  r=`pwd`; export r; \
1308	  s=`cd $(srcdir); pwd`; export s; \
1309	  $(SET_LIB_PATH) \
1310	  (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
1311	else \
1312	  true; \
1313	fi
1314
1315.PHONY: all-bootstrap
1316all-bootstrap:
1317	@if [ -f ./gcc/Makefile ] ; then \
1318	  r=`pwd`; export r; \
1319	  s=`cd $(srcdir); pwd`; export s; \
1320	  $(SET_LIB_PATH) \
1321	  (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) bootstrap); \
1322	else \
1323	  true; \
1324	fi
1325
1326.PHONY: check-gcc
1327check-gcc:
1328	@if [ -f ./gcc/Makefile ] ; then \
1329	  r=`pwd`; export r; \
1330	  s=`cd $(srcdir); pwd`; export s; \
1331	  $(SET_LIB_PATH) \
1332	  (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
1333	else \
1334	  true; \
1335	fi
1336
1337.PHONY: install-gcc
1338install-gcc:
1339	@if [ -f ./gcc/Makefile ] ; then \
1340	  r=`pwd`; export r; \
1341	  s=`cd $(srcdir); pwd`; export s; \
1342	  $(SET_LIB_PATH) \
1343	  (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1344	else \
1345	  true; \
1346	fi
1347
1348
1349# EXPERIMENTAL STUFF
1350# This rule is used to install the modules which use FLAGS_TO_PASS.
1351# To build a target install-X means to cd to X and make install.
1352.PHONY: install-dosrel
1353install-dosrel: installdirs info
1354	@dir=`echo $@ | sed -e 's/install-//'`; \
1355	if [ -f ./$${dir}/Makefile ] ; then \
1356	  r=`pwd`; export r; \
1357	  s=`cd $(srcdir); pwd`; export s; \
1358	  $(SET_LIB_PATH) \
1359	  (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
1360	else \
1361	  true; \
1362	fi
1363
1364install-dosrel-fake:
1365
1366
1367# This is a list of inter-dependencies among modules.
1368all-apache:
1369all-autoconf: all-m4 all-texinfo
1370all-automake:
1371all-bash:
1372all-bfd:
1373all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc
1374all-bison: all-texinfo
1375all-byacc:
1376all-cvssrc:
1377configure-target-cygmon: $(ALL_GCC)
1378all-target-cygmon: configure-target-cygmon all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
1379all-db:
1380all-dejagnu: all-tcl all-expect all-tk
1381all-diff: all-libiberty
1382all-emacs:
1383all-emacs19: all-bison all-byacc
1384all-etc:
1385configure-target-examples: $(ALL_GCC)
1386all-target-examples: configure-target-examples
1387all-expect: all-tcl all-tk
1388all-fileutils: all-libiberty
1389all-findutils:
1390all-find:
1391all-flex: all-libiberty all-bison all-byacc
1392all-gas: all-libiberty all-opcodes all-bfd
1393all-gash: all-tcl
1394all-gawk:
1395ALL_GCC = all-gcc
1396all-gcc: all-bison all-byacc all-binutils all-gas all-ld
1397all-bootstrap: all-libiberty all-bison all-byacc all-binutils all-gas all-ld
1398GDB_TK = all-tk all-tcl all-itcl all-tix all-libgui
1399all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
1400all-gettext:
1401all-gnuserv:
1402configure-target-gperf: $(ALL_GCC)
1403all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++
1404all-gprof: all-libiberty all-bfd all-opcodes
1405all-grep: all-libiberty
1406all-grez: all-libiberty all-bfd all-opcodes
1407all-gui: all-gdb all-libproc all-target-librx
1408all-guile:
1409all-gzip: all-libiberty
1410all-hello: all-libiberty
1411all-indent:
1412all-inet: all-tcl all-send-pr all-perl
1413all-intl:
1414all-ispell: all-emacs19
1415all-itcl: all-tcl all-tk
1416all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex
1417configure-target-libg++: $(ALL_GCC) configure-target-librx
1418all-target-libg++: configure-target-libg++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-librx all-target-libstdc++
1419configure-target-libgloss: $(ALL_GCC)
1420all-target-libgloss: configure-target-libgloss configure-target-newlib
1421configure-target-libio: $(ALL_GCC)
1422all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
1423check-target-libio: all-target-libstdc++
1424all-libgui: all-tcl all-tk all-itcl
1425all-libiberty:
1426configure-target-librx: $(ALL_GCC) configure-target-newlib
1427all-target-librx: configure-target-librx
1428configure-target-libstdc++: $(ALL_GCC)
1429all-target-libstdc++: configure-target-libstdc++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
1430all-m4: all-libiberty
1431all-make: all-libiberty
1432all-mmalloc:
1433configure-target-newlib: $(ALL_GCC)
1434all-target-newlib: configure-target-newlib all-binutils all-gas all-gcc
1435all-opcodes: all-bfd all-libiberty
1436all-patch: all-libiberty
1437all-perl:
1438all-prms: all-libiberty
1439all-rcs:
1440all-readline:
1441all-recode: all-libiberty
1442all-sed: all-libiberty
1443all-send-pr: all-prms
1444all-shellutils:
1445all-sim: all-libiberty all-bfd all-opcodes all-readline
1446all-snavigator: all-tcl all-tk all-tix all-itcl all-db all-grep
1447all-tar: all-libiberty
1448all-tcl:
1449all-tclX: all-tcl all-tk
1450all-tk: all-tcl
1451all-texinfo: all-libiberty
1452all-textutils:
1453all-tgas: all-libiberty all-bfd all-opcodes
1454all-time:
1455all-tix: all-tcl all-tk
1456all-wdiff:
1457all-target-winsup: all-target-newlib all-target-libiberty all-target-libio configure-target-winsup 
1458configure-target-winsup: configure-target-newlib
1459all-uudecode: all-libiberty
1460configure-target-libiberty: $(ALL_GCC)
1461all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
1462all-target: $(ALL_TARGET_MODULES)
1463install-target: $(INSTALL_TARGET_MODULES)
1464install-gdbtk: install-tcl install-tk install-itcl install-tix install-libgui install-gdb
1465### other supporting targets
1466
1467MAKEDIRS= \
1468	$(prefix) \
1469	$(exec_prefix)
1470.PHONY: installdirs
1471installdirs: mkinstalldirs
1472	$(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1473
1474dir.info: do-install-info
1475	if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
1476	  $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
1477	  mv -f dir.info.new dir.info ; \
1478	else true ; \
1479	fi
1480
1481dist:
1482	@echo "Building a full distribution of this tree isn't done"
1483	@echo "via 'make dist'.  Check out the etc/ subdirectory" 
1484
1485etags tags: TAGS
1486
1487# Right now this just builds TAGS in each subdirectory.  emacs19 has the
1488# ability to use several tags files at once, so there is probably no need
1489# to combine them into one big TAGS file (like CVS 1.3 does).  We could
1490# (if we felt like it) have this Makefile write a piece of elisp which
1491# the user could load to tell emacs19 where all the TAGS files we just
1492# built are.
1493TAGS: do-TAGS
1494
1495# with the gnu make, this is done automatically.
1496
1497Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
1498	$(SHELL) ./config.status
1499
1500#
1501# Support for building net releases
1502
1503# Files in devo used in any net release.
1504# ChangeLog omitted because it may refer to files which are not in this
1505# distribution (perhaps it would be better to include it anyway).
1506DEVO_SUPPORT= README Makefile.in configure configure.in \
1507	config.guess config.sub config move-if-change \
1508	mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install \
1509	COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
1510	mkinstalldirs ltconfig ltmain.sh missing ylwrap
1511
1512# Files in devo/etc used in any net release.
1513# ChangeLog omitted because it may refer to files which are not in this
1514# distribution (perhaps it would be better to include it anyway).
1515ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
1516	make-stds.texi standards.info*
1517
1518# When you use `make setup-dirs' or `make taz' you should always redefine
1519# this macro.
1520SUPPORT_FILES = list-of-support-files-for-tool-in-question
1521
1522.PHONY: taz
1523
1524taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
1525  texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1526	# Take out texinfo from a few places; make simple BISON=bison line.
1527	sed -e '/^all\.normal: /s/\all-texinfo //' \
1528	    -e '/^	install-texinfo /d' \
1529	<Makefile.in >tmp
1530	mv -f tmp Makefile.in
1531	#
1532	./configure sun4
1533	[ -z "$(CONFIGURE_TARGET_MODULES)" ] \
1534	  || $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
1535	    CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
1536	# Make links, and run "make diststuff" or "make info" when needed.
1537	rm -rf proto-toplev ; mkdir proto-toplev
1538	set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
1539	for d in $$dirs ; do \
1540	  if [ -d $$d ]; then \
1541	    if [ ! -f $$d/Makefile ] ; then true ; \
1542	    elif grep '^diststuff:' $$d/Makefile >/dev/null ; then \
1543		(cd $$d ; $(MAKE) diststuff ) || exit 1 ; \
1544	    elif grep '^info:' $$d/Makefile >/dev/null ; then \
1545	        (cd $$d ; $(MAKE) info ) || exit 1 ; \
1546	    fi ; \
1547	    if [ -d $$d/proto-$$d.dir ]; then \
1548	      ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
1549	    else \
1550	      ln -s ../$$d proto-toplev/$$d ; \
1551	    fi ; \
1552	  else ln -s ../$$d proto-toplev/$$d ; fi ; \
1553	done
1554	cd etc ; $(MAKE) info
1555	$(MAKE) distclean
1556	#
1557	mkdir proto-toplev/etc
1558	(cd proto-toplev/etc; \
1559	 for i in $(ETC_SUPPORT); do \
1560		ln -s ../../etc/$$i . ; \
1561	 done)
1562	#
1563	# Take out texinfo from configurable dirs
1564	rm proto-toplev/configure.in
1565	sed -e '/^host_tools=/s/texinfo //' \
1566	    <configure.in >proto-toplev/configure.in
1567	#
1568	mkdir proto-toplev/texinfo
1569	ln -s ../../texinfo/texinfo.tex		proto-toplev/texinfo/
1570	ln -s ../../texinfo/gpl.texinfo		proto-toplev/texinfo/
1571	ln -s ../../texinfo/lgpl.texinfo	proto-toplev/texinfo/
1572	if test -r texinfo/util/tex3patch ; then \
1573	  mkdir proto-toplev/texinfo/util && \
1574	  ln -s ../../../texinfo/util/tex3patch	proto-toplev/texinfo/util ; \
1575	else true; fi
1576	chmod og=u `find . -print`
1577	if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
1578	  ver=`sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'`; \
1579	else \
1580	  ver=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
1581	fi; \
1582	$(MAKE) -f Makefile.in do-tar-gz TOOL=$(TOOL) VER=$$ver
1583
1584do-tar-gz:
1585	echo "==> Making $(TOOL)-$(VER).tar.gz"
1586	-rm -f $(TOOL)-$(VER)
1587	ln -s proto-toplev $(TOOL)-$(VER)
1588	tar cfh $(TOOL)-$(VER).tar $(TOOL)-$(VER)
1589	$(GZIPPROG) -v -9 $(TOOL)-$(VER).tar
1590
1591TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1592DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
1593
1594.PHONY: gas.tar.gz
1595GAS_SUPPORT_DIRS= bfd include libiberty opcodes setup.com makefile.vms
1596gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
1597	$(MAKE) -f Makefile.in taz TOOL=gas \
1598		SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
1599
1600# The FSF "binutils" release includes gprof and ld.
1601.PHONY: binutils.tar.gz
1602BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof setup.com makefile.vms
1603binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
1604	$(MAKE) -f Makefile.in taz TOOL=binutils \
1605		SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat"
1606
1607.PHONY: gas+binutils.tar.gz
1608GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
1609gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
1610	$(MAKE) -f Makefile.in taz TOOL=gas \
1611		SUPPORT_FILES="$(GASB_SUPPORT_DIRS) makeall.bat configure.bat"
1612
1613.PHONY: libg++.tar.gz
1614LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
1615libg++.tar.gz: $(DIST_SUPPORT) libg++
1616	$(MAKE) -f Makefile.in taz TOOL=libg++ \
1617		SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
1618
1619GNATS_SUPPORT_DIRS=include libiberty send-pr
1620gnats.tar.gz: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
1621	$(MAKE) -f  Makefile.in taz TOOL=gnats \
1622		SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
1623
1624.PHONY: gdb.tar.gz
1625GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils
1626GDBTK_SUPPORT_DIRS= `if [ -d tcl -a -d tk ] ; then echo tcl tk ; fi`
1627gdb.tar.gz: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
1628	$(MAKE) -f Makefile.in taz TOOL=gdb \
1629		SUPPORT_FILES="$(GDB_SUPPORT_DIRS) $(GDBTK_SUPPORT_DIRS)"
1630
1631.PHONY: newlib.tar.gz
1632NEWLIB_SUPPORT_DIRS=libgloss
1633# taz configures for the sun4 target which won't configure newlib.
1634# We need newlib configured so that the .info files are made.
1635# Unfortunately, it is not enough to just configure newlib separately:
1636# taz will build the .info files but since SUBDIRS won't contain newlib,
1637# distclean won't be run (leaving Makefile, config.status, and the tmp files
1638# used in building the .info files, eg: *.def, *.ref).
1639# The problem isn't solvable however without a lot of extra work because
1640# target libraries are built in subdir $(target_alias) which gets nuked during
1641# the make distclean.  For now punt on the issue of shipping newlib info files
1642# with newlib net releases and wait for a day when some native target (sun4?)
1643# supports newlib (if only minimally).
1644newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
1645	$(MAKE) -f Makefile.in taz TOOL=newlib \
1646		SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
1647		DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
1648
1649.NOEXPORT:
1650MAKEOVERRIDES=
1651
1652
1653# end of Makefile.in
1654