doc: Fix doc/xml for objdir builds

Fix various issues so that building the documentation in doc/xml works
for objdir builds:

- set srcdir=@srcdir@ like all other Makefile's, so VPATH is set
  correctly via Makefile.config

- Pass "--path '@abs_builddir@'" to all xml/xsl processors, so they
  can find the generated version.xml (otherwise they only look in
  srcdir)

- Pass --output when building PDFs, so the generated PDF doesn't go in
  srcdir

- Specify $(srcdir) for $(BOOK).xml and generate-xml.pl

- Change generate-xml.pl to find pod2refentry in srcdir instead of '.'

Change-Id: Id09595dba6e70e3d367a26e279446844750d1fd4
Reviewed-on: https://gerrit.openafs.org/15856
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
This commit is contained in:
Andrew Deason 2024-05-11 16:09:15 -05:00 committed by Michael Meffie
parent 829e484371
commit d86c4d632e
5 changed files with 60 additions and 26 deletions

View File

@ -12,6 +12,7 @@
#
# HTML_XSL is possibly specific to Debian and may need to be modified on other
# systems.
srcdir=@srcdir@
BOOK = auagd000
@ -33,22 +34,29 @@ DOCBOOK2PDF = @DOCBOOK2PDF@
KINDLEGEN = @KINDLEGEN@
DBTOEPUB = $(DOCBOOK_STYLESHEETS)/epub/bin/dbtoepub
XSL_FLAGS = --path '@abs_builddir@'
index.html: $(SRCS)
$(XSLTPROC) --param navig.graphics 1 \
$(XSLTPROC) $(XSL_FLAGS) \
--param navig.graphics 1 \
--param use.id.as.filename 1 \
--stringparam navig.graphics.path ../ $(DOCBOOK_STYLESHEETS)/$(HTML_XSL) $(BOOK).xml
--stringparam navig.graphics.path ../ $(DOCBOOK_STYLESHEETS)/$(HTML_XSL) \
$(srcdir)/$(BOOK).xml
$(BOOK).pdf: $(SRCS)
if test "x$(DOCBOOK2PDF)" = "xfop"; then \
$(XSLTPROC) $(DOCBOOK_STYLESHEETS)/fo/docbook.xsl $(BOOK).xml > $(BOOK).fo; \
$(XSLTPROC) $(DOCBOOK_STYLESHEETS)/fo/docbook.xsl \
$(srcdir)/$(BOOK).xml > $(BOOK).fo; \
$(DOCBOOK2PDF) $(BOOK).fo $(BOOK).pdf; \
else \
$(DOCBOOK2PDF) $(BOOK).xml; \
$(DOCBOOK2PDF) --output=$@ --xslt-opts="$(XSL_FLAGS)" \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).epub: $(SRCS)
if test -x "$(DBTOEPUB)" ; then \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).mobi: $(BOOK).epub
@ -57,7 +65,7 @@ $(BOOK).mobi: $(BOOK).epub
fi
check:
xmllint --noout --valid $(BOOK).xml
xmllint $(XSL_FLAGS) --noout --valid $(srcdir)/$(BOOK).xml
clean:
rm -f *.aux *.epub *.fo *.html *.log *.mobi *.out *.pdf

View File

@ -1,4 +1,5 @@
# Makefile to build the AFS Reference Guide for Unix.
srcdir=@srcdir@
BOOK = auarf000
@ -16,20 +17,26 @@ DOCBOOK2PDF = @DOCBOOK2PDF@
DBTOEPUB = $(DOCBOOK_STYLESHEETS)/epub/bin/dbtoepub
KINDLEGEN = @KINDLEGEN@
XSL_FLAGS = --path '@abs_builddir@'
entities.dtd sect1.xml sect3.xml sect5.xml sect8.xml:
./generate-xml.pl $(TOP_SRCDIR)
$(srcdir)/generate-xml.pl $(TOP_SRCDIR)
$(BOOK).pdf: $(SRCS)
if test "x$(DOCBOOK2PDF)" = "xfop"; then \
$(XSLTPROC) $(DOCBOOK_STYLESHEETS)/fo/docbook.xsl $(BOOK).xml > $(BOOK).fo; \
$(XSLTPROC) $(XSL_FLAGS) \
$(DOCBOOK_STYLESHEETS)/fo/docbook.xsl \
$(srcdir)/$(BOOK).xml > $(BOOK).fo; \
$(DOCBOOK2PDF) $(BOOK).fo $(BOOK).pdf; \
else \
$(DOCBOOK2PDF) $(BOOK).xml; \
$(DOCBOOK2PDF) --output=$@ --xslt-opts="$(XSL_FLAGS)" \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).epub: $(SRCS)
if test -x "$(DBTOEPUB)" ; then \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).mobi: $(BOOK).epub
@ -38,7 +45,7 @@ $(BOOK).mobi: $(BOOK).epub
fi
check:
xmllint --noout --valid $(BOOK).xml
xmllint $(XSL_FLAGS) --noout --valid $(srcdir)/$(BOOK).xml
clean:
rm -f $(BOOK).pdf $(BOOK).mobi $(BOOK).epub $(BOOK).fo \

View File

