OSDN Git Service

2006-02-20 Paolo Bonzini <bonzini@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / Make-lang.in
index f12c19c..575d8bf 100644 (file)
@@ -1,6 +1,6 @@
 # -*- makefile -*-
 # Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler.
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 # Contributed by Paul Brook <paul@nowt.org
 # and Steven Bosscher <s.bosscher@student.tudelft.nl>
 
 
 #You should have received a copy of the GNU General Public License
 #along with GCC; see the file COPYING.  If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330,
-#Boston, MA 02111-1307, USA.
+#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+#Boston, MA 02110-1301, USA.
 
 # This file provides the language dependent support in the main Makefile.
 # Each language makefile fragment must provide the following targets:
 #
-# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
-# foo.info, foo.dvi,
-# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
-# foo.uninstall, foo.distdir,
+# foo.all.cross, foo.start.encap, foo.rest.encap,
+# foo.info
+# foo.install-common, foo.install-info, foo.install-man,
+# foo.uninstall, foo.install-info, foo.dvi, foo.html,
 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
 #
 # $(srcdir) must be set to the gcc/ source directory (*not* gcc/fortran/).
 
 # Actual name to use when installing a native compiler.
-GFORTRAN_INSTALL_NAME = `echo gfortran|sed '$(program_transform_name)'`
-
-# Actual name to use when installing a cross-compiler.
-GFORTRAN_CROSS_NAME = `echo gfortran|sed '$(program_transform_cross_name)'`
+GFORTRAN_INSTALL_NAME := $(shell echo gfortran|sed '$(program_transform_name)')
+GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed '$(program_transform_name)')
 
 #^L
 
-# This is in addition to the warning flags defined by default.
-# You can use it to enable/disable warnings globally or for specific
-# files, e.g.
-# fortran-warn = -Wno-strict-prototypes
-# fortran/arith.o-warn = -Wno-error
-#
-# We don't need these cheats, everything builds fine with all warnings
-# enabled and -Werror.
+# Use strict warnings for this front end.
+fortran-warn = $(STRICT_WARN)
+
+# These files get warnings from an inline function in GMP saying:
+# "control may reach end of non-void function '__gmpz_get_ui' being inlined"
+fortran/expr.o-warn = -Wno-error
+fortran/resolve.o-warn = -Wno-error
+fortran/simplify.o-warn = -Wno-error
+fortran/trans-common.o-warn = -Wno-error
 
 # These are the groups of object files we have.  The F95_PARSER_OBJS are
 # all the front end files, the F95_OBJS are the files for the translation
-# from the parse tree to GENERIC, and F95_ADDITIONAL_OBJS are the files
-# from the middle end we depend on.
+# from the parse tree to GENERIC
 
-F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o fortran/check.o\
-    fortran/decl.o fortran/error.o fortran/expr.o fortran/interface.o \
-    fortran/intrinsic.o fortran/io.o fortran/iresolve.o fortran/match.o \
-    fortran/matchexp.o fortran/misc.o fortran/module.o fortran/parse.o \
-    fortran/primary.o fortran/options.o fortran/resolve.o \
-    fortran/scanner.o fortran/simplify.o fortran/st.o fortran/symbol.o \
-    fortran/dump-parse-tree.o
+F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \
+    fortran/check.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o \
+    fortran/error.o fortran/expr.o fortran/interface.o \
+    fortran/intrinsic.o fortran/io.o fortran/iresolve.o \
+    fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \
+    fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o \
+    fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o \
+    fortran/symbol.o
 
 F95_OBJS = $(F95_PARSER_OBJS) \
-    fortran/f95-lang.o fortran/convert.o fortran/trans.o fortran/trans-decl.o \
-    fortran/trans-types.o fortran/trans-const.o fortran/trans-expr.o \
-    fortran/trans-stmt.o fortran/trans-io.o fortran/trans-array.o \
-    fortran/trans-intrinsic.o fortran/dependency.o fortran/trans-common.o \
-    fortran/data.o
-
-# FIXME:
-# We rely on c-semantics to expand from GIMPLE to RTL.
-# This should go away once a real GIMPLE expander is available. 
-F95_ADDITIONAL_OBJS = \
-       tree-cfg.o tree-dfa.o tree-optimize.o tree-gimple.o \
-       tree-ssa.o tree-ssa-ccp.o tree-ssa-dce.o \
-       tree-alias-common.o tree-alias-type.o gimplify.o stor-layout.o
+    fortran/convert.o fortran/dependency.o fortran/f95-lang.o \
+    fortran/trans.o fortran/trans-array.o fortran/trans-common.o \
+    fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o \
+    fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \
+    fortran/trans-stmt.o fortran/trans-types.o
 
 # GFORTRAN uses GMP for its internal arithmetics.
 F95_LIBS = $(GMPLIBS) $(LIBS)
 
 #\f
 # Define the names for selecting gfortran in LANGUAGES.
