-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
108 lines (82 loc) · 2.55 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
##########################
# #
# Sub repositories #
# #
##########################
UTIL:=ocaml_util
SUBREPOSITORIES:=$(UTIL)
##########################
# #
# Libraries definitions. #
# #
##########################
OCAMLLIBS:=-I . -I $(UTIL)
##########################
# #
# Variables definitions. #
# #
##########################
CAMLLIB:=$(shell $(CAMLBIN)ocamlc.opt -where)
CAMLC:=$(CAMLBIN)ocamlc.opt -c
CAMLOPTC:=$(CAMLBIN)ocamlopt.opt -c
CAMLLINK:=$(CAMLBIN)ocamlc.opt
CAMLOPTLINK:=$(CAMLBIN)ocamlopt.opt
CAMLDOC:=$(CAMLBIN)ocamldoc.opt
###################################
# #
# Definition of the "all" target. #
# #
###################################
MLFILES:= \
asm.ml \
hello.ml
CMOFILES:=$(MLFILES:.ml=.cmo)
CMOFILES0:=$(filter-out ,$(CMOFILES))
CMIFILES:=$(MLFILES:.ml=.cmi)
CMIFILES0:=$(filter-out ,$(CMIFILES))
CMXFILES:=$(MLFILES:.ml=.cmx)
CMXSFILES:=$(MLFILES:.ml=.cmxs)
CMXSFILES0:=$(filter-out ,$(CMXSFILES))
OFILES:=$(MLFILES:.ml=.o)
MLIFILES:=$(MLFILES:.ml=.mli)
all: $(SUBREPOSITORIES) $(CMOFILES) $(CMXSFILES)
$(UTIL):
cd $(UTIL); $(MAKE) all
####################
# #
# Special targets. #
# #
####################
.PHONY: all opt byte archclean clean install depend html $(SUBREPOSITORIES)
%.cmi: %.mli
$(CAMLC) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) $<
%.cmo: %.ml
$(CAMLC) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) $(PP) $<
%.cmx: %.ml
$(CAMLOPTC) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) $(PP) $<
%.cmxs: %.ml
$(CAMLOPTLINK) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) -shared -o $@ $(PP) $<
%.cmo: %.ml4
$(CAMLC) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) $(PP) -impl $<
%.cmx: %.ml4
$(CAMLOPTC) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) $(PP) -impl $<
%.cmxs: %.ml4
$(CAMLOPTLINK) $(OCAMLLIBS) $(ZDEBUG) $(ZFLAGS) -shared -o $@ $(PP) -impl $<
%.ml.d: %.ml
$(CAMLBIN)ocamldep -slash $(OCAMLLIBS) $(PP) "$<" > "$@"
byte:
$(MAKE) all "OPT:=-byte"
opt:
$(MAKE) all "OPT:=-opt"
clean:
rm -f $(CMOFILES) $(CMIFILES) $(CMXFILES) $(CMXSFILES) $(OFILES) $(MLFILES:.ml=.cmo) $(MLFILES:.ml=.cmx) *~
rm -f $(CMOFILES) $(MLFILES:.ml=.cmi) $(MLFILES:.ml=.ml.d) $(MLFILES:.ml=.cmx) $(MLFILES:.ml=.o)
cd $(UTIL); $(MAKE) clean
archclean:
rm -f *.cmx *.o
-include $(MLFILES:.ml=.ml.d)
.SECONDARY: $(MLFILES:.ml=.ml.d)
#API Documents (ocamldoc,coqdoc)
html: $(SUBREPOSITORIES) $(MLIFILES)
mkdir -p html/ocamldoc
$(CAMLDOC) -I $(UTIL) -d html/ocamldoc -html $(MLIFILES)