blob: c7b0f8db9ed78159c943e38618968cb614ff7578 [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 Zagorac6c9f7fa2021-12-27 12:44:07 +010068$(warning Please do not set the OT_USE_VARS configuration variable, as the source will probably not be able to compile! For now, this variable can only be used for experimental purposes, and is not intended for wider use.)
69
Miroslav Zagorac4cb2c832021-09-08 20:56:05 +020070OT_DEFINE = -DUSE_OT_VARS
71OPTIONS_OBJS += \
Willy Tarreaua63d1a02021-04-02 17:16:46 +020072 addons/ot/src/vars.o
Miroslav Zagorac4cb2c832021-09-08 20:56:05 +020073endif
Miroslav Zagorac70230c62020-12-09 16:54:31 +010074
Willy Tarreaua63d1a02021-04-02 17:16:46 +020075OPTIONS_CFLAGS += $(OT_CFLAGS) -Iaddons/ot/include
Miroslav Zagorac70230c62020-12-09 16:54:31 +010076OPTIONS_LDFLAGS += $(OT_LDFLAGS)
77OPTIONS_CFLAGS += $(OT_DEFINE)