Give up on automake's built-in rules for generating PDF and HTML and use our own.

Also include split version of the manual.
This commit is contained in:
Adam Spiers 2011-12-03 14:03:58 +00:00
parent e046048a1c
commit a17537af3e
5 changed files with 71 additions and 43 deletions

4
.gitignore vendored
View file

@ -17,10 +17,10 @@ config.log
config.status config.status
configure configure
/doc/ChangeLog.OLD /doc/ChangeLog.OLD
/doc/manual.html
/doc/manual.pdf /doc/manual.pdf
/doc/manual-single.html
/doc/manual-split/
/doc/manual.texi /doc/manual.texi
/doc/stow.html
/doc/stow.pdf /doc/stow.pdf
/doc/stow.8 /doc/stow.8
/lib/Stow.pm /lib/Stow.pm

View file

@ -14,7 +14,8 @@ configure.ac
COPYING COPYING
default-ignore-list default-ignore-list
doc/ChangeLog.OLD doc/ChangeLog.OLD
doc/stow.html doc/manual-single.html
doc/manual.pdf
doc/stow.8 doc/stow.8
doc/stow.info doc/stow.info
doc/stow.texi doc/stow.texi

View file

@ -74,12 +74,9 @@
^autom4te\.cache/.+$ ^autom4te\.cache/.+$
^config\.(log|status)$ ^config\.(log|status)$
^doc/\.dirstamp$ ^doc/\.dirstamp$
^doc/manual-split/
^doc/stamp-vti$ ^doc/stamp-vti$
^doc/manual.texi$
^doc/manual.pdf$
^doc/stow.pdf$
^doc/HOWTO-RELEASE$ ^doc/HOWTO-RELEASE$
^doc/manual\.html\b
# Avoid test files # Avoid test files
^tmp-testing-trees ^tmp-testing-trees

View file

