Skip to content

Commit

Permalink
Update Makefile to use jbuilder.
Browse files Browse the repository at this point in the history
  • Loading branch information
didier-wenzek committed Sep 12, 2017
1 parent 1654368 commit 3fc5f07
Showing 1 changed file with 9 additions and 39 deletions.
48 changes: 9 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,16 @@
TARGETS = okafka.cma okafka.cmxa okafka.cmxs okafka.a dllocamlkafka.so libocamlkafka.a
LIB = $(addprefix _build/, $(TARGETS))
TOOLS = tail_kafka_topic.native sendto_kafka_topic.native
all:
jbuilder build @install

CFLAGS = -cflag -safe-string -cflag -bin-annot

all: librdkafka-version
rm -f libocamlkafka.clib okafka.mllib META
ln -s libocamlkafka.clib.sync libocamlkafka.clib
ln -s okafka.mllib.sync okafka.mllib
ln -s META.sync META
ocamlbuild -use-ocamlfind $(CFLAGS) kafka.ml $(TARGETS)

LWT_OPT = -cflags -ccopt,-I,-ccopt,$(shell ocamlfind query lwt.unix)
lwt: librdkafka-version
rm -f libocamlkafka.clib okafka.mllib META
ln -s libocamlkafka.clib.lwt libocamlkafka.clib
ln -s okafka.mllib.lwt okafka.mllib
ln -s META.lwt META
ocamlbuild -use-ocamlfind $(LWT_OPT) -pkgs lwt,lwt.unix kafka.ml $(CFLAGS) $(TARGETS)

librdkafka-version: librdkafka-version.c
$(CC) -o librdkafka-version librdkafka-version.c -lrdkafka

_build/tests.native:
ocamlbuild -use-ocamlfind $(LWT_OPT) -pkgs lwt,lwt.unix -libs okafka $(CFLAGS) tests.native

install:
ocamlfind install okafka META $(LIB) _build/kafka*.cmi _build/kafka*.mli _build/kafka*.cmt* _build/kafka*cmx
install: all
jbuilder install

uninstall:
ocamlfind remove okafka

tools: lwt
ocamlbuild -use-ocamlfind $(LWT_OPT) -pkgs lwt,lwt.unix,cmdliner -libs okafka $(CFLAGS) $(TOOLS)

issues: lwt
ocamlbuild -use-ocamlfind $(LWT_OPT) -pkgs lwt,lwt.unix,cmdliner -libs okafka $(CFLAGS) issue3.native
jbuilder uninstall

tests: _build/tests.native
_build/tests.native
test:
jbuilder runtest

clean:
ocamlbuild -clean
jbuilder clean

.PHONY: all clean tests install
.PHONY: all clean test install uninstall

0 comments on commit 3fc5f07

Please sign in to comment.