-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
72 lines (47 loc) · 1.74 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
OCAMLC = ocamlc
OCAMLOPT = ocamlopt
OCAMLOPTFLAGS =
OCAMLABI := $(shell ocamlc -version)
OCAMLLIBDIR := $(shell ocamlc -where)
OCAMLDESTDIR ?= $(OCAMLLIBDIR)
OCAML_TEST_INC = -I `ocamlfind query oUnit`
OCAML_TEST_LIB = `ocamlfind query oUnit`/oUnit.cmxa
LIBS = inotify.cmi inotify.cmxa inotify.cma
PROGRAMS = test_inotify
PKG_NAME = inotify
all: $(LIBS)
all-byte: inotify.cmi inotify.cma
all-opt: inotify.cmi inotify.cmxa inotify.cma
bins: $(PROGRAMS)
libs: $(LIBS)
inotify.cmxa: libinotify_stubs.a inotify_stubs.a inotify.cmx
$(OCAMLOPT) $(OCAMLOPTFLAGS) -a -cclib -linotify_stubs -o $@ inotify.cmx
inotify.cma: libinotify_stubs.a inotify.cmi inotify.cmo
$(OCAMLC) -a -dllib dllinotify_stubs.so -cclib -linotify_stubs -o $@ inotify.cmo
inotify_stubs.a: inotify_stubs.o
ocamlmklib -o inotify_stubs $+
libinotify_stubs.a: inotify_stubs.o
ar rcs $@ $+
ocamlmklib -o inotify_stubs $+
%.cmo: %.ml
$(OCAMLC) -c -o $@ $<
%.cmi: %.mli
$(OCAMLC) -c -o $@ $<
%.cmx: %.ml
$(OCAMLOPT) $(OCAMLOPTFLAGS) -c -o $@ $<
%.o: %.c
$(OCAMLC) -c -o $@ $<
OCAMLFIND_INSTALL_FLAGS ?= -destdir $(OCAMLDESTDIR) -ldconf ignore
.PHONY: install
install: $(LIBS)
ocamlfind install $(OCAMLFIND_INSTALL_FLAGS) $(PKG_NAME) META inotify.cmi inotify.mli inotify.cma inotify.cmxa *.a *.so *.cmx
install-byte:
ocamlfind install $(OCAMLFIND_INSTALL_FLAGS) $(PKG_NAME) META inotify.cmi inotify.mli inotify.cma *.a *.so
install-opt:
ocamlfind install $(OCAMLFIND_INSTALL_FLAGS) $(PKG_NAME) META inotify.cmi inotify.mli inotify.cma inotify.cmxa *.a *.so *.cmx
uninstall:
ocamlfind remove $(OCAMLFIND_INSTALL_FLAGS) $(PKG_NAME)
test.inotify: inotify.cmxa test.inotify.ml
$(OCAMLOPT) -o $@ unix.cmxa $+
clean:
-rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa $(LIBS) $(PROGRAMS)