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)
76 # start-sanitize-chill
77 CHILLFLAGS = $(CFLAGS)
82 # Use -O2 to stress test the compiler.
84 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
85 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
86 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
90 # Not plain GZIP, since gzip looks there for extra command-line options.
93 # BISON: This line sed'ed to BISON = bison -y for FSF releases, don't remove.
94 BISON = `if [ -f $$r/byacc/byacc ] ; \
95 then echo $$r/byacc/byacc ; \
99 LEX = `if [ -f $$r/flex/flex ] ; \
100 then echo $$r/flex/flex ; \
103 M4 = `if [ -f $$r/m4/m4 ] ; \
104 then echo $$r/m4/m4 ; \
107 MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
108 then echo $$r/texinfo/makeinfo/makeinfo ; \
109 else echo makeinfo ; fi`
111 # This just becomes part of the MAKEINFO definition passed down to
112 # sub-makes. It lets flags be given on the command line while still
113 # using the makeinfo from the object tree.
116 EXPECT = `if [ -f $$r/expect/expect ] ; \
117 then echo $$r/expect/expect ; \
118 else echo expect ; fi`
120 RUNTEST = `if [ -f $${srcroot}/dejagnu/runtest ] ; \
121 then echo $${srcroot}/dejagnu/runtest ; \
122 else echo runtest ; fi`
125 # compilers to use to create programs which must be run in the build
128 CXX_FOR_BUILD = $(CXX)
130 SUBDIRS = "this is set via configure, don't edit this"
133 # This is set by the configure script to the list of directories which
134 # should be built using the target tools.
135 TARGET_CONFIGDIRS = libiberty libgloss newlib libio librx libstdc++ libg++ winsup
137 # Target libraries are put under this directory:
138 TARGET_SUBDIR = . # Changed by configure to $(target_alias) if cross.
140 # This is set by the configure script to the arguments passed to configure.
144 INSTALL_TARGET = install-dirs \
146 $(INSTALL_TARGET_MODULES) \
147 $(INSTALL_X11_MODULES) \
153 if [ -f $$r/gcc/Makefile ] ; then \
154 if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
155 echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $${srcroot}/newlib/libc/include -nostdinc; \
157 echo $$r/gcc/xgcc -B$$r/gcc/; \
160 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
163 t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
167 # start-sanitize-chill
168 CHILL_FOR_TARGET = ` \
169 if [ -f $$r/gcc/Makefile ] ; then \
170 echo $$r/gcc/xgcc -B$$r/gcc/ -L$$r/gcc/ch/runtime/; \
172 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
175 t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
182 if [ -f $$r/gcc/Makefile ] ; then \
183 if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
184 echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $${srcroot}/newlib/libc/include -nostdinc; \
186 echo $$r/gcc/xgcc -B$$r/gcc/; \
189 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
192 t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
197 if [ -f $$r/gas/as.new ] ; then \
198 echo $$r/gas/as.new ; \
200 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
203 t='$(program_transform_name)'; echo as | sed -e 's/x/x/' $$t ; \
208 if [ -f $$r/ld/ld.new ] ; then \
209 echo $$r/ld/ld.new ; \
211 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
214 t='$(program_transform_name)'; echo ld | sed -e 's/x/x/' $$t ; \
218 DLLTOOL_FOR_TARGET = ` \
219 if [ -f $$r/binutils/dlltool ] ; then \
220 echo $$r/binutils/dlltool ; \
222 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
225 t='$(program_transform_name)'; echo dlltool | sed -e 's/x/x/' $$t ; \
230 if [ -f $$r/binutils/ar ] ; then \
231 echo $$r/binutils/ar ; \
233 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
236 t='$(program_transform_name)'; echo ar | sed -e 's/x/x/' $$t ; \
240 RANLIB_FOR_TARGET = ` \
241 if [ -f $$r/binutils/ranlib ] ; then \
242 echo $$r/binutils/ranlib ; \
244 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
247 t='$(program_transform_name)'; echo ranlib | sed -e 's/x/x/' $$t ; \
252 if [ -f $$r/binutils/nm.new ] ; then \
253 echo $$r/binutils/nm.new ; \
255 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
258 t='$(program_transform_name)'; echo nm | sed -e 's/x/x/' $$t ; \
262 #### host and target specific makefile fragments come in here.
265 # Flags to pass down to all sub-makes.
266 # Please keep these in alphabetical order.
267 BASE_FLAGS_TO_PASS = \
268 "AR_FLAGS=$(AR_FLAGS)" \
269 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
270 "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
272 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
273 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
275 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
276 $(start-sanitize-chill)\
277 "CHILLFLAGS=$(CHILLFLAGS)" \
278 "CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \
279 "CHILL_LIB=$(CHILL_LIB)" \
280 $(end-sanitize-chill)\
281 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
282 "CXXFLAGS=$(CXXFLAGS)" \
283 "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
284 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
285 "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \
286 "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
287 "INSTALL=$(INSTALL)" \
288 "INSTALL_DATA=$(INSTALL_DATA)" \
289 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
290 "INSTALL_XFORM=$(INSTALL_XFORM)" \
291 "LDFLAGS=$(LDFLAGS)" \
293 "LD_FOR_TARGET=$(LD_FOR_TARGET)" \
294 "LIBCFLAGS=$(LIBCFLAGS)" \
295 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
296 "LIBCXXFLAGS=$(LIBCXXFLAGS)" \
297 "LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
299 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
300 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
301 "PICFLAG=$(PICFLAG)" \
302 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
303 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
306 "RUNTEST=$(RUNTEST)" \
307 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
309 "exec_prefix=$(exec_prefix)" \
313 # Flags to pass down to most sub-makes, in which we're building with
314 # the host environment.
315 # If any variables are added here, they must be added to do-*, below.
324 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
326 # Flags that are concerned with the location of the X11 include files
329 # NOTE: until the top-level is getting the values via autoconf, it only
330 # causes problems to have this top-level Makefile overriding the autoconf-set
331 # values in child directories. Only variables that don't conflict with
332 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
334 X11_FLAGS_TO_PASS = \
335 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
336 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
338 # Flags to pass down to makes which are built with the target environment.
339 # The double $ decreases the length of the command line; the variables
340 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
341 # If any variables are added here, they must be added to do-*, below.
342 EXTRA_TARGET_FLAGS = \
343 'AR=$$(AR_FOR_TARGET)' \
344 'AS=$$(AS_FOR_TARGET)' \
345 'CC=$$(CC_FOR_TARGET)' \
346 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
347 'CXX=$$(CXX_FOR_TARGET)' \
348 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
349 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
350 'LD=$$(LD_FOR_TARGET)' \
351 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
352 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
353 'NM=$$(NM_FOR_TARGET)' \
354 'PICFLAG=$$(PICFLAG_FOR_TARGET)' \
355 'RANLIB=$$(RANLIB_FOR_TARGET)'
357 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
359 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
360 # unfortunately needs the native compiler and the target ar and
362 # If any variables are added here, they must be added to do-*, below.
363 # The HOST_* variables are a special case, which are used for the gcc
364 # cross-building scheme.
366 'AR=$$(AR_FOR_TARGET)' \
370 'HOST_CC=$(CC_FOR_BUILD)' \
371 'HOST_PREFIX=$(HOST_PREFIX)' \
372 'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
374 'RANLIB=$$(RANLIB_FOR_TARGET)' \
375 `if test x"$(LANGUAGES)" != x; then echo "LANGUAGES=$(LANGUAGES)"; fi` \
376 `if test x"$(STMP_FIXPROTO)" != x; then echo "STMP_FIXPROTO=$(STMP_FIXPROTO)"; fi` \
377 `if test x"$(LIMITS_H_TEST)" != x; then echo "LIMITS_H_TEST=$(LIMITS_H_TEST)"; fi` \
378 `if test x"$(LIBGCC1_TEST)" != x; then echo "LIBGCC1_TEST=$(LIBGCC1_TEST)"; fi` \
379 `if test x"$(LIBGCC2_CFLAGS)" != x; then echo "LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)"; fi` \
380 `if test x"$(LIBGCC2_INCLUDES)" != x; then echo "LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)"; fi` \
381 `if test x"$(ENQUIRE)" != x; then echo "ENQUIRE=$(ENQUIRE)"; fi` \
382 `if test x"$(BOOT_CFLAGS)" != x; then echo "BOOT_CFLAGS=$(BOOT_CFLAGS)"; fi`
384 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
386 # This is a list of the targets for all of the modules which are compiled
387 # using $(FLAGS_TO_PASS).
435 # This is a list of the check targets for all of the modules which are
436 # compiled using $(FLAGS_TO_PASS).
437 # This is a list of the check targets for all of the modules which are
438 # compiled using $(FLAGS_TO_PASS).
440 # The list is in two parts. The first lists those tools which
441 # are tested as part of the host's native tool-chain, and not
442 # tested in a cross configuration.
443 NATIVE_CHECK_MODULES = \
447 CROSS_CHECK_MODULES = \
489 CHECK_MODULES=$(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
491 # This is a list of the install targets for all of the modules which are
492 # compiled using $(FLAGS_TO_PASS).
539 # This is a list of the targets for all of the modules which are compiled
540 # using $(X11_FLAGS_TO_PASS).
550 # This is a list of the check targets for all of the modules which are
551 # compiled using $(X11_FLAGS_TO_PASS).
552 CHECK_X11_MODULES = \
560 # This is a list of the install targets for all the modules which are
561 # compiled using $(X11_FLAGS_TO_PASS).
562 INSTALL_X11_MODULES = \
571 # This is a list of the targets for all of the modules which are compiled
572 # using $(TARGET_FLAGS_TO_PASS).
573 ALL_TARGET_MODULES = \
575 all-target-libstdc++ \
580 all-target-libgloss \
581 all-target-libiberty \
584 # This is a list of the configure targets for all of the modules which
585 # are compiled using the target tools.
586 CONFIGURE_TARGET_MODULES = \
587 configure-target-libio \
588 configure-target-libstdc++ \
589 configure-target-librx \
590 configure-target-libg++ \
591 configure-target-newlib \
592 configure-target-winsup \
593 configure-target-libgloss \
594 configure-target-libiberty \
595 configure-target-examples
597 # This is a list of the check targets for all of the modules which are
598 # compiled using $(TARGET_FLAGS_TO_PASS).
599 CHECK_TARGET_MODULES = \
601 check-target-libstdc++ \
602 check-target-libg++ \
603 check-target-newlib \
604 check-target-winsup \
605 check-target-libiberty
607 # This is a list of the install targets for all of the modules which are
608 # compiled using $(TARGET_FLAGS_TO_PASS).
609 INSTALL_TARGET_MODULES = \
610 install-target-libio \
611 install-target-libstdc++ \
612 install-target-libg++ \
613 install-target-newlib \
614 install-target-winsup \
615 install-target-libgloss \
616 install-target-libiberty
618 # The first rule in the file had better be this one. Don't put any above it.
622 # The target built for a native build.
626 $(ALL_TARGET_MODULES) \
630 # Do a target for all the subdirectories. A ``make do-X'' will do a
631 # ``make X'' in all subdirectories (because, in general, there is a
632 # dependency (below) of X upon do-X, a ``make X'' will also do this,
633 # but it may do additional work as well).
634 # This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
635 # because it is so large that it can easily overflow the command line
636 # length limit on some systems.
645 do-maintainer-clean \
649 @target=`echo $@ | sed -e 's/^do-//'`; \
651 srcroot=`cd $(srcdir); pwd`; export srcroot; \
652 for i in $(SUBDIRS) -dummy-; do \
653 if [ -f ./$$i/Makefile ]; then \
656 for flag in $(EXTRA_GCC_FLAGS); do \
657 eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
661 for flag in $(EXTRA_HOST_FLAGS); do \
662 eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
666 export AR AS CC CXX NM RANLIB; \
668 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
669 "CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
670 "RANLIB=$${RANLIB}" \
672 then true; else exit 1; fi; \
675 @target=`echo $@ | sed -e 's/^do-//'`; \
677 srcroot=`cd $(srcdir); pwd`; export srcroot; \
678 for i in $(TARGET_CONFIGDIRS) -dummy-; do \
679 if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \
680 for flag in $(EXTRA_TARGET_FLAGS); do \
681 eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
683 export AR AS CC CXX NM RANLIB; \
684 if (cd $(TARGET_SUBDIR)/$$i; \
685 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
686 "CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
687 "RANLIB=$${RANLIB}" \
689 then true; else exit 1; fi; \
693 # Here are the targets which correspond to the do-X targets.
695 .PHONY: info installcheck dvi install-info
696 .PHONY: clean distclean mostlyclean maintainer-clean realclean
697 .PHONY: local-clean local-distclean local-maintainer-clean
699 installcheck: do-installcheck
702 install-info: do-install-info dir.info
703 srcroot=`cd $(srcdir); pwd`; export srcroot; \
704 if [ -f dir.info ] ; then \
705 $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
709 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
712 -rm -f Makefile config.status
713 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
714 rm -rf $(TARGET_SUBDIR); \
717 local-maintainer-clean:
718 @echo "This command is intended for maintainers to use;"
719 @echo "it deletes files that may require special tools to rebuild."
721 clean: do-clean local-clean
722 mostlyclean: do-mostlyclean local-clean
723 distclean: do-distclean local-clean local-distclean
724 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
725 maintainer-clean: local-distclean
726 realclean: maintainer-clean
731 check: $(CHECK_MODULES) \
732 $(CHECK_TARGET_MODULES) \
733 $(CHECK_X11_MODULES) \
736 # Installation targets.
738 .PHONY: install uninstall source-vault binary-vault vault-install
739 install: $(INSTALL_TARGET)
742 @echo "the uninstall target is not supported in this tree"
745 $(MAKE) -f ./release/Build-A-Release \
746 host=$(host_alias) source-vault
749 $(MAKE) -f ./release/Build-A-Release \
750 host=$(host_alias) target=$(target_alias)
753 @if [ -f ./release/vault-install ] ; then \
754 ./release/vault-install $(host_alias) $(target_alias) ; \
760 install.all: install-no-fixedincludes
761 @if [ -f ./gcc/Makefile ] ; then \
762 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; \
794 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
795 rm -rf gcc/include; \
796 mv gcc/tmp-include gcc/include 2>/dev/null; \
799 # This rule is used to build the modules which use FLAGS_TO_PASS. To
800 # build a target all-X means to cd to X and make all.
802 # all-gui, and all-libproc are handled specially because
803 # they are still experimental, and if they fail to build, that
804 # shouldn't stop "make all".
805 .PHONY: $(ALL_MODULES) all-gui all-libproc
806 $(ALL_MODULES) all-gui all-libproc:
807 @dir=`echo $@ | sed -e 's/all-//'`; \
808 if [ -f ./$${dir}/Makefile ] ; then \
810 srcroot=`cd $(srcdir); pwd`; export srcroot; \
811 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
816 # These rules are used to check the modules which use FLAGS_TO_PASS.
817 # To build a target check-X means to cd to X and make check. Some
818 # modules are only tested in a native toolchain.
820 .PHONY: $(CHECK_MODULES) $(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
821 $(NATIVE_CHECK_MODULES):
822 @if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
823 dir=`echo $@ | sed -e 's/check-//'`; \
824 if [ -f ./$${dir}/Makefile ] ; then \
826 srcroot=`cd $(srcdir); pwd`; export srcroot; \
827 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
833 $(CROSS_CHECK_MODULES):
834 @dir=`echo $@ | sed -e 's/check-//'`; \
835 if [ -f ./$${dir}/Makefile ] ; then \
837 srcroot=`cd $(srcdir); pwd`; export srcroot; \
838 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
843 # This rule is used to install the modules which use FLAGS_TO_PASS.
844 # To build a target install-X means to cd to X and make install.
845 .PHONY: $(INSTALL_MODULES)
846 $(INSTALL_MODULES): install-dirs
847 @dir=`echo $@ | sed -e 's/install-//'`; \
848 if [ -f ./$${dir}/Makefile ] ; then \
850 srcroot=`cd $(srcdir); pwd`; export srcroot; \
851 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
856 # This rule is used to configure the modules which are built with the
858 .PHONY: $(CONFIGURE_TARGET_MODULES)
859 $(CONFIGURE_TARGET_MODULES):
860 @dir=`echo $@ | sed -e 's/configure-target-//'`; \
861 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
863 elif echo " $(TARGET_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
864 if [ -d $(srcdir)/$${dir} ]; then \
865 [ -d $(TARGET_SUBDIR)/$${dir} ] || mkdir $(TARGET_SUBDIR)/$${dir};\
867 srcroot=`cd $(srcdir); pwd`; export srcroot; \
868 AR="$(AR_FOR_TARGET)"; export AR; \
869 AS="$(AS_FOR_TARGET)"; export AS; \
870 CC="$(CC_FOR_TARGET)"; export CC; \
871 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
872 CXX="$(CXX_FOR_TARGET)"; export CXX; \
873 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
874 LD="$(LD_FOR_TARGET)"; export LD; \
875 NM="$(NM_FOR_TARGET)"; export NM; \
876 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
877 echo Configuring in $(TARGET_SUBDIR)/$${dir}; \
878 cd $(TARGET_SUBDIR)/$${dir}; \
881 topdir=$(srcdir) ;; \
883 case "$(TARGET_SUBDIR)" in \
884 .) topdir="../$(srcdir)" ;; \
885 *) topdir="../../$(srcdir)" ;; \
888 if [ "$(srcdir)" = "." ] ; then \
889 if [ "$(TARGET_SUBDIR)" != "." ] ; then \
890 if $(SHELL) $${srcroot}/symlink-tree $${topdir}/$${dir} "Makefile" ; then \
898 srcdiroption="--srcdir=."; \
901 srcdiroption="--srcdir=$${topdir}/$${dir}"; \
902 libsrcdir="$${srcroot}/$${dir}"; \
904 if [ -f $${libsrcdir}/configure ] ; then \
905 $(SHELL) $${libsrcdir}/configure \
906 $(CONFIG_ARGUMENTS) $${srcdiroption} \
907 --with-target-subdir="$(TARGET_SUBDIR)"; \
909 $(SHELL) $${srcroot}/configure \
910 $(CONFIG_ARGUMENTS) $${srcdiroption} \
911 --with-target-subdir="$(TARGET_SUBDIR)"; \
920 # This rule is used to build the modules which use TARGET_FLAGS_TO_PASS.
921 # To build a target all-X means to cd to X and make all.
922 .PHONY: $(ALL_TARGET_MODULES)
923 $(ALL_TARGET_MODULES):
924 @dir=`echo $@ | sed -e 's/all-target-//'`; \
925 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
927 srcroot=`cd $(srcdir); pwd`; export srcroot; \
928 (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
933 # This rule is used to check the modules which use TARGET_FLAGS_TO_PASS.
934 # To build a target install-X means to cd to X and make install.
935 .PHONY: $(CHECK_TARGET_MODULES)
936 $(CHECK_TARGET_MODULES):
937 @dir=`echo $@ | sed -e 's/check-target-//'`; \
938 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
940 srcroot=`cd $(srcdir); pwd`; export srcroot; \
941 (cd $(TARGET_SUBDIR)/$${dir};$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\
946 # This rule is used to install the modules which use
947 # TARGET_FLAGS_TO_PASS. To build a target install-X means to cd to X
949 .PHONY: $(INSTALL_TARGET_MODULES)
950 $(INSTALL_TARGET_MODULES): install-dirs
951 @dir=`echo $@ | sed -e 's/install-target-//'`; \
952 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
954 srcroot=`cd $(srcdir); pwd`; export srcroot; \
955 (cd $(TARGET_SUBDIR)/$${dir}; \
956 $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
961 # This rule is used to build the modules which use X11_FLAGS_TO_PASS.
962 # To build a target all-X means to cd to X and make all.
963 .PHONY: $(ALL_X11_MODULES)
965 @dir=`echo $@ | sed -e 's/all-//'`; \
966 if [ -f ./$${dir}/Makefile ] ; then \
968 srcroot=`cd $(srcdir); pwd`; export srcroot; \
970 $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
975 # This rule is used to check the modules which use X11_FLAGS_TO_PASS.
976 # To build a target check-X means to cd to X and make all.
977 .PHONY: $(CHECK_X11_MODULES)
978 $(CHECK_X11_MODULES):
979 @dir=`echo $@ | sed -e 's/check-//'`; \
980 if [ -f ./$${dir}/Makefile ] ; then \
982 srcroot=`cd $(srcdir); pwd`; export srcroot; \
984 $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
989 # This rule is used to install the modules which use X11_FLAGS_TO_PASS.
990 # To build a target install-X means to cd to X and make install.
991 .PHONY: $(INSTALL_X11_MODULES)
992 $(INSTALL_X11_MODULES):
993 @dir=`echo $@ | sed -e 's/install-//'`; \
994 if [ -f ./$${dir}/Makefile ] ; then \
996 srcroot=`cd $(srcdir); pwd`; export srcroot; \
998 $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
1003 # gcc is the only module which uses GCC_FLAGS_TO_PASS.
1006 @if [ -f ./gcc/Makefile ] ; then \
1007 r=`pwd`; export r; \
1008 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1009 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
1014 .PHONY: all-bootstrap
1016 @if [ -f ./gcc/Makefile ] ; then \
1017 r=`pwd`; export r; \
1018 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1019 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) bootstrap); \
1026 @if [ -f ./gcc/Makefile ] ; then \
1027 r=`pwd`; export r; \
1028 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1029 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
1036 @if [ -f ./gcc/Makefile ] ; then \
1037 r=`pwd`; export r; \
1038 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1039 (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1045 # EXPERIMENTAL STUFF
1046 # This rule is used to install the modules which use FLAGS_TO_PASS.
1047 # To build a target install-X means to cd to X and make install.
1048 .PHONY: install-dosrel
1049 install-dosrel: install-dirs info
1050 @dir=`echo $@ | sed -e 's/install-//'`; \
1051 if [ -f ./$${dir}/Makefile ] ; then \
1052 r=`pwd`; export r; \
1053 srcroot=`cd $(srcdir); pwd`; export srcroot; \
1054 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
1059 install-dosrel-fake:
1062 # This is a list of inter-dependencies among modules.
1063 all-autoconf: all-m4
1065 all-binutils: all-libiberty all-opcodes all-bfd all-flex all-byacc
1068 all-dejagnu: all-tcl all-expect all-tk
1069 all-diff: all-libiberty
1071 all-emacs19: all-byacc
1073 configure-target-examples: $(ALL_GCC)
1074 all-target-examples: configure-target-examples
1075 all-expect: all-tcl all-tk
1076 all-fileutils: all-libiberty
1078 all-flex: all-libiberty all-byacc
1079 all-gas: all-libiberty all-opcodes all-bfd
1083 all-gcc: all-libiberty all-byacc all-binutils all-gas all-ld
1084 all-bootstrap: all-libiberty all-byacc all-binutils all-gas all-ld
1085 GDB_TK = all-tk all-tcl
1086 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
1087 all-gprof: all-libiberty all-bfd
1088 all-grep: all-libiberty
1089 all-grez: all-libiberty all-bfd
1090 all-gui: all-gdb all-libproc all-target-librx
1091 all-gzip: all-libiberty
1092 all-hello: all-libiberty
1094 all-ispell: all-emacs19
1095 all-ld: all-libiberty all-bfd all-byacc all-flex
1096 configure-target-libg++: $(ALL_GCC) configure-target-librx
1097 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++
1098 configure-target-libgloss: $(ALL_GCC)
1099 all-target-libgloss: configure-target-libgloss configure-target-newlib
1100 configure-target-libio: $(ALL_GCC)
1101 all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
1103 configure-target-librx: $(ALL_GCC) configure-target-newlib
1104 all-target-librx: configure-target-librx
1105 configure-target-libstdc++: $(ALL_GCC)
1106 all-target-libstdc++: configure-target-libstdc++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
1107 all-m4: all-libiberty
1108 all-make: all-libiberty
1110 configure-target-newlib: $(ALL_GCC)
1111 all-target-newlib: configure-target-newlib all-binutils all-gas all-gcc
1112 all-opcodes: all-bfd
1113 all-patch: all-libiberty
1114 all-prms: all-libiberty
1117 all-recode: all-libiberty
1118 all-sed: all-libiberty
1119 all-send-pr: all-prms
1121 all-sim: all-libiberty all-bfd
1122 all-tar: all-libiberty
1124 all-tclX: all-tcl all-tk
1126 all-texinfo: all-libiberty
1128 all-tgas: all-libiberty all-bfd
1131 all-target-winsup: all-target-newlib configure-target-winsup
1132 configure-target-winsup: configure-target-newlib
1133 all-uudecode: all-libiberty
1134 configure-target-libiberty: $(ALL_GCC)
1135 all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
1137 ### other supporting targets
1144 .PHONY: install-dirs
1146 @for i in $(MAKEDIRS) ; do \
1147 echo Making $$i... ; \
1148 parent=`echo $$i | sed -e 's@/[^/]*$$@@' | sed -e 's@^$$@/@'`; \
1149 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi ; \
1150 if [ ! -d $$i ] ; then \
1151 if mkdir $$i ; then \
1162 dir.info: do-install-info
1163 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
1164 $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
1165 mv -f dir.info.new dir.info ; \
1170 @echo "Building a full distribution of this tree isn't done"
1171 @echo "via 'make dist'. Check out the etc/ subdirectory"
1175 # Right now this just builds TAGS in each subdirectory. emacs19 has the
1176 # ability to use several tags files at once, so there is probably no need
1177 # to combine them into one big TAGS file (like CVS 1.3 does). We could
1178 # (if we felt like it) have this Makefile write a piece of elisp which
1179 # the user could load to tell emacs19 where all the TAGS files we just
1183 # with the gnu make, this is done automatically.
1185 Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
1186 $(SHELL) ./config.status
1189 # Support for building net releases
1191 # Files in devo used in any net release.
1192 # ChangeLog omitted because it may refer to files which are not in this
1193 # distribution (perhaps it would be better to include it anyway).
1194 DEVO_SUPPORT= README Makefile.in configure configure.in \
1195 config.guess config.sub config move-if-change \
1196 mpw-README mpw-build.in mpw-config.in mpw-configure \
1197 COPYING COPYING.LIB install.sh config-ml.in symlink-tree
1199 # Files in devo/etc used in any net release.
1200 # ChangeLog omitted because it may refer to files which are not in this
1201 # distribution (perhaps it would be better to include it anyway).
1202 ETC_SUPPORT= Makefile.in cfg-paper.texi configure.in configure.man \
1203 configure.texi standards.texi make-stds.texi \
1204 configure.info* standards.info* cfg-paper.info*
1206 # When you use `make setup-dirs' or `make taz' you should always redefine
1208 SUPPORT_FILES = list-of-support-files-for-tool-in-question
1209 # Files where "byacc" (Cygnus version) should be changed to "bison -y" (FSF).
1210 DISTBISONFILES= binutils/Makefile.in gas/Makefile.in gdb/Makefile.in
1214 taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
1215 texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1216 # Make sure "diststuff" files get built properly.
1217 for f in $(DISTBISONFILES) ; do \
1218 if [ -r $$f ]; then \
1219 sed '/^BISON *=.*$$/s/.*/BISON = bison -y/' <$$f >tmp ; \
1223 # Take out texinfo from a few places; make simple BISON=bison line.
1224 sed -e '/^all\.normal: /s/\all-texinfo //' \
1225 -e '/^ install-texinfo /d' \
1226 -e '/^BISON = /,/^$$/d' \
1227 -e '/^# BISON:/s/.*/BISON = bison -y/' \
1229 mv -f tmp Makefile.in
1231 $(start-sanitize-Sanitize)
1232 @if [ -f .Sanitize ] ; then echo "RUN Sanitize FIRST!" ; false ; fi ;
1233 $(end-sanitize-Sanitize)
1235 [ -z "$(CONFIGURE_TARGET_MODULES)" ] \
1236 || $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
1237 CC_FOR_TARGET="$(CC) CXX_FOR_TARGET="$(CXX)"
1238 # Make links, and run "make diststuff" or "make info" when needed.
1239 rm -rf proto-toplev ; mkdir proto-toplev
1240 set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
1241 for d in $$dirs ; do \
1242 if [ -d $$d ]; then \
1243 if [ ! -f $$d/Makefile ] ; then true ; \
1244 elif grep '^diststuff:' $$d/Makefile >/dev/null ; then \
1245 (cd $$d ; $(MAKE) diststuff ) || exit 1 ; \
1246 elif grep '^info:' $$d/Makefile >/dev/null ; then \
1247 (cd $$d ; $(MAKE) info ) || exit 1 ; \
1249 if [ -d $$d/proto-$$d.dir ]; then \
1250 ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
1252 ln -s ../$$d proto-toplev/$$d ; \
1254 else ln -s ../$$d proto-toplev/$$d ; fi ; \
1256 cd etc ; $(MAKE) info
1259 mkdir proto-toplev/etc
1260 (cd proto-toplev/etc; \
1261 for i in $(ETC_SUPPORT); do \
1262 ln -s ../../etc/$$i . ; \
1265 # Take out texinfo from configurable dirs
1266 rm proto-toplev/configure.in
1267 sed -e '/^host_tools=/s/texinfo //' \
1268 <configure.in >proto-toplev/configure.in
1270 mkdir proto-toplev/texinfo
1271 ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
1272 ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
1273 ln -s ../../texinfo/lgpl.texinfo proto-toplev/texinfo/
1274 ln -s ../../texinfo/tex3patch proto-toplev/texinfo/
1275 chmod og=u `find . -print`
1276 (VER=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
1277 echo "==> Making $(TOOL)-$$VER.tar.gz"; \
1278 rm -f $(TOOL)-$$VER; ln -s proto-toplev $(TOOL)-$$VER; \
1279 tar cfh - $(TOOL)-$$VER \
1280 | $(GZIPPROG) -v -9 >$(TOOL)-$$VER.tar.gz )
1282 TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
1283 DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
1286 GAS_SUPPORT_DIRS= bfd include libiberty opcodes
1287 gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
1288 $(MAKE) -f Makefile.in taz TOOL=gas \
1289 SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
1291 # The FSF "binutils" release includes gprof and ld.
1292 .PHONY: binutils.tar.gz
1293 BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof
1294 binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
1295 $(MAKE) -f Makefile.in taz TOOL=binutils \
1296 SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat"
1298 .PHONY: gas+binutils.tar.gz
1299 GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
1300 gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
1301 $(MAKE) -f Makefile.in taz TOOL=gas \
1302 SUPPORT_FILES="$(GASB_SUPPORT_DIRS) makeall.bat configure.bat"
1304 .PHONY: libg++.tar.gz
1305 LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
1306 libg++.tar.gz: $(DIST_SUPPORT) libg++
1307 $(MAKE) -f Makefile.in taz TOOL=libg++ \
1308 SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
1310 GNATS_SUPPORT_DIRS=include libiberty send-pr
1311 gnats.tar.gz: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
1312 $(MAKE) -f Makefile.in taz TOOL=gnats \
1313 SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
1316 GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils
1317 GDBTK_SUPPORT_DIRS= `if [ -d tcl -a -d tk ] ; then echo tcl tk ; fi`
1318 gdb.tar.gz: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
1319 $(MAKE) -f Makefile.in taz TOOL=gdb \
1320 SUPPORT_FILES="$(GDB_SUPPORT_DIRS) $(GDBTK_SUPPORT_DIRS)"
1322 .PHONY: newlib.tar.gz
1323 NEWLIB_SUPPORT_DIRS=libgloss
1324 # taz configures for the sun4 target which won't configure newlib.
1325 # We need newlib configured so that the .info files are made.
1326 # Unfortunately, it is not enough to just configure newlib separately:
1327 # taz will build the .info files but since SUBDIRS won't contain newlib,
1328 # distclean won't be run (leaving Makefile, config.status, and the tmp files
1329 # used in building the .info files, eg: *.def, *.ref).
1330 # The problem isn't solvable however without a lot of extra work because
1331 # target libraries are built in subdir $(target_alias) which gets nuked during
1332 # the make distclean. For now punt on the issue of shipping newlib info files
1333 # with newlib net releases and wait for a day when some native target (sun4?)
1334 # supports newlib (if only minimally).
1335 newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
1336 $(MAKE) -f Makefile.in taz TOOL=newlib \
1337 SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
1338 DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
1343 # start-sanitize-chill
1344 ## This is ugly, but I don't want GNU make to put these variables in
1345 ## the environment. Older makes will see this as a set of targets
1346 ## with no dependencies and no actions.
1347 unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
1348 # end-sanitize-chill
1350 # end of Makefile.in