| 1 |
# |
| 2 |
# WARNING: do not run this directly, it should be run by the main Makefile |
| 3 |
|
| 4 |
include ../../Makefile.defs |
| 5 |
auto_gen= |
| 6 |
NAME=db_redis.so |
| 7 |
|
| 8 |
ifeq ($(CROSS_COMPILE),) |
| 9 |
HIREDIS_BUILDER = $(shell \ |
| 10 |
if pkg-config --exists hiredis; then \ |
| 11 |
echo 'pkg-config hiredis'; \ |
| 12 |
fi) |
| 13 |
|
| 14 |
HIREDIS_CLUSTER_BUILDER = $(shell \ |
| 15 |
if pkg-config --exists hiredis_cluster; then \ |
| 16 |
echo 'pkg-config hiredis_cluster'; \ |
| 17 |
fi) |
| 18 |
|
| 19 |
endif |
| 20 |
|
| 21 |
ifeq ($(HIREDIS_BUILDER),) |
| 22 |
HIREDISDEFS=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/hiredis -I/usr/include/hiredis |
| 23 |
HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis |
| 24 |
ifneq ($(shell ls $(LOCALBASE) | grep libhiredis_ssl.so),) |
| 25 |
HIREDISDEFS += -DWITH_SSL |
| 26 |
HIREDISLIBS += -lhiredis_ssl |
| 27 |
endif |
| 28 |
else |
| 29 |
HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) |
| 30 |
HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) |
| 31 |
HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) |
| 32 |
ifeq ($(HIREDISLIBSPATH),) |
| 33 |
GCCSEARCHDIRS = $(shell $(CC) -print-search-dirs | grep -Eo '^.*libraries: =.*' | cut -d "=" -f2- | tr : ' ') |
| 34 |
ifneq ($(shell find $(GCCSEARCHDIRS) -name libhiredis_ssl.so 2>/dev/null),) |
| 35 |
HIREDISDEFS += -DWITH_SSL |
| 36 |
HIREDISLIBS += -lhiredis_ssl |
| 37 |
endif |
| 38 |
else |
| 39 |
ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) |
| 40 |
HIREDISDEFS += -DWITH_SSL |
| 41 |
HIREDISLIBS += -lhiredis_ssl |
| 42 |
endif |
| 43 |
endif |
| 44 |
|
| 45 |
ifeq (,$(findstring hiredis,$(HIREDISDEFS))) |
| 46 |
DEFS+=-DWITH_HIREDIS_PATH |
| 47 |
endif |
| 48 |
|
| 49 |
ifeq ($(HIREDISLIBS),-L -lhiredis) |
| 50 |
HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) /opt/local/include |
| 51 |
HIREDISLIBS = -L/opt/local/lib -lhiredis |
| 52 |
ifneq ($(shell ls /opt/local/lib | grep libhiredis_ssl.so),) |
| 53 |
HIREDISDEFS += -DWITH_SSL |
| 54 |
HIREDISLIBS += -lhiredis_ssl |
| 55 |
endif |
| 56 |
endif |
| 57 |
|
| 58 |
endif |
| 59 |
|
| 60 |
DEFS+=$(HIREDISDEFS) |
| 61 |
LIBS=$(HIREDISLIBS) |
| 62 |
|
| 63 |
ifneq ($(HIREDIS_CLUSTER_BUILDER),) |
| 64 |
HIREDISCLUSTERDEFS = $(shell $(HIREDIS_CLUSTER_BUILDER) --cflags) |
| 65 |
HIREDISCLUSTERLIBS = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs) |
| 66 |
HIREDISCLUSTERLIBSPATH = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs-only-L | cut -c 3-) |
| 67 |
ifneq ($(shell ls $(HIREDISCLUSTERLIBSPATH) | grep libhiredis_cluster_ssl.so),) |
| 68 |
HIREDISCLUSTERDEFS += -DWITH_SSL |
| 69 |
HIREDISCLUSTERLIBS += -lhiredis_cluster_ssl |
| 70 |
endif |
| 71 |
DEFS+=-DWITH_HIREDIS_CLUSTER |
| 72 |
DEFS+=$(HIREDISCLUSTERDEFS) |
| 73 |
LIBS+=$(HIREDISCLUSTERLIBS) |
| 74 |
endif |
| 75 |
|
| 76 |
include ../../Makefile.modules |
| 77 |
|
| 78 |
install-redis-scripts: $(bin_prefix)/$(bin_dir) |
| 79 |
REDISON=yes $(MAKE) -C ../../../utils/kamctl/ install-modules |
| 80 |
|
| 81 |
install-scripts: install-redis-scripts |