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 += \ |
| 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 | |
| 59 | OPTIONS_CFLAGS += $(OT_CFLAGS) -Icontrib/opentracing/include |
| 60 | OPTIONS_LDFLAGS += $(OT_LDFLAGS) |
| 61 | OPTIONS_CFLAGS += $(OT_DEFINE) |