]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Make glue for building PDFs
authorBen Kaduk <kaduk@mit.edu>
Wed, 17 Oct 2012 00:11:14 +0000 (20:11 -0400)
committerBen Kaduk <kaduk@mit.edu>
Wed, 14 Nov 2012 19:15:24 +0000 (14:15 -0500)
sphinx-build's latex output engine creates a subdirectory with
various latex files, and a Makefile.  The generated Makefile assumes
gmake, which we do not.  The logic needed in this makefile is rather
simple, so we just include it in src/doc/Makefile.in, even if we
do need a rather complicated shell expression to work in the subdirectory.

ticket: 7433
tags: pullup

.gitignore
src/doc/Makefile.in

index 36c4f1af9fc2554594baddec747c428358dab4f5..8ec785de244f28f6ed17b37c53798d9a3750a230 100644 (file)
@@ -16,6 +16,7 @@ testlog
 /doc/version.py
 
 /doc/html/
+/doc/pdf/
 
 /src/config.log
 /src/config.status
index 913a50a934871b5eeb820802674b65c2dd26b985..3c5d3f3b5190fab43d0ed1e714dcca68b2cf9c78 100644 (file)
@@ -28,6 +28,10 @@ RST_SOURCES= _static \
        relay \
        resources.rst
 
+PDFDIR=$(docsrc)/pdf
+PDFDOCS= admin appdev basic build plugindev user
+LATEXOPTS=
+
 # Create HTML documentation in $(docsrc)/html suitable for a
 # release tarball or the web site (that is, without substitutions for
 # configured paths).  This can be done in an unconfigured source tree
@@ -53,6 +57,28 @@ notice.txt: $(docsrc)/conf.py $(docsrc)/notice.rst
 NOTICE: notice.txt
        cp notice.txt $(top_srcdir)/../NOTICE
 
+$(PDFDIR): composite
+       $(SPHINX_BUILD) -b latex -q rst_composite $(PDFDIR)
+       # sphinx-build generates a gmake-specific Makefile that we don't use
+       mv $(PDFDIR)/Makefile $(PDFDIR)/GMakefile
+
+# Not pretty.  Can't use a suffix rule .tex.pdf without a Makefile in
+# $(PDFDIR) because pdflatex looks for include files in the current
+# working directory.  The sphinx-build Makefile is quite conservative
+# and runs pdflatex five times; we can be slightly less conservative.
+pdf: $(PDFDIR)
+       (cd $(PDFDIR) && \
+        for i in $(PDFDOCS); do \
+               texfile=`echo $${i}.tex` && \
+               idxfile=`echo $${i}.idx` && \
+               pdflatex $(LATEXOPTS) $$texfile && \
+               pdflatex $(LATEXOPTS) $$texfile && \
+               makeindex -s python.ist $$idxfile || true; \
+               pdflatex $(LATEXOPTS) $$texfile && \
+               pdflatex $(LATEXOPTS) $$texfile; done && \
+        rm -f *.dvi *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla \
+       )
+
 # Use doxygen to generate API documentation, translate it into RST
 # format, and then create a composite of $(docsrc)'s RST and the
 # generated files in rst_composite.  Used by the html and substhtml targets.