-F95 f95: f951$(exeext)
+FORTRAN fortran: f951$(exeext)
 
 # Tell GNU make to ignore files by these names if they exist.
 .PHONY: F95 f95
@@ -113,40 +104,42 @@ gfortran-cross$(exeext): gfortran$(exeext)
        cp gfortran$(exeext) gfortran-cross$(exeext)
 
 # The compiler itself is called f951.
-f951$(exeext): $(F95_OBJS) $(F95_ADDITIONAL_OBJS) \
+f951$(exeext): $(F95_OBJS) \
                $(BACKEND) $(LIBDEPS)
        $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-               $(F95_OBJS) $(F95_ADDITIONAL_OBJS) $(BACKEND) $(F95_LIBS)
-
-gt-fortran-f95-lang.h gtype-fortran.h        : s-gtype; @true
-gt-fortran-trans-decl.h gt-fortran-trans.h    : s-gtype; @true
-gt-fortran-trans-io.h gt-fortran-trans-types.h: s-gtype; @true
-gt-fortran-trans-intrinsic.h                 : s-gtype; @true
+               $(F95_OBJS) $(BACKEND) $(F95_LIBS)
 
+gt-fortran-trans.h    : s-gtype; @true
 #\f
 # Build hooks:
 
-f95.all.build: gfortran$(exeext)
-f95.all.cross: gfortran-cross$(exeext)
+fortran.all.cross: gfortran-cross$(exeext)
 
-f95.start.encap: gfortran$(exeext)
-f95.rest.encap:
+fortran.start.encap: gfortran$(exeext)
+fortran.rest.encap:
 
-f95.srcinfo: fortran/gfortran.info
+fortran.srcinfo: doc/gfortran.info
        -cp -p $^ $(srcdir)/fortran
 
-f95.tags: force
+fortran.tags: force
        cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
        etags --include TAGS.sub --include ../TAGS.sub
 
-f95.info: fortran/gfortran.info
-f95.dvi: fortran/gfortran.dvi
-f95.generated-manpages:
+fortran.info: doc/gfortran.info
+fortran.dvi: doc/gfortran.dvi
+fortran.html: $(htmldir)/gfortran/index.html
+
+F95_MANFILES = doc/gfortran.1
+
+fortran.man: $(F95_MANFILES)
+
+fortran.srcman: $(F95_MANFILES)
+       -cp -p $^ $(srcdir)/doc
 
-f95.man:
-f95.srcman:
+fortran.srcextra:
 
 check-f95 : check-gfortran
+check-fortran : check-gfortran
 lang_checks += check-gfortran
 
 # GFORTRAN documentation.
@@ -156,76 +149,74 @@ GFORTRAN_TEXI = \
   $(srcdir)/doc/include/fdl.texi \
   $(srcdir)/doc/include/gpl.texi \
   $(srcdir)/doc/include/funding.texi \
-  $(srcdir)/doc/include/gcc-common.texi
+  $(srcdir)/doc/include/gcc-common.texi \
+  gcc-vers.texi
 
-fortran/gfortran.info: $(GFORTRAN_TEXI)
+doc/gfortran.info: $(GFORTRAN_TEXI)
        if [ x$(BUILD_INFO) = xinfo ]; then \
-         rm -f fortran/gfortran.info-*; \
-         $(MAKEINFO) -I$(srcdir)/doc/include -I$(srcdir)/fortran \
-           -o fortran/gfortran.info $(srcdir)/fortran/gfortran.texi; \
+         rm -f doc/gfortran.info-*; \
+         $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
+           -o $@ $<; \
        else true; fi
 
-fortran/gfortran.dvi: $(GFORTRAN_TEXI)
-       s=`cd $(srcdir); ${PWD}`; export s; \
-       cd fortran && $(TEXI2DVI) -I $$s/doc/include -I $$s/fortran \
-         $$s/fortran/gfortran.texi
+doc/gfortran.dvi: $(GFORTRAN_TEXI)
+       $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
 
