-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.mk
More file actions
143 lines (113 loc) · 3.43 KB
/
config.mk
File metadata and controls
143 lines (113 loc) · 3.43 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# ===========================================================================
# Generic configuration options for building the RedisX library (both static
# and shared).
#
# You can include this snipplet in your Makefile also.
# ============================================================================
# Location under which the Smithsonian/xchange library is installed.
# (I.e., the root directory under which there is an include/ directory
# that contains xchange.h, and a lib/ or lib64/ directory that contains
# libxchange.so
XCHANGE ?= /usr
# Folders in which sources and header files are located, respectively
SRC ?= src
INC ?= include
# Folders for compiled objects, libraries, and binaries, respectively
OBJ ?= obj
LIB ?= lib
BIN ?= bin
# Compiler: use gcc by default
CC ?= gcc
# Whether to use OpenMP. If not defined, we'll enable it automatically if
# libgomp is available
#WITH_OPENMP = 1
# Whether to build with TLS support (via OpenSSL). If not defined, we'll
# enable it automatically if libssl is available
#WITH_TLS = 1
# Add include/ directory
CPPFLAGS += -I$(INC)
# Base compiler options (if not defined externally...)
CFLAGS ?= -g -Os -Wall
# Extra linker flags (if any)
#LDFLAGS=
# cppcheck options for 'check' target
CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \
--error-exitcode=1 --std=c99
# Add-on ccpcheck options
CHECKOPTS += --inline-suppr $(CHECKEXTRA)
# Exhaustive checking for newer cppcheck
#CHECKOPTS += --check-level=exhaustive
# Specific Doxygen to use if not the default one
#DOXYGEN ?= /opt/bin/doxygen
# ============================================================================
# END of user config section.
#
# Below are some generated constants based on the one that were set above
# ============================================================================
# If XCHANGE is defined convert to absolute path for sub-makes.
ifdef XCHANGE
XCHANGE := $(shell cd $(XCHANGE); pwd)
export XCHANGE
endif
ifneq ($(shell which ldconfig), )
# Detect OpenSSL automatically, and enable TLS support if present
ifndef WITH_TLS
ifneq ($(shell ldconfig -p | grep libssl), )
WITH_TLS = 1
else
WITH_TLS = 0
endif
endif
# Detect OpenMP automatically, and enable WITH_OPENMP support if present
ifndef WITH_OPENMP
ifneq ($(shell ldconfig -p | grep libomp), )
WITH_OPENMP = 1
else
WITH_OPENMP = 0
endif
endif
endif
# Link against math libs (for e.g. isnan()), and xchange dependency
LDFLAGS += -lm -lxchange
# Compile for specific C standard
ifdef CSTANDARD
CFLAGS += -std=$(CSTANDARD)
endif
# Add source code fortification checks
ifdef FORTIFY
CFLAGS += -D_FORTIFY_SOURCE=$(FORTIFY)
endif
ifeq ($(WEXTRA),1)
CFLAGS += -Wextra
endif
ifdef FNMATCH_C
CPPFLAGS += -DFNMATCH=1
endif
ifeq ($(WITH_OPENMP),1)
CFLAGS += -fopenmp
LDFLAGS += -fopenmp
endif
ifeq ($(WITH_TLS),1)
CPPFLAGS += -DWITH_TLS=1
LDFLAGS += -lssl
endif
# Search for libraries under LIB
ifneq ($(findstring $(LIB),$(LD_LIBRARY_PATH)),$LIB)
LDFLAGS += -L$(LIB)
endif
# Compile and link against a specific xchange library (if defined)
ifdef XCHANGE
CPPFLAGS += -I$(XCHANGE)/include
LDFLAGS += -L$(XCHANGE)/lib
endif
# Build static or shared libs
ifeq ($(STATICLINK),1)
LIBREDISX = $(LIB)/libredisx.a
else
LIBREDISX = $(LIB)/libredisx.so
endif
# Search for files in the designated locations
vpath %.h $(INC)
vpath %.c $(SRC)
vpath %.o $(OBJ)
vpath %.d dep