@ -5,14 +5,9 @@ info_TEXINFOS = doc/stow.texi
dist_man_MANS = doc/stow.8 dist_man_MANS = doc/stow.8
dist_doc_DATA = \ dist_doc_DATA = \
README \ README \
doc/stow.html doc/version.texi \ doc/manual.pdf doc/manual-single.html doc/version.texi \
ChangeLog doc/ChangeLog.OLD ChangeLog doc/ChangeLog.OLD
# Would be nice to include the split page HTML version of the manual
# in the distribution, but automake doesn't support wildcards and I'm
# loathe to explicitly list every single page here :-(
#nobase_dist_doc_DATA = doc/manual-split/*.html
pmdir = $(libdir)/perl5 pmdir = $(libdir)/perl5
dist_pm_DATA = lib/Stow.pm dist_pm_DATA = lib/Stow.pm
pmstowdir = $(pmdir)/Stow pmstowdir = $(pmdir)/Stow
@ -32,6 +27,8 @@ AM_MAKEINFOFLAGS = -I $(srcdir)
# to AM_INIT_AUTOMAKE which has to be silenced via -Wno-override. # to AM_INIT_AUTOMAKE which has to be silenced via -Wno-override.
TEXI2DVI = texi2dvi $(AM_MAKEINFOFLAGS) TEXI2DVI = texi2dvi $(AM_MAKEINFOFLAGS)
doc_deps = $(info_TEXINFOS) doc/version.texi
DEFAULT_IGNORE_LIST = $(srcdir)/default-ignore-list DEFAULT_IGNORE_LIST = $(srcdir)/default-ignore-list
TESTS_DIR = $(srcdir)/t TESTS_DIR = $(srcdir)/t
@ -77,7 +74,7 @@ $(TESTS_OUT):
CPAN_FILES = MANIFEST MANIFEST.SKIP Build.PL META.yml META.json CPAN_FILES = MANIFEST MANIFEST.SKIP Build.PL META.yml META.json
EXTRA_DIST = \ EXTRA_DIST = \
bin/stow.in bin/chkstow.in lib/Stow.pm.in \ bin/stow.in bin/chkstow.in lib/Stow.pm.in \
doc/stow.pdf \ doc/manual-split \
$(TESTS) t/testutil.pm \ $(TESTS) t/testutil.pm \
$(TEXINFO_TEX) \ $(TEXINFO_TEX) \
$(DEFAULT_IGNORE_LIST) \ $(DEFAULT_IGNORE_LIST) \
@ -88,7 +85,7 @@ CLEANFILES = $(bin_SCRIPTS) $(dist_pm_DATA)
clean-local: clean-local:
-rm -rf $(TESTS_OUT) \ -rm -rf $(TESTS_OUT) \
bin/stow bin/chkstow doc/stow.8 ChangeLog \ bin/stow bin/chkstow doc/stow.8 ChangeLog \
doc/stow.html doc/stow.pdf doc/manual-split doc/manual-single.html doc/manual.pdf
# this is more explicit and reliable than the config file trick # this is more explicit and reliable than the config file trick
edit = sed -e 's|[@]PERL[@]|$(PERL)|g' \ edit = sed -e 's|[@]PERL[@]|$(PERL)|g' \
@ -112,27 +109,72 @@ lib/Stow.pm: lib/Stow.pm.in Makefile $(DEFAULT_IGNORE_LIST)
# The below rules should only be needed by developers. # The below rules should only be needed by developers.
############################################################################## ##############################################################################
doc/stow.html: doc/stow.texi
[ -d doc ] || mkdir doc # required in vpath mode
-rm -f $@
texi2html --P=$(srcdir) --output=$@ -expandinfo -menu -monolithic -verbose $<
doc/stow.8: bin/stow Makefile doc/stow.8: bin/stow Makefile
[ -d doc ] || mkdir doc # required in vpath mode [ -d doc ] || mkdir doc # required in vpath mode
pod2man $< > $@ pod2man $< > $@
# It's conventional to generate $project.info, but it's also nicer to # We use automake's built-in rule to generate stow.info. The built-in
# generate manual.html and manual.pdf (which ultimately go somewhere # rules would also generate doc/stow.html and doc/stow.pdf, but after
# like /usr/share/doc/stow/) rather than stow.html and stow.pdf, to # installation we want $(docdir) (typically /usr/share/doc/stow/) to
# make it obvious that these files contain the manual. So we have to # contain manual-single.html, manual.pdf, and manual-split/*.html, to
# jump through a few extra hoops. # make it explicitly obvious that these files contain the user manual
install-data-hook: # rather than some other Stow-related documentation.
cd $(DESTDIR)$(docdir) && \ #
mv -f stow.html manual.html # If it were not for a troublesome dependency on doc/$(am__dirstamp):
cp $(srcdir)/doc/stow.pdf $(DESTDIR)$(docdir)/manual.pdf #
# http://article.gmane.org/gmane.comp.sysutils.automake.general/13192
#
# we could have achieved this using the built-in rules combined with
# install-data-hook to rename from stow.pdf to manual.pdf etc. on
# install. Instead, by overriding the built-in rules with modified
# versions, we can kill both birds with one stone.
doc/manual-single.html: $(doc_deps)
[ -d doc ] || mkdir doc # required in vpath mode
-rm -f $@
texi2html --P=$(srcdir) --output=$@ -expandinfo -menu -monolithic -verbose $<
doc/manual.pdf: $(doc_deps)
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
$(TEXI2PDF) -o $@ `test -f 'doc/stow.texi' || echo '$(srcdir)/'`doc/stow.texi
doc/manual-split: $(doc_deps)
rm -rf $@.new
if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
-o $@.new `test -f 'doc/stow.texi' || echo '$(srcdir)/'`doc/stow.texi; \
then \
rm -rf $@; \
mv $@.new $@; \
else \
rm -Rf $@.new $@; \
exit 1; \
fi
# The split version of the manual is copied to $(docdir)/manual-split
# by install-data-hook. The whole subdirectory is included via
# EXTRA_DIST in order to avoid having to list each file explicitly in
# dist_doc_DATA, since automake doesn't support wildcards, and
# dist_doc_DATA cannot refer to directories while EXTRA_DIST can (go
# figure ...)
install-data-hook: doc/manual-split
cp -r $(srcdir)/doc/manual-split $(DESTDIR)$(docdir)
uninstall-hook: uninstall-hook:
rm -f $(DESTDIR)$(docdir)/manual.{html,pdf} chmod u+w -R $(DESTDIR)$(docdir)/manual-split
rm -rf $(DESTDIR)$(docdir)/manual-split
# Using install-data-hook has the slightly annoying disadvantage that
# by default the split version of the manual isn't automatically
# rebuilt during development by a simple `make'. A workaround hack
# for this is to piggy-back the dependency onto manual-single.html,
# which *is* automatically rebuilt by `make':
doc/manual-single.html: doc/manual-split
# With the above hack, this probably isn't necessary but is safer to
# keep in anyway:
dist-hook: doc/manual-split
ChangeLog: doc/ChangeLog.OLD Makefile ChangeLog: doc/ChangeLog.OLD Makefile
@if [ -d .git ]; then \ @if [ -d .git ]; then \
@ -147,16 +189,3 @@ ChangeLog: doc/ChangeLog.OLD Makefile
else \ else \
echo "Not in a git repository; can't update ChangeLog."; \ echo "Not in a git repository; can't update ChangeLog."; \
fi fi
# For website only; cannot currently be included in dist_doc_DATA
# because of:
#
# http://article.gmane.org/gmane.comp.sysutils.automake.general/13192
#
# This means that it is still included in the distribution and
# installed, but is only automatically (re)built when making a new
# distribution - if stow.texi changes during development, it has to be
# rebuilt manually via 'make pdf'.
dist-hook: pdf
pdf: doc/stow.pdf

1
NEWS
View file

@ -13,6 +13,7 @@ phase.
** Improved debugging output. ** Improved debugging output.
** Converted man page to POD format. ** Converted man page to POD format.
** Include PDF, and both split- and single-page HTML versions of manual in the distribution.
** Fixed code style consistency issues. ** Fixed code style consistency issues.
** Running configure from outside the source tree now works. ** Running configure from outside the source tree now works.
** `make distcheck' now works. ** `make distcheck' now works.