Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (66 loc) · 2.88 KB
/
Copy pathMakefile
File metadata and controls
78 lines (66 loc) · 2.88 KB
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
# CSwL's Makefile — builds the book in its four variants.
#
# Each variant produces `_out/<variant>/{html,lean}`:
#
# student full prose, answer keys elided (become `sorry`)
# -> the cut that becomes the GitHub Classroom assignment and
# the published HTML book
# solutions full prose, answer keys shown
# -> answer key, published after each submission
# terse lecture prose, answer keys elided and `workinclass!` proofs
# stubbed -> opened in VS Code during class
# grading full prose, answer keys shown plus `import AutograderLib`
# and the `[autogradedProof …]` attributes -> never leaves the
# private repository; it's what
# lake exe autograder --local <submission> <file>
# runs against
#
# `_out/<variant>/lean/` is a standalone Lake project (with its own
# `lakefile.toml` and `lean-toolchain`), generated by
# `CSwLMeta/Save/Project.lean`. `lean4-autograder-main` is a dependency only
# of the `grading` variant's generated project -- never of CSwL's own
# `lakefile.toml`, where it would collide with the Mathlib that `cslib`
# brings.
#
# The `Literate`/`build-web.sh` pipeline was retired on 08/16: all four
# chapters are already in the `Manual` genre, and the book is only built
# from here.
.PHONY: all student solutions terse grading build serve clean lecture
default: all
all: student solutions terse grading
# Builds the executable before running any variant. On subsequent calls
# Lake notices nothing changed and exits immediately.
build:
lake build cswl-book
student: build
lake exe cswl-book student
solutions: build
lake exe cswl-book solutions
terse: build
lake exe cswl-book terse
grading: build
lake exe cswl-book grading
# Serves all four variants at http://127.0.0.1:8000/ (each under
# `<variant>/html/`), with Verso's own server -- configured in
# `verso-serve.toml`. Replaces the old `python3 -m http.server -d _out/`.
serve: all
lake build verso-serve
lake exe verso-serve
clean:
rm -rf _out/
# Copies the `terse` Lake project to a working directory outside the
# repository, `../lecture` by default (`make lecture LECTURE=<dir>` for another), for
# the instructor to open in VS Code in class, and builds it. The directory is
# a local git repository and is never published: commit in it after each
# class to keep what was written there. The target refuses to overwrite
# changes that are not committed.
LECTURE ?= ../lecture
lecture: terse
@if [ -d "$(LECTURE)/.git" ] && [ -n "$$(git -C "$(LECTURE)" status --porcelain)" ]; then \
echo "error: $(LECTURE) has uncommitted changes; commit or discard them first" >&2; \
exit 1; \
fi
mkdir -p "$(LECTURE)"
rsync -a --delete --exclude=.git --exclude=.lake _out/terse/lean/ "$(LECTURE)/"
[ -d "$(LECTURE)/.git" ] || git -C "$(LECTURE)" init --quiet
cd "$(LECTURE)" && lake exe cache get && lake build