-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
119 lines (86 loc) · 3.74 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.PHONY: default iadocs docs build_iadocs build_docs setcap clean
default: dist/cca docs iadocs
# Docs file lists
DOCS_FILES := admin_handbook.html cca.scfg.example azure.json courses_example.csv schema.sql drop.sql
IADOCS_FILES := index.html cover_page.htm appendix.pdf crita_planning.pdf critb_design.pdf \
critb_recordoftasks.htm critc_development.pdf critd_functionality.pdf crite_evaluation.pdf
# Create docs and iadocs targets using patterns
docs: $(DOCS_FILES:%=dist/docs/%)
iadocs: $(IADOCS_FILES:%=dist/iadocs/%)
# Final binary with embedded stuff
dist/cca: go.* *.go build/static/style.css build/static/student.js templates/* \
$(DOCS_FILES:%=build/docs/%) $(IADOCS_FILES:%=build/iadocs/%) \
.editorconfig .gitignore .gitattributes scripts/* sql/* docs/* iadocs/* README.md LICENSE Makefile
mkdir -p dist
go build -o $@
# Generic docs rules
dist/docs/%: build/docs/%
mkdir -p $(@D)
cp $< $@
build/docs/%.sql: sql/%.sql
mkdir -p $(@D)
cp $< $@
build/docs/%.csv: docs/%.csv
mkdir -p $(@D)
cp $< $@
build/docs/%.html: docs/%.md docs/handbook.css
mkdir -p $(@D)
pandoc --embed-resources --wrap none --standalone -t html -f markdown --css docs/handbook.css $< | gominify --type html -o $@
# Extra docs
build/docs/cca.scfg.example: docs/cca.scfg.example
mkdir -p $(@D)
cp $< $@
build/docs/azure.json: docs/azure.json
mkdir -p $(@D)
cp $< $@
# IA documentation
dist/iadocs/%: build/iadocs/%
mkdir -p $(@D)
cp $< $@
build/iadocs/%.htm: iadocs/%.htm
mkdir -p $(@D)
gominify --html-keep-end-tags --html-keep-document-tags -o $@ $<
build/iadocs/index.html: build/iadocs/cover_page.htm
cp $< $@
build/iadocs/%.pdf: iadocs/%.tex build/iadocs/header.texinc build/iadocs/bib.bib
mkdir -p $(@D)
lualatex -interaction batchmode -output-directory=build/iadocs $<
biber --output-directory=build/iadocs build/$(<:.tex=.bcf)
lualatex -interaction batchmode -output-directory=build/iadocs $<
lualatex -interaction batchmode -output-directory=build/iadocs $<
# Special case for Criterion C which needs the appendix's references
build/iadocs/critc_development.pdf: iadocs/critc_development.tex build/iadocs/header.texinc build/iadocs/bib.bib build/iadocs/appendix.pdf
# Technically I need build/iadocs/appendix.aux instead of build/iadocs/appendix.pdf
mkdir -p $(@D)
lualatex -interaction batchmode -output-directory=build/iadocs $<
biber --output-directory=build/iadocs build/$(<:.tex=.bcf)
lualatex -interaction batchmode -output-directory=build/iadocs $<
lualatex -interaction batchmode -output-directory=build/iadocs $<
# Special case for the appendix and the PDF'ed source code
build/iadocs/appendix.pdf: iadocs/appendix.tex build/iadocs/source.gen build/iadocs/agpl.texinc
mkdir -p $(@D)
lualatex -interaction batchmode -shell-escape -output-directory=build/iadocs $<
lualatex -interaction batchmode -shell-escape -output-directory=build/iadocs $<
build/iadocs/source.gen: go.* *.go frontend/*.css frontend/*.ts templates/* scripts/latexify-source.sh \
docs/* sql/* scripts/* iadocs/*.tex iadocs/*.texinc iadocs/bib.bib Makefile \
README.md LICENSE .editorconfig .gitignore .gitattributes
mkdir -p $(@D)
scripts/latexify-source.sh
# TeX includes and bibliography files could just be copied over
build/iadocs/%.texinc: iadocs/%.texinc
mkdir -p $(@D)
cp $< $@
build/iadocs/%.bib: iadocs/%.bib
mkdir -p $(@D)
cp $< $@
# Minified files will be embedded from build/static/
build/static/style.css: frontend/style.css
mkdir -p $(@D)
gominify -o $@ $<
build/static/student.js: frontend/student.ts
mkdir -p $(@D)
tsc $< --target ES6 --strict --noImplicitAny --outFile $@
gominify -o $@ $@
# Cleaning (git clean -xfd is a bit too aggressive, I lost my config once)
clean:
rm -rf dist build