-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
77 lines (63 loc) · 2.28 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
# new makefile - the build is about to get more complex.
all: top
json:
atdgen -t Ipython_json.atd
atdgen -j Ipython_json.atd
stub:
ocamlfind c iocaml_zmq_stubs.c
lib: json stub
# compile log (first so we can use it in the zmq code)
ocamlfind c -c -g log.mli log.ml
# iocaml_zmq (which requires preprocessing)
ocamlfind c -c -g \
-syntax camlp4o -package lwt.unix,lwt.syntax,ctypes.foreign \
iocaml_zmq.mli iocaml_zmq.ml
# rest of the library
ocamlfind c -c -g \
-package yojson,atdgen,compiler-libs \
Ipython_json_t.mli Ipython_json_j.mli base64.mli \
Ipython_json_t.ml Ipython_json_j.ml base64.ml
ocamlfind ocamlmklib -o iocaml_lib \
-l zmq \
-package ctypes.foreign,lwt.unix,yojson \
iocaml_zmq_stubs.o \
log.cmo Ipython_json_t.cmo Ipython_json_j.cmo iocaml_zmq.cmo base64.cmo
OCP_INDEX_INC=`ocamlfind query ocp-index.lib -predicates byte -format "%d"`
OCP_INDEX_ARCHIVE=`ocamlfind query ocp-index.lib -predicates byte -format "%a"`
HAS_OCP = $(shell if ocamlfind query ocp-index.lib >/dev/null 2>&1; then echo 1; else echo 0; fi)
ifeq ($(HAS_OCP),1)
TOP_PKG=threads,uuidm,lwt.unix,ctypes.foreign,yojson,atdgen,ocp-indent.lib,compiler-libs
TOP_SRC = \
message.mli sockets.mli completion.mli exec.mli iocaml.mli \
message.ml sockets.ml completion.ml exec.ml iocaml.ml
TOP_OBJ = message.cmo sockets.cmo completion.cmo exec.cmo iocaml.cmo
TOP_OCP = -I $(OCP_INDEX_INC) $(OCP_INDEX_INC)/$(OCP_INDEX_ARCHIVE)
else
TOP_PKG=threads,uuidm,lwt.unix,ctypes.foreign,yojson,atdgen,compiler-libs
TOP_SRC = \
message.mli sockets.mli exec.mli iocaml.mli \
message.ml sockets.ml exec.ml iocaml.ml
TOP_OBJ = message.cmo sockets.cmo exec.cmo iocaml.cmo
TOP_OCP =
endif
top: lib
ocamlfind c -c -g -thread \
-syntax camlp4o -package optcomp -ppopt "-let has_ocp=$(HAS_OCP)" \
-package $(TOP_PKG) \
$(TOP_OCP) $(TOP_SRC)
ocamlfind ocamlmktop -g -thread -linkpkg \
-o iocaml.top \
-package $(TOP_PKG) $(TOP_OCP) \
iocaml_lib.cma $(TOP_OBJ) iocaml_main.ml
BINDIR=`opam config var bin`
install: top
ocamlfind install iocaml-kernel META *.cmi *.cmo *.cma *.so *.a *.o
cp iocaml.top $(BINDIR)/iocaml.top
uninstall:
ocamlfind remove iocaml-kernel
rm -f $(BINDIR)/iocaml.top
reinstall:
-$(MAKE) uninstall
$(MAKE) install
clean:
rm *.cmi *.cmo *.cma *.so *.a *.o iocaml.top