forked from KxSystems/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (63 loc) · 1.84 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
OSFLAG :=
MS :=
ifeq ($(OS),Windows_NT)
OSFLAG = w
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
MS = 64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
MS = 32
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG = l
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG = m
endif
MS=$(shell getconf LONG_BIT) # 32/64
endif
QARCH=$(OSFLAG)$(MS)
Q=${QHOME}/$(QARCH)
ifeq ($(OS),Windows_NT)
KAFKA_ROOT=librdkafka.redist.0.9.5
PTHREADS_ROOT=pthreads.2.9.1.4
KFK_INCLUDE=${KAFKA_ROOT}/build/native/include/
INCLUDES=-I${KFK_INCLUDE}
OPTS=-DKXVER=3 -DWIN32 -Wall -Wno-strict-aliasing -Wno-parentheses -shared -fPIC
KFK_LD=${KAFKA_ROOT}/runtimes/win7-x64/native/
LDOPTS=-L${KFK_LD} -lws2_32 -lrdkafka
TGT=libkfk.dll
else
KAFKA_ROOT=${HOME}
KFK_INCLUDE=${KAFKA_ROOT}/include
OPTS=-DKXVER=3 -Wall -Wno-strict-aliasing -Wno-parentheses -shared -fPIC -Wextra -Werror -Wsign-compare -Wwrite-strings
LDOPTS_STATIC=${KAFKA_ROOT}/lib/librdkafka.a -lz -lpthread -lssl -g -O2
LDOPTS=-L${KAFKA_ROOT}/lib/ -lrdkafka -lz -lpthread -lssl -g -O2
OSXOPTS=-undefined dynamic_lookup -mmacosx-version-min=10.12
TGT=libkfk.so
endif
all: $(QARCH)
static: $(addsuffix st,$(QARCH))
install:
install $(TGT) $(Q)
fmt:
clang-format -style=file kfk.c -i
print-% : ; @echo $* = $($*)
m64:
$(CC) kfk.c -m64 $(OPTS) $(LDOPTS) -I$(KFK_INCLUDE) -o $(TGT) $(OSXOPTS)
m64st:
$(CC) kfk.c -m64 $(OPTS) $(LDOPTS_STATIC) -I$(KFK_INCLUDE) -o $(TGT) $(OSXOPTS)
w32:
$(CC) kfk.c -m32 $(OPTS) $(LDOPTS) -I$(KFK_INCLUDE)
w64:
$(CC) kfk.c -m64 $(OPTS) $(LDOPTS) $(INCLUDES) q.lib -lws2_32
l32:
$(CC) kfk.c -m32 $(OPTS) $(LDOPTS) -I$(KFK_INCLUDE) -lrt -o $(TGT)
l32st:
$(CC) kfk.c -m32 $(OPTS) $(LDOPTS_STATIC) -I$(KFK_INCLUDE) -lrt -o $(TGT)
l64:
$(CC) kfk.c -m64 $(OPTS) $(LDOPTS) -I$(KFK_INCLUDE) -lrt -o $(TGT)
l64st:
$(CC) kfk.c -m64 $(OPTS) $(LDOPTS_STATIC) -I$(KFK_INCLUDE) -lrt -o $(TGT)