-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
86 lines (59 loc) · 2.04 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
.PHONY: build test install uninstall reinstall clean
FINDLIB_NAME=profuse
MOD_NAME=profuse
OCAML_LIB_DIR=$(shell ocamlc -where)
CTYPES_LIB_DIR=$(shell ocamlfind query ctypes)
OCAMLBUILD=CTYPES_LIB_DIR=$(CTYPES_LIB_DIR) OCAML_LIB_DIR=$(OCAML_LIB_DIR) \
ocamlbuild -use-ocamlfind -classic-display
WITH_LWT=$(shell ocamlfind query lwt > /dev/null 2>&1 ; echo $$?)
WITH_CMDLINER=$(shell ocamlfind query cmdliner > /dev/null 2>&1 ; echo $$?)
TARGETS=.cma .cmxa
PRODUCTS=$(addprefix $(MOD_NAME)_,$(TARGETS)) \
# $(addprefix $(MOD_NAME)_linux,$(TARGETS))
# lib$(MOD_NAME)_stubs.a dll$(MOD_NAME)_stubs.so
ifeq ($(WITH_LWT), 0)
PRODUCTS+=$(addprefix $(MOD_NAME)_lwt,$(TARGETS))
endif
ifeq ($(WITH_CMDLINER), 0)
PRODUCTS+=fusedump.native
endif
TYPES=.mli .cmi .cmti
VERSIONS=_7_8 _7_23
INSTALL:=$(addprefix $(MOD_NAME), $(TYPES)) \
$(addprefix profuse_signatures, $(TYPES)) \
$(foreach versioned,$(addprefix $(MOD_NAME), $(VERSIONS)),\
$(addprefix $(versioned), $(TYPES)))\
$(addprefix fuse, $(TYPES)) \
$(addprefix nodes, $(TYPES)) \
$(addprefix $(MOD_NAME)_, $(TARGETS))
INSTALL:=$(addprefix _build/lib/,$(INSTALL))
ifeq ($(WITH_LWT), 0)
INSTALL_LWT:=$(addprefix fuse_lwt,$(TYPES)) \
$(addprefix $(MOD_NAME)_lwt,$(TARGETS))
INSTALL_LWT:=$(addprefix _build/lwt/,$(INSTALL_LWT))
INSTALL+=$(INSTALL_LWT)
endif
ARCHIVES:=_build/lib/$(MOD_NAME)_.a
ifeq ($(WITH_LWT), 0)
ARCHIVES+=_build/lwt/$(MOD_NAME)_lwt.a
endif
build: lib/profuse_signatures.mli
$(OCAMLBUILD) $(PRODUCTS)
lib/profuse_signatures.mli: lib/profuse_signatures.ml
echo "(* THIS FILE IS AUTOGENERATED, SEE MAKEFILE *)" > $@
ocamlfind ocamlc \
-package unix-fcntl,unix-errno,unix-sys-stat,unix-dirent \
-package unix-unistd,ctypes -i \
lib/profuse_signatures.ml >> $@ || (rm -f $@ && false)
test: build
$(OCAMLBUILD) lib_test/test.native
./test.native
install:
ocamlfind install $(FINDLIB_NAME) META \
$(INSTALL) \
$(ARCHIVES)
uninstall:
ocamlfind remove $(FINDLIB_NAME)
reinstall: uninstall install
clean:
ocamlbuild -clean