2 # Makefile for directory with subdirs to build.
3 # Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 exec_prefix = $(prefix)
25 bindir = $(exec_prefix)/bin
26 libdir = $(exec_prefix)/lib
27 tooldir = $(exec_prefix)/$(target)
29 program_transform_name =
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
49 INSTALL = $${srcroot}/install.sh -c
50 INSTALL_PROGRAM = $(INSTALL)
51 INSTALL_DATA = $(INSTALL) -m 644
52 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
54 INSTALL_DOSREL = install-dosrel-fake
61 # Special variables passed down in EXTRA_GCC_FLAGS. They are defined
62 # here so that they can be overridden by Makefile fragments.
63 HOST_CC = $(CC_FOR_BUILD)
65 HOST_PREFIX_1 = loser-
67 # We don't specify -g -O because many compilers don't support -g -O,
68 # and/or -O is broken in and of itself.
71 CFLAGS_FOR_TARGET = $(CFLAGS)
72 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
78 # Use -O2 to stress test the compiler.
80 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
81 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
82 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
89 # Not plain GZIP, since gzip looks there for extra command-line options.
92 # These values are substituted by configure.
97 LEX = `if [ -f $$r/flex/flex ] ; \
98 then echo $$r/flex/flex ; \
99 else echo ${DEFAULT_LEX} ; fi`
101 M4 = `if [ -f $$r/m4/m4 ] ; \
102 then echo $$r/m4/m4 ; \
105 MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
106 then echo $$r/texinfo/makeinfo/makeinfo ; \
107 else echo makeinfo ; fi`
109 # This just becomes part of the MAKEINFO definition passed down to
110 # sub-makes. It lets flags be given on the command line while still
111 # using the makeinfo from the object tree.
114 EXPECT = `if [ -f $$r/expect/expect ] ; \
115 then echo $$r/expect/expect ; \
116 else echo expect ; fi`
118 RUNTEST = `if [ -f $${srcroot}/dejagnu/runtest ] ; \
119 then echo $${srcroot}/dejagnu/runtest ; \
120 else echo runtest ; fi`
123 # compilers to use to create programs which must be run in the build
126 CXX_FOR_BUILD = $(CXX)
128 SUBDIRS = "this is set via configure, don't edit this"
131 # This is set by the configure script to the list of directories which
132 # should be built using the target tools.
133 TARGET_CONFIGDIRS = libiberty libgloss newlib libio librx libstdc++ libg++ winsup
135 # Target libraries are put under this directory:
136 TARGET_SUBDIR = . # Changed by configure to $(target_alias) if cross.
138 # This is set by the configure script to the arguments passed to configure.
141 # This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
145 # This is the name of the environment variable used for the path to
146 # the libraries. This may be changed by configure.in.
147 RPATH_ENVVAR = LD_LIBRARY_PATH
149 # configure.in sets SET_LIB_PATH to this if --enable-shared was used.
150 REALLY_SET_LIB_PATH = \
151 $(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes:$$$(RPATH_ENVVAR); \
152 export $(RPATH_ENVVAR);
155 INSTALL_TARGET = install-dirs \
157 $(INSTALL_TARGET_MODULES) \
158 $(INSTALL_X11_MODULES) \
164 if [ -f $$r/gcc/Makefile ] ; then \
165 if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
166 echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $${srcroot}/newlib/libc/include -nostdinc; \
168 echo $$r/gcc/xgcc -B$$r/gcc/; \
171 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
174 t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
180 if [ -f $$r/gcc/Makefile ] ; then \
181 if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
182 echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $${srcroot}/newlib/libc/include -nostdinc; \
184 echo $$r/gcc/xgcc -B$$r/gcc/; \
187 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
190 t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
195 if [ -f $$r/gas/as.new ] ; then \
196 echo $$r/gas/as.new ; \
198 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
201 t='$(program_transform_name)'; echo as | sed -e 's/x/x/' $$t ; \
206 if [ -f $$r/ld/ld.new ] ; then \
207 echo $$r/ld/ld.new ; \
209 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
212 t='$(program_transform_name)'; echo ld | sed -e 's/x/x/' $$t ; \
216 DLLTOOL_FOR_TARGET = ` \
217 if [ -f $$r/binutils/dlltool ] ; then \
218 echo $$r/binutils/dlltool ; \
220 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
223 t='$(program_transform_name)'; echo dlltool | sed -e 's/x/x/' $$t ; \
228 if [ -f $$r/binutils/ar ] ; then \
229 echo $$r/binutils/ar ; \
231 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
234 t='$(program_transform_name)'; echo ar | sed -e 's/x/x/' $$t ; \
238 RANLIB_FOR_TARGET = ` \
239 if [ -f $$r/binutils/ranlib ] ; then \
240 echo $$r/binutils/ranlib ; \
242 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
245 t='$(program_transform_name)'; echo ranlib | sed -e 's/x/x/' $$t ; \
250 if [ -f $$r/binutils/nm.new ] ; then \
251 echo $$r/binutils/nm.new ; \
253 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
256 t='$(program_transform_name)'; echo nm | sed -e 's/x/x/' $$t ; \
260 #### host and target specific makefile fragments come in here.
263 # Flags to pass down to all sub-makes.
264 # Please keep these in alphabetical order.
265 BASE_FLAGS_TO_PASS = \
266 "AR_FLAGS=$(AR_FLAGS)" \
267 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
268 "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
270 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
271 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
273 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
274 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
275 "CXXFLAGS=$(CXXFLAGS)" \
276 "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
277 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
278 "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \
279 "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
280 "INSTALL=$(INSTALL)" \
281 "INSTALL_DATA=$(INSTALL_DATA)" \
282 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
283 "INSTALL_XFORM=$(INSTALL_XFORM)" \
284 "LDFLAGS=$(LDFLAGS)" \
286 "LD_FOR_TARGET=$(LD_FOR_TARGET)" \
287 "LIBCFLAGS=$(LIBCFLAGS)" \
288 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
289 "LIBCXXFLAGS=$(LIBCXXFLAGS)" \
290 "LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
292 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
293 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
294 "PICFLAG=$(PICFLAG)" \
295 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
296 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
299 "RUNTEST=$(RUNTEST)" \
300 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
302 "exec_prefix=$(exec_prefix)" \
306 # Flags to pass down to most sub-makes, in which we're building with
307 # the host environment.
308 # If any variables are added here, they must be added to do-*, below.
314 'DLLTOOL=$(DLLTOOL)' \
319 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
321 # Flags that are concerned with the location of the X11 include files
324 # NOTE: until the top-level is getting the values via autoconf, it only
325 # causes problems to have this top-level Makefile overriding the autoconf-set
326 # values in child directories. Only variables that don't conflict with
327 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
329 X11_FLAGS_TO_PASS = \
330 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
331 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
333 # Flags to pass down to makes which are built with the target environment.
334 # The double $ decreases the length of the command line; the variables
335 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
336 # If any variables are added here, they must be added to do-*, below.
337 EXTRA_TARGET_FLAGS = \
338 'AR=$$(AR_FOR_TARGET)' \
339 'AS=$$(AS_FOR_TARGET)' \
340 'CC=$$(CC_FOR_TARGET)' \
341 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
342 'CXX=$$(CXX_FOR_TARGET)' \
343 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
344 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
345 'LD=$$(LD_FOR_TARGET)' \
346 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
347 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
348 'NM=$$(NM_FOR_TARGET)' \
349 'PICFLAG=$$(PICFLAG_FOR_TARGET)' \
350 'RANLIB=$$(RANLIB_FOR_TARGET)'
352 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
354 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
355 # unfortunately needs the native compiler and the target ar and
357 # If any variables are added here, they must be added to do-*, below.
358 # The HOST_* variables are a special case, which are used for the gcc
359 # cross-building scheme.
361 'AR=$$(AR_FOR_TARGET)' \
365 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
366 'HOST_CC=$(CC_FOR_BUILD)' \
367 'HOST_PREFIX=$(HOST_PREFIX)' \
368 'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
370 'RANLIB=$$(RANLIB_FOR_TARGET)' \
371 `if test x"$(LANGUAGES)" != x; then echo "LANGUAGES=$(LANGUAGES)"; fi` \
372 `if test x"$(STMP_FIXPROTO)" != x; then echo "STMP_FIXPROTO=$(STMP_FIXPROTO)"; fi` \
373 `if test x"$(LIMITS_H_TEST)" != x; then echo "LIMITS_H_TEST=$(LIMITS_H_TEST)"; fi` \
374 `if test x"$(LIBGCC1_TEST)" != x; then echo "LIBGCC1_TEST=$(LIBGCC1_TEST)"; fi` \
375 `if test x"$(LIBGCC2_CFLAGS)" != x; then echo "LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)"; fi` \
376 `if test x"$(LIBGCC2_INCLUDES)" != x; then echo "LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)"; fi` \
377 `if test x"$(ENQUIRE)" != x; then echo "ENQUIRE=$(ENQUIRE)"; fi` \
378 `if test x"$(BOOT_CFLAGS)" != x; then echo "BOOT_CFLAGS=$(BOOT_CFLAGS)"; fi`
380 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
382 # This is a list of the targets for all of the modules which are compiled
383 # using $(FLAGS_TO_PASS).
431 # This is a list of the check targets for all of the modules which are
432 # compiled using $(FLAGS_TO_PASS).
433 # This is a list of the check targets for all of the modules which are
434 # compiled using $(FLAGS_TO_PASS).
436 # The list is in two parts. The first lists those tools which
437 # are tested as part of the host's native tool-chain, and not
438 # tested in a cross configuration.
439 NATIVE_CHECK_MODULES = \
443 CROSS_CHECK_MODULES = \
485 CHECK_MODULES=$(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
487 # This is a list of the install targets for all of the modules which are
488 # compiled using $(FLAGS_TO_PASS).
534 # This is a list of the targets for all of the modules which are compiled
535 # using $(X11_FLAGS_TO_PASS).
545 # This is a list of the check targets for all of the modules which are
546 # compiled using $(X11_FLAGS_TO_PASS).
547 CHECK_X11_MODULES = \
555 # This is a list of the install targets for all the modules which are
556 # compiled using $(X11_FLAGS_TO_PASS).
557 INSTALL_X11_MODULES = \
566 # This is a list of the targets for all of the modules which are compiled
567 # using $(TARGET_FLAGS_TO_PASS).
568 ALL_TARGET_MODULES = \
570 all-target-libstdc++ \
575 all-target-libgloss \
576 all-target-libiberty \
579 # This is a list of the configure targets for all of the modules which
580 # are compiled using the target tools.
581 CONFIGURE_TARGET_MODULES = \
582 configure-target-libio \
583 configure-target-libstdc++ \
584 configure-target-librx \
585 configure-target-libg++ \
586 configure-target-newlib \
587 configure-target-winsup \
588 configure-target-libgloss \
589 configure-target-libiberty \
590 configure-target-examples
592 # This is a list of the check targets for all of the modules which are
593 # compiled using $(TARGET_FLAGS_TO_PASS).
594 CHECK_TARGET_MODULES = \
596 check-target-libstdc++ \
597 check-target-libg++ \
598 check-target-newlib \
599 check-target-winsup \
600 check-target-libiberty
602 # This is a list of the install targets for all of the modules which are
603 # compiled using $(TARGET_FLAGS_TO_PASS).
604 INSTALL_TARGET_MODULES = \
605 install-target-libio \
606 install-target-libstdc++ \
607 install-target-libg++ \
608 install-target-newlib \
609 install-target-winsup \
610 install-target-libgloss \
611 install-target-libiberty
613 # The first rule in the file had better be this one. Don't put any above it.
617 # The target built for a native build.
621 $(ALL_TARGET_MODULES) \
625 # Do a target for all the subdirectories. A ``make do-X'' will do a
626 # ``make X'' in all subdirectories (because, in general, there is a
627 # dependency (below) of X upon do-X, a ``make X'' will also do this,
628 # but it may do additional work as well).
629 # This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
630 # because it is so large that it can easily overflow the command line
631 # length limit on some systems.
640 do-maintainer-clean \
644 @target=`echo $@ | sed -e 's/^do-//'`; \
646 srcroot=`cd $(srcdir); pwd`; export srcroot; \
648 for i in $(SUBDIRS) -dummy-; do \
649 if [ -f ./$$i/Makefile ]; then \
652 for flag in $(EXTRA_GCC_FLAGS); do \
653 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
657 for flag in $(EXTRA_HOST_FLAGS); do \
658 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
662 export AR AS CC CXX NM RANLIB DLLTOOL; \
664 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
665 "CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
666 "RANLIB=$${RANLIB}" \
667 "DLLTOOL=$${DLLTOOL}" \
669 then true; else exit 1; fi; \
672 @target=`echo $@ | sed -e 's/^do-//'`; \
674 srcroot=`cd $(srcdir); pwd`; export srcroot; \
676 for i in $(TARGET_CONFIGDIRS) -dummy-; do \
677 if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \
678 for flag in $(EXTRA_TARGET_FLAGS); do \
679 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \
681 export AR AS CC CXX NM RANLIB DLLTOOL; \
682 if (cd $(TARGET_SUBDIR)/$$i; \
683 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
684 "CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
685 "RANLIB=$${RANLIB}" \
686 "DLLTOOL=$${DLLTOOL}" \
688 then true; else exit 1; fi; \
692 # Here are the targets which correspond to the do-X targets.
694 .PHONY: info installcheck dvi install-info
695 .PHONY: clean distclean mostlyclean maintainer-clean realclean
696 .PHONY: local-clean local-distclean local-maintainer-clean
698 installcheck: do-installcheck
701 install-info: do-install-info dir.info
702 srcroot=`cd $(srcdir); pwd`; export srcroot; \
703 if [ -f dir.info ] ; then \
704 $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
708 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
711 -rm -f Makefile config.status
712 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
713 rm -rf $(TARGET_SUBDIR); \
716 local-maintainer-clean:
717 @echo "This command is intended for maintainers to use;"
718 @echo "it deletes files that may require special tools to rebuild."
720 clean: do-clean local-clean
721 mostlyclean: do-mostlyclean local-clean
722 distclean: do-distclean local-clean local-distclean
723 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
724 maintainer-clean: local-distclean
725 realclean: maintainer-clean
730 check: $(CHECK_MODULES) \
731 $(CHECK_TARGET_MODULES) \
732 $(CHECK_X11_MODULES) \
735 # Installation targets.
737 .PHONY: install uninstall source-vault binary-vault vault-install
738 install: $(INSTALL_TARGET)
741 @echo "the uninstall target is not supported in this tree"
744 $(MAKE) -f ./release/Build-A-Release \
745 host=$(host_alias) source-vault
748 $(MAKE) -f ./release/Build-A-Release \
749 host=$(host_alias) target=$(target_alias)
752 @if [ -f ./release/vault-install ] ; then \
753 ./release/vault-install $(host_alias) $(target_alias) ; \
759 install.all: install-no-fixedincludes
760 @if [ -f ./gcc/Makefile ] ; then \
761 r=`pwd` ; export r ; \
764 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
769 # install-no-fixedincludes is used because Cygnus can not distribute
770 # the fixed header files.
771 .PHONY: install-no-fixedincludes
772 install-no-fixedincludes: \
775 $(INSTALL_TARGET_MODULES) \
776 $(INSTALL_X11_MODULES) \
779 # Install the gcc headers files, but not the fixed include files,
780 # which Cygnus is not allowed to distribute. This rule is very
781 # dependent on the workings of the gcc Makefile.in.
782 .PHONY: gcc-no-fixedincludes
783 gcc-no-fixedincludes:
784 @if [ -f ./gcc/Makefile ]; then \
785 rm -rf gcc/tmp-include; \
786 mv gcc/include gcc/tmp-include 2>/dev/null; \
788 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
789 touch gcc/stmp-fixinc gcc/include/fixed; \
790 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
792 srcroot=`cd $(srcdir); pwd` ; export srcroot; \
795 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
796 rm -rf gcc/include; \
797 mv gcc/tmp-include gcc/include 2>/dev/null; \
800 # This rule is used to build the modules which use FLAGS_TO_PASS. To
801 # build a target all-X means to cd to X and make all.
803 # all-gui, and all-libproc are handled specially because
804 # they are still experimental, and if they fail to build, that
805 # shouldn't stop "make all".
806 .PHONY: $(ALL_MODULES) all-gui all-libproc
807 $(ALL_MODULES) all-gui all-libproc:
808 @dir=`echo $@ | sed -e 's/all-//'`; \
809 if [ -f ./$${dir}/Makefile ] ; then \
811 srcroot=`cd $(srcdir); pwd`; export srcroot; \
813 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
818 # These rules are used to check the modules which use FLAGS_TO_PASS.
819 # To build a target check-X means to cd to X and make check. Some
820 # modules are only tested in a native toolchain.
822 .PHONY: $(CHECK_MODULES) $(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
823 $(NATIVE_CHECK_MODULES):
824 @if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
825 dir=`echo $@ | sed -e 's/check-//'`; \
826 if [ -f ./$${dir}/Makefile ] ; then \
828 srcroot=`cd $(srcdir); pwd`; export srcroot; \
830 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
836 $(CROSS_CHECK_MODULES):
837 @dir=`echo $@ | sed -e 's/check-//'`; \
838 if [ -f ./$${dir}/Makefile ] ; then \
840 srcroot=`cd $(srcdir); pwd`; export srcroot; \
842 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
847 # This rule is used to install the modules which use FLAGS_TO_PASS.
848 # To build a target install-X means to cd to X and make install.
849 .PHONY: $(INSTALL_MODULES)
850 $(INSTALL_MODULES): install-dirs
851 @dir=`echo $@ | sed -e 's/install-//'`; \
852 if [ -f ./$${dir}/Makefile ] ; then \
854 srcroot=`cd $(srcdir); pwd`; export srcroot; \
856 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
861 # This rule is used to configure the modules which are built with the
863 .PHONY: $(CONFIGURE_TARGET_MODULES)
864 $(CONFIGURE_TARGET_MODULES):
865 @dir=`echo $@ | sed -e 's/configure-target-//'`; \
866 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
868 elif echo " $(TARGET_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
869 if [ -d $(srcdir)/$${dir} ]; then \
870 [ -d $(TARGET_SUBDIR)/$${dir} ] || mkdir $(TARGET_SUBDIR)/$${dir};\
872 srcroot=`cd $(srcdir); pwd`; export srcroot; \
874 AR="$(AR_FOR_TARGET)"; export AR; \
875 AS="$(AS_FOR_TARGET)"; export AS; \
876 CC="$(CC_FOR_TARGET)"; export CC; \
877 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
878 CXX="$(CXX_FOR_TARGET)"; export CXX; \
879 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
880 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
881 LD="$(LD_FOR_TARGET)"; export LD; \
882 NM="$(NM_FOR_TARGET)"; export NM; \
883 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
884 echo Configuring in $(TARGET_SUBDIR)/$${dir}; \
885 cd $(TARGET_SUBDIR)/$${dir}; \
888 topdir=$(srcdir) ;; \
890 case "$(TARGET_SUBDIR)" in \
891 .) topdir="../$(srcdir)" ;; \
892 *) topdir="../../$(srcdir)" ;; \
895 if [ "$(srcdir)" = "." ] ; then \
896 if [ "$(TARGET_SUBDIR)" != "." ] ; then \
897 if $(SHELL) $${srcroot}/symlink-tree $${topdir}/$${dir} "no-such-file" ; then \
898 if [ -f Makefile ]; then \
899 if $(MAKE) distclean; then \
913 srcdiroption="--srcdir=."; \
916 srcdiroption="--srcdir=$${topdir}/$${dir}"; \
917 libsrcdir="$${srcroot}/$${dir}"; \
919 if [ -f $${libsrcdir}/configure ] ; then \
920 $(SHELL) $${libsrcdir}/configure \
921 $(CONFIG_ARGUMENTS) $${srcdiroption} \
922 --with-target-subdir="$(TARGET_SUBDIR)"; \
924 $(SHELL) $${srcroot}/configure \
925 $(CONFIG_ARGUMENTS) $${srcdiroption} \
926 --with-target-subdir="$(TARGET_SUBDIR)"; \
935 # This rule is used to build the modules which use TARGET_FLAGS_TO_PASS.
936 # To build a target all-X means to cd to X and make all.
937 .PHONY: $(ALL_TARGET_MODULES)
938 $(ALL_TARGET_MODULES):
939 @dir=`echo $@ | sed -e 's/all-target-//'`; \
940 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
942 srcroot=`cd $(srcdir); pwd`; export srcroot; \
944 (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
949 # This rule is used to check the modules which use TARGET_FLAGS_TO_PASS.
950 # To build a target install-X means to cd to X and make install.
951 .PHONY: $(CHECK_TARGET_MODULES)
952 $(CHECK_TARGET_MODULES):
953 @dir=`echo $@ | sed -e 's/check-target-//'`; \
954 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
956 srcroot=`cd $(srcdir); pwd`; export srcroot; \
958 (cd $(TARGET_SUBDIR)/$${dir};$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\
963 # This rule is used to install the modules which use
964 # TARGET_FLAGS_TO_PASS. To build a target install-X means to cd to X
966 .PHONY: $(INSTALL_TARGET_MODULES)
967 $(INSTALL_TARGET_MODULES): install-dirs
968 @dir=`echo $@ | sed -e 's/install-target-//'`; \
969 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
971 srcroot=`cd $(srcdir); pwd`; export srcroot; \
973 (cd $(TARGET_SUBDIR)/$${dir}; \
974 $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
979 # This rule is used to build the modules which use X11_FLAGS_TO_PASS.
980 # To build a target all-X means to cd to X and make all.
981 .PHONY: $(ALL_X11_MODULES)
983 @dir=`echo $@ | sed -e 's/all-//'`; \
984 if [ -f ./$${dir}/Makefile ] ; then \
986 srcroot=`cd $(srcdir); pwd`; export srcroot; \
989 $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
994 # This rule is used to check the modules which use X11_FLAGS_TO_PASS.
995 # To build a target check-X means to cd to X and make all.
996 .PHONY: $(CHECK_X11_MODULES)
997 $(CHECK_X11_MODULES):
998 @dir=`echo $@ | sed -e 's/check-//'`; \
999 if [ -f ./$${dir}/Makefile ] ; then \
1000 r=`pwd`; export r; \
1001 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1004 $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
1009 # This rule is used to install the modules which use X11_FLAGS_TO_PASS.
1010 # To build a target install-X means to cd to X and make install.
1011 .PHONY: $(INSTALL_X11_MODULES)
1012 $(INSTALL_X11_MODULES):
1013 @dir=`echo $@ | sed -e 's/install-//'`; \
1014 if [ -f ./$${dir}/Makefile ] ; then \
1015 r=`pwd`; export r; \
1016 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1019 $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
1024 # gcc is the only module which uses GCC_FLAGS_TO_PASS.
1027 @if [ -f ./gcc/Makefile ] ; then \
1028 r=`pwd`; export r; \
1029 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1031 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
1036 .PHONY: all-bootstrap
1038 @if [ -f ./gcc/Makefile ] ; then \
1039 r=`pwd`; export r; \
1040 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1042 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) bootstrap); \
1049 @if [ -f ./gcc/Makefile ] ; then \
1050 r=`pwd`; export r; \
1051 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1053 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
1060 @if [ -f ./gcc/Makefile ] ; then \
1061 r=`pwd`; export r; \
1062 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1064 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1070 # EXPERIMENTAL STUFF
1071 # This rule is used to install the modules which use FLAGS_TO_PASS.
1072 # To build a target install-X means to cd to X and make install.
1073 .PHONY: install-dosrel
1074 install-dosrel: install-dirs info
1075 @dir=`echo $@ | sed -e 's/install-//'`; \
1076 if [ -f ./$${dir}/Makefile ] ; then \
1077 r=`pwd`; export r; \
1078 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1080 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
1085 install-dosrel-fake:
1088 # This is a list of inter-dependencies among modules.
1089 all-autoconf: all-m4
1091 all-binutils: all-libiberty all-opcodes all-bfd all-flex all-byacc
1094 all-dejagnu: all-tcl all-expect all-tk
1095 all-diff: all-libiberty
1097 all-emacs19: all-byacc
1099 configure-target-examples: $(ALL_GCC)
1100 all-target-examples: configure-target-examples
1101 all-expect: all-tcl all-tk
1102 all-fileutils: all-libiberty
1104 all-flex: all-libiberty all-byacc
1105 all-gas: all-libiberty all-opcodes all-bfd
1109 all-gcc: all-libiberty all-byacc all-binutils all-gas all-ld
1110 all-bootstrap: all-libiberty all-byacc all-binutils all-gas all-ld
1111 GDB_TK = all-tk all-tcl
1112 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
1113 all-gprof: all-libiberty all-bfd all-opcodes
1114 all-grep: all-libiberty
1115 all-grez: all-libiberty all-bfd all-opcodes
1116 all-gui: all-gdb all-libproc all-target-librx
1117 all-gzip: all-libiberty
1118 all-hello: all-libiberty
1120 all-ispell: all-emacs19
1121 all-ld: all-libiberty all-bfd all-opcodes all-byacc all-flex
1122 configure-target-libg++: $(ALL_GCC) configure-target-librx
1123 all-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++
1124 configure-target-libgloss: $(ALL_GCC)
1125 all-target-libgloss: configure-target-libgloss configure-target-newlib
1126 configure-target-libio: $(ALL_GCC)
1127 all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
1129 configure-target-librx: $(ALL_GCC) configure-target-newlib
1130 all-target-librx: configure-target-librx
1131 configure-target-libstdc++: $(ALL_GCC)
1132 all-target-libstdc++: configure-target-libstdc++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
1133 all-m4: all-libiberty
1134 all-make: all-libiberty
1136 configure-target-newlib: $(ALL_GCC)
1137 all-target-newlib: configure-target-newlib all-binutils all-gas all-gcc
1138 all-opcodes: all-bfd all-libiberty
1139 all-patch: all-libiberty
1140 all-prms: all-libiberty
1143 all-recode: all-libiberty
1144 all-sed: all-libiberty
1145 all-send-pr: all-prms
1147 all-sim: all-libiberty all-bfd all-opcodes
1148 all-tar: all-libiberty
1150 all-tclX: all-tcl all-tk
1152 all-texinfo: all-libiberty
1154 all-tgas: all-libiberty all-bfd all-opcodes
1157 all-target-winsup: all-target-newlib all-target-libiberty configure-target-winsup
1158 configure-target-winsup: configure-target-newlib
1159 all-uudecode: all-libiberty
1160 configure-target-libiberty: $(ALL_GCC)
1161 all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
1163 ### other supporting targets
1170 .PHONY: install-dirs
1172 @for i in $(MAKEDIRS) ; do \
1173 echo Making $$i... ; \
1174 parent=`echo $$i | sed -e 's@/[^/]*$$@@' | sed -e 's@^$$@/@'`; \
1175 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi ; \
1176 if [ ! -d $$i ] ; then \
1177 if mkdir $$i ; then \
1188 dir.info: do-install-info
1189 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
1190 $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
1191 mv -f dir.info.new dir.info ; \
1196 @echo "Building a full distribution of this tree isn't done"
1197 @echo "via 'make dist'. Check out the etc/ subdirectory"
1201 # Right now this just builds TAGS in each subdirectory. emacs19 has the
1202 # ability to use several tags files at once, so there is probably no need
1203 # to combine them into one big TAGS file (like CVS 1.3 does). We could
1204 # (if we felt like it) have this Makefile write a piece of elisp which
1205 # the user could load to tell emacs19 where all the TAGS files we just
1209 # with the gnu make, this is done automatically.
1211 Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
1212 $(SHELL) ./config.status
1215 # Support for building net releases
1217 # Files in devo used in any net release.
1218 # ChangeLog omitted because it may refer to files which are not in this
1219 # distribution (perhaps it would be better to include it anyway).
1220 DEVO_SUPPORT= README Makefile.in configure configure.in \
1221 config.guess config.sub config move-if-change \
1222 mpw-README mpw-build.in mpw-config.in mpw-configure \
1223 COPYING COPYING.LIB install.sh config-ml.in symlink-tree
1225 # Files in devo/etc used in any net release.
1226 # ChangeLog omitted because it may refer to files which are not in this
1227 # distribution (perhaps it would be better to include it anyway).
1228 ETC_SUPPORT= Makefile.in cfg-paper.texi configure.in configure.man \
1229 configure.texi standards.texi make-stds.texi \
1230 configure.info* standards.info* cfg-paper.info*
1232 # When you use `make setup-dirs' or `make taz' you should always redefine
1234 SUPPORT_FILES = list-of-support-files-for-tool-in-question
1235 # Files where "byacc" (Cygnus version) should be changed to "bison -y" (FSF).
1236 DISTBISONFILES= binutils/Makefile.in gas/Makefile.in gdb/Makefile.in
1240 taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
1241 texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1242 # Make sure "diststuff" files get built properly.
1243 for f in $(DISTBISONFILES) ; do \
1244 if [ -r $$f ]; then \
1245 sed '/^BISON *=.*$$/s/.*/BISON = bison -y/' <$$f >tmp ; \
1249 # Take out texinfo from a few places; make simple BISON=bison line.
1250 sed -e '/^all\.normal: /s/\all-texinfo //' \
1251 -e '/^ install-texinfo /d' \
1252 -e '/^BISON = /,/^$$/d' \
1253 -e '/^# BISON:/s/.*/BISON = bison -y/' \
1255 mv -f tmp Makefile.in
1258 [ -z "$(CONFIGURE_TARGET_MODULES)" ] \
1259 || $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
1260 CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
1261 # Make links, and run "make diststuff" or "make info" when needed.
1262 rm -rf proto-toplev ; mkdir proto-toplev
1263 set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
1264 for d in $$dirs ; do \
1265 if [ -d $$d ]; then \
1266 if [ ! -f $$d/Makefile ] ; then true ; \
1267 elif grep '^diststuff:' $$d/Makefile >/dev/null ; then \
1268 (cd $$d ; $(MAKE) diststuff ) || exit 1 ; \
1269 elif grep '^info:' $$d/Makefile >/dev/null ; then \
1270 (cd $$d ; $(MAKE) info ) || exit 1 ; \
1272 if [ -d $$d/proto-$$d.dir ]; then \
1273 ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
1275 ln -s ../$$d proto-toplev/$$d ; \
1277 else ln -s ../$$d proto-toplev/$$d ; fi ; \
1279 cd etc ; $(MAKE) info
1282 mkdir proto-toplev/etc
1283 (cd proto-toplev/etc; \
1284 for i in $(ETC_SUPPORT); do \
1285 ln -s ../../etc/$$i . ; \
1288 # Take out texinfo from configurable dirs
1289 rm proto-toplev/configure.in
1290 sed -e '/^host_tools=/s/texinfo //' \
1291 <configure.in >proto-toplev/configure.in
1293 mkdir proto-toplev/texinfo
1294 ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
1295 ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
1296 ln -s ../../texinfo/lgpl.texinfo proto-toplev/texinfo/
1297 ln -s ../../texinfo/tex3patch proto-toplev/texinfo/
1298 chmod og=u `find . -print`
1299 (VER=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
1300 echo "==> Making $(TOOL)-$$VER.tar.gz"; \
1301 rm -f $(TOOL)-$$VER; ln -s proto-toplev $(TOOL)-$$VER; \
1302 tar cfh - $(TOOL)-$$VER \
1303 | $(GZIPPROG) -v -9 >$(TOOL)-$$VER.tar.gz )
1305 TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1306 DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
1309 GAS_SUPPORT_DIRS= bfd include libiberty opcodes
1310 gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
1311 $(MAKE) -f Makefile.in taz TOOL=gas \
1312 SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
1314 # The FSF "binutils" release includes gprof and ld.
1315 .PHONY: binutils.tar.gz
1316 BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof
1317 binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
1318 $(MAKE) -f Makefile.in taz TOOL=binutils \
1319 SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat"
1321 .PHONY: gas+binutils.tar.gz
1322 GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
1323 gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
1324 $(MAKE) -f Makefile.in taz TOOL=gas \
1325 SUPPORT_FILES="$(GASB_SUPPORT_DIRS) makeall.bat configure.bat"
1327 .PHONY: libg++.tar.gz
1328 LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
1329 libg++.tar.gz: $(DIST_SUPPORT) libg++
1330 $(MAKE) -f Makefile.in taz TOOL=libg++ \
1331 SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
1333 GNATS_SUPPORT_DIRS=include libiberty send-pr
1334 gnats.tar.gz: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
1335 $(MAKE) -f Makefile.in taz TOOL=gnats \
1336 SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
1339 GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils
1340 gdb.tar.gz: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
1341 $(MAKE) -f Makefile.in taz TOOL=gdb \
1342 SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
1344 .PHONY: newlib.tar.gz
1345 NEWLIB_SUPPORT_DIRS=libgloss
1346 # taz configures for the sun4 target which won't configure newlib.
1347 # We need newlib configured so that the .info files are made.
1348 # Unfortunately, it is not enough to just configure newlib separately:
1349 # taz will build the .info files but since SUBDIRS won't contain newlib,
1350 # distclean won't be run (leaving Makefile, config.status, and the tmp files
1351 # used in building the .info files, eg: *.def, *.ref).
1352 # The problem isn't solvable however without a lot of extra work because
1353 # target libraries are built in subdir $(target_alias) which gets nuked during
1354 # the make distclean. For now punt on the issue of shipping newlib info files
1355 # with newlib net releases and wait for a day when some native target (sun4?)
1356 # supports newlib (if only minimally).
1357 newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
1358 $(MAKE) -f Makefile.in taz TOOL=newlib \
1359 SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
1360 DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
1366 # end of Makefile.in