-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.mk
145 lines (114 loc) · 4.19 KB
/
config.mk
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
143
144
# ===========================================================================
# Generic configuration options for building smax-postgres
#
# You can include this snipplet in your Makefile also.
# ============================================================================
# Whether to compile with systemd integration (needs systemd development
# files, i.e. sd-daemon.h and libsystemd.so).
SYSTEMD ?= 1
# The PostgreSQL installation directory containing C headers and shared
# libraries (libpq.so)
#PGDIR ?= /usr/pgsql-16
# 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
# Location under which the Smithsonian/redisx library is installed.
# (I.e., the root directory under which there is an include/ directory
# that contains redisx.h, and a lib/ or lib64/ directory that contains
# libredisx.so
REDISX ?= /usr
# Location under which the Smithsonian/smax-clib library is installed.
# (I.e., the root directory under which there is an include/ directory
# that contains smax.h, and a lib/ or lib64/ directory that contains
# libsmax.so
SMAXLIB ?= /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
# Add include/ directory
CPPFLAGS += -I$(INC)
# Uncomment if using timescaleDB < 2.13 (version 2.13 introduced a new interface)
#CPPFLAGS += -DTIMESCALEDB_OLD=1
# Base compiler options (if not defined externally...)
CFLAGS ?= -g -Os -Wall -std=c99
# Extra warnings (not supported on all compilers)
#CFLAGS += -Wextra
# Link against math libs (for e.g. isnan())
LDFLAGS ?= -lm
# cppcheck options for 'check' target
CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \
--error-exitcode=1 --std=c11 $(CHECKEXTRA)
CHECKOPTS += --template='{file}({line}): {severity} ({id}): {message}' --inline-suppr
# 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
# ============================================================================
# Make sure we can locate the PostgreSQL headers / libraries
ifdef PGDIR
# Search the selected Postgres directory
CPPFLAGS += -I$(PGDIR)/include
LDFLAGS += -L$(PGDIR)/lib
else
# Check if libpq-fe.h is in unusual location (bloody Debian...)
$(shell test -e /usr/include/postgresql)
ifeq ($(.SHELLSTATUS),0)
CPPFLAGS += -I/usr/include/postgresql
endif
endif
# Compiler and linker options etc.
ifeq ($(BUILD_MODE),debug)
CFLAGS += -g -DDEBUG
endif
# Always link against dependencies
LDFLAGS += -lm -lsmax -lredisx -lxchange -lpq
ifeq ($(SYSTEMD),1)
DFLAGS += -DUSE_SYSTEMD=1
LDFLAGS += -lsystemd
endif
# Search for libraries under LIB
ifneq ($(findstring $(LIB),$(LD_LIBRARY_PATH)),$LIB)
LDFLAGS += -L$(LIB)
LD_LIBRARY_PATH := $(LIB):$(LD_LIBRARY_PATH)
endif
# Compile and link against a specific PostgreSQL library (if defined)
ifdef PGDIR
CPPFLAGS += -I$(PGDIR)/include
LDFLAGS += -L$(PGDIR)/lib
LD_LIBRARY_PATH := $(PGDIR)/lib:$(LD_LIBRARY_PATH)
endif
# Compile and link against a specific smax library (if defined)
ifdef SMAXLIB
CPPFLAGS += -I$(SMAXLIB)/include
LDFLAGS += -L$(SMAXLIB)/lib
LD_LIBRARY_PATH := $(SMAXLIB)/lib:$(LD_LIBRARY_PATH)
endif
# Compile and link against a specific redisx library (if defined)
ifdef REDISX
CPPFLAGS += -I$(REDISX)/include
LDFLAGS += -L$(REDISX)/lib
LD_LIBRARY_PATH := $(REDISX)/lib:$(LD_LIBRARY_PATH)
endif
# Compile and link against a specific xchange library (if defined)
ifdef XCHANGE
CPPFLAGS += -I$(XCHANGE)/include
LDFLAGS += -L$(XCHANGE)/lib
LD_LIBRARY_PATH := $(XCHANGE)/lib:$(LD_LIBRARY_PATH)
endif
# Search for files in the designated locations
vpath %.h $(INC)
vpath %.c $(SRC)
vpath %.o $(OBJ)
vpath %.d dep