-
Notifications
You must be signed in to change notification settings - Fork 909
/
Makefile
84 lines (70 loc) · 2.46 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
#
# WARNING: do not run this directly, it should be run by the main Makefile
include ../../Makefile.defs
auto_gen=
NAME=db_redis.so
ifeq ($(CROSS_COMPILE),)
HIREDIS_BUILDER = $(shell \
if pkg-config --exists hiredis; then \
echo 'pkg-config hiredis'; \
fi)
HIREDIS_CLUSTER_BUILDER = $(shell \
if pkg-config --exists hiredis_cluster; then \
echo 'pkg-config hiredis_cluster'; \
fi)
endif
ifeq ($(HIREDIS_BUILDER),)
HIREDISDEFS=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/hiredis -I/usr/include/hiredis
HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis
ifneq ($(shell ls $(LOCALBASE) | grep libhiredis_ssl.so),)
HIREDISDEFS += -DWITH_SSL
HIREDISLIBS += -lhiredis_ssl
endif
else
HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags)
HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs)
HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-)
ifeq ($(HIREDISLIBSPATH),)
GCCSEARCHDIRS = $(shell $(CC) -print-search-dirs | grep -Po '^.*libraries: =.*' | cut -d "=" -f2- | tr : ' ')
ifneq ($(shell find $(GCCSEARCHDIRS) libhiredis_ssl.so),)
HIREDISDEFS += -DWITH_SSL
HIREDISLIBS += -lhiredis_ssl
endif
else
ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),)
HIREDISDEFS += -DWITH_SSL
HIREDISLIBS += -lhiredis_ssl
endif
endif
ifeq (,$(findstring hiredis,$(HIREDISDEFS)))
DEFS+=-DWITH_HIREDIS_PATH
endif
ifeq ($(HIREDISLIBS),-L -lhiredis)
HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) /opt/local/include
HIREDISLIBS = -L/opt/local/lib -lhiredis
ifneq ($(shell ls /opt/local/lib | grep libhiredis_ssl.so),)
HIREDISDEFS += -DWITH_SSL
HIREDISLIBS += -lhiredis_ssl
endif
endif
endif
DEFS+=$(HIREDISDEFS)
LIBS=$(HIREDISLIBS)
ifneq ($(HIREDIS_CLUSTER_BUILDER),)
HIREDISCLUSTERDEFS = $(shell $(HIREDIS_CLUSTER_BUILDER) --cflags)
HIREDISCLUSTERLIBS = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs)
HIREDISCLUSTERLIBSPATH = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs-only-L | cut -c 3-)
ifneq ($(shell ls $(HIREDISCLUSTERLIBSPATH) | grep libhiredis_ssl.so),)
HIREDISCLUSTERDEFS += -DWITH_SSL
HIREDISCLUSTERLIBS += -lhiredis_ssl
endif
DEFS+=-DWITH_HIREDIS_CLUSTER
DEFS+=$(HIREDISCLUSTERDEFS)
LIBS+=$(HIREDISCLUSTERLIBS)
endif
SERLIBPATH=../../lib
SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1
include ../../Makefile.modules
install-redis-scripts: $(bin_prefix)/$(bin_dir)
REDISON=yes $(MAKE) -C ../../../utils/kamctl/ install-modules
install-scripts: install-redis-scripts