From 92dc78605afa815363e1af32d97d5184ede74c29 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 2 Apr 2021 15:31:10 +0200 Subject: [PATCH] BUILD: makefile: add a "USE_PROMEX" variable to ease building prometheus-exporter The Prometheus exporter has gained in popularity and deserves to be easier to build. Let's add a standard "USE_PROMEX" variable to enable it without having to modify EXTRA_OBJS nor fiddling with the build path. The readme was updated to reflect this. --- Makefile | 7 ++++++- contrib/prometheus-exporter/README | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 327dbc1f7..2e15ed6f6 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ # USE_DL : enable it if your system requires -ldl. Automatic on Linux. # USE_RT : enable it if your system requires -lrt. Automatic on Linux. # USE_BACKTRACE : enable backtrace(). Automatic on Linux. +# USE_PROMEX : enable the Prometheus exporter # USE_DEVICEATLAS : enable DeviceAtlas api. # USE_51DEGREES : enable third party device detection library from 51Degrees # USE_WURFL : enable WURFL detection library from Scientiamobile @@ -303,7 +304,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER \ USE_CLOSEFROM USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS \ USE_DL USE_RT USE_DEVICEATLAS USE_51DEGREES USE_WURFL USE_SYSTEMD \ USE_OBSOLETE_LINKER USE_PRCTL USE_THREAD_DUMP USE_EVPORTS USE_OT \ - USE_QUIC + USE_QUIC USE_PROMEX #### Target system options # Depending on the target platform, some options are set, as well as some @@ -615,6 +616,10 @@ endif OPTIONS_OBJS += src/hlua.o src/hlua_fcn.o endif +ifneq ($(USE_PROMEX),) +OPTIONS_OBJS += contrib/prometheus-exporter/service-prometheus.o +endif + ifneq ($(USE_DEVICEATLAS),) # Use DEVICEATLAS_SRC and possibly DEVICEATLAS_INC and DEVICEATLAS_LIB to force path # to DeviceAtlas headers and libraries if needed. diff --git a/contrib/prometheus-exporter/README b/contrib/prometheus-exporter/README index fdbc50203..e41ebdc59 100644 --- a/contrib/prometheus-exporter/README +++ b/contrib/prometheus-exporter/README @@ -12,9 +12,10 @@ HAProxy, like the stats applet. However, PROMEX is not built by default with HAProxy. It is provided as an extra component for everyone want to use it. So you need to explicitly build HAProxy -with the PROMEX service, using the Makefile variable "EXTRA_OBJS". For instance: +with the PROMEX service, setting the Makefile variable "USE_PROMEX" to "1". For +instance: - > make TARGET=linux-glibc EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o" + > make TARGET=linux-glibc USE_PROMEX=1 if HAProxy provides the PROMEX service, the following build option will be reported by the command "haproxy -vv":