2008-01-02 19:48:34 +00:00
# This GNU Makefile supports different OS and CPU combinations.
#
2005-12-17 13:08:03 +00:00
# You should use it this way :
2024-04-10 15:58:00 +00:00
# [g]make TARGET=os [CFLAGS=...] USE_xxx=1 ...
2019-06-14 13:52:01 +00:00
#
# When in doubt, invoke help, possibly with a known target :
# [g]make help
2019-06-14 14:32:09 +00:00
# [g]make help TARGET=linux-glibc
2007-07-11 07:19:31 +00:00
#
2018-11-19 07:15:54 +00:00
# By default the detailed commands are hidden for a cleaner output, but you may
# see them by appending "V=1" to the make command.
#
2019-03-27 09:57:49 +00:00
# Valid USE_* options are enumerated in the "use_opts" variable and are listed
# below. Most of them are automatically set by the TARGET, others have to be
# explicitly specified :
2023-08-16 22:03:01 +00:00
# USE_EPOLL : enable epoll() on Linux 2.6. Automatic.
# USE_KQUEUE : enable kqueue() on BSD. Automatic.
# USE_EVPORTS : enable event ports on SunOS systems. Automatic.
# USE_NETFILTER : enable netfilter on Linux. Automatic.
2024-02-08 02:47:42 +00:00
# USE_PCRE : enable use of libpcre for regex.
2023-08-16 22:03:01 +00:00
# USE_PCRE_JIT : enable JIT for faster regex on libpcre >= 8.32
2024-02-08 02:47:42 +00:00
# USE_PCRE2 : enable use of libpcre2 for regex. Recommended.
2023-08-16 22:03:01 +00:00
# USE_PCRE2_JIT : enable JIT for faster regex on libpcre2
# USE_POLL : enable poll(). Automatic.
# USE_THREAD : enable threads support.
2024-02-08 02:47:42 +00:00
# USE_STATIC_PCRE : enable static libpcre.
# USE_STATIC_PCRE2 : enable static libpcre2. Recommended.
2023-08-16 22:03:01 +00:00
# USE_TPROXY : enable transparent proxy. Automatic.
# USE_LINUX_TPROXY : enable full transparent proxy. Automatic.
# USE_LINUX_SPLICE : enable kernel 2.6 splicing. Automatic.
2023-08-29 08:24:26 +00:00
# USE_LINUX_CAP : enable Linux capabilities.
2023-08-16 22:03:01 +00:00
# USE_LIBCRYPT : enable encrypted passwords using -lcrypt
# USE_CRYPT_H : set it if your system requires including crypt.h
# USE_GETADDRINFO : use getaddrinfo() to resolve IPv6 host names.
# USE_OPENSSL : enable use of OpenSSL. Recommended, but see below.
2023-07-06 22:41:46 +00:00
# USE_OPENSSL_AWSLC : enable use of AWS-LC
2023-08-16 22:03:01 +00:00
# USE_OPENSSL_WOLFSSL : enable use of wolfSSL with the OpenSSL API
# USE_QUIC : enable use of QUIC with the quictls API (quictls, libressl, boringssl)
2023-08-16 22:01:27 +00:00
# USE_QUIC_OPENSSL_COMPAT : enable use of QUIC with the standard openssl API (limited features)
2023-08-16 22:03:01 +00:00
# USE_ENGINE : enable use of OpenSSL Engine.
# USE_LUA : enable Lua support.
# USE_ACCEPT4 : enable use of accept4() on linux. Automatic.
# USE_CLOSEFROM : enable use of closefrom() on *bsd, solaris. Automatic.
# USE_PRCTL : enable use of prctl(). Automatic.
# USE_PROCCTL : enable use of procctl(). Automatic.
# USE_ZLIB : enable zlib library support and disable SLZ
# USE_SLZ : enable slz library instead of zlib (default=enabled)
# USE_CPU_AFFINITY : enable pinning processes to CPU on Linux. Automatic.
# USE_TFO : enable TCP fast open. Supported on Linux >= 3.7.
# USE_NS : enable network namespace support. Supported on Linux >= 2.6.24.
# USE_DL : enable it if your system requires -ldl. Automatic on Linux.
# USE_MATH : enable use of -lm. Automatic.
# 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
# USE_SYSTEMD : enable sd_notify() support.
# USE_OBSOLETE_LINKER : use when the linker fails to emit __start_init/__stop_init
# USE_THREAD_DUMP : use the more advanced thread state dump system. Automatic.
# USE_OT : enable the OpenTracing filter
# USE_MEMORY_PROFILING : enable the memory profiler. Linux-glibc only.
# USE_LIBATOMIC : force to link with/without libatomic. Automatic.
# USE_PTHREAD_EMULATION : replace pthread's rwlocks with ours
# USE_SHM_OPEN : use shm_open() for the startup-logs
2007-07-11 07:19:31 +00:00
#
2008-01-02 19:48:34 +00:00
# Options can be forced by specifying "USE_xxx=1" or can be disabled by using
2019-06-14 13:52:01 +00:00
# "USE_xxx=" (empty string). The list of enabled and disabled options for a
2022-12-23 16:29:11 +00:00
# given TARGET is enumerated at the end of "make help". Most of these options
# support specific xxx_CFLAGS and/or xxx_LDFLAGS that can be individually
# forced. The currently active ones for a given set of options are listed in
# "make opts USE_xxx=1 ...".
2008-01-02 19:48:34 +00:00
#
# Variables useful for packagers :
2020-09-13 06:53:06 +00:00
# CC is set to "cc" by default and is used for compilation only.
# LD is set to "cc" by default and is used for linking only.
2024-04-10 14:26:34 +00:00
# OPT_CFLAGS sets the default optimization level (-O2).
2024-04-10 09:29:49 +00:00
# CFLAGS may be used to append any flags for the C compiler.
2008-01-02 19:48:34 +00:00
# LDFLAGS is automatically set to -g and may be overridden.
2024-04-10 15:58:00 +00:00
# ARCH_FLAGS for flags common to both CC and LD. Defaults to -g.
2016-05-30 11:39:32 +00:00
# DEP may be cleared to ignore changes to include files during development
2008-01-02 19:48:34 +00:00
# DEBUG may be used to set some internal debugging options.
2018-10-22 04:22:46 +00:00
# ERR may be set to non-empty to pass -Werror to the compiler
2024-04-11 13:08:14 +00:00
# FAILFAST may be set to non-empty to pass -Wfatal-errors to the compiler
2024-04-11 13:29:42 +00:00
# WARN_CFLAGS overrides the default set of enabled warning options
2024-04-11 13:46:54 +00:00
# NOWARN_CFLAGS overrides the default set of disabled warning options
2008-01-02 19:48:34 +00:00
# ADDINC may be used to complete the include path in the form -Ipath.
# ADDLIB may be used to complete the library list in the form -Lpath -llib.
# DEFINE may be used to specify any additional define, which will be reported
# by "haproxy -vv" in CFLAGS.
# SILENT_DEFINE may be used to specify other defines which will not be
# reported by "haproxy -vv".
2017-06-01 15:38:58 +00:00
# EXTRA is used to force building or not building some extra tools.
2008-03-12 13:25:35 +00:00
# DESTDIR is not set by default and is used for installation only.
# It might be useful to set DESTDIR if you want to install haproxy
# in a sandbox.
2022-07-16 09:18:50 +00:00
# INSTALL is set to "install" by default and is used to provide the name of
# the install binary used by the install targets and any additional
# flags.
2008-03-12 13:25:35 +00:00
# PREFIX is set to "/usr/local" by default and is used for installation only.
# SBINDIR is set to "$(PREFIX)/sbin" by default and is used for installation
# only.
2008-03-12 13:57:54 +00:00
# MANDIR is set to "$(PREFIX)/share/man" by default and is used for
# installation only.
2008-03-12 15:24:49 +00:00
# DOCDIR is set to "$(PREFIX)/doc/haproxy" by default and is used for
# installation only.
2020-01-12 12:55:41 +00:00
# HLUA_PREPEND_PATH may be used to prepend a folder to Lua's default package.path.
# HLUA_PREPEND_CPATH may be used to prepend a folder to Lua's default package.cpath.
2008-01-02 19:48:34 +00:00
#
# Other variables :
2018-09-28 17:21:26 +00:00
# PCRE_CONFIG : force the binary path to get pcre config (by default
# pcre-config)
2008-01-02 19:48:34 +00:00
# PCREDIR : force the path to libpcre.
2013-02-13 11:39:06 +00:00
# PCRE_LIB : force the lib path to libpcre (defaults to $PCREDIR/lib).
# PCRE_INC : force the include path to libpcre ($PCREDIR/inc)
2018-09-28 17:21:26 +00:00
# PCRE2_CONFIG : force the binary path to get pcre2 config (by default
# pcre2-config)
2013-09-17 13:26:39 +00:00
# SSL_LIB : force the lib path to libssl/libcrypto
# SSL_INC : force the include path to libssl/libcrypto
2015-01-23 13:06:13 +00:00
# LUA_LIB : force the lib path to lua
# LUA_INC : force the include path to lua
2015-03-03 22:13:03 +00:00
# LUA_LIB_NAME : force the lib name (or automatically evaluated, by order of
2022-06-28 08:03:00 +00:00
# priority : lua5.4, lua54, lua5.3, lua53, lua).
CONTRIB: opentracing: add the OpenTracing filter
This commit adds the OpenTracing filter (hereinafter we will use the
abbreviated name 'the OT filter') to the contrib tree.
The OT filter adds native support for using distributed tracing in HAProxy.
This is enabled by sending an OpenTracing compliant request to one of the
supported tracers; such as Datadog, Jaeger, Lightstep and Zipkin tracers.
Please note: tracers are not listed by any preference, but alphabetically.
The OT filter is a standard HAProxy filter, so what applies to others also
applies to this one (of course, by that I mean what is described in the
documentation, more precisely in the doc/internals/filters.txt file).
The OT filter activation is done explicitly by specifying it in the HAProxy
configuration. If this is not done, the OT filter in no way participates
in the work of HAProxy.
As for the impact on HAProxy speed, this is documented with several tests
located in the test directory, and the result is found in the README-speed-*
files. In short, the speed of operation depends on the way it is used and
the complexity of the configuration, from an almost immeasurable impact to
a significant deceleration (5x and more). I think that in some normal use
the speed of HAProxy with the filter on will be quite satisfactory with a
slowdown of less than 4%.
The OT filter allows intensive use of ACLs, which can be defined anywhere in
the configuration. Thus, it is possible to use the filter only for those
connections that are of interest to us.
More detailed documentation related to the operation, configuration and use
of the filter can be found in the contrib/opentracing directory.
To make the OpenTracing filter easier to configure and compile, several
entries have been added to the Makefile. When running the make utility,
it is possible to use several new arguments:
USE_OT=1 : enable the OpenTracing filter
OT_DEBUG=1 : compile the OpenTracing filter in debug mode
OT_INC=path : force the include path to libopentracing-c-wrapper
OT_LIB=path : force the lib path to libopentracing-c-wrapper
OT_RUNPATH=1 : add libopentracing-c-wrapper RUNPATH to haproxy executable
If USE_OT is set, then an additional Makefile from the contrib/opentracing
directory is included in the compilation process.
2020-12-09 15:54:31 +00:00
# OT_DEBUG : compile the OpenTracing filter in debug mode
# OT_INC : force the include path to libopentracing-c-wrapper
# OT_LIB : force the lib path to libopentracing-c-wrapper
# OT_RUNPATH : add RUNPATH for libopentracing-c-wrapper to haproxy executable
2021-09-08 18:56:05 +00:00
# OT_USE_VARS : allows the use of variables for the OpenTracing context
2008-01-02 19:48:34 +00:00
# IGNOREGIT : ignore GIT commit versions if set.
# VERSION : force haproxy version reporting.
# SUBVERS : add a sub-version (eg: platform, model, ...).
2020-10-01 02:05:39 +00:00
# EXTRAVERSION : local version string to append (e.g. build number etc)
2008-01-02 19:48:34 +00:00
# VERDATE : force haproxy's release date.
2019-06-14 13:52:01 +00:00
# VTEST_PROGRAM : location of the vtest program to run reg-tests.
2020-09-12 06:24:48 +00:00
# DEBUG_USE_ABORT: use abort() for program termination, see include/haproxy/bug.h for details
2008-01-02 19:48:34 +00:00
2022-11-17 07:23:10 +00:00
i n c l u d e i n c l u d e / m a k e / v e r b o s e . m k
2022-11-17 08:02:56 +00:00
i n c l u d e i n c l u d e / m a k e / c o m p i l e r . m k
2022-12-22 18:32:24 +00:00
i n c l u d e i n c l u d e / m a k e / o p t i o n s . m k
2017-09-14 17:05:45 +00:00
2008-03-12 13:25:35 +00:00
#### Installation options.
DESTDIR =
2022-07-16 09:18:50 +00:00
INSTALL = install
2008-03-12 13:25:35 +00:00
PREFIX = /usr/local
SBINDIR = $( PREFIX) /sbin
2008-11-16 00:29:03 +00:00
MANDIR = $( PREFIX) /share/man
2008-03-12 15:24:49 +00:00
DOCDIR = $( PREFIX) /doc/haproxy
2008-01-02 19:48:34 +00:00
#### TARGET system
2020-03-06 08:07:38 +00:00
# Use TARGET=<target_name> to optimize for a specific target OS among the
2008-01-02 19:48:34 +00:00
# following list (use the default "generic" if uncertain) :
2022-03-04 15:50:48 +00:00
# linux-glibc, linux-glibc-legacy, linux-musl, solaris, freebsd, freebsd-glibc,
# dragonfly, openbsd, netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic,
2020-10-08 05:15:06 +00:00
# custom
2008-03-11 05:37:39 +00:00
TARGET =
2008-01-02 19:48:34 +00:00
2024-04-10 15:00:10 +00:00
#### No longer used
CPU =
i f n e q ( $( CPU ) , )
i f n e q ( $( CPU ) , g e n e r i c )
$(warning Warning : the "CPU " variable was forced to "$( CPU ) " but is no longer \
used and will be ignored. For native builds, modern compilers generally \
prefer that the string "-march=native" is passed in CPU_CFLAGS or CFLAGS. \
For other CPU-specific options, please read suggestions in the INSTALL file.)
e n d i f
e n d i f
2005-12-17 11:21:26 +00:00
2024-04-10 15:58:00 +00:00
#### No longer used
2009-04-11 17:45:50 +00:00
ARCH =
2024-04-10 15:58:00 +00:00
i f n e q ( $( ARCH ) , )
$(warning Warning : the "ARCH " variable was forced to "$( ARCH ) " but is no \
longer used and will be ignored. Please check the INSTALL file for other \
options, but usually in order to pass arch-specific options, ARCH_FLAGS, \
CFLAGS or LDFLAGS are preferred.)
e n d i f
2009-04-11 17:45:50 +00:00
2008-01-02 19:48:34 +00:00
#### Toolchain options.
2020-09-13 06:53:06 +00:00
CC = cc
2008-03-17 17:23:12 +00:00
LD = $( CC)
2005-12-17 13:08:03 +00:00
2024-04-10 14:26:34 +00:00
#### Default optimizations
# Those are integrated early in the list of CFLAGS, and may be overridden by
# other CFLAGS options if needed.
OPT_CFLAGS = -O2
2024-04-10 16:21:18 +00:00
#### No longer used
DEBUG_CFLAGS =
i f n e q ( $( DEBUG_CFLAGS ) , )
$(warning Warning : DEBUG_CFLAGS was forced to "$( DEBUG_CFLAGS ) " but is no \
longer used and will be ignored. If you have ported this build setting from \
and older version, it is likely that you just want to pass these options \
to the CFLAGS variable. If you are passing some debugging-related options \
such as -g/-ggdb3/-pg etc, they can now be passed in ARCH_FLAGS at once for \
both the compilation and linking stages.)
e n d i f
2005-12-17 11:48:26 +00:00
2018-10-22 04:22:46 +00:00
#### Add -Werror when set to non-empty
ERR =
2018-11-23 07:29:15 +00:00
#### May be used to force running a specific set of reg-tests
REG_TEST_FILES =
2019-03-29 14:07:24 +00:00
REG_TEST_SCRIPT = ./scripts/run-regtests.sh
2018-11-23 07:29:15 +00:00
2024-04-10 16:48:20 +00:00
#### Standard C definition
# Compiler-specific flags that may be used to set the standard behavior we
# rely on and to disable some negative over-optimization. More specifically,
# we rely on signed integer wraparound on overflow, however recently clang and
# gcc decided to change their code generation regarding this and abuse the
# undefined behavior to silently produce invalid code. For this reason we have
# to use -fwrapv or -fno-strict-overflow to guarantee the intended behavior.
# It is preferable not to change this option in order to avoid breakage.
STD_CFLAGS := $( call cc-opt-alt,-fwrapv,-fno-strict-overflow)
2024-04-11 13:29:42 +00:00
#### Compiler-specific flags to enable certain classes of warnings.
# Some are hard-coded, others are enabled only if supported.
WARN_CFLAGS := -Wall -Wextra -Wundef -Wdeclaration-after-statement \
$( call cc-all-fast, \
-Wtype-limits -Wshift-negative-value -Wshift-overflow= 2 \
-Wduplicated-cond -Wnull-dereference)
2022-01-31 14:10:14 +00:00
2024-04-11 13:29:42 +00:00
#### Compiler-specific flags to enable certain classes of warnings.
2024-04-11 13:46:54 +00:00
NOWARN_CFLAGS := $( cc-wnouwo)
NOWARN_CFLAGS += $( call cc-nowarn,address-of-packed-member)
NOWARN_CFLAGS += $( call cc-nowarn,unused-label)
NOWARN_CFLAGS += $( call cc-nowarn,sign-compare)
NOWARN_CFLAGS += $( call cc-nowarn,unused-parameter)
NOWARN_CFLAGS += $( call cc-nowarn,clobbered)
NOWARN_CFLAGS += $( call cc-nowarn,missing-field-initializers)
NOWARN_CFLAGS += $( call cc-nowarn,cast-function-type)
NOWARN_CFLAGS += $( call cc-nowarn,string-plus-int)
NOWARN_CFLAGS += $( call cc-nowarn,atomic-alignment)
2010-11-28 07:28:15 +00:00
2024-04-11 13:20:46 +00:00
#### CFLAGS defining error handling
# ERROR_CFLAGS are just accumulators for these variables, they're not meant
# to be exposed nor manipulated outside of this. They're not reported in
# VERBOSE_CFLAGS and don't cause a rebuild when changed.
ERROR_CFLAGS :=
2024-04-11 13:03:12 +00:00
ifneq ($(ERR : 0=), )
2024-04-11 13:20:46 +00:00
ERROR_CFLAGS += -Werror
2020-03-10 08:37:08 +00:00
e n d i f
2024-04-11 13:08:14 +00:00
ifneq ($(FAILFAST : 0=), )
2024-04-11 13:20:46 +00:00
ERROR_CFLAGS += -Wfatal-errors
2024-04-11 13:08:14 +00:00
e n d i f
2024-04-10 13:16:02 +00:00
#### No longer used
2008-01-02 19:48:34 +00:00
SMALL_OPTS =
2024-04-10 13:16:02 +00:00
i f n e q ( $( SMALL_OPTS ) , )
$(warning Warning : SMALL_OPTS was forced to "$( SMALL_OPTS ) " but is no longer \
used and will be ignored. Please check if this setting are still relevant, \
and move it either to DEFINE or to CFLAGS instead.)
e n d i f
2005-12-17 11:21:26 +00:00
2008-01-02 19:48:34 +00:00
#### Debug settings
# You can enable debugging on specific code parts by setting DEBUG=-DDEBUG_xxx.
2020-07-04 10:43:46 +00:00
# Use quotes and spaces if multiple options are needed (the DEBUG variables is
# passed as-is to CFLAGS). Please check sources for their exact meaning or do
# not use them at all. Some even more obscure ones might also be available
# without appearing here. Currently defined DEBUG macros include DEBUG_FULL,
2022-01-21 18:00:25 +00:00
# DEBUG_MEM_STATS, DEBUG_DONT_SHARE_POOLS, DEBUG_FD, DEBUG_POOL_INTEGRITY,
2022-02-28 13:59:25 +00:00
# DEBUG_NO_POOLS, DEBUG_FAIL_ALLOC, DEBUG_STRICT_ACTION=[0-3], DEBUG_HPACK,
2021-02-16 17:44:00 +00:00
# DEBUG_AUTH, DEBUG_SPOE, DEBUG_UAF, DEBUG_THREAD, DEBUG_STRICT, DEBUG_DEV,
2023-05-11 09:33:35 +00:00
# DEBUG_TASK, DEBUG_MEMORY_POOLS, DEBUG_POOL_TRACING, DEBUG_QPACK, DEBUG_LIST.
2024-04-10 07:20:19 +00:00
DEBUG =
2005-12-17 13:08:03 +00:00
2012-05-25 21:53:16 +00:00
#### Trace options
# Use TRACE=1 to trace function calls to file "trace.out" or to stderr if not
# possible.
TRACE =
2008-01-02 19:48:34 +00:00
#### Additional include and library dirs
# Redefine this if you want to add some special PATH to include/libs
ADDINC =
ADDLIB =
2005-12-17 12:46:33 +00:00
2008-01-02 19:48:34 +00:00
#### Specific macro definitions
# Use DEFINE=-Dxxx to set any tunable macro. Anything declared here will appear
# in the build options reported by "haproxy -vv". Use SILENT_DEFINE if you do
# not want to pollute the report with complex defines.
2012-10-05 13:47:31 +00:00
# The following settings might be of interest when SSL is enabled :
# LISTEN_DEFAULT_CIPHERS is a cipher suite string used to set the default SSL
# ciphers on "bind" lines instead of using OpenSSL's defaults.
# CONNECT_DEFAULT_CIPHERS is a cipher suite string used to set the default
# SSL ciphers on "server" lines instead of using OpenSSL's defaults.
2008-01-02 19:48:34 +00:00
DEFINE =
SILENT_DEFINE =
2017-06-01 15:38:58 +00:00
#### extra programs to build
2014-05-10 10:16:21 +00:00
# Force this to enable building extra programs or to disable them.
# It's automatically appended depending on the targets.
EXTRA =
2008-01-02 19:48:34 +00:00
2020-03-06 08:07:38 +00:00
#### CPU dependent optimizations
2024-04-10 15:00:10 +00:00
# This may optionally be used to pass CPU-specific optimizations such as
# -march=native, -mcpu=something, -m64 etc independently of CFLAGS if it is
# considered more convenient. Historically, the optimization level was also
# passed there. This is still supported but not recommended though; OPT_CFLAGS
# is better suited. The default is empty.
CPU_CFLAGS =
2008-01-02 19:48:34 +00:00
2024-04-10 15:58:00 +00:00
#### Architecture dependent flags.
# These flags are passed both to the compiler and to the linker. A number of
# settings may need to be passed to both tools, among which some arch-specific
# options such as -m32 or -m64, some debugging options (-g), some profiling
# options (-pg), some options affecting how the linkage is done (-flto), as
# well as some code analysers such as -fsanitize=address. All of these make
# sense here and will be consistently propagated to both stages. By default
# only the debugging is enabled (-g).
ARCH_FLAGS = -g
2009-04-11 17:45:50 +00:00
2024-04-10 09:29:49 +00:00
#### Extra CFLAGS
# These CFLAGS are empty by default and are appended at the end of all the
# flags passed to the compiler, so that it is possible to use them to force
# some optimization levels, architecture types and/or disable certain warnings.
# Just set CFLAGS to the desired ones on the "make" command line.
CFLAGS =
2024-04-10 16:16:44 +00:00
#### Extra LDFLAGS
# These LDFLAGS are used as the first "ld" options just after ARCH_FLAGS,
# regardless of any library path or any other option. They may be used to add
# any linker-specific option at the beginning of the ld command line. It may be
# convenient to set a run time search path (-rpath), see INSTALL for more info.
LDFLAGS =
2005-12-17 12:46:33 +00:00
2019-03-27 09:57:49 +00:00
#### list of all "USE_*" options. These ones must be updated if new options are
# added, so that the relevant options are properly added to the CFLAGS and to
# the reported build options.
2023-02-03 08:23:56 +00:00
#
# Relevant *_CFLAGS/*_LDFLAGS will be concatenated in the order defined here.
# Note that PCRE last position is advisable as it relies on pcre configuration
# detection tool which may generate default include/lib paths overriding more
# specific entries if present before them.
use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER USE_POLL \
2022-07-10 08:58:57 +00:00
USE_THREAD USE_PTHREAD_EMULATION USE_BACKTRACE \
2023-08-29 08:24:26 +00:00
USE_TPROXY USE_LINUX_TPROXY USE_LINUX_CAP \
2022-04-11 16:52:53 +00:00
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_ENGINE \
2023-07-06 22:41:46 +00:00
USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_OPENSSL_AWSLC \
USE_SSL USE_LUA USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ \
USE_CPU_AFFINITY USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC \
USE_MATH USE_DEVICEATLAS USE_51DEGREES \
2022-11-23 15:41:25 +00:00
USE_WURFL USE_SYSTEMD USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL \
USE_THREAD_DUMP USE_EVPORTS USE_OT USE_QUIC USE_PROMEX \
2023-02-03 08:23:56 +00:00
USE_MEMORY_PROFILING USE_SHM_OPEN \
USE_STATIC_PCRE USE_STATIC_PCRE2 \
2023-06-02 15:07:24 +00:00
USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT USE_QUIC_OPENSSL_COMPAT
2019-03-27 09:57:49 +00:00
BUILD: makefile: initialize all build options' variables at once
A lot of _SRC, _INC, _LIB etc variables are set and expected to be
initialized to an empty string by default. However, an in-depth
review of all of them showed that WOLFSSL_{INC,LIB}, SSL_{INC,LIB},
LUA_{INC,LIB}, and maybe others were not always initialized and could
sometimes leak from the environment and as such cause strange build
issues when running from cascaded scripts that had exported them.
The approach taken here consists in iterating over all USE_* options
and unsetting any _SRC, _INC, _LIB, _CFLAGS and _LDFLAGS that follows
the same name. For the few variable names options that don't exactly
match the build option (SSL & WOLFSSL), these ones are specifically
added to the list. The few that were explicitly cleared in their own
sections were just removed since not needed anymore. Note that an
"undefine" command appeared in GNU make 3.82 but since we support
older ones we can only initialize the variables to an empty string
here. It's not a problem in practice.
We're now certain that these variables are empty wherever they are
used, and that it is possible to just append to them, or use them
as-is.
2022-12-22 14:47:47 +00:00
# preset all variables for all supported build options among use_opts
$( reset_opts_vars )
2024-04-11 06:27:18 +00:00
# Check that any USE_* variable that was forced actually exist.
$( warn_unknown_options )
2008-01-02 19:48:34 +00:00
#### Target system options
2019-03-27 09:57:49 +00:00
# poll() is always supported, unless explicitly disabled by passing USE_POLL=""
# on the make command line.
2013-04-02 06:14:29 +00:00
USE_POLL = default
2021-04-22 12:14:22 +00:00
# SLZ is always supported unless explicitly disabled by passing USE_SLZ=""
# or disabled by enabling ZLIB using USE_ZLIB=1
2024-04-11 08:41:39 +00:00
ifeq ($(USE_ZLIB : 0=), )
2022-12-21 14:49:56 +00:00
USE_SLZ = default
2021-04-22 12:14:22 +00:00
e n d i f
2019-03-27 10:44:19 +00:00
# generic system target has nothing specific
2008-01-02 19:48:34 +00:00
i f e q ( $( TARGET ) , g e n e r i c )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts,USE_POLL USE_TPROXY)
2019-03-27 10:44:19 +00:00
e n d i f
# Haiku
2015-10-19 23:01:16 +00:00
i f e q ( $( TARGET ) , h a i k u )
TARGET_LDFLAGS = -lnetwork
2021-06-19 14:42:43 +00:00
set_target_defaults = $( call default_opts,USE_POLL USE_TPROXY USE_OBSOLETE_LINKER)
2019-03-27 10:44:19 +00:00
e n d i f
2019-06-14 14:32:09 +00:00
# For linux >= 2.6.28 and glibc
i f e q ( $( TARGET ) , l i n u x - g l i b c )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2019-03-27 10:30:47 +00:00
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \
2023-08-29 08:24:26 +00:00
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP \
2019-06-14 16:33:56 +00:00
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
2024-04-04 12:06:11 +00:00
USE_GETADDRINFO USE_BACKTRACE USE_SHM_OPEN USE_SYSTEMD)
2022-07-16 09:18:50 +00:00
INSTALL = install -v
2019-03-27 10:44:19 +00:00
e n d i f
2019-09-01 14:48:36 +00:00
# For linux >= 2.6.28, glibc without new features
i f e q ( $( TARGET ) , l i n u x - g l i b c - l e g a c y )
set_target_defaults = $( call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \
2023-08-29 08:24:26 +00:00
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP \
2019-09-01 14:48:36 +00:00
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_GETADDRINFO)
2022-07-16 09:18:50 +00:00
INSTALL = install -v
2019-09-01 14:48:36 +00:00
e n d i f
2020-04-16 13:14:17 +00:00
# For linux >= 2.6.28 and musl
i f e q ( $( TARGET ) , l i n u x - m u s l )
set_target_defaults = $( call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \
2023-08-29 08:24:26 +00:00
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP \
2020-04-16 13:14:17 +00:00
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
2022-10-21 08:35:37 +00:00
USE_GETADDRINFO USE_SHM_OPEN)
2022-07-16 09:18:50 +00:00
INSTALL = install -v
2020-04-16 13:14:17 +00:00
e n d i f
2020-09-30 19:46:16 +00:00
# Solaris 10 and above
2008-01-02 19:48:34 +00:00
i f e q ( $( TARGET ) , s o l a r i s )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2019-05-21 09:12:03 +00:00
USE_POLL USE_TPROXY USE_LIBCRYPT USE_CRYPT_H USE_GETADDRINFO USE_THREAD \
2020-09-30 19:46:16 +00:00
USE_RT USE_OBSOLETE_LINKER USE_EVPORTS USE_CLOSEFROM)
2022-01-13 19:16:48 +00:00
TARGET_CFLAGS = -DFD_SETSIZE= 65536 -D_REENTRANT -D_XOPEN_SOURCE= 600 -D__EXTENSIONS__
2008-01-02 19:48:34 +00:00
TARGET_LDFLAGS = -lnsl -lsocket
2019-03-27 10:44:19 +00:00
e n d i f
2020-09-15 07:10:04 +00:00
# FreeBSD 10 and above
2008-01-02 19:48:34 +00:00
i f e q ( $( TARGET ) , f r e e b s d )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2019-03-27 10:30:47 +00:00
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE \
2022-11-18 14:22:51 +00:00
USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO USE_PROCCTL USE_SHM_OPEN)
2019-03-27 10:44:19 +00:00
e n d i f
2022-03-04 15:50:48 +00:00
# kFreeBSD glibc
i f e q ( $( TARGET ) , f r e e b s d - g l i b c )
set_target_defaults = $( call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE \
USE_ACCEPT4 USE_GETADDRINFO USE_CRYPT_H USE_DL)
e n d i f
2020-10-08 05:15:06 +00:00
# DragonFlyBSD 4.3 and above
i f e q ( $( TARGET ) , d r a g o n f l y )
set_target_defaults = $( call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE \
USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
e n d i f
2019-03-27 10:44:19 +00:00
# Mac OS/X
2013-04-02 06:17:43 +00:00
i f e q ( $( TARGET ) , o s x )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2020-10-09 23:26:23 +00:00
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE \
USE_GETADDRINFO)
2018-03-05 14:37:04 +00:00
EXPORT_SYMBOL = -export_dynamic
2019-03-27 10:44:19 +00:00
e n d i f
2020-09-27 03:05:25 +00:00
# OpenBSD 6.3 and above
2008-01-02 19:48:34 +00:00
i f e q ( $( TARGET ) , o p e n b s d )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2020-11-20 09:50:39 +00:00
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_KQUEUE USE_ACCEPT4 \
USE_CLOSEFROM USE_GETADDRINFO)
2019-03-27 10:44:19 +00:00
e n d i f
2020-10-08 20:24:52 +00:00
# NetBSD 8 and above
2015-07-02 06:58:22 +00:00
i f e q ( $( TARGET ) , n e t b s d )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2022-08-13 04:57:31 +00:00
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_KQUEUE USE_ACCEPT4 \
USE_CLOSEFROM USE_GETADDRINFO)
2019-03-27 10:44:19 +00:00
e n d i f
# AIX 5.1 only
2014-04-02 18:44:43 +00:00
i f e q ( $( TARGET ) , a i x 5 1 )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2021-06-15 14:11:33 +00:00
USE_POLL USE_LIBCRYPT USE_OBSOLETE_LINKER)
2019-03-29 17:56:00 +00:00
TARGET_CFLAGS = -Dss_family= __ss_family -Dip6_hdr= ip6hdr -DSTEVENS_API -D_LINUX_SOURCE_COMPAT -Dunsetenv= my_unsetenv
2019-03-27 10:44:19 +00:00
e n d i f
MINOR: build: add aix72-gcc build TARGET and power{8,9} CPUs
As haproxy wont build on AIX 7.2 using the old "aix52" TARGET a new
TARGET was introduced which adds two special CFLAGS to prevent the
loading of AIXs xmem.h and var.h. This is done by defining the
corresponding include-guards _H_XMEM and _H_VAR. Without excluding
those headers-files the build fails because of redefinition errors:
1)
CC src/mux_fcgi.o
In file included from /usr/include/sys/uio.h:90,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8.3.0/include-fixed/sys/socket.h:104,
from include/common/compat.h:32,
from include/common/cfgparse.h:25,
from src/mux_fcgi.c:13:
src/mux_fcgi.c:204:13: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
struct ist rem_addr;
^~~~~~~~
2)
CC src/cfgparse-listen.o
In file included from include/types/arg.h:31,
from include/types/acl.h:29,
from include/types/proxy.h:41,
from include/proto/log.h:34,
from include/common/cfgparse.h:30,
from src/mux_h2.c:13:
include/types/vars.h:30:8: error: redefinition of 'struct var'
struct var {
^~~
Futhermore, to enable multithreading via USE_THREAD, the atomic
library was added to the LDFLAGS. Finally, two new CPUs were added
to simplify the usage of power8 and power9 optimizations.
This TARGET was only tested on GCC 8.3 and may or may not work on
IBM's native C-compiler (XLC).
Should be backported to 2.1.
2020-02-10 09:29:13 +00:00
# AIX 5.2
2012-06-06 14:15:03 +00:00
i f e q ( $( TARGET ) , a i x 5 2 )
2019-03-29 19:55:54 +00:00
set_target_defaults = $( call default_opts, \
2019-03-29 20:30:17 +00:00
USE_POLL USE_LIBCRYPT USE_OBSOLETE_LINKER)
2012-06-06 14:15:03 +00:00
TARGET_CFLAGS = -D_MSGQSUPPORT
2019-03-27 10:44:19 +00:00
e n d i f
MINOR: build: add aix72-gcc build TARGET and power{8,9} CPUs
As haproxy wont build on AIX 7.2 using the old "aix52" TARGET a new
TARGET was introduced which adds two special CFLAGS to prevent the
loading of AIXs xmem.h and var.h. This is done by defining the
corresponding include-guards _H_XMEM and _H_VAR. Without excluding
those headers-files the build fails because of redefinition errors:
1)
CC src/mux_fcgi.o
In file included from /usr/include/sys/uio.h:90,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8.3.0/include-fixed/sys/socket.h:104,
from include/common/compat.h:32,
from include/common/cfgparse.h:25,
from src/mux_fcgi.c:13:
src/mux_fcgi.c:204:13: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
struct ist rem_addr;
^~~~~~~~
2)
CC src/cfgparse-listen.o
In file included from include/types/arg.h:31,
from include/types/acl.h:29,
from include/types/proxy.h:41,
from include/proto/log.h:34,
from include/common/cfgparse.h:30,
from src/mux_h2.c:13:
include/types/vars.h:30:8: error: redefinition of 'struct var'
struct var {
^~~
Futhermore, to enable multithreading via USE_THREAD, the atomic
library was added to the LDFLAGS. Finally, two new CPUs were added
to simplify the usage of power8 and power9 optimizations.
This TARGET was only tested on GCC 8.3 and may or may not work on
IBM's native C-compiler (XLC).
Should be backported to 2.1.
2020-02-10 09:29:13 +00:00
# AIX 7.2 and above
i f e q ( $( TARGET ) , a i x 7 2 - g c c )
set_target_defaults = $( call default_opts, \
USE_POLL USE_THREAD USE_LIBCRYPT USE_OBSOLETE_LINKER USE_GETADDRINFO)
TARGET_CFLAGS = -D_H_XMEM -D_H_VAR
2022-12-21 09:46:07 +00:00
USE_LIBATOMIC = implicit
MINOR: build: add aix72-gcc build TARGET and power{8,9} CPUs
As haproxy wont build on AIX 7.2 using the old "aix52" TARGET a new
TARGET was introduced which adds two special CFLAGS to prevent the
loading of AIXs xmem.h and var.h. This is done by defining the
corresponding include-guards _H_XMEM and _H_VAR. Without excluding
those headers-files the build fails because of redefinition errors:
1)
CC src/mux_fcgi.o
In file included from /usr/include/sys/uio.h:90,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8.3.0/include-fixed/sys/socket.h:104,
from include/common/compat.h:32,
from include/common/cfgparse.h:25,
from src/mux_fcgi.c:13:
src/mux_fcgi.c:204:13: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
struct ist rem_addr;
^~~~~~~~
2)
CC src/cfgparse-listen.o
In file included from include/types/arg.h:31,
from include/types/acl.h:29,
from include/types/proxy.h:41,
from include/proto/log.h:34,
from include/common/cfgparse.h:30,
from src/mux_h2.c:13:
include/types/vars.h:30:8: error: redefinition of 'struct var'
struct var {
^~~
Futhermore, to enable multithreading via USE_THREAD, the atomic
library was added to the LDFLAGS. Finally, two new CPUs were added
to simplify the usage of power8 and power9 optimizations.
This TARGET was only tested on GCC 8.3 and may or may not work on
IBM's native C-compiler (XLC).
Should be backported to 2.1.
2020-02-10 09:29:13 +00:00
e n d i f
2019-03-27 10:44:19 +00:00
# Cygwin
2009-06-14 16:27:54 +00:00
i f e q ( $( TARGET ) , c y g w i n )
2019-03-29 20:30:17 +00:00
set_target_defaults = $( call default_opts, \
USE_POLL USE_TPROXY USE_OBSOLETE_LINKER)
2021-01-08 04:35:52 +00:00
# Cygwin adds IPv6 support only in version 1.7 (in beta right now).
2009-06-14 16:27:54 +00:00
TARGET_CFLAGS = $( if $( filter 1.5.%, $( shell uname -r) ) , -DUSE_IPV6 -DAF_INET6= 23 -DINET6_ADDRSTRLEN= 46, )
2019-03-27 10:44:19 +00:00
e n d i f
2008-01-02 19:48:34 +00:00
2019-03-29 19:55:54 +00:00
# set the default settings according to the target above
$( set_target_defaults )
2021-11-14 14:28:38 +00:00
# Some architectures require to link with libatomic for atomics of certain
# sizes. These ones are reported as value 1 in the *_LOCK_FREE macros. Value
# 2 indicates that the builtin is native thus doesn't require libatomic. Hence
# any occurrence of 1 indicates libatomic is necessary. It's better to avoid
# linking with it by default as it's not always available nor deployed
# (especially on archs which do not need it).
2024-04-11 08:41:39 +00:00
ifneq ($(USE_THREAD : 0=), )
2024-04-10 16:21:18 +00:00
ifneq ( $( shell $( CC) $( OPT_CFLAGS) $( ARCH_FLAGS) $( CPU_CFLAGS) $( STD_CFLAGS) $( WARN_CFLAGS) $( NOWARN_CFLAGS) $( ERROR_CFLAGS) $( CFLAGS) -dM -E -xc - </dev/null 2>/dev/null | grep -c 'LOCK_FREE.*1' ) ,0)
2022-12-21 14:49:56 +00:00
USE_LIBATOMIC = implicit
endif
2021-11-14 14:28:38 +00:00
e n d i f
2008-01-02 19:48:34 +00:00
#### Determine version, sub-version and release date.
# If GIT is found, and IGNOREGIT is not set, VERSION, SUBVERS and VERDATE are
# extracted from the last commit. Otherwise, use the contents of the files
# holding the same names in the current directory.
2005-12-18 00:02:42 +00:00
2007-01-01 23:44:53 +00:00
i f e q ( $( IGNOREGIT ) , )
2022-12-21 14:49:56 +00:00
VERSION := $( shell [ -d .git/. ] && ( git describe --tags --match 'v*' --abbrev= 0 | cut -c 2-) 2>/dev/null)
ifneq ( $( VERSION) ,)
# OK git is there and works.
SUBVERS := $( shell comms = ` git log --format= oneline --no-merges v$( VERSION) .. 2>/dev/null | wc -l | tr -d '[:space:]' ` ; commit = ` ( git log -1 --pretty= %h --abbrev= 6) 2>/dev/null` ; [ $$ comms -gt 0 ] && echo " - $$ commit- $$ comms " )
VERDATE := $( shell git log -1 --pretty= format:%ci | cut -f1 -d' ' | tr '-' '/' )
endif
2007-09-09 21:31:11 +00:00
e n d i f
2008-01-02 19:48:34 +00:00
# Last commit version not found, take it from the files.
2007-09-09 21:31:11 +00:00
i f e q ( $( VERSION ) , )
2022-12-21 14:49:56 +00:00
VERSION := $( shell cat VERSION 2>/dev/null || touch VERSION)
2007-09-09 21:31:11 +00:00
e n d i f
i f e q ( $( SUBVERS ) , )
2022-12-21 14:49:56 +00:00
SUBVERS := $( shell ( grep -v '\$$Format' SUBVERS 2>/dev/null || touch SUBVERS) | head -n 1)
2007-09-09 21:31:11 +00:00
e n d i f
i f e q ( $( VERDATE ) , )
2022-12-21 14:49:56 +00:00
VERDATE := $( shell ( grep -v '^\$$Format' VERDATE 2>/dev/null || touch VERDATE) | head -n 1 | cut -f1 -d' ' | tr '-' '/' )
2006-12-23 10:12:04 +00:00
e n d i f
2006-11-12 22:57:19 +00:00
2020-10-01 02:05:39 +00:00
# this one is always empty by default and appended verbatim
EXTRAVERSION =
2008-01-02 19:48:34 +00:00
#### Build options
# Do not change these ones, enable USE_* variables instead.
OPTIONS_CFLAGS =
OPTIONS_LDFLAGS =
OPTIONS_OBJS =
2019-01-10 09:01:03 +00:00
#### Extra objects to be built and integrated (used only for development)
EXTRA_OBJS =
2019-03-27 09:57:49 +00:00
# This variable collects all USE_* values except those set to "implicit". This
# is used to report a list of all flags which were used to build this version.
# Do not assign anything to it.
2022-12-22 18:32:24 +00:00
BUILD_OPTIONS := $( call build_options)
2019-03-27 09:57:49 +00:00
2019-03-27 13:44:14 +00:00
# All USE_* options have their equivalent macro defined in the code (some might
# possibly be unused though)
2022-12-22 18:32:24 +00:00
OPTIONS_CFLAGS += $( call opts_as_defines)
2019-03-27 13:44:14 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_LIBCRYPT : 0=), )
2022-12-21 14:49:56 +00:00
ifneq ( $( TARGET) ,openbsd)
ifneq ( $( TARGET) ,osx)
2022-12-21 15:14:11 +00:00
LIBCRYPT_LDFLAGS = -lcrypt
2022-12-21 14:49:56 +00:00
endif
endif
2019-09-01 13:59:10 +00:00
e n d i f
2010-01-29 16:50:44 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_ZLIB : 0=), )
2022-12-21 14:49:56 +00:00
# Use ZLIB_INC and ZLIB_LIB to force path to zlib.h and libz.{a,so} if needed.
2022-12-21 15:15:40 +00:00
ZLIB_CFLAGS = $( if $( ZLIB_INC) ,-I$( ZLIB_INC) )
ZLIB_LDFLAGS = $( if $( ZLIB_LIB) ,-L$( ZLIB_LIB) ) -lz
MEDIUM: HTTP compression (zlib library support)
This commit introduces HTTP compression using the zlib library.
http_response_forward_body has been modified to call the compression
functions.
This feature includes 3 algorithms: identity, gzip and deflate:
* identity: this is mostly for debugging, and it was useful for
developping the compression feature. With Content-Length in input, it
is making each chunk with the data available in the current buffer.
With chunks in input, it is rechunking, the output chunks will be
bigger or smaller depending of the size of the input chunk and the
size of the buffer. Identity does not apply any change on data.
* gzip: same as identity, but applying a gzip compression. The data
are deflated using the Z_NO_FLUSH flag in zlib. When there is no more
data in the input buffer, it flushes the data in the output buffer
(Z_SYNC_FLUSH). At the end of data, when it receives the last chunk in
input, or when there is no more data to read, it writes the end of
data with Z_FINISH and the ending chunk.
* deflate: same as gzip, but with deflate algorithm and zlib format.
Note that this algorithm has ambiguous support on many browsers and
no support at all from recent ones. It is strongly recommended not
to use it for anything else than experimentation.
You can't choose the compression ratio at the moment, it will be set to
Z_BEST_SPEED (1), as tests have shown very little benefit in terms of
compression ration when going above for HTML contents, at the cost of
a massive CPU impact.
Compression will be activated depending of the Accept-Encoding request
header. With identity, it does not take care of that header.
To build HAProxy with zlib support, use USE_ZLIB=1 in the make
parameters.
This work was initially started by David Du Colombier at Exceliance.
2012-10-23 08:25:10 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_SLZ : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/slz.o
2021-04-22 12:14:22 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_POLL : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/ev_poll.o
2006-11-12 22:57:19 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_EPOLL : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/ev_epoll.o
2006-11-12 22:57:19 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_KQUEUE : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/ev_kqueue.o
2006-11-12 22:57:19 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_EVPORTS : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/ev_evports.o
2019-04-08 16:53:32 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_RT : 0=), )
2022-12-21 15:16:36 +00:00
RT_LDFLAGS = -lrt
2018-10-18 14:28:54 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_THREAD : 0=), )
2023-05-31 10:03:33 +00:00
THREAD_LDFLAGS = -pthread
2020-03-04 07:31:47 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_BACKTRACE : 0=), )
2022-12-21 15:18:40 +00:00
BACKTRACE_LDFLAGS = -Wl,$( if $( EXPORT_SYMBOL) ,$( EXPORT_SYMBOL) ,--export-dynamic)
2020-03-03 14:40:23 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_CPU_AFFINITY : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/cpuset.o
2021-04-14 13:03:51 +00:00
e n d i f
2022-12-22 13:39:54 +00:00
# OpenSSL is packaged in various forms and with various dependencies.
# In general -lssl is enough, but on some platforms, -lcrypto may be needed,
# reason why it's added by default. Some even need -lz, then you'll need to
# pass it in the "ADDLIB" variable if needed. If your SSL libraries are not
# in the usual path, use SSL_INC=/path/to/inc and SSL_LIB=/path/to/lib.
# This is for the WolfSSL variant of the OpenSSL API. Setting it implies
# OPENSSL so it's not necessary to set the latter.
2024-04-11 08:41:39 +00:00
ifneq ($(USE_OPENSSL_WOLFSSL : 0=), )
2023-05-25 18:17:27 +00:00
SSL_CFLAGS := $( if $( SSL_INC) ,-I$( SSL_INC) /wolfssl -I$( SSL_INC) )
2022-12-22 13:39:54 +00:00
SSL_LDFLAGS := $( if $( SSL_LIB) ,-L$( SSL_LIB) ) -lwolfssl
# always automatically set USE_OPENSSL
2024-04-11 08:41:39 +00:00
USE_OPENSSL := $( if $( USE_OPENSSL:0= ) ,$( USE_OPENSSL:0= ) ,implicit)
2022-12-22 13:39:54 +00:00
e n d i f
2023-07-06 22:41:46 +00:00
# This is for the AWS-LC variant of the OpenSSL API. Setting it implies
# OPENSSL so it's not necessary to set the latter.
2024-04-11 08:41:39 +00:00
ifneq ($(USE_OPENSSL_AWSLC : 0=), )
2023-07-06 22:41:46 +00:00
# always automatically set USE_OPENSSL
2024-04-11 08:41:39 +00:00
USE_OPENSSL := $( if $( USE_OPENSSL:0= ) ,$( USE_OPENSSL:0= ) ,implicit)
2023-07-06 22:41:46 +00:00
e n d i f
2022-12-22 13:39:54 +00:00
# This is for any variant of the OpenSSL API. By default it uses OpenSSL.
2024-04-11 08:41:39 +00:00
ifneq ($(USE_OPENSSL : 0=), )
2022-12-22 13:39:54 +00:00
# only preset these for the regular openssl
2024-04-11 08:41:39 +00:00
ifeq ( $( USE_OPENSSL_WOLFSSL:0= ) ,)
2022-12-22 13:39:54 +00:00
SSL_CFLAGS := $( if $( SSL_INC) ,-I$( SSL_INC) )
SSL_LDFLAGS := $( if $( SSL_LIB) ,-L$( SSL_LIB) ) -lssl -lcrypto
2022-12-21 14:49:56 +00:00
endif
2024-04-11 08:41:39 +00:00
USE_SSL := $( if $( USE_SSL:0= ) ,$( USE_SSL:0= ) ,implicit)
2024-06-13 14:45:48 +00:00
OPTIONS_OBJS += src/ssl_sock.o src/ssl_ckch.o src/ssl_ocsp.o src/ssl_crtlist.o src/ssl_sample.o src/cfgparse-ssl.o src/ssl_gencert.o src/ssl_utils.o src/jwt.o src/ssl_clienthello.o
2022-11-23 15:41:25 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_ENGINE : 0=), )
2022-12-21 14:49:56 +00:00
# OpenSSL 3.0 emits loud deprecation warnings by default when building with
# engine support, and this option is made to silence them. Better use it
# only when absolutely necessary, until there's a viable alternative to the
# engine API.
2022-12-22 10:45:33 +00:00
ENGINE_CFLAGS = -DOPENSSL_SUPPRESS_DEPRECATED
2022-04-11 14:31:31 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_QUIC : 0=), )
2024-05-27 14:02:54 +00:00
OPTIONS_OBJS += src/quic_rx.o src/mux_quic.o src/h3.o src/quic_tx.o \
src/quic_conn.o src/quic_frame.o src/quic_sock.o \
src/quic_ssl.o src/quic_tls.o src/proto_quic.o \
src/quic_trace.o src/quic_cli.o src/quic_tp.o \
src/quic_cid.o src/quic_retransmit.o src/quic_retry.o \
src/quic_loss.o src/quic_cc_cubic.o src/quic_stream.o \
src/xprt_quic.o src/quic_ack.o src/hq_interop.o \
src/quic_cc_newreno.o src/qmux_http.o \
src/quic_cc_nocc.o src/qpack-dec.o src/quic_cc.o \
src/cfgparse-quic.o src/qmux_trace.o src/qpack-enc.o \
src/qpack-tbl.o src/h3_stats.o src/quic_stats.o \
2024-08-30 07:13:30 +00:00
src/quic_fctl.o src/cbuf.o src/quic_rules.o \
src/quic_token.o
2020-11-23 14:53:17 +00:00
e n d i f
2017-11-02 15:00:51 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_QUIC_OPENSSL_COMPAT : 0=), )
2023-06-02 15:07:24 +00:00
OPTIONS_OBJS += src/quic_openssl_compat.o
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_LUA : 0=), )
2022-12-21 14:49:56 +00:00
check_lua_inc = $( shell if [ -d $( 2) $( 1) ] ; then echo $( 2) $( 1) ; fi ; )
LUA_INC := $( firstword $( foreach lib,lua5.4 lua54 lua5.3 lua53 lua,$( call check_lua_inc,$( lib) ,"/usr/include/" ) ) )
check_lua_lib = $( shell echo "int main(){}" | $( CC) -o /dev/null -x c - $( 2) -l$( 1) 2>/dev/null && echo $( 1) )
LUA_LD_FLAGS := -Wl,$( if $( EXPORT_SYMBOL) ,$( EXPORT_SYMBOL) ,--export-dynamic) $( if $( LUA_LIB) ,-L$( LUA_LIB) )
# Try to automatically detect the Lua library if not set
ifeq ( $( LUA_LIB_NAME) ,)
LUA_LIB_NAME := $( firstword $( foreach lib,lua5.4 lua54 lua5.3 lua53 lua,$( call check_lua_lib,$( lib) ,$( LUA_LD_FLAGS) ) ) )
endif
# Lua lib name must be set now (forced/detected above)
ifeq ( $( LUA_LIB_NAME) ,)
$( error unable to automatically detect the Lua library name, you can enforce its name with LUA_LIB_NAME = <name> ( where <name> can be lua5.4, lua54, lua, ...) )
endif
ifneq ( $( HLUA_PREPEND_PATH) ,)
2022-12-21 15:20:41 +00:00
LUA_CFLAGS += -DHLUA_PREPEND_PATH= $( HLUA_PREPEND_PATH)
2022-12-21 14:49:56 +00:00
BUILD_OPTIONS += HLUA_PREPEND_PATH = $( HLUA_PREPEND_PATH)
endif # HLUA_PREPEND_PATH
ifneq ( $( HLUA_PREPEND_CPATH) ,)
2022-12-21 15:20:41 +00:00
LUA_CFLAGS += -DHLUA_PREPEND_CPATH= $( HLUA_PREPEND_CPATH)
2022-12-21 14:49:56 +00:00
BUILD_OPTIONS += HLUA_PREPEND_CPATH = $( HLUA_PREPEND_CPATH)
endif # HLUA_PREPEND_CPATH
USE_MATH = implicit
2022-12-21 15:20:41 +00:00
LUA_CFLAGS += $( if $( LUA_INC) ,-I$( LUA_INC) )
LUA_LDFLAGS = $( LUA_LD_FLAGS) -l$( LUA_LIB_NAME)
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/hlua.o src/hlua_fcn.o
2022-12-15 10:55:51 +00:00
e n d i f # USE_LUA
2015-01-23 13:06:13 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_PROMEX : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += addons/promex/service-prometheus.o
2024-01-30 06:34:54 +00:00
PROMEX_CFLAGS = -Iaddons/promex/include
2021-04-02 13:31:10 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_DEVICEATLAS : 0=), )
2022-12-21 14:49:56 +00:00
# Use DEVICEATLAS_SRC and possibly DEVICEATLAS_INC and DEVICEATLAS_LIB to force path
2024-01-25 09:11:18 +00:00
# to DeviceAtlas headers and libraries if needed. In this context, DEVICEATLAS_NOCACHE
# can be used to disable the cache support if needed (this also removes the necessity of having
# a C++ toolchain installed).
2022-12-21 14:49:56 +00:00
DEVICEATLAS_INC = $( DEVICEATLAS_SRC)
DEVICEATLAS_LIB = $( DEVICEATLAS_SRC)
2024-01-25 09:11:18 +00:00
include addons/deviceatlas/Makefile.inc
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += addons/deviceatlas/da.o
2015-06-01 12:00:07 +00:00
e n d i f
2022-12-21 14:23:04 +00:00
# Use 51DEGREES_SRC and possibly 51DEGREES_INC and 51DEGREES_LIB to force path
2022-12-21 17:54:36 +00:00
# to 51degrees v3/v4 headers and libraries if needed. Note that the SRC/INC/
# LIB/CFLAGS/LDFLAGS variables names all use 51DEGREES as the prefix,
# regardless of the version since they are mutually exclusive. The version
# (51DEGREES_VER) must be either 3 or 4, and defaults to 3 if not set.
2022-12-21 14:23:04 +00:00
51DEGREES_INC = $( 51DEGREES_SRC)
51DEGREES_LIB = $( 51DEGREES_SRC)
2022-12-21 17:54:36 +00:00
51DEGREES_VER = 3
2024-04-11 08:41:39 +00:00
ifneq ($(USE_51DEGREES : 0=), )
2022-12-21 17:54:36 +00:00
ifeq ( $( 51DEGREES_VER) ,4) # v4 here
_51DEGREES_SRC = $( shell find $( 51DEGREES_LIB) -maxdepth 2 -name '*.c' )
OPTIONS_OBJS += $( _51DEGREES_SRC:%.c= %.o)
51DEGREES_CFLAGS += -DUSE_51DEGREES_V4
2024-04-11 08:41:39 +00:00
ifeq ( $( USE_THREAD:0= ) ,)
2022-12-21 17:54:36 +00:00
51DEGREES_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING -DFIFTYONE_DEGREES_NO_THREADING
endif
2023-05-15 13:13:32 +00:00
USE_LIBATOMIC = implicit
2022-12-21 17:54:36 +00:00
endif # 51DEGREES_VER==4
ifeq ( $( 51DEGREES_VER) ,3) # v3 here
OPTIONS_OBJS += $( 51DEGREES_LIB) /../cityhash/city.o
OPTIONS_OBJS += $( 51DEGREES_LIB) /51Degrees.o
2024-04-11 08:41:39 +00:00
ifeq ( $( USE_THREAD:0= ) ,)
2022-12-21 17:54:36 +00:00
51DEGREES_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING
else
OPTIONS_OBJS += $( 51DEGREES_LIB) /../threading.o
endif
2022-12-21 14:23:04 +00:00
else
2022-12-21 17:54:36 +00:00
ifneq ( $( 51DEGREES_VER) ,4)
$( error 51Degrees version ( 51DEGREES_VER) must be either 3 or 4)
endif
endif # 51DEGREES_VER==3
OPTIONS_OBJS += addons/51degrees/51d.o
51DEGREES_CFLAGS += $( if $( 51DEGREES_INC) ,-I$( 51DEGREES_INC) )
51DEGREES_LDFLAGS += $( if $( 51DEGREES_LIB) ,-L$( 51DEGREES_LIB) )
USE_MATH = implicit
2022-12-21 14:23:04 +00:00
e n d i f # USE_51DEGREES
2015-05-12 14:06:21 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_WURFL : 0=), )
2022-12-21 14:49:56 +00:00
# Use WURFL_SRC and possibly WURFL_INC and WURFL_LIB to force path
# to WURFL headers and libraries if needed.
WURFL_INC = $( WURFL_SRC)
WURFL_LIB = $( WURFL_SRC)
OPTIONS_OBJS += addons/wurfl/wurfl.o
2022-12-21 17:58:46 +00:00
WURFL_CFLAGS = $( if $( WURFL_INC) ,-I$( WURFL_INC) )
2022-12-21 14:49:56 +00:00
ifneq ( $( WURFL_DEBUG) ,)
2022-12-21 17:58:46 +00:00
WURFL_CFLAGS += -DWURFL_DEBUG
2022-12-21 14:49:56 +00:00
endif
ifneq ( $( WURFL_HEADER_WITH_DETAILS) ,)
2022-12-21 17:58:46 +00:00
WURFL_CFLAGS += -DWURFL_HEADER_WITH_DETAILS
2022-12-21 14:49:56 +00:00
endif
2022-12-21 17:58:46 +00:00
WURFL_LDFLAGS = $( if $( WURFL_LIB) ,-L$( WURFL_LIB) ) -lwurfl
2019-04-19 14:03:32 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_SYSTEMD : 0=), )
2024-04-03 13:13:00 +00:00
OPTIONS_OBJS += src/systemd.o
2017-11-20 14:58:35 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_PCRE : 0=)$( USE_STATIC_PCRE :0=) $( USE_PCRE_JIT :0=) , )
ifneq ( $( USE_PCRE2:0= ) $( USE_STATIC_PCRE2:0= ) $( USE_PCRE2_JIT:0= ) ,)
2022-12-21 14:49:56 +00:00
$( error cannot compile both PCRE and PCRE2 support)
endif
# PCREDIR is used to automatically construct the PCRE_INC and PCRE_LIB paths,
# by appending /include and /lib respectively. If your system does not use the
# same sub-directories, simply force these variables instead of PCREDIR. It is
# automatically detected but can be forced if required (for cross-compiling).
# Forcing PCREDIR to an empty string will let the compiler use the default
# locations.
# in case only USE_STATIC_PCRE/USE_PCRE_JIT were set
2024-04-11 08:41:39 +00:00
USE_PCRE := $( if $( USE_PCRE:0= ) ,$( USE_PCRE:0= ) ,implicit)
2022-12-21 14:49:56 +00:00
PCRE_CONFIG := pcre-config
PCREDIR := $( shell $( PCRE_CONFIG) --prefix 2>/dev/null || echo /usr/local)
ifneq ( $( PCREDIR) ,)
PCRE_INC := $( PCREDIR) /include
PCRE_LIB := $( PCREDIR) /lib
endif
2022-12-21 16:24:38 +00:00
PCRE_CFLAGS := $( if $( PCRE_INC) ,-I$( PCRE_INC) )
2024-04-11 08:41:39 +00:00
ifeq ( $( USE_STATIC_PCRE:0= ) ,)
2022-12-21 16:24:38 +00:00
PCRE_LDFLAGS := $( if $( PCRE_LIB) ,-L$( PCRE_LIB) ) -lpcreposix -lpcre
2022-12-21 14:49:56 +00:00
else
2022-12-21 16:24:38 +00:00
PCRE_LDFLAGS := $( if $( PCRE_LIB) ,-L$( PCRE_LIB) ) -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
2022-12-21 14:49:56 +00:00
endif
e n d i f # USE_PCRE
2006-11-12 22:57:19 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_PCRE2 : 0=)$( USE_STATIC_PCRE 2:0=) $( USE_PCRE 2_JIT :0=) , )
2022-12-21 14:49:56 +00:00
# in case only USE_STATIC_PCRE2/USE_PCRE2_JIT were set
2024-04-11 08:41:39 +00:00
USE_PCRE2 := $( if $( USE_PCRE2:0= ) ,$( USE_PCRE2:0= ) ,implicit)
2022-12-21 14:49:56 +00:00
PCRE2_CONFIG := pcre2-config
PCRE2DIR := $( shell $( PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local)
ifneq ( $( PCRE2DIR) ,)
PCRE2_INC := $( PCRE2DIR) /include
PCRE2_LIB := $( PCRE2DIR) /lib
ifeq ( $( PCRE2_WIDTH) ,)
PCRE2_WIDTH = 8
endif
ifneq ( $( PCRE2_WIDTH) ,8)
ifneq ( $( PCRE2_WIDTH) ,16)
ifneq ( $( PCRE2_WIDTH) ,32)
$( error PCRE2_WIDTH needs to be set to either 8,16 or 32)
endif
endif
endif
2022-12-21 16:24:38 +00:00
PCRE2_CFLAGS := -DPCRE2_CODE_UNIT_WIDTH= $( PCRE2_WIDTH) $( if $( PCRE2_INC) , -I$( PCRE2_INC) )
2022-12-21 14:49:56 +00:00
PCRE2_LDFLAGS := $( shell $( PCRE2_CONFIG) --libs$( PCRE2_WIDTH) 2>/dev/null || echo -L/usr/local/lib -lpcre2-$( PCRE2_WIDTH) )
ifeq ( $( PCRE2_LDFLAGS) ,)
$( error libpcre2-$( PCRE2_WIDTH) not found)
else
ifeq ( $( PCRE2_WIDTH) ,8)
PCRE2_LDFLAGS += -lpcre2-posix
endif
endif
2024-04-11 08:41:39 +00:00
ifneq ( $( USE_STATIC_PCRE2:0= ) ,)
2022-12-21 14:49:56 +00:00
PCRE2_LDFLAGS := $( if $( PCRE2_LIB) ,-L$( PCRE2_LIB) ) -Wl,-Bstatic -L$( PCRE2_LIB) $( PCRE2_LDFLAGS) -Wl,-Bdynamic
else
PCRE2_LDFLAGS := $( if $( PCRE2_LIB) ,-L$( PCRE2_LIB) ) -L$( PCRE2_LIB) $( PCRE2_LDFLAGS)
endif
endif # PCRE2DIR
e n d i f # USE_PCRE2
2016-11-21 21:25:58 +00:00
2024-04-11 08:41:39 +00:00
ifneq ($(USE_NS : 0=), )
2022-12-21 14:49:56 +00:00
OPTIONS_OBJS += src/namespace.o
2022-12-22 16:58:24 +00:00
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_LINUX_CAP : 0=), )
2023-08-29 08:24:26 +00:00
OPTIONS_OBJS += src/linuxcap.o
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_OT : 0=), )
2022-12-21 14:49:56 +00:00
include addons/ot/Makefile
2022-12-22 16:58:24 +00:00
e n d i f
2022-12-14 17:46:48 +00:00
# better keep this one close to the end, as several libs above may need it
2024-04-11 08:41:39 +00:00
ifneq ($(USE_DL : 0=), )
2022-12-14 17:46:48 +00:00
DL_LDFLAGS = -ldl
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_MATH : 0=), )
2022-12-21 10:59:33 +00:00
MATH_LDFLAGS = -lm
e n d i f
2024-04-11 08:41:39 +00:00
ifneq ($(USE_LIBATOMIC : 0=), )
2022-12-21 09:46:07 +00:00
LIBATOMIC_LDFLAGS = -latomic
2022-12-22 16:58:24 +00:00
e n d i f
#### End of the USE_* options handling, any such option that would be added
#### below could be silently ignored.
2022-12-22 17:24:46 +00:00
# appends all foo_{C,LD}FLAGS to OPTIONS_{C,LD}FLAGS
$( collect_opts_flags )
2008-01-02 19:48:34 +00:00
#### Global compile options
2024-04-10 16:21:18 +00:00
VERBOSE_CFLAGS = $( OPT_CFLAGS) $( ARCH_FLAGS) $( CPU_CFLAGS) $( STD_CFLAGS) $( TARGET_CFLAGS) $( CFLAGS) $( DEFINE)
2020-05-27 09:05:33 +00:00
COPTS = -Iinclude
2018-10-22 04:22:46 +00:00
2024-04-10 16:21:18 +00:00
COPTS += $( OPT_CFLAGS) $( ARCH_FLAGS) $( CPU_CFLAGS) $( STD_CFLAGS) $( WARN_CFLAGS) $( NOWARN_CFLAGS) $( ERROR_CFLAGS) $( TARGET_CFLAGS) $( DEFINE) $( SILENT_DEFINE)
2024-04-10 09:29:49 +00:00
COPTS += $( DEBUG) $( OPTIONS_CFLAGS) $( CFLAGS) $( ADDINC)
2005-12-17 13:08:03 +00:00
2020-10-01 02:05:39 +00:00
i f n e q ( $( VERSION ) $( SUBVERS ) $( EXTRAVERSION ) , )
2022-12-21 14:49:56 +00:00
COPTS += -DCONFIG_HAPROXY_VERSION= \" $( VERSION) $( SUBVERS) $( EXTRAVERSION) \"
2008-01-02 19:48:34 +00:00
e n d i f
2007-01-07 01:03:04 +00:00
2008-01-02 19:48:34 +00:00
i f n e q ( $( VERDATE ) , )
2022-12-21 14:49:56 +00:00
COPTS += -DCONFIG_HAPROXY_DATE= \" $( VERDATE) \"
2007-01-07 01:03:04 +00:00
e n d i f
2012-05-25 21:53:16 +00:00
i f n e q ( $( TRACE ) , )
2022-12-21 14:49:56 +00:00
# if tracing is enabled, we want it to be as fast as possible
TRACE_COPTS := $( filter-out -O0 -O1 -O2 -pg -finstrument-functions,$( COPTS) ) -O3 -fomit-frame-pointer
COPTS += -finstrument-functions
2012-05-25 21:53:16 +00:00
e n d i f
2008-01-02 19:48:34 +00:00
#### Global link options
# These options are added at the end of the "ld" command line. Use LDFLAGS to
# add options at the beginning of the "ld" command line if needed.
LDOPTS = $( TARGET_LDFLAGS) $( OPTIONS_LDFLAGS) $( ADDLIB)
2005-12-17 11:29:56 +00:00
2008-03-11 05:37:39 +00:00
i f e q ( $( TARGET ) , )
all :
2021-01-05 17:10:41 +00:00
@echo "Building HAProxy without specifying a TARGET is not supported."
2008-03-11 05:37:39 +00:00
@echo
2021-01-05 17:10:41 +00:00
@echo "Usage:"
2008-03-11 05:37:39 +00:00
@echo
2021-01-05 17:10:41 +00:00
@echo " $ make help # To print a full explanation. "
@echo " $ make TARGET=xxx USE_<feature>=1 # To build HAProxy. "
2008-03-11 05:37:39 +00:00
@echo
2021-01-05 17:10:41 +00:00
@echo "The most commonly used targets are:"
2008-03-11 05:37:39 +00:00
@echo
2021-01-05 17:10:41 +00:00
@echo " linux-glibc - Modern Linux with glibc"
@echo " linux-musl - Modern Linux with musl"
@echo " freebsd - FreeBSD"
@echo " openbsd - OpenBSD"
@echo " netbsd - NetBSD"
@echo " osx - macOS"
@echo " solaris - Solaris"
2008-03-11 05:37:39 +00:00
@echo
2021-01-05 17:10:41 +00:00
@echo "Choose the target which matches your OS the most in order to"
@echo "gain the maximum performance out of it."
@echo
@echo "Common features you might want to include in your build are:"
@echo
@echo " USE_OPENSSL=1 - Support for TLS encrypted connections"
@echo " USE_ZLIB=1 - Support for HTTP response compression"
@echo " USE_PCRE=1 - Support for PCRE regular expressions"
@echo " USE_LUA=1 - Support for dynamic processing using Lua"
@echo
@echo "Use 'make help' to print a full explanation of supported targets"
2022-12-23 16:29:11 +00:00
@echo "and features, and 'make ... opts' to show the variables in use"
@echo "for a given set of build options, in a reusable form."
2008-03-11 05:37:39 +00:00
@echo
@exit 1
2019-06-16 15:53:39 +00:00
e l s e
i f n e q ( $( filter $ ( TARGET ) , linux linux 22 linux 24 linux 24e linux 26 linux 2628) , )
2019-06-14 14:44:49 +00:00
all :
@echo
@echo " Target ' $( TARGET) ' was removed from HAProxy 2.0 due to being irrelevant and "
@echo "often wrong. Please use 'linux-glibc' instead or define your custom target"
@echo "by checking available options using 'make help TARGET=<your-target>'."
@echo
@exit 1
2008-03-11 05:37:39 +00:00
e l s e
2021-04-02 11:59:17 +00:00
all : haproxy dev /flags /flags $( EXTRA )
2022-12-21 14:49:56 +00:00
e n d i f # obsolete targets
e n d i f # TARGET
2005-12-17 11:21:26 +00:00
2020-11-05 15:42:25 +00:00
OBJS =
2012-05-25 21:53:16 +00:00
2019-01-10 09:01:03 +00:00
i f n e q ( $( EXTRA_OBJS ) , )
2022-12-21 14:49:56 +00:00
OBJS += $( EXTRA_OBJS)
2019-01-10 09:01:03 +00:00
e n d i f
MEDIUM: add haproxy-systemd-wrapper
Currently, to reload haproxy configuration, you have to use "-sf".
There is a problem with this way of doing things. First of all, in the systemd world,
reload commands should be "oneshot" ones, which means they should not be the new main
process but rather a tool which makes a call to it and then exits. With the current approach,
the reload command is the new main command and moreover, it makes the previous one exit.
Systemd only tracks the main program, seeing it ending, it assumes it either finished or failed,
and kills everything remaining as a grabage collector. We then end up with no haproxy running
at all.
This patch adds wrapper around haproxy, no changes at all have been made into it,
so it's not intrusive and doesn't change anything for other hosts. What this wrapper does
is basically launching haproxy as a child, listen to the SIGUSR2 (not to conflict with
haproxy itself) signal, and spawing a new haproxy with "-sf" as a child to relay the
first one.
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2013-02-12 09:53:53 +00:00
2024-05-27 14:02:54 +00:00
OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/stream.o \
src/log.o src/server.o src/tcpcheck.o src/http_ana.o \
src/stick_table.o src/tools.o src/sample.o src/flt_spoe.o \
src/cfgparse.o src/peers.o src/cli.o src/resolvers.o \
src/connection.o src/backend.o src/cache.o src/http_htx.o \
src/proxy.o src/stconn.o src/check.o src/haproxy.o \
src/stats-html.o src/listener.o src/pattern.o src/debug.o \
src/cfgparse-listen.o src/http_client.o src/activity.o \
src/applet.o src/http_act.o src/http_fetch.o src/http_ext.o \
src/dns.o src/vars.o src/tcp_rules.o src/pool.o src/stats.o \
src/stats-proxy.o src/sink.o src/filters.o src/mux_pt.o \
src/event_hdl.o src/server_state.o src/h1_htx.o src/h1.o \
src/flt_http_comp.o src/task.o src/payload.o src/fcgi-app.o \
src/map.o src/trace.o src/tcp_sample.o src/tcp_act.o \
src/session.o src/htx.o src/cfgparse-global.o src/mjson.o \
src/h2.o src/ring.o src/fd.o src/sock.o src/mworker.o \
src/flt_trace.o src/thread.o src/proto_rhttp.o src/acl.o \
src/http.o src/flt_bwlim.o src/channel.o src/queue.o \
src/mqtt.o src/proto_tcp.o src/lb_chash.o src/http_rules.o \
src/errors.o src/extcheck.o src/dns_ring.o src/stats-json.o \
src/http_conv.o src/frontend.o src/proto_sockpair.o \
src/compression.o src/ncbuf.o src/stats-file.o src/raw_sock.o \
2024-09-30 13:23:43 +00:00
src/lb_fwrr.o src/action.o src/uri_normalizer.o src/buf.o \
2024-05-27 14:02:54 +00:00
src/proto_uxst.o src/ebmbtree.o src/xprt_handshake.o \
src/protocol.o src/proto_udp.o src/lb_fwlc.o src/sha1.o \
src/proto_uxdg.o src/mailers.o src/lb_fas.o src/cfgcond.o \
src/cfgdiag.o src/sock_unix.o src/sock_inet.o \
src/mworker-prog.o src/lb_map.o src/ev_select.o src/shctx.o \
src/hpack-dec.o src/fix.o src/clock.o src/cfgparse-tcp.o \
src/arg.o src/signal.o src/fcgi.o src/dynbuf.o src/regex.o \
src/lru.o src/lb_ss.o src/eb64tree.o src/chunk.o \
src/cfgparse-unix.o src/guid.o src/ebimtree.o src/eb32tree.o \
src/eb32sctree.o src/base64.o src/uri_auth.o src/time.o \
src/hpack-tbl.o src/ebsttree.o src/ebistree.o src/auth.o \
src/hpack-huff.o src/freq_ctr.o src/dict.o src/wdt.o \
src/pipe.o src/init.o src/http_acl.o src/hpack-enc.o \
2024-09-15 08:10:29 +00:00
src/cebu32_tree.o src/cebu64_tree.o src/cebua_tree.o \
src/cebub_tree.o src/cebuib_tree.o src/cebuis_tree.o \
src/cebul_tree.o src/cebus_tree.o \
2024-07-10 10:15:45 +00:00
src/ebtree.o src/dgram.o src/hash.o src/version.o \
2024-07-04 09:37:23 +00:00
src/limits.o src/mux_spop.o
2020-11-05 15:42:25 +00:00
i f n e q ( $( TRACE ) , )
2022-12-21 14:49:56 +00:00
OBJS += src/calltrace.o
2020-11-05 15:42:25 +00:00
e n d i f
2016-05-30 11:39:32 +00:00
# Used only for forced dependency checking. May be cleared during development.
2020-05-27 09:05:33 +00:00
INCLUDES = $( wildcard include/*/*.h)
2016-05-30 13:16:10 +00:00
DEP = $( INCLUDES) .build_opts
2018-12-13 13:02:25 +00:00
help :
MINOR: build: discard echoing in help target
When V=1 is used in conjuction with help, the output becomes pretty
difficult to read properly.
$ make TARGET=linux-glibc V=1 help
..
DEBUG_USE_ABORT: use abort() for program termination, see include/haproxy/bug.h for details
echo; \
if [ -n "" ]; then \
if [ -n "" ]; then \
echo "Current TARGET: "; \
else \
echo "Current TARGET: (custom target)"; \
fi; \
else \
echo "TARGET not set, you may pass 'TARGET=xxx' to set one among :";\
echo " linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, netbsd,"; \
echo " osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic,"; \
echo " custom"; \
fi
TARGET not set, you may pass 'TARGET=xxx' to set one among :
linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, netbsd,
osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic,
custom
echo;echo "Enabled features for TARGET '' (disable with 'USE_xxx=') :"
Enabled features for TARGET '' (disable with 'USE_xxx=') :
set -- POLL ; echo " $*" | (fmt || cat) 2>/dev/null
POLL
echo;echo "Disabled features for TARGET '' (enable with 'USE_xxx=1') :"
Disabled features for TARGET '' (enable with 'USE_xxx=1') :
set -- EPOLL KQUEUE NETFILTER PCRE PCRE_JIT PCRE2 PCRE2_JIT PRIVATE_CACHE THREAD PTHREAD_PSHARED BACKTRACE STATIC_PCRE STATIC_PCRE2 TPROXY LINUX_TPROXY LINUX_SPLICE LIBCRYPT CRYPT_H GETADDRINFO OPENSSL LUA FUTEX ACCEPT4 CLOSEFROM ZLIB SLZ CPU_AFFINITY TFO NS DL RT DEVICEATLAS 51DEGREES WURFL SYSTEMD OBSOLETE_LINKER PRCTL THREAD_DUMP EVPORTS OT QUIC; echo " $*" | (fmt || cat) 2>/dev/null
EPOLL KQUEUE NETFILTER PCRE PCRE_JIT PCRE2 PCRE2_JIT PRIVATE_CACHE
This commit ensure the help target always discard line echoing
regardless of V variable as done for reg-tests-help target.
2021-01-17 18:47:47 +00:00
@sed -ne " /^[^#]* $$ /q;s/^# \{0,1\}\(.*\)/\1/;p " Makefile
@echo; \
2019-06-14 13:52:01 +00:00
if [ -n " $( TARGET) " ] ; then \
2019-06-16 17:26:18 +00:00
if [ -n " $( set_target_defaults) " ] ; then \
echo " Current TARGET: $( TARGET) " ; \
else \
echo " Current TARGET: $( TARGET) (custom target) " ; \
fi ; \
2023-05-24 13:59:04 +00:00
echo; echo " Enabled features for TARGET ' $( TARGET) ' (disable with 'USE_xxx=') : " ; \
set -- $( enabled_opts) ; echo " $$ * " | ( fmt || cat) 2>/dev/null; \
echo; echo " Disabled features for TARGET ' $( TARGET) ' (enable with 'USE_xxx=1') : " ; \
set -- $( disabled_opts) ; echo " $$ * " | ( fmt || cat) 2>/dev/null; \
2019-06-14 13:52:01 +00:00
else \
2023-05-24 13:59:04 +00:00
echo "TARGET not set, you should pass 'TARGET=xxx' to set one among :" ; \
2020-10-08 05:15:06 +00:00
echo " linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, netbsd," ; \
echo " osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic," ; \
echo " custom" ; \
2019-06-14 13:52:01 +00:00
fi
2018-12-13 13:02:25 +00:00
2020-03-04 15:21:06 +00:00
# Used only to force a rebuild if some build options change, but we don't do
2023-05-24 14:18:39 +00:00
# it for certain build targets which take no build options nor when the
# TARGET variable is not set since we're not building, by definition.
IGNORE_OPTS = help install install-man install-doc install-bin \
uninstall clean tags cscope tar git-tar version update-version \
opts reg-tests reg-tests-help admin/halog/halog dev/flags/flags \
dev/haring/haring dev/poll/poll dev/tcploop/tcploop
i f n e q ( $( TARGET ) , )
i f e q ( $( filter $ ( firstword $ ( MAKECMDGOALS ) ) ,$ ( IGNORE_OPTS ) ) , )
2024-04-11 13:51:38 +00:00
build_opts = $( shell rm -f .build_opts.new; echo \' $( TARGET) $( BUILD_OPTIONS) $( VERBOSE_CFLAGS) $( WARN_CFLAGS) $( NOWARN_CFLAGS) $( DEBUG) \' > .build_opts.new; if cmp -s .build_opts .build_opts.new; then rm -f .build_opts.new; else mv -f .build_opts.new .build_opts; fi )
2019-03-29 16:17:52 +00:00
.build_opts : $( build_opts )
2020-03-04 15:21:06 +00:00
e l s e
.build_opts :
2023-05-24 14:18:39 +00:00
e n d i f # ignore_opts
2023-05-24 15:23:45 +00:00
e l s e
.build_opts :
2023-05-24 14:18:39 +00:00
e n d i f # non-empty target
2016-05-30 11:39:32 +00:00
2020-05-27 08:43:24 +00:00
haproxy : $( OPTIONS_OBJS ) $( OBJS )
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2005-12-17 11:21:26 +00:00
2006-06-26 00:48:02 +00:00
objsize : haproxy
2018-11-19 06:44:42 +00:00
$( Q) objdump -t $^| grep ' g ' | grep -F '.text' | awk '{print $$5 FS $$6}' | sort
2006-06-26 00:48:02 +00:00
2016-05-30 11:39:32 +00:00
%.o : %.c $( DEP )
2018-11-19 07:15:54 +00:00
$( cmd_CC) $( COPTS) -c -o $@ $<
2005-12-17 11:21:26 +00:00
2021-04-02 12:46:21 +00:00
admin/halog/halog : admin /halog /halog .o admin /halog /fgets 2.o src /ebtree .o src /eb 32tree .o src /eb 64tree .o src /ebmbtree .o src /ebsttree .o src /ebistree .o src /ebimtree .o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2020-10-22 03:12:57 +00:00
2021-08-11 11:54:52 +00:00
admin/dyncookie/dyncookie : admin /dyncookie /dyncookie .o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2021-08-11 11:54:52 +00:00
2021-04-02 11:31:46 +00:00
dev/flags/flags : dev /flags /flags .o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2020-10-22 03:12:57 +00:00
2022-08-12 09:23:59 +00:00
dev/haring/haring : dev /haring /haring .o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2022-08-12 09:23:59 +00:00
2021-04-02 12:27:26 +00:00
dev/hpack/% : dev /hpack /%.o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2021-04-02 12:27:26 +00:00
2021-04-02 11:31:46 +00:00
dev/poll/poll :
2022-11-17 07:34:37 +00:00
$( cmd_MAKE) -C dev/poll poll CC = '$(CC)' OPTIMIZE = '$(COPTS)' V = '$(V)'
2020-10-22 03:12:57 +00:00
2022-06-14 14:35:41 +00:00
dev/qpack/decode : dev /qpack /decode .o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2022-06-14 14:35:41 +00:00
2021-04-02 11:31:46 +00:00
dev/tcploop/tcploop :
2022-11-17 07:34:37 +00:00
$( cmd_MAKE) -C dev/tcploop tcploop CC = '$(CC)' OPTIMIZE = '$(COPTS)' V = '$(V)'
2020-10-22 03:12:57 +00:00
2022-09-08 18:47:28 +00:00
dev/udp/udp-perturb : dev /udp /udp -perturb .o
2024-04-10 16:16:44 +00:00
$( cmd_LD) $( ARCH_FLAGS) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2022-09-08 18:47:28 +00:00
2019-01-04 17:20:32 +00:00
# rebuild it every time
2022-11-17 07:06:16 +00:00
.PHONY : src /version .c dev /poll /poll dev /tcploop /tcploop
2019-01-04 17:20:32 +00:00
2019-08-08 14:53:40 +00:00
src/calltrace.o : src /calltrace .c $( DEP )
2018-11-19 07:15:54 +00:00
$( cmd_CC) $( TRACE_COPTS) -c -o $@ $<
2012-05-25 21:53:16 +00:00
2016-05-30 11:39:32 +00:00
src/haproxy.o : src /haproxy .c $( DEP )
2018-11-19 07:15:54 +00:00
$( cmd_CC) $( COPTS) \
2008-01-02 19:48:34 +00:00
-DBUILD_TARGET= '"$(strip $(TARGET))"' \
-DBUILD_CC= '"$(strip $(CC))"' \
-DBUILD_CFLAGS= '"$(strip $(VERBOSE_CFLAGS))"' \
-DBUILD_OPTIONS= '"$(strip $(BUILD_OPTIONS))"' \
2020-11-21 17:07:59 +00:00
-DBUILD_DEBUG= '"$(strip $(DEBUG))"' \
2022-12-22 18:32:24 +00:00
-DBUILD_FEATURES= '"$(strip $(build_features))"' \
2008-01-02 19:48:34 +00:00
-c -o $@ $<
2007-12-02 10:28:59 +00:00
2008-03-12 13:57:54 +00:00
install-man :
2022-07-16 09:18:50 +00:00
$( Q) $( INSTALL) -d " $( DESTDIR) $( MANDIR) " /man1
$( Q) $( INSTALL) -m 644 doc/haproxy.1 " $( DESTDIR) $( MANDIR) " /man1
2008-03-12 13:57:54 +00:00
2015-10-13 20:20:55 +00:00
EXCLUDE_DOCUMENTATION = lgpl gpl coding-style
DOCUMENTATION = $( filter-out $( EXCLUDE_DOCUMENTATION) ,$( patsubst doc/%.txt,%,$( wildcard doc/*.txt) ) )
2008-03-12 15:24:49 +00:00
install-doc :
2022-07-16 09:18:50 +00:00
$( Q) $( INSTALL) -d " $( DESTDIR) $( DOCDIR) "
2018-11-19 06:51:04 +00:00
$( Q) for x in $( DOCUMENTATION) ; do \
2022-07-16 09:18:50 +00:00
$( INSTALL) -m 644 doc/$$ x.txt " $( DESTDIR) $( DOCDIR) " ; \
2008-03-12 15:24:49 +00:00
done
2016-06-24 16:30:22 +00:00
install-bin :
2018-11-19 06:44:42 +00:00
$( Q) for i in haproxy $( EXTRA) ; do \
2016-06-24 16:30:22 +00:00
if ! [ -e " $$ i " ] ; then \
echo "Please run 'make' before 'make install'." ; \
exit 1; \
fi ; \
done
2022-07-16 09:18:50 +00:00
$( Q) $( INSTALL) -d " $( DESTDIR) $( SBINDIR) "
$( Q) $( INSTALL) haproxy $( EXTRA) " $( DESTDIR) $( SBINDIR) "
2008-03-12 13:25:35 +00:00
2008-03-12 16:28:13 +00:00
install : install -bin install -man install -doc
2008-03-12 14:21:05 +00:00
2015-02-04 11:14:26 +00:00
uninstall :
2018-11-19 06:51:04 +00:00
$( Q) rm -f " $( DESTDIR) $( MANDIR) " /man1/haproxy.1
$( Q) for x in $( DOCUMENTATION) ; do \
2015-02-04 11:14:26 +00:00
rm -f " $( DESTDIR) $( DOCDIR) " /$$ x.txt ; \
done
2018-11-19 06:51:04 +00:00
$( Q) -rmdir " $( DESTDIR) $( DOCDIR) "
$( Q) rm -f " $( DESTDIR) $( SBINDIR) " /haproxy
2015-02-04 11:14:26 +00:00
2005-12-17 11:21:26 +00:00
clean :
2020-05-27 08:43:24 +00:00
$( Q) rm -f *.[ oas] src/*.[ oas] haproxy test .build_opts .build_opts.new
2021-04-02 13:35:19 +00:00
$( Q) for dir in . src dev/* admin/* addons/* include/* doc; do rm -f $$ dir/*~ $$ dir/*.rej $$ dir/core; done
2020-10-01 02:05:39 +00:00
$( Q) rm -f haproxy-$( VERSION) .tar.gz haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) .tar.gz
$( Q) rm -f haproxy-$( VERSION) haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) nohup.out gmon.out
2021-04-02 13:35:19 +00:00
$( Q) rm -f addons/promex/*.[ oas]
2021-04-02 14:12:32 +00:00
$( Q) rm -f addons/51degrees/*.[ oas] addons/51degrees/dummy/*.[ oas] addons/51degrees/dummy/*/*.[ oas]
2022-01-27 18:13:54 +00:00
$( Q) rm -f addons/deviceatlas/*.[ oas] addons/deviceatlas/dummy/*.[ oas] addons/deviceatlas/dummy/*.o
2022-12-08 08:27:36 +00:00
$( Q) rm -f addons/deviceatlas/dummy/Os/*.o
2021-04-02 15:16:46 +00:00
$( Q) rm -f addons/ot/src/*.[ oas]
2021-04-02 14:39:44 +00:00
$( Q) rm -f addons/wurfl/*.[ oas] addons/wurfl/dummy/*.[ oas]
2021-04-21 15:17:16 +00:00
$( Q) rm -f admin/*/*.[ oas] admin/*/*/*.[ oas]
2021-04-02 12:45:06 +00:00
$( Q) rm -f admin/iprange/iprange admin/iprange/ip6range admin/halog/halog
2021-08-11 11:54:52 +00:00
$( Q) rm -f admin/dyncookie/dyncookie
2021-04-21 15:17:16 +00:00
$( Q) rm -f dev/*/*.[ oas]
2022-08-12 09:23:59 +00:00
$( Q) rm -f dev/flags/flags dev/haring/haring dev/poll/poll dev/tcploop/tcploop
2021-04-02 12:27:26 +00:00
$( Q) rm -f dev/hpack/decode dev/hpack/gen-enc dev/hpack/gen-rht
2022-06-14 14:35:41 +00:00
$( Q) rm -f dev/qpack/decode
2005-12-17 11:51:03 +00:00
2009-10-10 20:20:44 +00:00
tags :
2018-11-19 07:14:40 +00:00
$( Q) find src include \( -name '*.c' -o -name '*.h' \) -print0 | \
2009-10-10 20:20:44 +00:00
xargs -0 etags --declarations --members
2013-10-18 14:26:39 +00:00
cscope :
2018-11-19 07:14:40 +00:00
$( Q) find src include -name "*.[ch]" -print | cscope -q -b -i -
2013-10-18 14:26:39 +00:00
2006-03-19 20:30:14 +00:00
tar : clean
2020-10-01 02:05:39 +00:00
$( Q) ln -s . haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION)
$( Q) tar --exclude= haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) /.git \
--exclude= haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) /haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) \
--exclude= haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) /haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) .tar.gz \
-cf - haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) /* | gzip -c9 >haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) .tar.gz
$( Q) echo haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) .tar.gz
$( Q) rm -f haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION)
2006-03-19 20:16:26 +00:00
2012-12-20 14:00:44 +00:00
git-tar :
2020-10-01 02:05:39 +00:00
$( Q) git archive --format= tar --prefix= " haproxy- $( VERSION) $( SUBVERS) $( EXTRAVERSION) / " HEAD | gzip -9 > haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) .tar.gz
$( Q) echo haproxy-$( VERSION) $( SUBVERS) $( EXTRAVERSION) .tar.gz
2007-09-09 21:31:11 +00:00
version :
@echo " VERSION: $( VERSION) "
@echo " SUBVERS: $( SUBVERS) "
@echo " VERDATE: $( VERDATE) "
# never use this one if you don't know what it is used for.
update-version :
@echo "Ready to update the following versions :"
@echo " VERSION: $( VERSION) "
@echo " SUBVERS: $( SUBVERS) "
@echo " VERDATE: $( VERDATE) "
@echo "Press [ENTER] to continue or Ctrl-C to abort now." ; read
echo " $( VERSION) " > VERSION
echo " $( SUBVERS) " > SUBVERS
echo " $( VERDATE) " > VERDATE
2018-06-18 17:32:10 +00:00
2022-12-23 16:29:11 +00:00
# just display the build options. The "USE_*" options and their respective
# settings are also listed if they're explicitly set on the command line, or if
# they are not empty. Implicit "USE_*" are not listed.
2018-10-03 07:40:22 +00:00
opts :
2024-04-11 15:20:42 +00:00
@echo 'Using the following variables (copy-pastable as make arguments):'
@echo ' TARGET="$(strip $(TARGET))" ' \\
@echo ' ARCH="$(strip $(ARCH))" ' \\
@echo ' CC="$(strip $(CC))" ' \\
@echo ' OPT_CFLAGS="$(strip $(OPT_CFLAGS))" ' \\
@echo ' ARCH_FLAGS="$(strip $(ARCH_FLAGS))" ' \\
@echo ' CPU_CFLAGS="$(strip $(CPU_CFLAGS))" ' \\
@echo ' STD_CFLAGS="$(strip $(STD_CFLAGS))" ' \\
@echo ' WARN_CFLAGS="$(strip $(WARN_CFLAGS))" ' \\
@echo ' NOWARN_CFLAGS="$(strip $(NOWARN_CFLAGS))" ' \\
@echo ' ERROR_CFLAGS="$(strip $(ERROR_CFLAGS))" ' \\
@echo ' CFLAGS="$(strip $(CFLAGS))" ' \\
2022-12-23 16:29:11 +00:00
@$( foreach opt,$( enabled_opts) ,\
$( if $( subst command line,,$( origin USE_$( opt) ) ) ,,\
2024-04-11 15:20:42 +00:00
echo ' USE_$(opt)=$(USE_$(opt:0=)) ' \\ ; ) \
2022-12-23 16:29:11 +00:00
$( if $( subst command line,,$( origin $( opt) _CFLAGS) ) ,\
2024-04-11 15:20:42 +00:00
$( if $( $( opt) _CFLAGS) ,echo ' $(opt)_CFLAGS="$($(opt)_CFLAGS)" ' \\ ; ) ,\
echo ' $(opt)_CFLAGS="$($(opt)_CFLAGS)" ' \\ ; ) \
2022-12-23 16:29:11 +00:00
$( if $( subst command line,,$( origin $( opt) _LDFLAGS) ) ,\
2024-04-11 15:20:42 +00:00
$( if $( $( opt) _LDFLAGS) ,echo ' $(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ' \\ ; ) ,\
echo ' $(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ' \\ ; ) )
@echo ' LDFLAGS="$(strip $(LDFLAGS))"'
2022-12-23 16:29:11 +00:00
@echo
2018-10-03 07:40:22 +00:00
@echo 'COPTS="$(strip $(COPTS))"'
@echo 'LDOPTS="$(strip $(LDOPTS))"'
@echo 'OPTIONS_OBJS="$(strip $(OPTIONS_OBJS))"'
@echo 'OBJS="$(strip $(OBJS))"'
2018-12-19 15:27:47 +00:00
i f e q ( r e g - t e s t s , $( firstword $ ( MAKECMDGOALS ) ) )
REGTEST_ARGS := $( wordlist 2, $( words $( MAKECMDGOALS) ) , $( MAKECMDGOALS) )
$( eval $( REGTEST_ARGS) :; @true)
e n d i f
2018-08-22 08:41:33 +00:00
# Target to run the regression testing script files.
2018-06-18 17:32:10 +00:00
reg-tests :
2019-03-29 14:07:24 +00:00
$( Q) $( REG_TEST_SCRIPT) --type " $( REGTESTS_TYPES) " $( REGTEST_ARGS) $( REG_TEST_FILES)
2018-12-19 15:27:47 +00:00
.PHONY : $( REGTEST_ARGS )
2018-12-13 21:15:05 +00:00
reg-tests-help :
@echo
2019-03-29 14:07:24 +00:00
@echo "To launch the reg tests for haproxy, first export to your environment "
@echo "VTEST_PROGRAM variable to point to your vtest program:"
2019-01-11 09:10:21 +00:00
@echo " $$ export VTEST_PROGRAM=/opt/local/bin/vtest "
2018-12-13 21:15:05 +00:00
@echo "or"
2019-01-11 09:10:21 +00:00
@echo " $$ setenv VTEST_PROGRAM /opt/local/bin/vtest "
2018-12-13 21:15:05 +00:00
@echo
2019-03-29 14:07:24 +00:00
@echo "The same thing may be done to set your haproxy program with HAPROXY_PROGRAM "
@echo "but with ./haproxy as default value."
2018-12-13 21:15:05 +00:00
@echo
@echo "To run all the tests:"
@echo " $$ make reg-tests "
@echo
@echo "You can also set the programs to be used on the command line:"
2019-01-11 09:10:21 +00:00
@echo " $$ VTEST_PROGRAM=<...> HAPROXY_PROGRAM=<...> make reg-tests "
2018-12-13 21:15:05 +00:00
@echo
2019-03-29 14:07:24 +00:00
@echo "To run tests with specific types:"
@echo " $$ REGTESTS_TYPES=slow,default make reg-tests "
2018-12-13 21:15:05 +00:00
@echo
2021-02-05 10:27:54 +00:00
@echo "with 'default,bug,devel,slow' as default value for REGTESTS_TYPES variable."
2019-03-29 14:07:24 +00:00
@echo
@echo "About the reg test types:"
@echo " any : all the tests without distinction (this is the default"
@echo " value of REGTESTS_TYPES."
@echo " default : dedicated to pure haproxy compliance tests."
@echo " slow : scripts which take non negligible time to run."
@echo " bug : scripts in relation with bugs they help to reproduce."
@echo " broken : scripts triggering known broken behaviors for which"
@echo " there is still no fix."
@echo " experimental: for scripts which are experimental, typically used to"
@echo " develop new scripts."
@echo
@echo "Note that 'reg-tests' target run '" $( REG_TEST_SCRIPT) "' script"
@echo "(see --help option of this script for more information)."
2018-12-13 21:15:05 +00:00
.PHONY : reg -tests reg -tests -help
2023-08-09 14:52:28 +00:00
# "make range" iteratively builds using "make all" and the exact same build
# options for all commits within RANGE. RANGE may be either a git range
# such as ref1..ref2 or a single commit, in which case all commits from
# the master branch to this one will be tested.
range :
$( Q) [ -d .git/. ] || { echo " ## Fatal: \"make $@ \" may only be used inside a Git repository. " ; exit 1; }
$( Q) if git diff-index --name-only HEAD 2>/dev/null | grep -q ^; then \
echo " Fatal: \"make $@ \" requires a clean working tree. " ; exit 1; fi
$( Q) [ -n " $( RANGE) " ] || { echo " ## Fatal: \"make $@ \" requires a git commit range in RANGE. " ; exit 1; }
$( Q) [ -n " $( TARGET) " ] || { echo " ## Fatal: \"make $@ \" needs the same variables as \"all\" (TARGET etc). " ; exit 1; }
$( Q) ( die( ) { echo; echo " ## Stopped in error at index [ $$ index/ $$ count ] commit $$ commit " ; \
echo " Previous branch was $$ BRANCH " ; exit $$ 1; } ; \
BRANCH = $$ ( git branch --show-current HEAD 2>/dev/null) ; \
[ -n " $$ BRANCH " ] || { echo " Fatal: \"make $@ \" may only be used inside a checked out branch. " ; exit 1; } ; \
[ -z " $$ {RANGE##*..*} " ] || RANGE = " master.. $$ {RANGE} " ; \
2023-08-16 16:16:16 +00:00
COMMITS = $$ ( git rev-list --abbrev-commit --reverse " $$ {RANGE} " ) ; \
index = 1; count = $$ ( echo $$ COMMITS | wc -w) ; \
2023-08-09 14:52:28 +00:00
[ " $$ {count} " -gt 0 ] || { echo " ## Fatal: no commit(s) found in range $$ {RANGE}. " ; exit 1; } ; \
echo " Found $$ {count} commit(s) in range $$ {RANGE}. " ; \
echo " Current branch is $$ BRANCH " ; \
echo "Starting to building now..." ; \
2023-08-16 16:16:16 +00:00
for commit in $$ COMMITS; do \
2023-08-09 14:52:28 +00:00
echo " [ $$ index/ $$ count ] $$ commit ############################# " ; \
git checkout -q $$ commit || die 1; \
$( MAKE) all || die 1; \
2023-08-16 16:16:16 +00:00
index = $$ ( ( index + 1) ) ; \
2023-08-09 14:52:28 +00:00
done ; \
echo; echo " Done! $$ {count} commit(s) built successfully for RANGE $$ {RANGE} " ; \
git checkout -q " $$ BRANCH " ; \
)