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