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 = |
Miroslav Zagorac | 41923ae | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 11 | OT_PKGSTAT = |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 12 | OTC_WRAPPER = opentracing-c-wrapper |
| 13 | |
| 14 | ifneq ($(OT_DEBUG),) |
| 15 | OT_DEBUG_EXT = _dbg |
| 16 | OT_DEFINE = -DDEBUG_OT |
| 17 | endif |
| 18 | |
| 19 | ifeq ($(OT_INC),) |
Miroslav Zagorac | 41923ae | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 20 | OT_PKGSTAT = $(shell pkg-config --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); echo $$?) |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 21 | OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT)) |
| 22 | else |
| 23 | ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),) |
| 24 | OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM) |
| 25 | endif |
| 26 | endif |
| 27 | |
Miroslav Zagorac | 41923ae | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 28 | ifeq ($(OT_PKGSTAT),) |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 29 | ifeq ($(OT_CFLAGS),) |
| 30 | $(error OpenTracing C wrapper : can't find headers) |
| 31 | endif |
Miroslav Zagorac | 41923ae | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 32 | else |
| 33 | ifneq ($(OT_PKGSTAT),0) |
| 34 | $(error OpenTracing C wrapper : can't find package) |
| 35 | endif |
| 36 | endif |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 37 | |
| 38 | ifeq ($(OT_LIB),) |
| 39 | OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT)) |
| 40 | else |
| 41 | ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),) |
| 42 | OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT) |
| 43 | ifneq ($(OT_RUNPATH),) |
| 44 | OT_LDFLAGS += -Wl,--rpath,$(OT_LIB) |
| 45 | endif |
| 46 | endif |
| 47 | endif |
| 48 | |
| 49 | ifeq ($(OT_LDFLAGS),) |
| 50 | $(error OpenTracing C wrapper : can't find library) |
| 51 | endif |
| 52 | |
| 53 | OPTIONS_OBJS += \ |
Willy Tarreau | a63d1a0 | 2021-04-02 17:16:46 +0200 | [diff] [blame] | 54 | 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 Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 66 | |
Willy Tarreau | a63d1a0 | 2021-04-02 17:16:46 +0200 | [diff] [blame] | 67 | OPTIONS_CFLAGS += $(OT_CFLAGS) -Iaddons/ot/include |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 68 | OPTIONS_LDFLAGS += $(OT_LDFLAGS) |
| 69 | OPTIONS_CFLAGS += $(OT_DEFINE) |