1mydir=doc 2BUILDTOP=$(REL).. 3 4SPHINX_ARGS=@MAINT@-W 5SPHINX_BUILD=sphinx-build $(SPHINX_ARGS) 6DOXYGEN=doxygen 7 8docsrc=$(top_srcdir)/../doc 9sysconfdir=@sysconfdir@ 10DEFCCNAME=@DEFCCNAME@ 11DEFKTNAME=@DEFKTNAME@ 12DEFCKTNAME=@DEFCKTNAME@ 13PKCS11_MODNAME=@PKCS11_MODNAME@ 14 15RST_SOURCES= _static \ 16 _templates \ 17 conf.py \ 18 index.rst \ 19 admin \ 20 appdev \ 21 basic \ 22 build \ 23 formats \ 24 plugindev \ 25 user \ 26 about.rst \ 27 build_this.rst \ 28 copyright.rst \ 29 mitK5defaults.rst \ 30 mitK5features.rst \ 31 mitK5license.rst \ 32 notice.rst \ 33 resources.rst 34 35PDFDIR=$(docsrc)/pdf 36PDFDOCS= admin appdev basic build plugindev user 37LATEXOPTS= 38 39# Create HTML documentation in $(docsrc)/html suitable for a 40# release tarball or the web site (that is, without substitutions for 41# configured paths). This can be done in an unconfigured source tree 42# as: 43# make -f Makefile.in SPHINX_ARGS= htmlsrc 44html: composite 45 rm -rf $(docsrc)/html 46 $(SPHINX_BUILD) -q rst_composite $(docsrc)/html 47 48# Dummy target for use in an unconfigured source tree. 49htmlsrc: 50 $(MAKE) -f Makefile.in srcdir=. top_srcdir=.. PYTHON=python3 html clean 51 52# Create HTML documentation in html_subst suitable for 53# installation by an OS package, with substitutions for configured 54# paths. 55substhtml: composite paths.py 56 rm -rf html_subst 57 cp paths.py rst_composite 58 $(SPHINX_BUILD) -t pathsubs -q rst_composite html_subst 59 60# Create an ASCII (okay, UTF-8) version of the NOTICE file 61notice.txt: $(docsrc)/conf.py $(docsrc)/notice.rst $(docsrc)/version.py 62 $(SPHINX_BUILD) -b text -t notice -q $(docsrc) . 63 64NOTICE: notice.txt 65 cp notice.txt $(top_srcdir)/../NOTICE 66 67$(PDFDIR): composite 68 $(SPHINX_BUILD) -b latex -q rst_composite $(PDFDIR) 69 # sphinx-build generates a gmake-specific Makefile that we don't use 70 mv $(PDFDIR)/Makefile $(PDFDIR)/GMakefile 71 72# Not pretty. Can't use a suffix rule .tex.pdf without a Makefile in 73# $(PDFDIR) because pdflatex looks for include files in the current 74# working directory. The sphinx-build Makefile is quite conservative 75# and runs pdflatex five times; we can be slightly less conservative. 76pdf: $(PDFDIR) 77 (cd $(PDFDIR) && \ 78 for i in $(PDFDOCS); do \ 79 texfile=`echo $${i}.tex` && \ 80 idxfile=`echo $${i}.idx` && \ 81 pdflatex $(LATEXOPTS) $$texfile && \ 82 pdflatex $(LATEXOPTS) $$texfile && \ 83 makeindex -s python.ist $$idxfile || true; \ 84 pdflatex $(LATEXOPTS) $$texfile && \ 85 pdflatex $(LATEXOPTS) $$texfile; done && \ 86 rm -f *.dvi *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla \ 87 ) 88 89# Use doxygen to generate API documentation, translate it into RST 90# format, and then create a composite of $(docsrc)'s RST and the 91# generated files in rst_composite. Used by the html and substhtml targets. 92composite: Doxyfile $(docsrc)/version.py 93 rm -rf doxy rst_apiref rst_composite 94 $(DOXYGEN) 95 (cwd=`pwd`; cd $(docsrc)/tools && \ 96 $(PYTHON) doxy.py -i $$cwd/doxy/xml -o $$cwd/rst_apiref) 97 mkdir -p rst_composite 98 do_subdirs="$(RST_SOURCES)" ; \ 99 for i in $$do_subdirs; do \ 100 cp -r $(docsrc)/$$i rst_composite; \ 101 done 102 cp rst_apiref/*.rst rst_composite/appdev/refs/api 103 cp rst_apiref/types/*.rst rst_composite/appdev/refs/types 104 cp rst_apiref/macros/*.rst rst_composite/appdev/refs/macros 105 cp $(docsrc)/version.py rst_composite 106 107Doxyfile: $(srcdir)/Doxyfile.in 108 sed -e 's|@SRC@|$(top_srcdir)|g' \ 109 -e 's|@DOC@|$(top_srcdir)/../doc|g' $(srcdir)/Doxyfile.in > $@ 110 111paths.py: 112 rm -f $@ 113 echo 'bindir = "``$(CLIENT_BINDIR)``"' > $@ 114 echo 'sbindir = "``$(SERVER_BINDIR)``"' >> $@ 115 echo 'libdir = "``$(KRB5_LIBDIR)``"' >> $@ 116 echo 'localstatedir = "``$(localstatedir)``"' >> $@ 117 echo 'runstatedir = "``$(runstatedir)``"' >> $@ 118 echo 'sysconfdir = "``$(sysconfdir)``"' >> $@ 119 echo 'ccache = "``$(DEFCCNAME)``"' >> $@ 120 echo 'keytab = "``$(DEFKTNAME)``"' >> $@ 121 echo 'ckeytab = "``$(DEFCKTNAME)``"' >> $@ 122 echo 'pkcs11_modname = "``$(PKCS11_MODNAME)``"' >> $@ 123 124# Dummy rule that man/Makefile can invoke 125version.py: $(docsrc)/version.py 126 127$(docsrc)/version.py: $(top_srcdir)/patchlevel.h $(srcdir)/version.py.in 128 rm -f $@ 129 $(CC) -E -I$(top_srcdir) - < $(srcdir)/version.py.in > $@ 130 131clean: 132 rm -rf doxy rst_apiref rst_composite rst_notice html_subst \ 133 Doxyfile paths.py $(docsrc)/version.py notice.txt \ 134 $(docsrc)/html/.doctrees $(docsrc)/pdf/.doctrees \ 135 $(docsrc)/tools/*.pyc 136