-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (77 loc) · 2.52 KB
/
Makefile
File metadata and controls
107 lines (77 loc) · 2.52 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
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
# The project's name.
THIS := optitrust
OPTITRUST_PREFIX := `opam config var prefix`
INSTALL_TARGET := $(OPTITRUST_PREFIX)/lib/$(THIS)
BROWSER ?= xdg-open
OPTITRUST_BROWSER ?= firefox
all:
dune build
precompile:
$(MAKE) -C include precompiled_stdlib.pch
keep_building:
dune build --watch --terminal-persistence=clear-on-rebuild
install_git_hooks: .git/hooks/pre-commit
.git/hooks/pre-commit:
ln -s ../../tools/pre-commit.sh $@
# requires root access -- can use another absolute path if needed
COMPCERT_STDLIB_DIR_DST=/usr/local/lib/compcert
COMPCERT_STDLIB_DIR_SRC=./src/c/compcert_parser/include
install_compcert_stdlib:
install -d $(COMPCERT_STDLIB_DIR_DST)
install -m 0644 $(COMPCERT_STDLIB_DIR_SRC)/*.h $(COMPCERT_STDLIB_DIR_DST)
install:
dune build -p $(THIS) @install
dune install -p $(THIS)
uninstall:
@ ocamlfind remove $(THIS) || true
# dune uninstall
reinstall: uninstall
@ make install
show_install:
@ echo "#require \"$(THIS)\";;\nopen Optitrust;;\n#show Run;;" | ocaml
BUILDOCDIR = _build/default/_doc/_html
FINALDOCDIR = _doc
DOC = $(FINALDOCDIR)/optitrust/Optitrust/index.html
.PHONY: cleandoc
cleandoc:
@ rm -rf $(BUILDOCDIR)
# FIXME: should probably run './tester run tests/*/*_doc -dump-trace', but its expensive, let user do it?
.PHONY: doc
doc:
@ dune build -p $(THIS) @doc
@ rm -rf $(FINALDOCDIR)
@ cp -r $(BUILDOCDIR) $(FINALDOCDIR)
@ ./doc/add_tests_into_doc.sh
@ find $(FINALDOCDIR) -name "*.html" -exec sed -i 's|_doc/optitrust|optitrust/optitrust|g' {} +
@ echo "You can view the documentation by typing 'make viewdoc'".
test_into_doc:
@ ./doc/add_tests_into_doc.sh
.PHONY: viewdoc
viewdoc:
tools/open_in_browser.sh $(DOC)
# Also for testing:
# in terminal, execute utop-full
# type: #require "optitrust";;
# type: open Optitrust;;
# type: #show "Run";;
# type: exit 0;;
tests:
./tester run
style:
find tests/ src/ -path tests/batch -prune -o -path src/c/compcert_parser -prune -o -name "*.ml" -print0 | xargs -0 grep --color -nE '.{101}'
clean: clean_cache
dune clean
rm include/*.pch
clean_cache:
find . -type f -name '*.ser' -exec rm {} +
find . -type f -name '*.trace' -exec rm {} +
find . -type f -name '*_notfmt.cpp' -exec rm {} +
find . -type f -name '*.cmxs' -exec rm -f {} +
watch:
nohup .vscode/watch.sh >/dev/null 2>&1
PDFS := $(patsubst %.md, %.pdf, $(wildcard *.md))
md: $(PDFS)
%.pdf: %.md
pandoc -V geometry:margin=1in $< -o $@
artifact: sc_artifact.pdf
.PHONY: all install install_git_hooks install_compcert_stdlib uninstall show_install tests clean watch md artifact