blob: 065f6f4a39b74a9de45990bc6d0c0c5eb0de33dc [file] [log] [blame]
Miroslav Zagorac70230c62020-12-09 16:54:31 +01001# USE_OT : enable the OpenTracing filter
2# OT_DEBUG : compile the OpenTracing filter in debug mode
3# OT_INC : force the include path to libopentracing-c-wrapper
4# OT_LIB : force the lib path to libopentracing-c-wrapper
5# OT_RUNPATH : add libopentracing-c-wrapper RUNPATH to haproxy executable
6
7OT_DEFINE =
8OT_CFLAGS =
9OT_LDFLAGS =
10OT_DEBUG_EXT =
11OTC_WRAPPER = opentracing-c-wrapper
12
13ifneq ($(OT_DEBUG),)
14OT_DEBUG_EXT = _dbg
15OT_DEFINE = -DDEBUG_OT
16endif
17
18ifeq ($(OT_INC),)
19OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT))
20else
21ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),)
22OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM)
23endif
24endif
25
26ifeq ($(OT_CFLAGS),)
27$(error OpenTracing C wrapper : can't find headers)
28endif
29
30ifeq ($(OT_LIB),)
31OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT))
32else
33ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),)
34OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT)
35ifneq ($(OT_RUNPATH),)
36OT_LDFLAGS += -Wl,--rpath,$(OT_LIB)
37endif
38endif
39endif
40
41ifeq ($(OT_LDFLAGS),)
42$(error OpenTracing C wrapper : can't find library)
43endif
44
45OPTIONS_OBJS += \
46 contrib/opentracing/src/cli.o \
47 contrib/opentracing/src/conf.o \
48 contrib/opentracing/src/event.o \
49 contrib/opentracing/src/filter.o \
50 contrib/opentracing/src/group.o \
51 contrib/opentracing/src/http.o \
52 contrib/opentracing/src/opentracing.o \
53 contrib/opentracing/src/parser.o \
54 contrib/opentracing/src/pool.o \
55 contrib/opentracing/src/scope.o \
56 contrib/opentracing/src/util.o \
57 contrib/opentracing/src/vars.o
58
59OPTIONS_CFLAGS += $(OT_CFLAGS) -Icontrib/opentracing/include
60OPTIONS_LDFLAGS += $(OT_LDFLAGS)
61OPTIONS_CFLAGS += $(OT_DEFINE)