+$(htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
+       $(mkinstalldirs) $(@D)
+       rm -f $(@D)/*
+       $(TEXI2HTML) -I $(docdir)/include -I $(srcdir)/fortran -o $(@D) $<
+
+.INTERMEDIATE: gfortran.pod
+
+gfortran.pod: $(GFORTRAN_TEXI)
+       -$(TEXI2POD) < $(srcdir)/fortran/invoke.texi > $@
+
+# Create or recreate the gfortran private include file directory.
+install-finclude-dir: installdirs
+       -rm -rf $(DESTDIR)$(libsubdir)/finclude
+       mkdir $(DESTDIR)$(libsubdir)/finclude
+       -chmod a+rx $(DESTDIR)$(libsubdir)/finclude
 #\f
 # Install hooks:
 # f951 is installed elsewhere as part of $(COMPILERS).
 
-# Nothing to do here.
-f95.install-normal:
-
 # Install the driver program as $(target)-gfortran
 # and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
-f95.install-common: installdirs
+fortran.install-common: install-finclude-dir installdirs
        -if [ -f f951$(exeext) ] ; then \
+         rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+         $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+         chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
          if [ -f gfortran-cross$(exeext) ] ; then \
-           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
-           $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
-           chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
            if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
              rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
              $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
            else true; fi; \
          else \
-           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
-           $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
-           chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
            rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
            $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
          fi ; \
        fi
 
-# Install the info documentation in $(infodir).
-# Taken from G77 (but then, what is not...)
-f95.install-info: f95.info installdirs
-       if [ -f fortran/gfortran.info ] ; then \
-         rm -f $(DESTDIR)$(infodir)/gfortran.info*; \
-         for f in fortran/gfortran.info*; do \
-             realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
-             $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$realfile; \
-         done; \
-         chmod a-x $(DESTDIR)$(infodir)/gfortran.info*; \
-       else true; fi
-       @if [ -f fortran/gfortran.info ] ; then \
-         if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
-         echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
-           install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
-         else : ; fi; \
-       else : ; fi
+fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
+
+fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
 
-f95.install-man: installdirs
-#TODO: write the gfortran man pages
+$(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
+               installdirs
+       -rm -f $@
+       -$(INSTALL_DATA) $< $@
+       -chmod a-x $@
 
-f95.uninstall:
+fortran.uninstall:
        if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
          echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
          install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
        else : ; fi; \
        rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
-       rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
+       rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
+       rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
        rm -rf $(DESTDIR)$(infodir)/gfortran.info*
 
 #\f
@@ -233,33 +224,34 @@ f95.uninstall:
 # A lot of the ancillary files are deleted by the main makefile.
 # We just have to delete files specific to us.
 
-f95.mostlyclean:
+fortran.mostlyclean:
        -rm -f f951$(exeext)
        -rm -f fortran/*.o
 
-f95.clean:
-f95.distclean:
+fortran.clean:
+fortran.distclean:
        -rm -f fortran/config.status fortran/Makefile
 
-f95.extraclean:
-f95.maintainer-clean:
-       -rm -f fortran/gfortran.info* fortran/gfortran.*aux
+fortran.extraclean:
+fortran.maintainer-clean:
+       -rm -f doc/gfortran.info* fortran/gfortran.*aux
+       -rm -f $(docobjdir)/gfortran.1
 
 #\f
 # Stage hooks:
 # The toplevel makefile has already created stage?/fortran at this point.
 
-f95.stage1: stage1-start
+fortran.stage1: stage1-start
        -mv fortran/*$(objext) stage1/fortran
-f95.stage2: stage2-start
+fortran.stage2: stage2-start
        -mv fortran/*$(objext) stage2/fortran
-f95.stage3: stage3-start
+fortran.stage3: stage3-start
        -mv fortran/*$(objext) stage3/fortran
-f95.stage4: stage4-start
+fortran.stage4: stage4-start
        -mv fortran/*$(objext) stage4/fortran
-f95.stageprofile: stageprofile-start
+fortran.stageprofile: stageprofile-start
        -mv fortran/*$(objext) stageprofile/fortran
-f95.stagefeedback: stageprofile-start
+fortran.stagefeedback: stageprofile-start
        -mv fortran/*$(objext) stagefeedback/fortran
 
 #\f
@@ -275,26 +267,34 @@ $(F95_PARSER_OBJS): fortran/gfortran.h fortran/intrinsic.h fortran/match.h \
                $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
                $(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
                flags.h output.h diagnostic.h errors.h function.h 
+fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
 
 GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/intrinsic.h fortran/trans-array.h \
     fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
     fortran/trans-stmt.h fortran/trans-types.h \
-    $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h
+    $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H)
 
 fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
-  gt-fortran-f95-lang.h gtype-fortran.h cgraph.h
+  gt-fortran-f95-lang.h gtype-fortran.h cgraph.h $(TARGET_H) \
+  $(BUILTINS_DEF) fortran/types.def
+fortran/scanner.o: toplev.h
 fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
 fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h cgraph.h
-fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h
+fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
+  cgraph.h $(TARGET_H) function.h $(FLAGS_H) $(RTL_H) tree-gimple.h \
+  tree-dump.h
+fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
+  real.h toplev.h $(TARGET_H)
 fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h
+fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
+fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
+fortran/trans-openmp.o: $(GFORTRAN_TRANS_DEPS)
+fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \
+  fortran/ioparm.def
 fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS)
 fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
   gt-fortran-trans-intrinsic.h
-fortran/dependency.o: fortran/gfortran.h fortran/dependency.h
-fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) fortran/gfortran.h
-fortran/data.c: $(GFORTRAN_TRANS_DEPS)
+fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
+fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H)
+fortran/resolve.o: fortran/dependency.h