-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
68 lines (57 loc) · 2.08 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
COQC=coqc
VFILES=$(wildcard *.v)
VEXERCISES=$(wildcard exercise*.v)
HTML=$(VFILES:%.v=%.html) $(VEXERCISES:%.v=%-solution.html)
html: $(HTML)
run: jscoq.stamp html
@echo
@echo "Go to: http://localhost:8000/demo.html"
@echo
python3 -m http.server 8000 || python -m SimpleHTTPServer 8000
%.html.tmp: %.v header.html footer.html Makefile setup.stamp jscoq.stamp
# if does not work, then html ok but no links
-$(COQC) $< > /dev/null
udoc/_build/install/default/bin/udoc --with-header header.html --with-footer footer.html -t $* $< -o $@
lesson%.html : lesson%.html.tmp
@mv $< $@
cheat%.html : cheat%.html.tmp
@mv $< $@
similar.html : similar.v
udoc/_build/install/default/bin/udoc --with-header header.html --with-footer footer.html -t $* $< -o $@
# Exercises
exercise%.html: exercise%.html.tmp
@sed -e '/^(\*D\*).*$$/d' -e 's/^(\*A\*).*$$/Admitted./' -e 's/^\(.*\)(\*a\*).*$$/\1admit./' $< > $@
exercise%-solution.html: exercise%.html.tmp
@sed -e 's/^(\*D\*)//' -e 's/^(\*A\*)//' -e 's/(\*a\*)//' $< > $@
exercise%-todo.v: exercise%.v
@sed -e '/^(\*D\*).*$$/d' -e 's/^(\*A\*).*$$/Admitted./' -e 's/^\(.*\)(\*a\*).*$$/\1admit./' $< > $@
jscoq.stamp: jscoq.tgz
tar -xzf jscoq.tgz
touch $@
setup.stamp:
git submodule update --init --remote
which dune
cd udoc && make all
touch setup.stamp
refresh-jscoq:
rm -rf jscoq-src/ && git submodule update --init --remote && make build-jscoq && make jscoq.stamp
PWD=$(shell pwd)
OPAMROOT=$(PWD)/_opam
export OPAMROOT
# The default addon is mathcomp, but if you don't build jscoq first you
# don't have coq_makefile, so the addon cannot be built.
# Also, the last bit of make addons fails, but it is run again at make dist
build-jscoq:
dpkg -l gcc-multilib || sudo apt-get install gcc-multilib
which npm
opam init -j 2 -y --compiler 4.07.1
eval `opam env` && cd jscoq-src && \
git submodule update --init --remote && \
etc/toolchain-setup.sh && \
make coq && \
make jscoq ADDONS= && \
make addons ; \
make jscoq && \
make dist
mv jscoq-src/_build/dist/ jscoq-src/_build/jscoq
cd jscoq-src/_build/ && tar -czf ../../jscoq.tgz jscoq