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 |
Miroslav Zagorac | 4cb2c83 | 2021-09-08 20:56:05 +0200 | [diff] [blame] | 6 | # OT_USE_VARS : allows the use of variables for the OpenTracing context |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 7 | |
| 8 | OT_DEFINE = |
| 9 | OT_CFLAGS = |
| 10 | OT_LDFLAGS = |
| 11 | OT_DEBUG_EXT = |
Miroslav Zagorac | 3571111 | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 12 | OT_PKGSTAT = |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 13 | OTC_WRAPPER = opentracing-c-wrapper |
| 14 | |
| 15 | ifneq ($(OT_DEBUG),) |
| 16 | OT_DEBUG_EXT = _dbg |
| 17 | OT_DEFINE = -DDEBUG_OT |
| 18 | endif |
| 19 | |
| 20 | ifeq ($(OT_INC),) |
Miroslav Zagorac | 3571111 | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 21 | OT_PKGSTAT = $(shell pkg-config --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); echo $$?) |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 22 | OT_CFLAGS = $(shell pkg-config --silence-errors --cflags $(OTC_WRAPPER)$(OT_DEBUG_EXT)) |
| 23 | else |
| 24 | ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),) |
| 25 | OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM) |
| 26 | endif |
| 27 | endif |
| 28 | |
Miroslav Zagorac | 3571111 | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 29 | ifeq ($(OT_PKGSTAT),) |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 30 | ifeq ($(OT_CFLAGS),) |
| 31 | $(error OpenTracing C wrapper : can't find headers) |
| 32 | endif |
Miroslav Zagorac | 3571111 | 2021-07-29 11:10:08 +0200 | [diff] [blame] | 33 | else |
| 34 | ifneq ($(OT_PKGSTAT),0) |
| 35 | $(error OpenTracing C wrapper : can't find package) |
| 36 | endif |
| 37 | endif |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 38 | |
| 39 | ifeq ($(OT_LIB),) |
| 40 | OT_LDFLAGS = $(shell pkg-config --silence-errors --libs $(OTC_WRAPPER)$(OT_DEBUG_EXT)) |
| 41 | else |
| 42 | ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),) |
| 43 | OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT) |
| 44 | ifneq ($(OT_RUNPATH),) |
| 45 | OT_LDFLAGS += -Wl,--rpath,$(OT_LIB) |
| 46 | endif |
| 47 | endif |
| 48 | endif |
| 49 | |
| 50 | ifeq ($(OT_LDFLAGS),) |
| 51 | $(error OpenTracing C wrapper : can't find library) |
| 52 | endif |
| 53 | |
| 54 | OPTIONS_OBJS += \ |
Willy Tarreau | a63d1a0 | 2021-04-02 17:16:46 +0200 | [diff] [blame] | 55 | 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 Zagorac | 4cb2c83 | 2021-09-08 20:56:05 +0200 | [diff] [blame] | 65 | addons/ot/src/util.o |
| 66 | |
| 67 | ifneq ($(OT_USE_VARS),) |
Miroslav Zagorac | 9964ad8 | 2022-03-09 19:59:15 +0100 | [diff] [blame] | 68 | OT_DEFINE += -DUSE_OT_VARS |
Miroslav Zagorac | 4cb2c83 | 2021-09-08 20:56:05 +0200 | [diff] [blame] | 69 | OPTIONS_OBJS += \ |
Willy Tarreau | a63d1a0 | 2021-04-02 17:16:46 +0200 | [diff] [blame] | 70 | addons/ot/src/vars.o |
Miroslav Zagorac | 4cb2c83 | 2021-09-08 20:56:05 +0200 | [diff] [blame] | 71 | endif |
Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 72 | |
Willy Tarreau | bc2f393 | 2022-12-22 17:58:24 +0100 | [diff] [blame] | 73 | OT_CFLAGS := $(OT_CFLAGS) -Iaddons/ot/include $(OT_DEFINE) |