blob: 2ee74d32c4583dc5b491afacef8a10a7fc14ff4c [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
Miroslav Zagorac4cb2c832021-09-08 20:56:05 +02006# OT_USE_VARS : allows the use of variables for the OpenTracing context
Miroslav Zagorac70230c62020-12-09 16:54:31 +01007
8OT_DEFINE =
9OT_CFLAGS =
10OT_LDFLAGS =
11OT_DEBUG_EXT =
Miroslav Zagorac35711112021-07-29 11:10:08 +020012OT_PKGSTAT =
Miroslav Zagorac70230c62020-12-09 16:54:31 +010013OTC_WRAPPER = opentracing-c-wrapper
14
15ifneq ($(OT_DEBUG),)
16OT_DEBUG_EXT = _dbg
17OT_DEFINE = -DDEBUG_OT
18endif
19
20ifeq ($(OT_INC),)
Miroslav Zagorac35711112021-07-29 11:10:08 +020021OT_PKGSTAT = $(shell pkg-config --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); echo $$?)
Miroslav Zagorac70230c62020-12-09 16:54:31 +010022OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT))
23else
24ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),)
25OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM)
26endif
27endif
28
Miroslav Zagorac35711112021-07-29 11:10:08 +020029ifeq ($(OT_PKGSTAT),)
Miroslav Zagorac70230c62020-12-09 16:54:31 +010030ifeq ($(OT_CFLAGS),)
31$(error OpenTracing C wrapper : can't find headers)
32endif
Miroslav Zagorac35711112021-07-29 11:10:08 +020033else
34ifneq ($(OT_PKGSTAT),0)
35$(error OpenTracing C wrapper : can't find package)
36endif
37endif
Miroslav Zagorac70230c62020-12-09 16:54:31 +010038
39ifeq ($(OT_LIB),)
40OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT))
41else
42ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),)
43OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT)
44ifneq ($(OT_RUNPATH),)
45OT_LDFLAGS += -Wl,--rpath,$(OT_LIB)
46endif
47endif
48endif
49
50ifeq ($(OT_LDFLAGS),)
51$(error OpenTracing C wrapper : can't find library)
52endif
53
54OPTIONS_OBJS += \
Willy Tarreaua63d1a02021-04-02 17:16:46 +020055 addons/ot/src/cli.o \
56 addons/ot/src/conf.o \
57 addons/ot/src/event.o \
58 addons/ot/src/filter.o \
59 addons/ot/src/group.o \
60 addons/ot/src/http.o \
61 addons/ot/src/opentracing.o \
62 addons/ot/src/parser.o \
63 addons/ot/src/pool.o \
64 addons/ot/src/scope.o \
Miroslav Zagorac4cb2c832021-09-08 20:56:05 +020065 addons/ot/src/util.o
66
67ifneq ($(OT_USE_VARS),)
Miroslav Zagorac9964ad82022-03-09 19:59:15 +010068OT_DEFINE += -DUSE_OT_VARS
Miroslav Zagorac4cb2c832021-09-08 20:56:05 +020069OPTIONS_OBJS += \
Willy Tarreaua63d1a02021-04-02 17:16:46 +020070 addons/ot/src/vars.o
Miroslav Zagorac4cb2c832021-09-08 20:56:05 +020071endif
Miroslav Zagorac70230c62020-12-09 16:54:31 +010072
Willy Tarreaua63d1a02021-04-02 17:16:46 +020073OPTIONS_CFLAGS += $(OT_CFLAGS) -Iaddons/ot/include
Miroslav Zagorac70230c62020-12-09 16:54:31 +010074OPTIONS_LDFLAGS += $(OT_LDFLAGS)
75OPTIONS_CFLAGS += $(OT_DEFINE)