-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
49 lines (37 loc) · 1.33 KB
/
Makefile
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
45
46
47
48
49
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = docsource
BUILDDIR = docsource/build
MD:= $(wildcard prose/*.md)
TANGLED:= $(MD:prose/%.md=ds2/.tangled%)
GENERATEDTEX:= $(MD:prose/%.md=tex/generated/%.tex)
TEX = tex/main.tex tex/generated/pygments_macros.tex tex/titlepage.tex
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile test docs pdf clean weave tangle count
test: tangle
cd test; python -m unittest discover
docs: Makefile
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@cp -a docsource/build/html/. docs/
html: docs
tex/generated/pygments_macros.tex :
prosecode styledefs --outfile tex/generated/pygments_macros.tex
tex/generated/%.tex: prose/%.md
prosecode weave --execute --outfile $@ $<
ds2/.tangled% : prose/%.md
prosecode tangle $< --srcdir ds2/
@touch $@
tangle: $(TANGLED)
clean:
$(foreach mdfile, $(MD), prosecode cleanup $(mdfile) --srcdir ds2/;)
rm tex/generated/*
rm tex/fullbook.*
rm ds2/.tangled*
weave: $(GENERATEDTEX)
pdf: tangle $(GENERATEDTEX) $(TEX)
cd tex; pdflatex -jobname=fullbook main.tex
count: tangle $(GENERATEDTEX) $(TEX)
printf '%s ' "$$(date "+%Y-%m-%d")" >> writinglog.txt
cd tex; texcount main.tex -1 -inc -sum >> ../writinglog.txt