This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add support for html/install-html.
On Fri, May 26, 2006 at 12:44:45AM -0300, Alexandre Oliva wrote:
> On May 24, 2006, "Carlos O'Donell" <carlos@codesourcery.com> wrote:
>
> >> I'm not sure I can or should approve this, but the rest is ok, except
> >> for...
>
> > I will have to send this to the GNU Classpath maintainers?
>
> Possibly, but at the very least to java-patches@gcc.gnu.org, to check
> whether they approve of divergence or not.
I've sent the classpath patches upstream to classpath@gnu.org. It is
still awaiting moderator approval so I haven't heard from them.
I wasn't sure what to do with imported projects. For example I have not
submitted the required patches to zlib, since it is also an imported
project. I've been told I should just try to get the patches approved in
gcc and the upstream project simultaneously.
Who could approve zlib changes?
> > Rather than maintain two separate variables I modified the 'html' target
> > to accept the same targets as 'install-html.'
>
> The main problem with directories as targets is that, if the build is
> interrupted after mkinstalldirs and before the rule is complete, the
> next build won't fix the incorrect build, since the directory will be
> there, and it will be newer than the dependencies.
>
> Hopefully texi2html generates index.html as the last thing it does,
> using a temporary file name and renaming it to the final name at the
> end, such that no such problem occurs. Besides, make will generally
> remove the target file if it's interrupted with ^C, but it won't
> remove directories.
I had not considered the problem in depth, all of your reasons are very
good reasons.
> > The install-html rule uses "test -f" and "test -d" to determine if a
> > single file, or an entire directory, should be installed.
>
> That's not quite the point. The problem I have in mind is the use of
> directories as targets.
Ok.
> > The proposed install-html rule is essentially a backport of the autoconf
> > CVS install-html rule.
>
> I assume you mean automake above, since autoconf doesn't have Makefile
> rules, or at least it didn't last I looked closely at it. Or maybe I
> just misunderstand what you mean :-)
I meant 'automake' :-)
I'm attaching a new patch with a slightly different strategy.
We separate the process of manual building and installing.
We define HTMLS_BUILD as the list of html target dependencies, all of
them are files. The vaule of HTMLS_INSTALL is used by the install-html
rule when installing files.
Tested on i686-pc-linux-gnu.
Cheers,
Carlos.
--
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716
2006-05-29 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.in: Rename htmldir to gcc_htmldir.
Define HTMLS_BUILD, HTMLS_INSTALL, html__strip_dir,
html__mkdir_p. Add install-html target.
* configure.ac: AC_SUBST datarootdir, docdir and htmldir.
* configure: Regenerate.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 114205)
+++ Makefile.in (working copy)
@@ -510,7 +510,7 @@
tmpdir = /tmp
# Directory in which to put HTML
-htmldir = $(objdir)/HTML/gcc-$(version)
+gcc_htmldir = $(objdir)/HTML/gcc-$(version)
# Whether we were configured with NLS.
USE_NLS = @USE_NLS@
@@ -3409,10 +3409,10 @@
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)
+$(gcc_htmldir)/cpp/index.html: $(TEXI_CPP_FILES)
+$(gcc_htmldir)/gcc/index.html: $(TEXI_GCC_FILES)
+$(gcc_htmldir)/gccint/index.html: $(TEXI_GCCINT_FILES)
+$(gcc_htmldir)/cppinternals/index.html: $(TEXI_CPPINT_FILES)
dvi:: doc/gcc.dvi doc/gccint.dvi doc/gccinstall.dvi doc/cpp.dvi \
doc/cppinternals.dvi lang.dvi
@@ -3424,17 +3424,28 @@
doc/gccinstall.dvi: $(TEXI_GCCINSTALL_FILES)
$(TEXI2DVI) -I . -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 lang.html
+# List the directories or single hmtl files which are installed by
+# install-html. The lang.html file triggers language fragments to build
+# html documentation. Installing language fragment documentation is not
+# yet supported.
+HTMLS_INSTALL=$(gcc_htmldir)/cpp $(gcc_htmldir)/gcc \
+ $(gcc_htmldir)/gccinstall $(gcc_htmldir)/gccint \
+ $(gcc_htmldir)/cppinternals
-$(htmldir)/%/index.html: %.texi
+# List the html file targets.
+HTMLS_BUILD=$(gcc_htmldir)/cpp/index.html $(gcc_htmldir)/gcc/index.html \
+ $(gcc_htmldir)/gccinstall/index.html $(gcc_htmldir)/gccint/index.html \
+ $(gcc_htmldir)/cppinternals/index.html lang.html
+
+html:: $(HTMLS_BUILD)
+
+$(gcc_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)
+$(gcc_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
$(mkinstalldirs) $(@D)
echo rm -f $(@D)/*
$(TEXI2HTML) -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
@@ -3727,6 +3738,26 @@
else true; fi; \
else true; fi;
+html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+html__mkdir_p = mkdir -p --
+
+install-html: $(HTMLS_BUILD)
+ @$(NORMAL_INSTALL)
+ test -z "$(htmldir)" || $(html__mkdir_p) "$(DESTDIR)$(htmldir)"
+ @list='$(HTMLS_INSTALL)'; for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
+ f=$(html__strip_dir) \
+ if test -d "$$d$$p"; then \
+ echo " $(html__mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(html__mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
+ else \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
+ fi; \
+ done
+
# Install the man pages.
install-man: lang.install-man \
$(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \
Index: configure.ac
===================================================================
--- configure.ac (revision 114205)
+++ configure.ac (working copy)
@@ -817,6 +817,10 @@
esac],
[enable_languages=c])
+# Used by documentation targets
+AC_SUBST(datarootdir)
+AC_SUBST(docdir)
+AC_SUBST(htmldir)
# -------------------------
# Checks for other programs