Fencing requirement.
[doctor.git] / Makefile
1 BUILDDIR := build
2 PUBLICDIR := public
3 DESIGN_DOCS = $(wildcard design_docs/*.rst)
4 MANUALS = $(wildcard manuals/*.rst)
5
6 .PHONY: clean html pdf bps man all public
7
8 define index
9         rm -f $1/index.html
10         find $1 -type f | while read a; do echo "<li><a href=$${a#$1/}>$${a#$1/}</a></li>" >> $1/index.html; done
11 endef
12
13 all: man bps html pdf
14         $(call index,$(BUILDDIR))
15
16 public:
17         rm -rf $(PUBLICDIR)
18         mkdir -p $(PUBLICDIR)
19         cp -r $(BUILDDIR)/manuals $(PUBLICDIR)/
20         cp -r $(BUILDDIR)/design_docs $(PUBLICDIR)/
21         cp -r $(BUILDDIR)/requirements/html $(PUBLICDIR)/
22         cp -r $(BUILDDIR)/requirements/latex/*.pdf $(PUBLICDIR)/
23         $(call index,$(PUBLICDIR))
24
25 clean:
26         rm -rf $(BUILDDIR)/*
27
28 man:
29         mkdir -p $(BUILDDIR)/manuals
30         $(foreach f,$(MANUALS),rst2html.py $(f) $(BUILDDIR)/$(f:.rst=.html);)
31
32 bps: $(DESIGN_DOCS)
33         mkdir -p $(BUILDDIR)/design_docs
34         $(foreach f,$(DESIGN_DOCS),rst2html.py $(f) $(BUILDDIR)/$(f:.rst=.html);)
35
36 html:
37         sphinx-build -b html -c etc -d $(BUILDDIR)/doctrees \
38             requirements $(BUILDDIR)/requirements/html
39
40 pdf:
41         sphinx-build -b latex -c etc -d $(BUILDDIR)/doctrees \
42             requirements $(BUILDDIR)/requirements/latex
43         $(MAKE) -C $(BUILDDIR)/requirements/latex \
44             LATEXOPTS='--interaction=nonstopmode' all-pdf