blob: ef48ce49d3e0607bde0be8f857175b685669f7ca [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 =
Miroslav Zagorac41923ae2021-07-29 11:10:08 +020011OT_PKGSTAT =
Miroslav Zagorac70230c62020-12-09 16:54:31 +010012OTC_WRAPPER = opentracing-c-wrapper
13
14ifneq ($(OT_DEBUG),)
15OT_DEBUG_EXT = _dbg
16OT_DEFINE = -DDEBUG_OT
17endif
18
19ifeq ($(OT_INC),)
Miroslav Zagorac41923ae2021-07-29 11:10:08 +020020OT_PKGSTAT = $(shell pkg-config --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); echo $$?)
Miroslav Zagorac70230c62020-12-09 16:54:31 +010021OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT))
22else
23ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),)
24OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM)
25endif
26endif
27
Miroslav Zagorac41923ae2021-07-29 11:10:08 +020028ifeq ($(OT_PKGSTAT),)
Miroslav Zagorac70230c62020-12-09 16:54:31 +010029ifeq ($(OT_CFLAGS),)
30$(error OpenTracing C wrapper : can't find headers)
31endif
Miroslav Zagorac41923ae2021-07-29 11:10:08 +020032else
33ifneq ($(OT_PKGSTAT),0)
34$(error OpenTracing C wrapper : can't find package)
35endif
36endif
Miroslav Zagorac70230c62020-12-09 16:54:31 +010037
38ifeq ($(OT_LIB),)
39OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT))
40else
41ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),)
42OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT)
43ifneq ($(OT_RUNPATH),)
44OT_LDFLAGS += -Wl,--rpath,$(OT_LIB)
45endif
46endif
47endif
48
49ifeq ($(OT_LDFLAGS),)
50$(error OpenTracing C wrapper : can't find library)
51endif
52
53OPTIONS_OBJS += \
Willy Tarreaua63d1a02021-04-02 17:16:46 +020054 addons/ot/src/cli.o \
55 addons/ot/src/conf.o \
56 addons/ot/src/event.o \
57 addons/ot/src/filter.o \
58 addons/ot/src/group.o \
59 addons/ot/src/http.o \
60 addons/ot/src/opentracing.o \
61 addons/ot/src/parser.o \
62 addons/ot/src/pool.o \
63 addons/ot/src/scope.o \
64 addons/ot/src/util.o \
65 addons/ot/src/vars.o
Miroslav Zagorac70230c62020-12-09 16:54:31 +010066
Willy Tarreaua63d1a02021-04-02 17:16:46 +020067OPTIONS_CFLAGS += $(OT_CFLAGS) -Iaddons/ot/include
Miroslav Zagorac70230c62020-12-09 16:54:31 +010068OPTIONS_LDFLAGS += $(OT_LDFLAGS)
69OPTIONS_CFLAGS += $(OT_DEFINE)