]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: add a "USE_PROMEX" variable to ease building prometheus-exporter
authorWilly Tarreau <w@1wt.eu>
Fri, 2 Apr 2021 13:31:10 +0000 (15:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Apr 2021 15:48:42 +0000 (17:48 +0200)
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
contrib/prometheus-exporter/README

index 327dbc1f7e6d2ba1d0ec99f1092eed55861264f7..2e15ed6f67e9a86f6de4b8aa9032744678c7aa08 100644 (file)
--- 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.
index fdbc502032c634c4b909c6034741d69ebf167f0d..e41ebdc591d122cf2de62c7f2ba29d90e79600f2 100644 (file)
@@ -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":