From 9d65c5cb5765b9b45447850e37dcfa6d67d079f6 Mon Sep 17 00:00:00 2001
From: Mike Stump <mrs@apple.com>
Date: Sat, 13 Nov 2004 07:35:55 +0000
Subject: [PATCH] Makefile.in: Add html support.

        * Makefile.in: Add html support.
        * java/Make-lang.in: Likewise.
        * fortran/Make-lang.in: Likewise.
        * treelang/Make-lang.in: Likewise.
        * doc/install.texi: Likewise.
        * doc/makefile.texi: Likewise.
        * doc/sourcebuild.texi: Likewise.

From-SVN: r90577
---
 gcc/ChangeLog             | 10 ++++++++++
 gcc/Makefile.in           | 24 ++++++++++++++++++++++++
 gcc/doc/install.texi      |  4 ++++
 gcc/doc/makefile.texi     |  3 +++
 gcc/doc/sourcebuild.texi  |  8 ++++++--
 gcc/fortran/Make-lang.in  | 12 +++++++++---
 gcc/java/Make-lang.in     | 15 +++++++++++----
 gcc/treelang/Make-lang.in | 27 ++++++++++++++++-----------
 8 files changed, 83 insertions(+), 20 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 46711da44872..84922f923241 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2004-11-12  Mike Stump  <mrs@apple.com>
+
+	* Makefile.in: Add html support.
+	* java/Make-lang.in: Likewise.
+	* fortran/Make-lang.in: Likewise.
+	* treelang/Make-lang.in: Likewise.
+	* doc/install.texi: Likewise.
+	* doc/makefile.texi: Likewise.
+	* doc/sourcebuild.texi: Likewise.
+	
 2004-11-13  Kazu Hirata  <kazu@cs.umass.edu>
 
 	* tree-ssa-loop-manip.c: Fix a comment typo.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 359b7125c160..92008404c8c5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -254,6 +254,7 @@ INSTALL_SCRIPT = @INSTALL@
 MAKEINFO = @MAKEINFO@
 MAKEINFOFLAGS = --no-split
 TEXI2DVI = texi2dvi
+TEXI2HTML = $(MAKEINFO) --html
 TEXI2POD = perl $(srcdir)/../contrib/texi2pod.pl
 POD2MAN = pod2man --center="GNU" --release="gcc-$(version)"
 # Some versions of `touch' (such as the version on Solaris 2.8)
@@ -487,6 +488,9 @@ man7dir = $(mandir)/man7
 # Dir for temp files.
 tmpdir = /tmp
 
+# Directory in which to put HTML
+htmldir = $(objdir)/HTML/gcc-$(version)
+
 # Whether we were configured with NLS.
 USE_NLS = @USE_NLS@
 
@@ -2967,6 +2971,11 @@ doc/gcc.dvi: $(TEXI_GCC_FILES)
 doc/gccint.dvi: $(TEXI_GCCINT_FILES)
 doc/cppinternals.dvi: $(TEXI_CPPINT_FILES)
 
+$(htmldir)/cpp/index.html: $(TEXI_CPP_FILES)
+$(htmldir)/gcc/index.html: $(TEXI_GCC_FILES)
+$(htmldir)/gccint/index.html: $(TEXI_GCCINT_FILES)
+$(htmldir)/cppinternals/index.html: $(TEXI_CPPINT_FILES)
+
 dvi:: doc/gcc.dvi doc/gccint.dvi doc/gccinstall.dvi doc/cpp.dvi \
       doc/cppinternals.dvi
 