@ -5,6 +5,7 @@
@sections = ('1', '3', '5', '8');
$TOP_SRCDIR = shift @ARGV;
$srcdir = sprintf "%s/../doc/xml/AdminRef", $TOP_SRCDIR;
$doc_man_pages = sprintf "%s/../doc/man-pages", $TOP_SRCDIR;
open(ENTITIES, ">entities.dtd") || die;
@ -21,10 +22,10 @@ foreach $section (@sections) {
($xmlfile = $podfile) =~ s/\.pod$/.xml/;
($entity = $xmlfile) =~ s/\.xml$//;
printf "pod2refentry < %s > %s\n", $podfile, $xmlfile;
printf "%s/pod2refentry < %s > %s\n", $srcdir, $podfile, $xmlfile;
my $rc = system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
$section, $doc_man_pages, $section, $podfile, $section, $xmlfile);
my $rc = system(sprintf "%s/pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
$srcdir, $section, $doc_man_pages, $section, $podfile, $section, $xmlfile);
if ($rc != 0) {
die "Failed to generate sect${section}/${xmlfile}: $rc\n";
}

View File

@ -12,6 +12,7 @@
#
# HTML_XSL is specific to Debian and will need to be modified on other
# systems until we have a better mechanism for finding the correct path.
srcdir=@srcdir@
BOOK = auqbg000
@ -31,22 +32,30 @@ DOCBOOK2PDF = @DOCBOOK2PDF@
DBTOEPUB = $(DOCBOOK_STYLESHEETS)/epub/bin/dbtoepub
KINDLEGEN = @KINDLEGEN@
XSL_FLAGS = --path '@abs_builddir@'
index.html: $(SRCS)
$(XSLTPROC) --param navig.graphics 1 \
$(XSLTPROC) $(XSL_FLAGS) \
--param navig.graphics 1 \
--param use.id.as.filename 1 \
--stringparam navig.graphics.path ../ $(DOCBOOK_STYLESHEETS)/$(HTML_XSL) $(BOOK).xml
--stringparam navig.graphics.path ../ $(DOCBOOK_STYLESHEETS)/$(HTML_XSL) \
$(srcdir)/$(BOOK).xml
$(BOOK).pdf: $(SRCS)
if test "x$(DOCBOOK2PDF)" = "xfop"; then \
$(XSLTPROC) $(DOCBOOK_STYLESHEETS)/fo/docbook.xsl $(BOOK).xml > $(BOOK).fo; \
$(XSLTPROC) $(XSL_FLAGS) \
$(DOCBOOK_STYLESHEETS)/fo/docbook.xsl \
$(srcdir)/$(BOOK).xml > $(BOOK).fo; \
$(DOCBOOK2PDF) $(BOOK).fo $(BOOK).pdf; \
else \
$(DOCBOOK2PDF) $(BOOK).xml; \
$(DOCBOOK2PDF) --output=$@ --xslt-opts="$(XSL_FLAGS)" \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).epub: $(SRCS)
if test -x "$(DBTOEPUB)" ; then \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).mobi: $(BOOK).epub
@ -55,7 +64,7 @@ $(BOOK).mobi: $(BOOK).epub
fi
check:
xmllint --noout --valid $(BOOK).xml
xmllint $(XSL_FLAGS) --noout --valid $(srcdir)/$(BOOK).xml
clean:
rm -f *.aux *.epub *.fo *.html *.log *.mobi *.out *.pdf

View File

@ -12,6 +12,7 @@
#
# HTML_XSL is possibly specific to Debian and may need to be modified on other
# systems.
srcdir=@srcdir@
BOOK = auusg000
@ -31,22 +32,30 @@ DOCBOOK2PDF = @DOCBOOK2PDF@
DBTOEPUB = $(DOCBOOK_STYLESHEETS)/epub/bin/dbtoepub
KINDLEGEN = @KINDLEGEN@
XSL_FLAGS = --path '@abs_builddir@'
index.html: $(SRCS)
$(XSLTPROC) --param navig.graphics 1 \
$(XSLTPROC) $(XSL_FLAGS) \
--param navig.graphics 1 \
--param use.id.as.filename 1 \
--stringparam navig.graphics.path ../ $(DOCBOOK_STYLESHEETS)/$(HTML_XSL) $(BOOK).xml
--stringparam navig.graphics.path ../ $(DOCBOOK_STYLESHEETS)/$(HTML_XSL) \
$(srcdir)/$(BOOK).xml
$(BOOK).pdf: $(SRCS)
if test "x$(DOCBOOK2PDF)" = "xfop"; then \
$(XSLTPROC) $(DOCBOOK_STYLESHEETS)/fo/docbook.xsl $(BOOK).xml > $(BOOK).fo; \
$(XSLTPROC) $(XSL_FLAGS) \
$(DOCBOOK_STYLESHEETS)/fo/docbook.xsl \
$(srcdir)/$(BOOK).xml > $(BOOK).fo; \
$(DOCBOOK2PDF) $(BOOK).fo $(BOOK).pdf; \
else \
$(DOCBOOK2PDF) $(BOOK).xml; \
$(DOCBOOK2PDF) --output=$@ --xslt-opts="$(XSL_FLAGS)" \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).epub: $(SRCS)
if test -x "$(DBTOEPUB)" ; then \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
$(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl \
$(srcdir)/$(BOOK).xml; \
fi
$(BOOK).mobi: $(BOOK).epub
@ -55,7 +64,7 @@ $(BOOK).mobi: $(BOOK).epub
fi
check:
xmllint --noout --valid $(BOOK).xml
xmllint $(XSL_FLAGS) --noout --valid $(srcdir)/$(BOOK).xml
clean:
rm -f *.aux *.epub *.fo *.html *.log *.mobi *.out *.pdf