Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 1 | # 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 | |
| 7 | OT_DEFINE = |
| 8 | OT_CFLAGS = |
| 9 | OT_LDFLAGS = |
| 10 | OT_DEBUG_EXT = |
| 11 | OTC_WRAPPER = opentracing-c-wrapper |
| 12 | |
| 13 | ifneq ($(OT_DEBUG),) |
| 14 | OT_DEBUG_EXT = _dbg |
| 15 | OT_DEFINE = -DDEBUG_OT |
| 16 | endif |
| 17 | |
| 18 | ifeq ($(OT_INC),) |
| 19 | OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT)) |
| 20 | else |
| 21 | ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),) |
| 22 | OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM) |
| 23 | endif |
| 24 | endif |
| 25 | |
| 26 | ifeq ($(OT_CFLAGS),) |
| 27 | $(error OpenTracing C wrapper : can't find headers) |
| 28 | endif |
| 29 | |
| 30 | ifeq ($(OT_LIB),) |
| 31 | OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT)) |
| 32 | else |
| 33 | ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),) |
| 34 | OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT) |
| 35 | ifneq ($(OT_RUNPATH),) |
| 36 | OT_LDFLAGS += -Wl,--rpath,$(OT_LIB) |
| 37 | endif |
| 38 | endif |
| 39 | endif |
| 40 | |
| 41 | ifeq ($(OT_LDFLAGS),) |
| 42 | $(error OpenTracing C wrapper : can't find library) |
| 43 | endif |
| 44 | |
| 45 | OPTIONS_OBJS += \ |
Willy Tarreau | a63d1a0 | 2021-04-02 17:16:46 +0200 | [diff] [blame] | 46 | addons/ot/src/cli.o \ |
| 47 | addons/ot/src/conf.o \ |
| 48 | addons/ot/src/event.o \ |
| 49 | addons/ot/src/filter.o \ |
| 50 | addons/ot/src/group.o \ |
| 51 | addons/ot/src/http.o \ |
| 52 | addons/ot/src/opentracing.o \ |
| 53 | addons/ot/src/parser.o \ |
| 54 | addons/ot/src/pool.o \ |
| 55 | addons/ot/src/scope.o \ |
| 56 | addons/ot/src/util.o \ |
| 57 | addons/ot/src/vars.o |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 58 | |
Willy Tarreau | a63d1a0 | 2021-04-02 17:16:46 +0200 | [diff] [blame] | 59 | OPTIONS_CFLAGS += $(OT_CFLAGS) -Iaddons/ot/include |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 60 | OPTIONS_LDFLAGS += $(OT_LDFLAGS) |
| 61 | OPTIONS_CFLAGS += $(OT_DEFINE) |