-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
40 lines (36 loc) · 1.08 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
OSFLAG :=
MS :=
ifeq ($(KAFKA_ROOT),)
KFK_ROOT=${HOME}
else
KFK_ROOT=${KAFKA_ROOT}
endif
KFK_INCLUDE = ${KFK_ROOT}/include
W_OPTS = -Wall -Wno-strict-aliasing -Wno-parentheses -Wextra -Werror -Wsign-compare -Wno-ignored-qualifiers
OPTS = -DKXVER=3 -shared -fPIC $(W_OPTS)
LD_COMMON = -lz -lpthread -lssl -g -O2
LDOPTS_DYNAMIC = -L${KFK_ROOT}/lib/ -lrdkafka
LDOPTS_STATIC = ${KFK_ROOT}/lib/librdkafka.a
MS = $(shell getconf LONG_BIT)
TGT = libkfk.so
ifeq ($(shell uname),Linux)
LNK = -lrt
OSFLAG = l
OSXOPTS:=
else ifeq ($(shell uname),Darwin)
OSFLAG = m
LNK:=
OSXOPTS = -undefined dynamic_lookup -mmacosx-version-min=10.12
endif
QARCH = $(OSFLAG)$(MS)
Q = $(QHOME)/$(QARCH)
all: k.h
$(CC) kfk.c -m$(MS) $(OPTS) $(LDOPTS_DYNAMIC) $(LD_COMMON) -I$(KFK_INCLUDE) $(LNK) -o $(TGT) $(OSXOPTS)
static: k.h
$(CC) kfk.c -m$(MS) $(OPTS) $(LDOPTS_STATIC) $(LD_COMMON) -I$(KFK_INCLUDE) $(LNK) -o $(TGT) $(OSXOPTS)
k.h:
curl -s -O -L https://github.com/KxSystems/kdb/raw/master/c/c/k.h
install:
install $(TGT) $(Q)
clean:
rm -f libkfk.so