summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 1e06ef3c320d1137f03e0e29ac1c6e5cb42a3bc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
BUILDDIR := build
PUBLICDIR := public
DESIGN_DOCS = $(wildcard design_docs/*.rst)
MANUALS = $(wildcard manuals/*.rst)

.PHONY: clean html pdf bps man all public

define index
	rm -f $1/index.html
	find $1 -type f | while read a; do echo "<li><a href=$${a#$1/}>$${a#$1/}</a></li>" >> $1/index.html; done
endef

all: man bps html pdf
	$(call index,$(BUILDDIR))

public:
	rm -rf $(PUBLICDIR)
	mkdir -p $(PUBLICDIR)
	cp -r $(BUILDDIR)/manuals $(PUBLICDIR)/
	cp -r $(BUILDDIR)/design_docs $(PUBLICDIR)/
	cp -r $(BUILDDIR)/requirements/html $(PUBLICDIR)/
	cp -r $(BUILDDIR)/requirements/latex/*.pdf $(PUBLICDIR)/
	$(call index,$(PUBLICDIR))

clean:
	rm -rf $(BUILDDIR)/*

man:
	mkdir -p $(BUILDDIR)/manuals
	$(foreach f,$(MANUALS),rst2html.py $(f) $(BUILDDIR)/$(f:.rst=.html);)

bps: $(DESIGN_DOCS)
	mkdir -p $(BUILDDIR)/design_docs
	$(foreach f,$(DESIGN_DOCS),rst2html.py $(f) $(BUILDDIR)/$(f:.rst=.html);)

html:
	sphinx-build -b html -c etc -d $(BUILDDIR)/doctrees \
	    requirements $(BUILDDIR)/requirements/html

pdf:
	sphinx-build -b latex -c etc -d $(BUILDDIR)/doctrees \
	    requirements $(BUILDDIR)/requirements/latex
	$(MAKE) -C $(BUILDDIR)/requirements/latex \
	    LATEXOPTS='--interaction=nonstopmode' all-pdf