-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
110 lines (76 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
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
#
# Mettre la liste des fichiers .ml, .mly, .mll et .mli
# constituant le projet. Si un fichier b.ml dépend d'un fichier
# a.ml, a.ml doit se trouver avant dans la liste.
#
SOURCES = analysis.ml ast.mli parser.mly lexer.mll typing.ml amd64.ml compile.ml main.ml
# Nom du binaire
EXEC = minic
#######################################################################
# Partie générique, ne pas modifier.
#######################################################################
# Compilateurs
CAMLC = ocamlc nums.cma
CAMLOPT = ocamlopt nums.cmxa
CAMLDEP = ocamldep
CAMLLEX = ocamllex
CAMLYACC = menhir
CAMLYACC_FLAGS = --explain --infer
# Sources
SRC_MLL = $(filter %.mll, $(SOURCES))
SRC_MLY = $(filter %.mly, $(SOURCES))
SMLIY = $(SOURCES:.mly=.ml)
SMLIYL = $(SMLIY:.mll=.ml)
SMLYL = $(filter %.ml,$(SMLIYL))
OBJS = $(SMLYL:.ml=.cmo)
OPTOBJS = $(OBJS:.cmo=.cmx)
all: depend $(EXEC)
opt: depend $(EXEC).opt
$(EXEC): $(OBJS)
$(CAMLC) $(CUSTOM) -o $(EXEC) $(OBJS)
$(EXEC).opt: $(OPTOBJS)
$(CAMLOPT) -o $(EXEC) $(OPTOBJS)
.SUFFIXES: .ml .mli .cmo .cmi .cmx .mll .mly
.ml.cmo:
$(CAMLC) -c -bin-annot $<
.mli.cmi:
$(CAMLC) -c -bin-annot $<
.ml.cmx:
$(CAMLOPT) -c -bin-annot $<
.mll.cmo:
$(CAMLLEX) $<
$(CAMLC) -c -bin-annot $*.ml
.mll.cmx:
$(CAMLLEX) $<
$(CAMLOPT) -c -bin-annot $*.ml
.mly.cmo:
$(CAMLYACC) $(CAMLYACC_FLAGS) $<
$(CAMLC) -c -bin-annot $*.mli
$(CAMLC) -c -bin-annot $*.ml
.mly.cmx:
$(CAMLYACC) $(CAMLYACC_FLAGS) $<
$(CAMLOPT) -c -bin-annot $*.mli
$(CAMLOPT) -c -bin-annot $*.ml
.mly.cmi:
$(CAMLYACC) $<
$(CAMLC) -c -bin-annot $*.mli
.mll.ml:
$(CAMLLEX) $<
.mly.ml:
$(CAMLYACC) $(CAMLYACC_FLAGS) $<
clean:
rm -f *.cm[iox] *.cmt *.cmti *~ .*~ *.o parser.conflicts
rm -f $(SRC_MLL:.mll=.ml) $(SRC_MLY:.mly=.ml) $(SRC_MLY:.mly=.mli)
rm -f $(EXEC)
rm -f $(EXEC).opt
@cd tests && $(MAKE) clean
depend: $(SMLIYL)
echo $(SMLIYL)
$(CAMLDEP) $(SMLIYL) $(SRC_MLY:.mly=.mli) > depend
$(CAMLYACC) --depend $(SRC_MLY) >> depend 2>/dev/null
-include depend
# Tests unitaires (pas portable probablement...)
.PHONY: test tests
test:
tests:
@cd tests && $(MAKE) -i