@@ -2977,6 +2986,21 @@ doc/%.dvi: %.texi
 doc/gccinstall.dvi: $(TEXI_GCCINSTALL_FILES)
 	$(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
 
+html:: $(htmldir)/cpp/index.html $(htmldir)/gcc/index.html \
+       $(htmldir)/gccinstall/index.html $(htmldir)/gccint/index.html \
+       $(htmldir)/cppinternals/index.html
+
+$(htmldir)/%/index.html: %.texi
+	$(mkinstalldirs) $(@D)
+	rm -f $(@D)/*
+	$(TEXI2HTML) -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
+
+# Duplicate entry to handle renaming of gccinstall
+$(htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
+	$(mkinstalldirs) $(@D)
+	echo rm -f $(@D)/*
+	$(TEXI2HTML) -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
+
 MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7
 
 generated-manpages: man
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 84fae154bb36..d826681c5306 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2016,6 +2016,10 @@ printing with programs such as @command{dvips}.  You can also
 Free Software Foundation}, though such manuals may not be for the most
 recent version of GCC@.
 
+If you would like to generate online HTML documentation, do @samp{cd
+@var{objdir}; make html} and HTML will be generated for the manuals in
+@file{@var{objdir}/HTML}.
+
 @html
 <hr />
 <p>
diff --git a/gcc/doc/makefile.texi b/gcc/doc/makefile.texi
index 9d2e1bce2bba..3fb3072cd13b 100644
--- a/gcc/doc/makefile.texi
+++ b/gcc/doc/makefile.texi
@@ -19,6 +19,9 @@ calls @samp{make man} and @samp{make info}.
 @item dvi
 Produce DVI-formatted documentation.
 
+@item html
+Produce HTML-formatted documentation.
+
 @item man
 Generate man pages.
 
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 0ab5c52bea02..2f4416695ec4 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -306,7 +306,8 @@ needs fixing, @file{syslimits.h} is the fixed copy.
 
 The main GCC documentation is in the form of manuals in Texinfo
 format.  These are installed in Info format, and DVI versions may be
-generated by @samp{make dvi}.  In addition, some man pages are
+generated by @samp{make dvi} and HTML versions may be generated by
+@command{make html}.  In addition, some man pages are
 generated from the Texinfo manuals, there are some other text files
 with miscellaneous documentation, and runtime libraries have their own
 documentation outside the @file{gcc} directory.  FIXME: document the
@@ -341,7 +342,8 @@ A copy of @file{texinfo.tex} known to work with the GCC manuals.
 @end table
 
 DVI formatted manuals are generated by @samp{make dvi}, which uses
-@command{texi2dvi} (via the Makefile macro @code{$(TEXI2DVI)}).  Info
+@command{texi2dvi} (via the Makefile macro @code{$(TEXI2DVI)}).  HTML
+formatted manuals are generated by @command{make html}.  Info
 manuals are generated by @samp{make info} (which is run as part of
 a bootstrap); this generates the manuals in the source directory,
 using @command{makeinfo} via the Makefile macro @code{$(MAKEINFO)},
@@ -591,6 +593,8 @@ Build DVI documentation for the front end, in the build directory.
 This should be done using @code{$(TEXI2DVI)}, with appropriate
 @option{-I} arguments pointing to directories of included files.
 This hook is a double-colon hook.
+@item html
+Build HTML documentation for the front end, in the source directory.
 @item man
 Build generated man pages for the front end from Texinfo manuals
 (@pxref{Man Page Generation}), in the build directory.  This target
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 14cdcfedf5e2..bdd8494c0d81 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -25,7 +25,7 @@
 # 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.info
 # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
 # foo.uninstall, foo.distdir,
 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
@@ -132,6 +132,7 @@ f95.tags: force
 
 f95.info: doc/gfortran.info
 dvi:: doc/gfortran.dvi
+html:: $(htmldir)/gfortran/index.html
 
 F95_MANFILES = doc/gfortran.1
 
@@ -157,13 +158,18 @@ GFORTRAN_TEXI = \
 doc/gfortran.info: $(GFORTRAN_TEXI)
 	if [ x$(BUILD_INFO) = xinfo ]; then \
 	  rm -f doc/gfortran.info-*; \
-	  $(MAKEINFO) -I$(srcdir)/doc/include -I$(srcdir)/fortran \
-	    -o doc/gfortran.info $(srcdir)/fortran/gfortran.texi; \
+	  $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
+	    -o $@ $<; \
 	else true; fi
 
 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)
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 29500c8091bc..bea8c73d5560 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -174,6 +174,7 @@ java.srcinfo: doc/gcj.info
 	-cp -p $^ $(srcdir)/doc
 
 dvi:: doc/gcj.dvi
+html:: $(htmldir)/java/index.html
 JAVA_MANFILES = doc/gcj.1 doc/gcjh.1 doc/jv-scan.1 doc/jcf-dump.1 doc/gij.1 \
                 doc/jv-convert.1 doc/grmic.1 doc/grmiregistry.1
 
@@ -373,18 +374,24 @@ java/java-tree-inline.o: tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	-DINLINER_FOR_JAVA=1 \
 	$(srcdir)/tree-inline.c -o $@
 
+TEXI_JAVA_FILES = java/gcj.texi $(docdir)/include/fdl.texi $(docdir)/include/gpl.texi \
+	 $(docdir)/include/gcc-common.texi
+
 # Documentation
-doc/gcj.info: java/gcj.texi $(docdir)/include/fdl.texi \
-  $(docdir)/include/gpl.texi $(docdir)/include/gcc-common.texi
+doc/gcj.info: $(TEXI_JAVA_FILES)
 	if test "x$(BUILD_INFO)" = xinfo; then \
 	  rm -f doc/gcj.info*; \
 	  $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir)/include -o $@ $<; \
 	else true; fi
 
-doc/gcj.dvi: java/gcj.texi $(docdir)/include/fdl.texi \
-	 $(docdir)/include/gpl.texi $(docdir)/include/gcc-common.texi
+doc/gcj.dvi: $(TEXI_JAVA_FILES)
 	$(TEXI2DVI) -I $(abs_docdir)/include -o $@ $<
 
+$(htmldir)/java/index.html: $(TEXI_JAVA_FILES)
+	$(mkinstalldirs) $(@D)
+	rm -f $(@D)/*
+	$(TEXI2HTML) -I $(docdir)/include -I $(srcdir)/java -o $(@D) $<
+
 .INTERMEDIATE: gcj.pod gcjh.pod jv-scan.pod jcf-dump.pod gij.pod \
   jv-convert.pod grmic.pod grmiregistry.pod
 
diff --git a/gcc/treelang/Make-lang.in b/gcc/treelang/Make-lang.in
index 2625ef1d1a43..fc4d3e6001db 100644
--- a/gcc/treelang/Make-lang.in
+++ b/gcc/treelang/Make-lang.in
@@ -149,16 +149,27 @@ treelang.srcinfo: doc/treelang.info
 
 dvi:: doc/treelang.dvi
 
-doc/treelang.info: treelang/treelang.texi $(docdir)/include/gcc-common.texi \
-	 $(docdir)/include/gpl.texi $(docdir)/include/fdl.texi \
+TEXI_TREELANG_FILES = treelang/treelang.texi \
+	 $(docdir)/include/gcc-common.texi \
+	 $(docdir)/include/gpl.texi \
+	 $(docdir)/include/fdl.texi \
 	 $(docdir)/include/funding.texi
+
+doc/treelang.info: $(TEXI_TREELANG_FILES)
 	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(docdir)/include -o $@ $<
 
-doc/treelang.dvi: treelang/treelang.texi $(docdir)/include/gcc-common.texi \
-	 $(docdir)/include/gpl.texi $(docdir)/include/fdl.texi \
-	 $(docdir)/include/funding.texi
+doc/treelang.dvi: $(TEXI_TREELANG_FILES)
 	$(TEXI2DVI) -I $(abs_docdir)/include -o $@ $<
 
+html:: $(htmldir)/treelang/index.html
+
+$(htmldir)/treelang/index.html: $(TEXI_TREELANG_FILES)
+	$(mkinstalldirs) $(@D)
+	rm -f $(@D)/*
+	$(TEXI2HTML) -I$(docdir)/include -I$(srcdir)/treelang \
+	   --verbose --number-sections \
+	  -o $(@D) $<
+
 #
 # Install hooks:
 
@@ -295,10 +306,4 @@ treelang.check.fix: force
 
 #
 
-.PHONY: treelang.html
-
-treelang.html:
-	cd $(srcdir)/treelang && texi2html -I ../doc/include -verbose -menu -split_chapter -number treelang.texi
-#	mv treelang*.html $(srcdir)/treelang
-
 config.status: treelang/config-lang.in
-- 
GitLab