-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
101 lines (85 loc) · 2.88 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
#
# invoke make with 'VERBOSE=1' to verbose the output
#
include variables.mk
.PHONY: all clean compcert parser proof extraction $(VELUS) $(EXAMPLESDIR) documentation
all: $(VELUS)
# COMPCERT COQ
compcert: $(COMPCERTDIR)/Makefile.config
@echo "${bold}Building CompCert...${normal}"
$(MAKE) $(COMPCERTFLAGS) #compcert.ini driver/Version.ml proof
@echo "${bold}OK.${normal}"
# LUSTRE PARSER
parser:
@echo "${bold}Building Lustre parser...${normal}"
$(MAKE) $(PARSERFLAGS) all
@echo "${bold}OK.${normal}"
# VELUS COQ
proof: compcert parser $(MAKEFILEAUTO) $(MAKEFILECONFIG)
@echo "${bold}Building Velus proof...${normal}"
test -f .depend || $(MAKE) -s -f $(MAKEFILEAUTO) depend
$(MAKE) -s -f $(MAKEFILEAUTO) all
@echo "${bold}OK.${normal}"
$(MAKEFILEAUTO): automake $(COQPROJECT)
./$< -e ./$(EXTRACTION)/Extraction.v -f $(EXTRACTED) -o $@ $(COQPROJECT)
# EXTRACTION
extraction: proof
@echo "${bold}Extracting Velus Ocaml code...${normal}"
$(MAKE) -s -f $(MAKEFILEAUTO) $@
cp -f $(PARSERDIR)/LustreLexer.ml\
$(PARSERDIR)/Relexer.ml\
$(PARSERDIR)/LustreParser2.ml\
$(PARSERDIR)/LustreParser2.mli\
$(SRC_DIR)/CoreExpr/coreexprlib.ml\
$(SRC_DIR)/Lustre/lustrelib.ml\
$(SRC_DIR)/NLustre/nlustrelib.ml\
$(SRC_DIR)/Stc/stclib.ml\
$(SRC_DIR)/Obc/obclib.ml\
$(SRC_DIR)/ObcToClight/interfacelib.ml\
$(COMPCERT_INCLUDES:%=$(COMPCERTDIR)/%/*.ml*)\
$(EXTRACTED)
@echo "${bold}OK.${normal}"
# VELUS
$(VELUS): extraction $(SRC_DIR)/$(VELUSMAIN).ml $(SRC_DIR)/veluslib.ml
@echo "${bold}Building Velus...${normal}"
ocamlbuild $(FLAGS) $(VELUSMAIN).$(TARGET)
mv $(VELUSMAIN).$(TARGET) $@
cp $(COMPCERTDIR)/compcert.ini $(BUILDDIR)/$(SRC_DIR)/compcert.ini
@echo "${bold}Done.${normal}"
# TOOLS
$(AUTOMAKE): $(TOOLSDIR)/$(AUTOMAKE).ml
ocamlopt -o $@ $<
$(TOOLSDIR)/$(AUTOMAKE).ml: $(TOOLSDIR)/$(AUTOMAKE).mll
@echo "${bold}Building automake tool...${normal}"
ocamllex $<
velustotex: extraction tools/velustotex.ml
@echo "${bold}Building velustotex...${normal}"
ocamlbuild $(FLAGS) -I tools $@.$(TARGET)
mv $@.$(TARGET) $@
cp $(COMPCERTDIR)/compcert.ini $(BUILDDIR)/tools/compcert.ini
@echo "${bold}Done.${normal}"
# EXAMPLES
$(EXAMPLESDIR): $(VELUS)
$(MAKE) $(EXAMPLESFLAGS)
# DOCUMENTATION
documentation: proof $(MAKEFILEAUTO)
@echo "${bold}Exporting CompCert HTML doc...${normal}"
$(MAKE) $(COMPCERTFLAGS) documentation
@echo "${bold}OK.${normal}"
@echo "${bold}Exporting Velus HTML doc...${normal}"
mkdir -p doc/html
rm -f doc/html/*.html
make -s -f $(MAKEFILEAUTO) $@
@echo "${bold}OK.${normal}"
# CLEAN
clean:
if [ -f $(MAKEFILEAUTO) ] ; then $(MAKE) -s -f $(MAKEFILEAUTO) $@; fi;
rm -f $(MAKEFILEAUTO)
rm -f $(AUTOMAKE) $(TOOLSDIR)/$(AUTOMAKE).ml $(TOOLSDIR)/$(AUTOMAKE).cm* $(TOOLSDIR)/$(AUTOMAKE).o
$(MAKE) $(PARSERFLAGS) $@
$(MAKE) $(EXAMPLESFLAGS) $@
ocamlbuild -clean
realclean: clean
rm -f $(MAKEFILECONFIG) $(COQPROJECT)
$(MAKE) $(COMPCERTFLAGS) $<
$(MAKE) $(EXAMPLESFLAGS) $@