-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.common
123 lines (81 loc) · 2.69 KB
/
Makefile.common
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
120
121
122
123
# SimSoC-Cert, a toolkit for generating certified processor simulators
# See the COPYRIGHTS and LICENSE files.
# requires various variables to be defined:
# - DIR: relative path to root directory
# - COQ_INCLUDES: include directories other than CompCert ones
# defines the variables: CC, COQC, COQTOP
# provides the targets: extraction, libcoq, otags
# in addition:
# - default is the default target
# - clean is set to have :: dependencies
include $(DIR)/compcert/Makefile.config
ifeq ($(VERBOSE),1)
SHOW := @true
HIDE :=
else
SHOW := @echo
HIDE := @
endif
.PHONY: start default clean
start: default
FORCE:
######################################################################
# configure
$(DIR)/compcert/Makefile.config:
@echo "do './configure /path/to/compcert' first"; exit 1
######################################################################
# C compiler
CC := gcc
######################################################################
# extraction
COMPCERT := lib common $(ARCH)/$(VARIANT) $(ARCH) backend cfrontend driver
DEFAULT_COQ_INCLUDES := $(COMPCERT:%=-I $(DIR)/compcert/%)
COQTOP := coqtop -q $(DEFAULT_COQ_INCLUDES) $(COQ_INCLUDES) -batch -load-vernac-source
extraction: $(DIR)/coq/Extraction.vo extraction.v
mkdir -p extraction
$(SHOW) coqtop extraction.v
$(HIDE) $(COQTOP) ./extraction.v
clean::
rm -rf extraction
.PHONY: extraction-libcoq
extraction-libcoq:
$(MAKE) -C $(DIR)/coq extraction
.PHONY: ocaml
######################################################################
# Coq compiler
COQ_MAKEFILE := coq_makefile $(DEFAULT_COQ_INCLUDES) $(COQ_INCLUDES)
COQDEP := coqdep $(DEFAULT_COQ_INCLUDES) $(COQ_INCLUDES) -I .
COQC := coqc -q $(DEFAULT_COQ_INCLUDES) $(COQ_INCLUDES) -dont-load-proofs
%.vo: %.v
$(SHOW) coqc $<
$(HIDE) $(COQC) $<
.PHONY: libcoq
libcoq:
$(MAKE) -C $(DIR)/coq
COQDOC := coqdoc --html -toc -g -d html
######################################################################
# ocamlbuild
OCAMLBUILD := cd $(DIR) && ocamlbuild -j 2 -no-hygiene -no-links
######################################################################
# simgen
SIMGEN := $(DIR)/simgen/main
$(SIMGEN): FORCE
$(MAKE) -C $(DIR)/simgen
%.v: %.c $(SIMGEN)
$(SIMGEN) -ocompcertc-c -fstruct-assign -fno-longlong $< > $@
######################################################################
# dependot
DEPENDOT := $(DIR)/tools/dependot/dependot
$(DEPENDOT): FORCE
$(MAKE) -C $(DIR)/tools/dependot
%.dot: %.dep $(DEPENDOT)
$(DEPENDOT) < $< > $@
%.ps: %.dep $(DEPENDOT)
$(DEPENDOT) < $< | dot -Tps > $@
%.pdf: %.dep $(DEPENDOT)
$(DEPENDOT) < $< | dot -Tpdf > $@
######################################################################
# otags
.PHONY: otags
otags:
otags -sr '.mli' -r .