-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMakefile
70 lines (54 loc) · 1.26 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
#
# (c) 2014 Andreas Rossberg
#
NAME = 1ml
MODULES = \
lib source prim syntax parser lexer \
fomega types iL env erase trace sub elab \
lambda compile \
main
NOMLI = syntax iL main
PARSERS = parser
LEXERS = lexer
SAMPLES = prelude paper
TEXTS = README
MLS = $(MODULES:%=%.ml)
MLIS = $(filter-out $(NOMLI:%=%.mli), $(MODULES:%=%.mli))
MLYS = $(PARSERS:%=%.mly)
MLLS = $(LEXERS:%=%.mll)
CMOS = $(MODULES:%=%.cmo)
CMXS = $(MODULES:%=%.cmx)
IMLS = $(SAMPLES:%=%.1ml)
TXTS = $(TEXTS:%=%.txt)
$(NAME): $(CMXS) Makefile
ocamlopt $(CMXS) -o $@
unopt: $(CMOS) Makefile
ocamlc $(CMOS) -g -o $(NAME)
$(filter-out $(NOMLI:%=%.cmo), $(CMOS)): %.cmo: %.cmi
$(filter-out $(NOMLI:%=%.cmx), $(CMXS)): %.cmx: %.cmi
Makefile.depend: $(MLS) $(MLIS) Makefile
ocamldep $^ >$@
-include Makefile.depend
zip: $(MLS) $(MLIS) $(MLYS) $(MLLS) Makefile $(IMLS) $(TXTS)
mkdir tmp tmp/$(NAME)
cp $^ tmp/$(NAME)
rm -f $(NAME).zip
(cd tmp; zip -r ../$(NAME).zip $(NAME))
rm -r tmp
clean:
rm -f *.cmi *.cmo *.cmx *.o *.output *.depend
rm -f *.native *.byte $(NAME) $(NAME).opt $(NAME).zip
rm -f *~
%.cmi: %.mli
ocamlc -c $<
%.cmo: %.ml
ocamlc -c -g $<
%.cmx: %.ml
ocamlopt -c $<
%.ml: %.mly
ocamlyacc -v $<
%.mli: %.mly
ocamlyacc -v $<
%.ml: %.mll
ocamllex $<
.PRECIOUS: %.ml %.mli