-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
94 lines (70 loc) · 2.13 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
# canopy makefile
#
# ----------------------------------------------------------------------------
# executable programs
OCAMLC=ocamlc
OCAMLOPT=ocamlopt
OCAMLMKTOP=ocamlmktop
OCAMLDEP=ocamldep
OCAMLFIND=ocamlfind
OCAMLYACC=ocamlyacc
OCAMLLEX=ocamllex
# ----------------------------------------------------------------------------
# final executable names
OUT=runferret
TOP=ferret
# ----------------------------------------------------------------------------
# third-party, site-lib modules
OCAMLNET=equeue netstring netsys netclient smtp
LWT=lwt
# ----------------------------------------------------------------------------
# compiler and linker options
PKGS=-package "$(OCAMLNET)"
LINK=-linkpkg -inline 3 -ccopt -O2
OPTS=-pp camlp4o -thread
# ----------------------------------------------------------------------------
# input module files
SOURCES= \
parsec \
lexer \
atom \
mvar \
cell \
compiler \
interp \
terminal \
core \
prims \
main
# ----------------------------------------------------------------------------
# source files with proper extensions added
ML := $(addsuffix .ml, $(SOURCES))
MLI := $(addsuffix .mli, $(SOURCES))
CMO := $(addsuffix .cmo, $(SOURCES))
CMI := $(addsuffix .cmi, $(SOURCES))
CMX := $(addsuffix .cmx, $(SOURCES))
OBJ := $(addsuffix .o, $(SOURCES))
# ----------------------------------------------------------------------------
# top-level rules
all: $(OUT)
top: $(TOP)
# ----------------------------------------------------------------------------
# clean-up rule
clean:
rm -f $(OUT) $(TOP) $(MLI) $(CMI) $(CMO) $(CMX) $(OBJ) .depend
# ----------------------------------------------------------------------------
# build rules
$(OUT): $(ML)
$(OCAMLFIND) $(OCAMLOPT) $(OPTS) $(PKGS) $(LINK) $(ML) -o $(OUT)
$(TOP): $(ML)
$(OCAMLFIND) $(OCAMLMKTOP) $(OPTS) $(PKGS) $(ML) -o $(TOP)
%.mli: %.ml
$(OCAMLFIND) $(OCAMLOPT) $(OPTS) $(PKGS) -c -i $< > $@
%.cmi: %.mli
$(OCAMLFIND) $(OCAMLOPT) $(OPTS) $(PKGS) $<
%.cmx: %.ml
$(OCAMLFIND) $(OCAMLOPT) $(OPTS) $(PKGS) -c $<
%.cmo: %.ml
$(OCAMLFIND) $(OCAMLC) $(OPTS) $(PKGS) -c $<
.depend: $(ML)
$(OCAMLDEP) *.mli *.ml > .depend