-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathOMakefile
79 lines (59 loc) · 1.83 KB
/
OMakefile
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
prefix = /usr/local
INSTALL = install
RM = rm -f
# allow to override the above variables from command line
DefineCommandVars()
USE_OCAMLFIND = true
NATIVE_ENABLED = true
BYTE_ENABLED = true
ENDIANNESS = LITTLE_ENDIAN
match $(string $(shell ocaml -version))
case $"\([0-9]\)\.\([0-9]+\)\."
OCAML_MAJOR = $1
OCAML_MINOR = $2
export
OCAMLFLAGS = -w +a-4-32-44-48 -warn-error +a-3-4-6-7-9-18-27..29-32..99
OCAMLOPTFLAGS = -g -inline 100
OCAMLCFLAGS += -g
if $(ge $(OCAML_MAJOR), 4)
OCAMLFLAGS += -bin-annot
export
OCAMLPACKS[] =
camlp4
extlib
bytes
str
# workaround for missing dep in camlp4's META for >= 3.11
if $(or $(gt $(OCAML_MAJOR), 3), $(and $(equal $(OCAML_MAJOR), 3), $(ge $(OCAML_MINOR), 11)))
OCAMLPACKS = dynlink $(OCAMLPACKS)
export
# workaround for ocamldep-postproc bug in case-insensitive, case-preserving FS
# cf. https://github.com/ocaml-omake/omake/pull/150
Shell. +=
ocamldep-postproc(argv) =
OCamlScannerPostproc($(stdin))
CamlSources(mods) =
foreach(mod => ..., $(mods))
$(addsuffixes .cmo .cmi .cmx .sig $(EXT_OBJ), $(mod)):
CamlTargets(mods) =
return($(addsuffixes .cmo .cmi .cmx .o, $(mods)))
BASE = $(dir .)
%.sig: %.ml %.cmo
$(OCAMLFIND) $(OCAMLC) -package $(concat \,, $(OCAMLPACKS)) \
$(mapprefix -I, $(OCAMLINCLUDES)) \
$(OCAMLFLAGS) $(OCAMLCFLAGS) -i $< > $@
.SUBDIRS: compiler examples runtime test
extprotc$(EXE): compiler/extprotc$(EXE)
cp $^ $@
.DEFAULT: extprotc$(EXE)
.PHONY: install
install:
$(INSTALL) compiler/extprotc$(EXE) $(prefix)/bin/
ocamlfind install -patch-version "git" extprot runtime/META $(addsuffixes .cma .cmxa .cmxs .cmx .cmi .a, runtime/extprot) runtime/*.mli
.PHONY: uninstall
uninstall:
$(RM) $(prefix)/bin/extprotc$(EXE)
ocamlfind remove extprot
.PHONY: clean
clean:
$(RM) $(filter-proper-targets $(ls R, .)) *.s *.annot *.cmt *.cmti