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 :
|
2019-06-14 13:52:01 +00:00
|
|
|
# [g]make TARGET=os [ARCH=arch] [CPU=cpu] USE_xxx=1 ...
|
|
|
|
#
|
|
|
|
# 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 :
|
2008-01-02 19:48:34 +00:00
|
|
|
# USE_EPOLL : enable epoll() on Linux 2.6. Automatic.
|
|
|
|
# USE_KQUEUE : enable kqueue() on BSD. Automatic.
|
2019-04-08 16:53:32 +00:00
|
|
|
# USE_EVPORTS : enable event ports on SunOS systems. Automatic.
|
2008-01-02 19:48:34 +00:00
|
|
|
# USE_MY_EPOLL : redefine epoll_* syscalls. Automatic.
|
2011-08-22 15:12:02 +00:00
|
|
|
# USE_MY_SPLICE : redefine the splice syscall if build fails without.
|
2008-01-02 19:48:34 +00:00
|
|
|
# USE_NETFILTER : enable netfilter on Linux. Automatic.
|
|
|
|
# USE_PCRE : enable use of libpcre for regex. Recommended.
|
2013-04-04 21:05:32 +00:00
|
|
|
# USE_PCRE_JIT : enable JIT for faster regex on libpcre >= 8.32
|
2016-11-21 21:25:58 +00:00
|
|
|
# USE_PCRE2 : enable use of libpcre2 for regex.
|
|
|
|
# USE_PCRE2_JIT : enable JIT for faster regex on libpcre2
|
2008-01-02 19:48:34 +00:00
|
|
|
# USE_POLL : enable poll(). Automatic.
|
2012-09-25 09:11:16 +00:00
|
|
|
# USE_PRIVATE_CACHE : disable shared memory cache of ssl sessions.
|
2017-10-25 15:55:27 +00:00
|
|
|
# USE_THREAD : enable threads support.
|
2014-05-07 21:11:42 +00:00
|
|
|
# USE_PTHREAD_PSHARED : enable pthread process shared mutex on sslcache.
|
2008-01-02 19:48:34 +00:00
|
|
|
# USE_REGPARM : enable regparm optimization. Recommended on x86.
|
|
|
|
# USE_STATIC_PCRE : enable static libpcre. Recommended.
|
2016-11-21 21:25:58 +00:00
|
|
|
# USE_STATIC_PCRE2 : enable static libpcre2.
|
2008-01-02 19:48:34 +00:00
|
|
|
# USE_TPROXY : enable transparent proxy. Automatic.
|
2012-06-03 22:42:09 +00:00
|
|
|
# USE_LINUX_TPROXY : enable full transparent proxy. Automatic.
|
|
|
|
# USE_LINUX_SPLICE : enable kernel 2.6 splicing. Automatic.
|
[BUILD] fix platform-dependant build issues related to crypt()
Holger Just and Ross West reported build issues on FreeBSD and
Solaris that were initially caused by the definition of
_XOPEN_SOURCE at the top of auth.c, which was required on Linux
to avoid a build warning.
Krzysztof Oledzki found that using _GNU_SOURCE instead also worked
on Linux and did not cause any issue on several versions of FreeBSD.
Solaris still reported a warning this time, which was fixed by
including <crypt.h>, which itself is not present on FreeBSD nor on
all Linux toolchains.
So by adding a new build option (NEED_CRYPT_H), we can get Solaris
to get crypt() working and stop complaining at the same time, without
impacting other platforms.
This fix was tested at least on several linux toolchains (at least
uclibc, glibc 2.2.5, 2.3.6 and 2.7), on FreeBSD 4 to 8, Solaris 8
(which needs crypt.h), and AIX 5.3 (without crypt.h).
Every time it builds without a warning.
2010-03-04 18:10:14 +00:00
|
|
|
# USE_LIBCRYPT : enable crypted passwords using -lcrypt
|
|
|
|
# USE_CRYPT_H : set it if your system requires including crypt.h
|
2010-11-14 16:09:33 +00:00
|
|
|
# USE_VSYSCALL : enable vsyscall on Linux x86, bypassing libc
|
2011-03-23 19:00:53 +00:00
|
|
|
# USE_GETADDRINFO : use getaddrinfo() to resolve IPv6 host names.
|
2012-05-18 13:48:30 +00:00
|
|
|
# USE_OPENSSL : enable use of OpenSSL. Recommended, but see below.
|
2015-01-23 13:06:13 +00:00
|
|
|
# USE_LUA : enable Lua support.
|
2012-09-03 09:14:36 +00:00
|
|
|
# USE_FUTEX : enable use of futex on kernel 2.6. Automatic.
|
2012-10-08 18:11:03 +00:00
|
|
|
# USE_ACCEPT4 : enable use of accept4() on linux. Automatic.
|
|
|
|
# USE_MY_ACCEPT4 : use own implemention of accept4() if glibc < 2.10.
|
2019-04-15 17:38:50 +00:00
|
|
|
# USE_PRCTL : enable use of prctl(). Automatic.
|
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
|
|
|
# USE_ZLIB : enable zlib library support.
|
MAJOR: compression: integrate support for libslz
This library is designed to emit a zlib-compatible stream with no
memory usage and to favor resource savings over compression ratio.
While zlib requires 256 kB of RAM per compression context (and can only
support 4000 connections per GB of RAM), the stateless compression
offered by libslz does not need to retain buffers between subsequent
calls. In theory this slightly reduces the compression ratio but in
practice it does not have that much of an effect since the zlib
window is limited to 32kB.
Libslz is available at :
http://git.1wt.eu/web?p=libslz.git
It was designed for web compression and provides a lot of savings
over zlib in haproxy. Here are the preliminary results on a single
core of a core2-quad 3.0 GHz in 32-bit for only 300 concurrent
sessions visiting the home page of www.haproxy.org (76 kB) with
the default 16kB buffers :
BW In BW Out BW Saved Ratio memory VSZ/RSS
zlib 237 Mbps 92 Mbps 145 Mbps 2.58 84M / 69M
slz 733 Mbps 380 Mbps 353 Mbps 1.93 5.9M / 4.2M
So while the compression ratio is lower, the bandwidth savings are
much more important due to the significantly lower compression cost
which allows to consume even more data from the servers. In the
example above, zlib became the bottleneck at 24% of the output
bandwidth. Also the difference in memory usage is obvious.
More tests run on a single core of a core i5-3320M, with 500 concurrent
users and the default 16kB buffers :
At 100% CPU (no limit) :
BW In BW Out BW Saved Ratio memory VSZ/RSS hits/s
zlib 480 Mbps 188 Mbps 292 Mbps 2.55 130M / 101M 744
slz 1700 Mbps 810 Mbps 890 Mbps 2.10 23.7M / 9.7M 2382
At 85% CPU (limited) :
BW In BW Out BW Saved Ratio memory VSZ/RSS hits/s
zlib 1240 Mbps 976 Mbps 264 Mbps 1.27 130M / 100M 1738
slz 1600 Mbps 976 Mbps 624 Mbps 1.64 23.7M / 9.7M 2210
The most important benefit really happens when the CPU usage is
limited by "maxcompcpuusage" or the BW limited by "maxcomprate" :
in order to preserve resources, haproxy throttles the compression
ratio until usage is within limits. Since slz is much cheaper, the
average compression ratio is much higher and the input bandwidth
is quite higher for one Gbps output.
Other tests made with some reference files :
BW In BW Out BW Saved Ratio hits/s
daniels.html zlib 1320 Mbps 163 Mbps 1157 Mbps 8.10 1925
slz 3600 Mbps 580 Mbps 3020 Mbps 6.20 5300
tv.com/listing zlib 980 Mbps 124 Mbps 856 Mbps 7.90 310
slz 3300 Mbps 553 Mbps 2747 Mbps 5.97 1100
jquery.min.js zlib 430 Mbps 180 Mbps 250 Mbps 2.39 547
slz 1470 Mbps 764 Mbps 706 Mbps 1.92 1815
bootstrap.min.css zlib 790 Mbps 165 Mbps 625 Mbps 4.79 777
slz 2450 Mbps 650 Mbps 1800 Mbps 3.77 2400
So on top of saving a lot of memory, slz is constantly 2.5-3.5 times
faster than zlib and results in providing more savings for a fixed CPU
usage. For links smaller than 100 Mbps, zlib still provides a better
compression ratio, at the expense of a much higher CPU usage.
Larger input files provide slightly higher bandwidth for both libs, at
the expense of a bit more memory usage for zlib (it converges to 256kB
per connection).
2015-03-29 01:32:06 +00:00
|
|
|
# USE_SLZ : enable slz library instead of zlib (pick at most one).
|
2012-11-16 15:12:27 +00:00
|
|
|
# USE_CPU_AFFINITY : enable pinning processes to CPU on Linux. Automatic.
|
2013-04-02 14:43:24 +00:00
|
|
|
# USE_TFO : enable TCP fast open. Supported on Linux >= 3.7.
|
2014-11-17 14:11:45 +00:00
|
|
|
# USE_NS : enable network namespace support. Supported on Linux >= 2.6.24.
|
2015-03-17 13:33:22 +00:00
|
|
|
# USE_DL : enable it if your system requires -ldl. Automatic on Linux.
|
2018-10-18 14:28:54 +00:00
|
|
|
# USE_RT : enable it if your system requires -lrt. Automatic on Linux.
|
2015-06-01 12:00:07 +00:00
|
|
|
# USE_DEVICEATLAS : enable DeviceAtlas api.
|
2015-06-29 14:43:25 +00:00
|
|
|
# USE_51DEGREES : enable third party device detection library from 51Degrees
|
2019-04-19 14:03:32 +00:00
|
|
|
# USE_WURFL : enable WURFL detection library from Scientiamobile
|
2017-11-20 14:58:35 +00:00
|
|
|
# USE_SYSTEMD : enable sd_notify() support.
|
2019-03-29 20:30:17 +00:00
|
|
|
# USE_OBSOLETE_LINKER : use when the linker fails to emit __start_init/__stop_init
|
2019-05-17 08:08:49 +00:00
|
|
|
# USE_THREAD_DUMP : use the more advanced thread state dump system. Automatic.
|
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
|
|
|
|
# given TARGET is enumerated at the end of "make help".
|
2008-01-02 19:48:34 +00:00
|
|
|
#
|
|
|
|
# Variables useful for packagers :
|
|
|
|
# CC is set to "gcc" by default and is used for compilation only.
|
|
|
|
# LD is set to "gcc" by default and is used for linking only.
|
2009-04-11 17:45:50 +00:00
|
|
|
# ARCH may be useful to force build of 32-bit binary on 64-bit systems
|
2008-01-02 19:48:34 +00:00
|
|
|
# CFLAGS is automatically set for the specified CPU and may be overridden.
|
|
|
|
# LDFLAGS is automatically set to -g and may be overridden.
|
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
|
|
|
# SMALL_OPTS may be used to specify some options to shrink memory usage.
|
|
|
|
# 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
|
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.
|
|
|
|
# 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.
|
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
|
2015-03-06 12:48:32 +00:00
|
|
|
# priority : lua5.3, lua53, lua).
|
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, ...).
|
|
|
|
# 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.
|
2008-01-02 19:48:34 +00:00
|
|
|
|
2018-11-19 06:44:42 +00:00
|
|
|
# verbosity: pass V=1 for verbose shell invocation
|
|
|
|
V = 0
|
|
|
|
Q = @
|
|
|
|
ifeq ($V,1)
|
|
|
|
Q=
|
|
|
|
endif
|
|
|
|
|
2017-09-13 14:54:28 +00:00
|
|
|
# Function used to detect support of a given option by the compiler.
|
|
|
|
# Usage: CFLAGS += $(call cc-opt,option). Eg: $(call cc-opt,-fwrapv)
|
|
|
|
# Note: ensure the referencing variable is assigned using ":=" and not "=" to
|
|
|
|
# call it only once.
|
2018-10-03 07:52:51 +00:00
|
|
|
cc-opt = $(shell set -e; if $(CC) $(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "$(1)"; fi;)
|
2017-09-13 14:54:28 +00:00
|
|
|
|
2018-10-16 16:11:34 +00:00
|
|
|
# same but emits $2 if $1 is not supported
|
|
|
|
cc-opt-alt = $(shell set -e; if $(CC) $(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "$(1)"; else echo "$(2)"; fi;)
|
|
|
|
|
2017-09-14 17:05:45 +00:00
|
|
|
# Disable a warning when supported by the compiler. Don't put spaces around the
|
|
|
|
# warning! And don't use cc-opt which doesn't always report an error until
|
|
|
|
# another one is also returned.
|
|
|
|
# Usage: CFLAGS += $(call cc-nowarn,warning). Eg: $(call cc-opt,format-truncation)
|
2018-10-03 07:52:51 +00:00
|
|
|
cc-nowarn = $(shell set -e; if $(CC) -W$(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "-Wno-$(1)"; fi;)
|
2017-09-14 17:05:45 +00:00
|
|
|
|
2008-03-12 13:25:35 +00:00
|
|
|
#### Installation options.
|
|
|
|
DESTDIR =
|
|
|
|
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
|
|
|
|
# Use TARGET=<target_name> to optimize for a specifc target OS among the
|
|
|
|
# following list (use the default "generic" if uncertain) :
|
2019-06-14 14:32:09 +00:00
|
|
|
# linux-glibc, solaris, freebsd, openbsd, netbsd, cygwin,
|
|
|
|
# haiku, aix51, aix52, osx, generic, custom
|
2008-03-11 05:37:39 +00:00
|
|
|
TARGET =
|
2008-01-02 19:48:34 +00:00
|
|
|
|
|
|
|
#### TARGET CPU
|
|
|
|
# Use CPU=<cpu_name> to optimize for a particular CPU, among the following
|
|
|
|
# list :
|
2010-11-28 06:41:00 +00:00
|
|
|
# generic, native, i586, i686, ultrasparc, custom
|
2005-12-17 13:08:03 +00:00
|
|
|
CPU = generic
|
2005-12-17 11:21:26 +00:00
|
|
|
|
2009-04-11 17:45:50 +00:00
|
|
|
#### Architecture, used when not building for native architecture
|
|
|
|
# Use ARCH=<arch_name> to force build for a specific architecture. Known
|
|
|
|
# architectures will lead to "-m32" or "-m64" being added to CFLAGS and
|
|
|
|
# LDFLAGS. This can be required to build 32-bit binaries on 64-bit targets.
|
2010-11-28 06:41:00 +00:00
|
|
|
# Currently, only 32, 64, x86_64, i386, i486, i586 and i686 are understood.
|
2009-04-11 17:45:50 +00:00
|
|
|
ARCH =
|
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
#### Toolchain options.
|
|
|
|
# GCC is normally used both for compiling and linking.
|
2005-12-17 13:08:03 +00:00
|
|
|
CC = gcc
|
2008-03-17 17:23:12 +00:00
|
|
|
LD = $(CC)
|
2005-12-17 13:08:03 +00:00
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
#### Debug flags (typically "-g").
|
|
|
|
# Those flags only feed CFLAGS so it is not mandatory to use this form.
|
|
|
|
DEBUG_CFLAGS = -g
|
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
|
|
|
|
2010-11-28 07:28:15 +00:00
|
|
|
#### Compiler-specific flags that may be used to disable some negative over-
|
|
|
|
# optimization or to silence some warnings. -fno-strict-aliasing is needed with
|
|
|
|
# gcc >= 4.4.
|
BUG/MAJOR: Use -fwrapv.
Haproxy relies on signed integer wraparound on overflow, however this is
really an undefined behavior, so the C compiler is allowed to do whatever
it wants, and clang does exactly that, and that causes problems when the
timer goes from <= INT_MAX to > INT_MAX, and explains the various hangs
reported on FreeBSD every 49.7 days. To make sure we get the intended
behavior, use -fwrapv for now. A proper fix is to switch everything to
unsigned, and it will happen later, but this is simpler, and more likely to
be backported to the stable branches.
Many thanks to David King, Mark S, Dave Cottlehuber, Slawa Olhovchenkov,
Piotr Pawel Stefaniak, and any other I may have forgotten for reporting that
and investigating.
2017-04-19 09:34:10 +00:00
|
|
|
# We rely on signed integer wraparound on overflow, however clang think it
|
|
|
|
# can do whatever it wants since it's an undefined behavior, so use -fwrapv
|
|
|
|
# to be sure we get the intended behavior.
|
2017-09-13 14:54:28 +00:00
|
|
|
SPEC_CFLAGS := -fno-strict-aliasing -Wdeclaration-after-statement
|
2018-10-16 16:11:34 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-opt-alt,-fwrapv,$(call cc-opt,-fno-strict-overflow))
|
2017-09-14 17:05:45 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,format-truncation)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,address-of-packed-member)
|
2017-10-27 09:06:11 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,unused-label)
|
BUILD: build with -Wextra and sort out certain warnings
We're not far from being able to build with -Wextra -Werror. The
following warnings had to be disabled to enable a clean build at
-Wextra on x86_64 using gcc 4.7, 5.5, 6.4 and 7.3 :
sign-compare, unused-parameter, old-style-declaration,
ignored-qualifiers, clobbered, missing-field-initializers,
implicit-fallthrough
The following extra warnings could be added without side effects :
type-limits, shift-negative-value, shift-overflow=2 duplicated-cond,
null-dereference
As a result, -Wextra was enabled by default, hoping it will help catch
issues over the long term. If new undesired warnings pop up, it's easy
to disable them using the nowarn call.
2018-09-20 08:38:08 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,sign-compare)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,unused-parameter)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,old-style-declaration)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,ignored-qualifiers)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,clobbered)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,missing-field-initializers)
|
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,implicit-fallthrough)
|
2018-10-16 16:35:40 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,stringop-overflow)
|
2018-11-27 13:47:58 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-nowarn,cast-function-type)
|
BUILD: build with -Wextra and sort out certain warnings
We're not far from being able to build with -Wextra -Werror. The
following warnings had to be disabled to enable a clean build at
-Wextra on x86_64 using gcc 4.7, 5.5, 6.4 and 7.3 :
sign-compare, unused-parameter, old-style-declaration,
ignored-qualifiers, clobbered, missing-field-initializers,
implicit-fallthrough
The following extra warnings could be added without side effects :
type-limits, shift-negative-value, shift-overflow=2 duplicated-cond,
null-dereference
As a result, -Wextra was enabled by default, hoping it will help catch
issues over the long term. If new undesired warnings pop up, it's easy
to disable them using the nowarn call.
2018-09-20 08:38:08 +00:00
|
|
|
SPEC_CFLAGS += $(call cc-opt,-Wtype-limits)
|
|
|
|
SPEC_CFLAGS += $(call cc-opt,-Wshift-negative-value)
|
|
|
|
SPEC_CFLAGS += $(call cc-opt,-Wshift-overflow=2)
|
|
|
|
SPEC_CFLAGS += $(call cc-opt,-Wduplicated-cond)
|
|
|
|
SPEC_CFLAGS += $(call cc-opt,-Wnull-dereference)
|
2010-11-28 07:28:15 +00:00
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
#### Memory usage tuning
|
|
|
|
# If small memory footprint is required, you can reduce the buffer size. There
|
|
|
|
# are 2 buffers per concurrent session, so 16 kB buffers will eat 32 MB memory
|
|
|
|
# with 1000 concurrent sessions. Putting it slightly lower than a page size
|
|
|
|
# will prevent the additional parameters to go beyond a page. 8030 bytes is
|
|
|
|
# exactly 5.5 TCP segments of 1460 bytes and is generally good. Useful tuning
|
|
|
|
# macros include :
|
|
|
|
# SYSTEM_MAXCONN, BUFSIZE, MAXREWRITE, REQURI_LEN, CAPTURE_LEN.
|
|
|
|
# Example: SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024
|
|
|
|
SMALL_OPTS =
|
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.
|
|
|
|
# Currently defined DEBUG macros include DEBUG_FULL, DEBUG_MEMORY, DEBUG_FSM,
|
2019-05-20 12:25:05 +00:00
|
|
|
# DEBUG_HASH, DEBUG_AUTH, DEBUG_SPOE, DEBUG_UAF and DEBUG_THREAD, DEBUG_STRICT,
|
|
|
|
# DEBUG_DEV. Please check sources for exact meaning or do not use at all.
|
2008-01-02 19:48:34 +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
|
|
|
|
|
|
|
#### CPU dependant optimizations
|
|
|
|
# Some CFLAGS are set by default depending on the target CPU. Those flags only
|
|
|
|
# feed CPU_CFLAGS, which in turn feed CFLAGS, so it is not mandatory to use
|
|
|
|
# them. You should not have to change these options. Better use CPU_CFLAGS or
|
|
|
|
# even CFLAGS instead.
|
|
|
|
CPU_CFLAGS.generic = -O2
|
2010-11-28 06:41:00 +00:00
|
|
|
CPU_CFLAGS.native = -O2 -march=native
|
2008-01-02 19:48:34 +00:00
|
|
|
CPU_CFLAGS.i586 = -O2 -march=i586
|
|
|
|
CPU_CFLAGS.i686 = -O2 -march=i686
|
|
|
|
CPU_CFLAGS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
|
|
|
CPU_CFLAGS = $(CPU_CFLAGS.$(CPU))
|
|
|
|
|
2018-11-10 01:50:30 +00:00
|
|
|
#### ARCH dependant flags, may be overridden by CPU flags
|
2010-11-28 06:41:00 +00:00
|
|
|
ARCH_FLAGS.32 = -m32
|
|
|
|
ARCH_FLAGS.64 = -m64
|
2009-04-11 17:45:50 +00:00
|
|
|
ARCH_FLAGS.i386 = -m32 -march=i386
|
|
|
|
ARCH_FLAGS.i486 = -m32 -march=i486
|
|
|
|
ARCH_FLAGS.i586 = -m32 -march=i586
|
|
|
|
ARCH_FLAGS.i686 = -m32 -march=i686
|
|
|
|
ARCH_FLAGS.x86_64 = -m64 -march=x86-64
|
|
|
|
ARCH_FLAGS = $(ARCH_FLAGS.$(ARCH))
|
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
#### Common CFLAGS
|
|
|
|
# These CFLAGS contain general optimization options, CPU-specific optimizations
|
|
|
|
# and debug flags. They may be overridden by some distributions which prefer to
|
|
|
|
# set all of them at once instead of playing with the CPU and DEBUG variables.
|
2010-11-28 07:28:15 +00:00
|
|
|
CFLAGS = $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS)
|
2008-01-02 19:48:34 +00:00
|
|
|
|
|
|
|
#### Common LDFLAGS
|
|
|
|
# These LDFLAGS are used as the first "ld" options, regardless of any library
|
|
|
|
# path or any other option. They may be changed to add any linker-specific
|
|
|
|
# option at the beginning of the ld command line.
|
2009-04-11 17:45:50 +00:00
|
|
|
LDFLAGS = $(ARCH_FLAGS) -g
|
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.
|
|
|
|
use_opts = USE_EPOLL USE_KQUEUE USE_MY_EPOLL USE_MY_SPLICE USE_NETFILTER \
|
|
|
|
USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT USE_POLL \
|
|
|
|
USE_PRIVATE_CACHE USE_THREAD USE_PTHREAD_PSHARED USE_REGPARM \
|
|
|
|
USE_STATIC_PCRE USE_STATIC_PCRE2 USE_TPROXY USE_LINUX_TPROXY \
|
|
|
|
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_VSYSCALL \
|
|
|
|
USE_GETADDRINFO USE_OPENSSL USE_LUA USE_FUTEX USE_ACCEPT4 \
|
|
|
|
USE_MY_ACCEPT4 USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS \
|
2019-04-23 08:57:09 +00:00
|
|
|
USE_DL USE_RT USE_DEVICEATLAS USE_51DEGREES USE_WURFL USE_SYSTEMD \
|
2019-04-08 16:53:32 +00:00
|
|
|
USE_OBSOLETE_LINKER USE_PRCTL USE_THREAD_DUMP USE_EVPORTS
|
2019-03-27 09:57:49 +00:00
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
#### Target system options
|
|
|
|
# Depending on the target platform, some options are set, as well as some
|
2019-03-27 09:57:49 +00:00
|
|
|
# CFLAGS and LDFLAGS. All variables pre-set here will not appear in the build
|
|
|
|
# options string. They may be set to any value, but are historically set to
|
|
|
|
# "implicit" which eases debugging. You should not have to change anything
|
|
|
|
# there unless you're adding support for a new platform.
|
2019-03-27 10:30:47 +00:00
|
|
|
default_opts = $(foreach name,$(1),$(eval $(name)=implicit))
|
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
|
|
|
|
|
2017-10-25 15:55:27 +00:00
|
|
|
# Always enable threads support by default and let the Makefile detect if
|
|
|
|
# HAProxy can be compiled with threads or not.
|
|
|
|
|
2019-03-27 10:44:19 +00:00
|
|
|
# generic system target has nothing specific
|
2008-01-02 19:48:34 +00:00
|
|
|
ifeq ($(TARGET),generic)
|
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
|
|
|
endif
|
|
|
|
|
|
|
|
# Haiku
|
2015-10-19 23:01:16 +00:00
|
|
|
ifeq ($(TARGET),haiku)
|
|
|
|
TARGET_LDFLAGS = -lnetwork
|
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
|
|
|
endif
|
|
|
|
|
2019-06-14 14:32:09 +00:00
|
|
|
# For linux >= 2.6.28 and glibc
|
|
|
|
ifeq ($(TARGET),linux-glibc)
|
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 \
|
|
|
|
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_FUTEX USE_LINUX_TPROXY \
|
2019-06-14 16:33:56 +00:00
|
|
|
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
|
|
|
|
USE_GETADDRINFO)
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Solaris 8 and above
|
2008-01-02 19:48:34 +00:00
|
|
|
ifeq ($(TARGET),solaris)
|
2011-03-23 19:00:53 +00:00
|
|
|
# We also enable getaddrinfo() which works since solaris 8.
|
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 \
|
2019-06-16 17:13:28 +00:00
|
|
|
USE_RT USE_OBSOLETE_LINKER USE_EVPORTS)
|
2019-05-17 15:32:21 +00:00
|
|
|
TARGET_CFLAGS = -DFD_SETSIZE=65536 -D_REENTRANT -D_XOPEN_SOURCE=500 -D__EXTENSIONS__
|
2008-01-02 19:48:34 +00:00
|
|
|
TARGET_LDFLAGS = -lnsl -lsocket
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# FreeBSD 5 and above
|
2008-01-02 19:48:34 +00:00
|
|
|
ifeq ($(TARGET),freebsd)
|
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 \
|
|
|
|
USE_CLOSEFROM)
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Mac OS/X
|
2013-04-02 06:17:43 +00:00
|
|
|
ifeq ($(TARGET),osx)
|
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_KQUEUE)
|
2018-03-05 14:37:04 +00:00
|
|
|
EXPORT_SYMBOL = -export_dynamic
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# OpenBSD 5.7 and above
|
2008-01-02 19:48:34 +00:00
|
|
|
ifeq ($(TARGET),openbsd)
|
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_THREAD USE_KQUEUE USE_ACCEPT4)
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# NetBSD
|
2015-07-02 06:58:22 +00:00
|
|
|
ifeq ($(TARGET),netbsd)
|
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_KQUEUE)
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# AIX 5.1 only
|
2014-04-02 18:44:43 +00:00
|
|
|
ifeq ($(TARGET),aix51)
|
2019-03-29 19:55:54 +00:00
|
|
|
set_target_defaults = $(call default_opts, \
|
2019-03-29 17:56:54 +00:00
|
|
|
USE_POLL USE_LIBCRYPT USE_OBSOLETE_LINKER USE_PRIVATE_CACHE)
|
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
|
2014-04-02 18:44:43 +00:00
|
|
|
DEBUG_CFLAGS =
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# AIX 5.2 and above
|
2012-06-06 14:15:03 +00:00
|
|
|
ifeq ($(TARGET),aix52)
|
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
|
|
|
|
DEBUG_CFLAGS =
|
2019-03-27 10:44:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Cygwin
|
2009-06-14 16:27:54 +00:00
|
|
|
ifeq ($(TARGET),cygwin)
|
2019-03-29 20:30:17 +00:00
|
|
|
set_target_defaults = $(call default_opts, \
|
|
|
|
USE_POLL USE_TPROXY USE_OBSOLETE_LINKER)
|
2019-03-27 10:44:19 +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
|
|
|
endif
|
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)
|
|
|
|
|
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
|
|
|
ifeq ($(IGNOREGIT),)
|
2013-12-10 08:31:06 +00:00
|
|
|
VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
|
2006-12-23 10:12:04 +00:00
|
|
|
ifneq ($(VERSION),)
|
|
|
|
# OK git is there and works.
|
2014-07-16 09:38:52 +00:00
|
|
|
SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -dc '0-9'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms")
|
2013-12-10 08:31:06 +00:00
|
|
|
VERDATE := $(shell git log -1 --pretty=format:%ci | cut -f1 -d' ' | tr '-' '/')
|
2007-09-09 21:31:11 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
ifeq ($(VERSION),)
|
|
|
|
VERSION := $(shell cat VERSION 2>/dev/null || touch VERSION)
|
|
|
|
endif
|
|
|
|
ifeq ($(SUBVERS),)
|
2013-12-16 00:34:39 +00:00
|
|
|
SUBVERS := $(shell (grep -v '\$$Format' SUBVERS 2>/dev/null || touch SUBVERS) | head -n 1)
|
2007-09-09 21:31:11 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(VERDATE),)
|
2014-01-25 23:39:22 +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
|
|
|
endif
|
2006-11-12 22:57:19 +00:00
|
|
|
|
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:36:35 +00:00
|
|
|
# Return USE_xxx=$(USE_xxx) if the variable was set from the environment or the
|
|
|
|
# command line.
|
|
|
|
# Usage:
|
2008-01-02 19:48:34 +00:00
|
|
|
# BUILD_OPTIONS += $(call ignore_implicit,USE_xxx)
|
2019-03-27 09:36:35 +00:00
|
|
|
ignore_implicit = $(if $(subst environment,,$(origin $(1))), \
|
|
|
|
$(if $(subst command line,,$(origin $(1))),, \
|
|
|
|
$(1)=$($(1))), \
|
|
|
|
$(1)=$($(1))) \
|
2006-11-12 22:57:19 +00:00
|
|
|
|
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.
|
2019-03-27 12:20:08 +00:00
|
|
|
BUILD_OPTIONS := $(foreach opt,$(use_opts),$(call ignore_implicit,$(opt)))
|
|
|
|
BUILD_FEATURES := $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),+$(opt),-$(opt)))
|
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)
|
|
|
|
OPTIONS_CFLAGS += $(foreach opt,$(use_opts),$(if $($(opt)),-D$(opt),))
|
|
|
|
|
2010-01-29 16:50:44 +00:00
|
|
|
ifneq ($(USE_LIBCRYPT),)
|
|
|
|
OPTIONS_LDFLAGS += -lcrypt
|
|
|
|
endif
|
|
|
|
|
MAJOR: compression: integrate support for libslz
This library is designed to emit a zlib-compatible stream with no
memory usage and to favor resource savings over compression ratio.
While zlib requires 256 kB of RAM per compression context (and can only
support 4000 connections per GB of RAM), the stateless compression
offered by libslz does not need to retain buffers between subsequent
calls. In theory this slightly reduces the compression ratio but in
practice it does not have that much of an effect since the zlib
window is limited to 32kB.
Libslz is available at :
http://git.1wt.eu/web?p=libslz.git
It was designed for web compression and provides a lot of savings
over zlib in haproxy. Here are the preliminary results on a single
core of a core2-quad 3.0 GHz in 32-bit for only 300 concurrent
sessions visiting the home page of www.haproxy.org (76 kB) with
the default 16kB buffers :
BW In BW Out BW Saved Ratio memory VSZ/RSS
zlib 237 Mbps 92 Mbps 145 Mbps 2.58 84M / 69M
slz 733 Mbps 380 Mbps 353 Mbps 1.93 5.9M / 4.2M
So while the compression ratio is lower, the bandwidth savings are
much more important due to the significantly lower compression cost
which allows to consume even more data from the servers. In the
example above, zlib became the bottleneck at 24% of the output
bandwidth. Also the difference in memory usage is obvious.
More tests run on a single core of a core i5-3320M, with 500 concurrent
users and the default 16kB buffers :
At 100% CPU (no limit) :
BW In BW Out BW Saved Ratio memory VSZ/RSS hits/s
zlib 480 Mbps 188 Mbps 292 Mbps 2.55 130M / 101M 744
slz 1700 Mbps 810 Mbps 890 Mbps 2.10 23.7M / 9.7M 2382
At 85% CPU (limited) :
BW In BW Out BW Saved Ratio memory VSZ/RSS hits/s
zlib 1240 Mbps 976 Mbps 264 Mbps 1.27 130M / 100M 1738
slz 1600 Mbps 976 Mbps 624 Mbps 1.64 23.7M / 9.7M 2210
The most important benefit really happens when the CPU usage is
limited by "maxcompcpuusage" or the BW limited by "maxcomprate" :
in order to preserve resources, haproxy throttles the compression
ratio until usage is within limits. Since slz is much cheaper, the
average compression ratio is much higher and the input bandwidth
is quite higher for one Gbps output.
Other tests made with some reference files :
BW In BW Out BW Saved Ratio hits/s
daniels.html zlib 1320 Mbps 163 Mbps 1157 Mbps 8.10 1925
slz 3600 Mbps 580 Mbps 3020 Mbps 6.20 5300
tv.com/listing zlib 980 Mbps 124 Mbps 856 Mbps 7.90 310
slz 3300 Mbps 553 Mbps 2747 Mbps 5.97 1100
jquery.min.js zlib 430 Mbps 180 Mbps 250 Mbps 2.39 547
slz 1470 Mbps 764 Mbps 706 Mbps 1.92 1815
bootstrap.min.css zlib 790 Mbps 165 Mbps 625 Mbps 4.79 777
slz 2450 Mbps 650 Mbps 1800 Mbps 3.77 2400
So on top of saving a lot of memory, slz is constantly 2.5-3.5 times
faster than zlib and results in providing more savings for a fixed CPU
usage. For links smaller than 100 Mbps, zlib still provides a better
compression ratio, at the expense of a much higher CPU usage.
Larger input files provide slightly higher bandwidth for both libs, at
the expense of a bit more memory usage for zlib (it converges to 256kB
per connection).
2015-03-29 01:32:06 +00:00
|
|
|
ifneq ($(USE_SLZ),)
|
|
|
|
# Use SLZ_INC and SLZ_LIB to force path to zlib.h and libz.{a,so} if needed.
|
|
|
|
SLZ_INC =
|
|
|
|
SLZ_LIB =
|
2019-03-27 13:44:14 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(SLZ_INC),-I$(SLZ_INC))
|
MAJOR: compression: integrate support for libslz
This library is designed to emit a zlib-compatible stream with no
memory usage and to favor resource savings over compression ratio.
While zlib requires 256 kB of RAM per compression context (and can only
support 4000 connections per GB of RAM), the stateless compression
offered by libslz does not need to retain buffers between subsequent
calls. In theory this slightly reduces the compression ratio but in
practice it does not have that much of an effect since the zlib
window is limited to 32kB.
Libslz is available at :
http://git.1wt.eu/web?p=libslz.git
It was designed for web compression and provides a lot of savings
over zlib in haproxy. Here are the preliminary results on a single
core of a core2-quad 3.0 GHz in 32-bit for only 300 concurrent
sessions visiting the home page of www.haproxy.org (76 kB) with
the default 16kB buffers :
BW In BW Out BW Saved Ratio memory VSZ/RSS
zlib 237 Mbps 92 Mbps 145 Mbps 2.58 84M / 69M
slz 733 Mbps 380 Mbps 353 Mbps 1.93 5.9M / 4.2M
So while the compression ratio is lower, the bandwidth savings are
much more important due to the significantly lower compression cost
which allows to consume even more data from the servers. In the
example above, zlib became the bottleneck at 24% of the output
bandwidth. Also the difference in memory usage is obvious.
More tests run on a single core of a core i5-3320M, with 500 concurrent
users and the default 16kB buffers :
At 100% CPU (no limit) :
BW In BW Out BW Saved Ratio memory VSZ/RSS hits/s
zlib 480 Mbps 188 Mbps 292 Mbps 2.55 130M / 101M 744
slz 1700 Mbps 810 Mbps 890 Mbps 2.10 23.7M / 9.7M 2382
At 85% CPU (limited) :
BW In BW Out BW Saved Ratio memory VSZ/RSS hits/s
zlib 1240 Mbps 976 Mbps 264 Mbps 1.27 130M / 100M 1738
slz 1600 Mbps 976 Mbps 624 Mbps 1.64 23.7M / 9.7M 2210
The most important benefit really happens when the CPU usage is
limited by "maxcompcpuusage" or the BW limited by "maxcomprate" :
in order to preserve resources, haproxy throttles the compression
ratio until usage is within limits. Since slz is much cheaper, the
average compression ratio is much higher and the input bandwidth
is quite higher for one Gbps output.
Other tests made with some reference files :
BW In BW Out BW Saved Ratio hits/s
daniels.html zlib 1320 Mbps 163 Mbps 1157 Mbps 8.10 1925
slz 3600 Mbps 580 Mbps 3020 Mbps 6.20 5300
tv.com/listing zlib 980 Mbps 124 Mbps 856 Mbps 7.90 310
slz 3300 Mbps 553 Mbps 2747 Mbps 5.97 1100
jquery.min.js zlib 430 Mbps 180 Mbps 250 Mbps 2.39 547
slz 1470 Mbps 764 Mbps 706 Mbps 1.92 1815
bootstrap.min.css zlib 790 Mbps 165 Mbps 625 Mbps 4.79 777
slz 2450 Mbps 650 Mbps 1800 Mbps 3.77 2400
So on top of saving a lot of memory, slz is constantly 2.5-3.5 times
faster than zlib and results in providing more savings for a fixed CPU
usage. For links smaller than 100 Mbps, zlib still provides a better
compression ratio, at the expense of a much higher CPU usage.
Larger input files provide slightly higher bandwidth for both libs, at
the expense of a bit more memory usage for zlib (it converges to 256kB
per connection).
2015-03-29 01:32:06 +00:00
|
|
|
OPTIONS_LDFLAGS += $(if $(SLZ_LIB),-L$(SLZ_LIB)) -lslz
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
ifneq ($(USE_ZLIB),)
|
2012-02-10 19:37:26 +00:00
|
|
|
# Use ZLIB_INC and ZLIB_LIB to force path to zlib.h and libz.{a,so} if needed.
|
|
|
|
ZLIB_INC =
|
|
|
|
ZLIB_LIB =
|
2019-03-27 13:44:14 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(ZLIB_INC),-I$(ZLIB_INC))
|
2012-02-10 19:37:26 +00:00
|
|
|
OPTIONS_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
|
|
|
endif
|
|
|
|
|
2006-11-12 22:57:19 +00:00
|
|
|
ifneq ($(USE_POLL),)
|
2008-01-02 19:48:34 +00:00
|
|
|
OPTIONS_OBJS += src/ev_poll.o
|
2006-11-12 22:57:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(USE_EPOLL),)
|
2008-01-02 19:48:34 +00:00
|
|
|
OPTIONS_OBJS += src/ev_epoll.o
|
2006-11-12 22:57:19 +00:00
|
|
|
endif
|
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
ifneq ($(USE_KQUEUE),)
|
|
|
|
OPTIONS_OBJS += src/ev_kqueue.o
|
2006-11-12 22:57:19 +00:00
|
|
|
endif
|
|
|
|
|
2019-04-08 16:53:32 +00:00
|
|
|
ifneq ($(USE_EVPORTS),)
|
|
|
|
OPTIONS_OBJS += src/ev_evports.o
|
|
|
|
endif
|
|
|
|
|
2010-11-14 16:09:33 +00:00
|
|
|
ifneq ($(USE_VSYSCALL),)
|
|
|
|
OPTIONS_OBJS += src/i386-linux-vsys.o
|
|
|
|
endif
|
|
|
|
|
2006-11-12 22:57:19 +00:00
|
|
|
ifneq ($(USE_REGPARM),)
|
2009-10-27 20:40:18 +00:00
|
|
|
OPTIONS_CFLAGS += -DCONFIG_REGPARM=3
|
2006-11-12 22:57:19 +00:00
|
|
|
endif
|
|
|
|
|
2015-03-17 13:33:22 +00:00
|
|
|
ifneq ($(USE_DL),)
|
|
|
|
OPTIONS_LDFLAGS += -ldl
|
|
|
|
endif
|
|
|
|
|
2017-06-26 16:41:42 +00:00
|
|
|
ifneq ($(USE_THREAD),)
|
|
|
|
OPTIONS_LDFLAGS += -lpthread
|
|
|
|
endif
|
|
|
|
|
2018-10-18 14:28:54 +00:00
|
|
|
ifneq ($(USE_RT),)
|
|
|
|
OPTIONS_LDFLAGS += -lrt
|
|
|
|
endif
|
|
|
|
|
2012-05-18 13:48:30 +00:00
|
|
|
ifneq ($(USE_OPENSSL),)
|
2015-11-06 15:13:06 +00:00
|
|
|
# OpenSSL is packaged in various forms and with various dependencies.
|
2012-05-18 13:48:30 +00:00
|
|
|
# In general -lssl is enough, but on some platforms, -lcrypto may be needed,
|
2012-09-10 07:11:22 +00:00
|
|
|
# reason why it's added by default. Some even need -lz, then you'll need to
|
2013-09-17 13:26:39 +00:00
|
|
|
# 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.
|
2019-03-27 13:44:14 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(SSL_INC),-I$(SSL_INC))
|
2014-10-31 06:36:51 +00:00
|
|
|
OPTIONS_LDFLAGS += $(if $(SSL_LIB),-L$(SSL_LIB)) -lssl -lcrypto
|
2016-08-29 11:26:37 +00:00
|
|
|
ifneq ($(USE_DL),)
|
|
|
|
OPTIONS_LDFLAGS += -ldl
|
|
|
|
endif
|
2017-11-02 15:00:51 +00:00
|
|
|
OPTIONS_OBJS += src/ssl_sock.o
|
|
|
|
endif
|
|
|
|
|
|
|
|
# The private cache option affect the way the shctx is built
|
2019-03-27 13:44:14 +00:00
|
|
|
ifeq ($(USE_PRIVATE_CACHE),)
|
2014-05-07 21:11:42 +00:00
|
|
|
ifneq ($(USE_PTHREAD_PSHARED),)
|
|
|
|
OPTIONS_LDFLAGS += -lpthread
|
|
|
|
endif
|
2012-09-03 09:14:36 +00:00
|
|
|
endif
|
2019-02-25 13:26:54 +00:00
|
|
|
|
2015-01-23 13:06:13 +00:00
|
|
|
ifneq ($(USE_LUA),)
|
2015-03-03 22:13:03 +00:00
|
|
|
check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$(1) 2>/dev/null && echo $(1))
|
2017-06-09 07:57:45 +00:00
|
|
|
check_lua_inc = $(shell if [ -d $(2)$(1) ]; then echo $(2)$(1); fi;)
|
2015-03-03 22:13:03 +00:00
|
|
|
|
2019-03-27 13:44:14 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(LUA_INC),-I$(LUA_INC))
|
2018-02-26 08:25:56 +00:00
|
|
|
LUA_LD_FLAGS := -Wl,$(if $(EXPORT_SYMBOL),$(EXPORT_SYMBOL),--export-dynamic) $(if $(LUA_LIB),-L$(LUA_LIB))
|
2015-03-03 22:13:03 +00:00
|
|
|
ifeq ($(LUA_LIB_NAME),)
|
|
|
|
# Try to automatically detect the Lua library
|
2015-03-09 23:35:36 +00:00
|
|
|
LUA_LIB_NAME := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_lib,$(lib),$(LUA_LD_FLAGS))))
|
2015-03-03 22:13:03 +00:00
|
|
|
ifeq ($(LUA_LIB_NAME),)
|
2015-03-09 23:35:36 +00:00
|
|
|
$(error unable to automatically detect the Lua library name, you can enforce its name with LUA_LIB_NAME=<name> (where <name> can be lua5.3, lua53, lua, ...))
|
2015-03-03 22:13:03 +00:00
|
|
|
endif
|
2017-06-09 07:57:45 +00:00
|
|
|
LUA_INC := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_inc,$(lib),"/usr/include/")))
|
|
|
|
ifneq ($(LUA_INC),)
|
|
|
|
OPTIONS_CFLAGS += -I$(LUA_INC)
|
|
|
|
endif
|
2015-03-03 22:13:03 +00:00
|
|
|
endif
|
|
|
|
|
2015-03-17 13:33:22 +00:00
|
|
|
OPTIONS_LDFLAGS += $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) -lm
|
2015-07-16 18:52:51 +00:00
|
|
|
ifneq ($(USE_DL),)
|
|
|
|
OPTIONS_LDFLAGS += -ldl
|
|
|
|
endif
|
2016-01-21 08:28:58 +00:00
|
|
|
OPTIONS_OBJS += src/hlua.o src/hlua_fcn.o
|
2015-01-23 13:06:13 +00:00
|
|
|
endif
|
|
|
|
|
2015-06-01 12:00:07 +00:00
|
|
|
ifneq ($(USE_DEVICEATLAS),)
|
2015-11-06 15:13:06 +00:00
|
|
|
ifeq ($(USE_PCRE),)
|
|
|
|
$(error the DeviceAtlas module needs the PCRE library in order to compile)
|
|
|
|
endif
|
2015-06-02 12:10:28 +00:00
|
|
|
# Use DEVICEATLAS_SRC and possibly DEVICEATLAS_INC and DEVICEATLAS_LIB to force path
|
2015-06-29 14:43:25 +00:00
|
|
|
# to DeviceAtlas headers and libraries if needed.
|
2015-06-02 12:10:28 +00:00
|
|
|
DEVICEATLAS_SRC =
|
|
|
|
DEVICEATLAS_INC = $(DEVICEATLAS_SRC)
|
|
|
|
DEVICEATLAS_LIB = $(DEVICEATLAS_SRC)
|
2016-10-05 23:32:39 +00:00
|
|
|
ifeq ($(DEVICEATLAS_SRC),)
|
|
|
|
OPTIONS_LDFLAGS += -lda
|
|
|
|
else
|
2015-06-01 12:00:07 +00:00
|
|
|
OPTIONS_OBJS += $(DEVICEATLAS_LIB)/json.o
|
|
|
|
OPTIONS_OBJS += $(DEVICEATLAS_LIB)/dac.o
|
2016-10-05 23:32:39 +00:00
|
|
|
endif
|
2015-06-01 12:00:07 +00:00
|
|
|
OPTIONS_OBJS += src/da.o
|
2019-03-27 13:44:14 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(DEVICEATLAS_INC),-I$(DEVICEATLAS_INC))
|
2015-06-01 12:00:07 +00:00
|
|
|
endif
|
|
|
|
|
2015-05-12 14:06:21 +00:00
|
|
|
ifneq ($(USE_51DEGREES),)
|
2015-06-01 09:12:35 +00:00
|
|
|
# Use 51DEGREES_SRC and possibly 51DEGREES_INC and 51DEGREES_LIB to force path
|
|
|
|
# to 51degrees headers and libraries if needed.
|
|
|
|
51DEGREES_SRC =
|
|
|
|
51DEGREES_INC = $(51DEGREES_SRC)
|
|
|
|
51DEGREES_LIB = $(51DEGREES_SRC)
|
2015-09-18 16:24:29 +00:00
|
|
|
OPTIONS_OBJS += $(51DEGREES_LIB)/../cityhash/city.o
|
2015-06-29 14:43:25 +00:00
|
|
|
OPTIONS_OBJS += $(51DEGREES_LIB)/51Degrees.o
|
|
|
|
OPTIONS_OBJS += src/51d.o
|
2019-03-27 13:44:14 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(51DEGREES_INC),-I$(51DEGREES_INC))
|
2019-02-05 13:24:00 +00:00
|
|
|
ifeq ($(USE_THREAD),)
|
|
|
|
OPTIONS_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING
|
|
|
|
else
|
|
|
|
OPTIONS_OBJS += $(51DEGREES_LIB)/../threading.o
|
|
|
|
endif
|
|
|
|
|
2015-09-18 16:24:29 +00:00
|
|
|
OPTIONS_LDFLAGS += $(if $(51DEGREES_LIB),-L$(51DEGREES_LIB)) -lm
|
2015-05-12 14:06:21 +00:00
|
|
|
endif
|
|
|
|
|
2019-04-19 14:03:32 +00:00
|
|
|
ifneq ($(USE_WURFL),)
|
|
|
|
# Use WURFL_SRC and possibly WURFL_INC and WURFL_LIB to force path
|
|
|
|
# to WURFL headers and libraries if needed.
|
|
|
|
WURFL_SRC =
|
|
|
|
WURFL_INC = $(WURFL_SRC)
|
|
|
|
WURFL_LIB = $(WURFL_SRC)
|
|
|
|
OPTIONS_OBJS += src/wurfl.o
|
2019-04-23 08:57:09 +00:00
|
|
|
OPTIONS_CFLAGS += $(if $(WURFL_INC),-I$(WURFL_INC))
|
2019-04-19 14:03:32 +00:00
|
|
|
ifneq ($(WURFL_DEBUG),)
|
|
|
|
OPTIONS_CFLAGS += -DWURFL_DEBUG
|
|
|
|
endif
|
|
|
|
ifneq ($(WURFL_HEADER_WITH_DETAILS),)
|
|
|
|
OPTIONS_CFLAGS += -DWURFL_HEADER_WITH_DETAILS
|
|
|
|
endif
|
|
|
|
OPTIONS_LDFLAGS += $(if $(WURFL_LIB),-L$(WURFL_LIB)) -lwurfl
|
|
|
|
endif
|
|
|
|
|
2017-11-20 14:58:35 +00:00
|
|
|
ifneq ($(USE_SYSTEMD),)
|
|
|
|
OPTIONS_LDFLAGS += -lsystemd
|
|
|
|
endif
|
|
|
|
|
2013-01-13 06:00:42 +00:00
|
|
|
ifneq ($(USE_PCRE)$(USE_STATIC_PCRE)$(USE_PCRE_JIT),)
|
2016-11-21 21:25:58 +00:00
|
|
|
ifneq ($(USE_PCRE2)$(USE_STATIC_PCRE2)$(USE_PCRE2_JIT),)
|
|
|
|
$(error cannot compile both PCRE and PCRE2 support)
|
|
|
|
endif
|
2013-02-13 11:39:06 +00:00
|
|
|
# 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.
|
|
|
|
|
2018-09-28 17:21:26 +00:00
|
|
|
PCRE_CONFIG := pcre-config
|
|
|
|
PCREDIR := $(shell $(PCRE_CONFIG) --prefix 2>/dev/null || echo /usr/local)
|
2013-02-13 11:39:06 +00:00
|
|
|
ifneq ($(PCREDIR),)
|
|
|
|
PCRE_INC := $(PCREDIR)/include
|
|
|
|
PCRE_LIB := $(PCREDIR)/lib
|
2006-12-22 14:28:43 +00:00
|
|
|
endif
|
2013-02-13 11:39:06 +00:00
|
|
|
|
2008-11-20 13:47:04 +00:00
|
|
|
ifeq ($(USE_STATIC_PCRE),)
|
2013-02-13 11:39:06 +00:00
|
|
|
# dynamic PCRE
|
|
|
|
OPTIONS_CFLAGS += -DUSE_PCRE $(if $(PCRE_INC),-I$(PCRE_INC))
|
|
|
|
OPTIONS_LDFLAGS += $(if $(PCRE_LIB),-L$(PCRE_LIB)) -lpcreposix -lpcre
|
|
|
|
else
|
|
|
|
# static PCRE
|
|
|
|
OPTIONS_CFLAGS += -DUSE_PCRE $(if $(PCRE_INC),-I$(PCRE_INC))
|
|
|
|
OPTIONS_LDFLAGS += $(if $(PCRE_LIB),-L$(PCRE_LIB)) -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
|
2008-01-02 19:48:34 +00:00
|
|
|
endif
|
2013-02-13 11:39:06 +00:00
|
|
|
endif
|
2006-11-12 22:57:19 +00:00
|
|
|
|
2016-11-21 21:25:58 +00:00
|
|
|
ifneq ($(USE_PCRE2)$(USE_STATIC_PCRE2)$(USE_PCRE2_JIT),)
|
2018-09-28 17:21:26 +00:00
|
|
|
PCRE2_CONFIG := pcre2-config
|
|
|
|
PCRE2DIR := $(shell $(PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local)
|
2016-11-21 21:25:58 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2018-09-28 17:21:26 +00:00
|
|
|
PCRE2_LDFLAGS := $(shell $(PCRE2_CONFIG) --libs$(PCRE2_WIDTH) 2>/dev/null || echo -L/usr/local/lib -lpcre2-$(PCRE2_WIDTH))
|
2016-11-21 21:25:58 +00:00
|
|
|
|
|
|
|
ifeq ($(PCRE2_LDFLAGS),)
|
|
|
|
$(error libpcre2-$(PCRE2_WIDTH) not found)
|
|
|
|
else
|
|
|
|
ifeq ($(PCRE2_WIDTH),8)
|
|
|
|
PCRE2_LDFLAGS += -lpcre2-posix
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
OPTIONS_CFLAGS += -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=$(PCRE2_WIDTH)
|
|
|
|
OPTIONS_CFLAGS += $(if $(PCRE2_INC), -I$(PCRE2_INC))
|
|
|
|
|
|
|
|
ifneq ($(USE_STATIC_PCRE2),)
|
|
|
|
OPTIONS_LDFLAGS += $(if $(PCRE2_LIB),-L$(PCRE2_LIB)) -Wl,-Bstatic -L$(PCRE2_LIB) $(PCRE2_LDFLAGS) -Wl,-Bdynamic
|
|
|
|
else
|
|
|
|
OPTIONS_LDFLAGS += $(if $(PCRE2_LIB),-L$(PCRE2_LIB)) -L$(PCRE2_LIB) $(PCRE2_LDFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2009-10-26 20:10:04 +00:00
|
|
|
# This one can be changed to look for ebtree files in an external directory
|
|
|
|
EBTREE_DIR := ebtree
|
2006-11-12 22:57:19 +00:00
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
#### Global compile options
|
|
|
|
VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE)
|
BUILD: build with -Wextra and sort out certain warnings
We're not far from being able to build with -Wextra -Werror. The
following warnings had to be disabled to enable a clean build at
-Wextra on x86_64 using gcc 4.7, 5.5, 6.4 and 7.3 :
sign-compare, unused-parameter, old-style-declaration,
ignored-qualifiers, clobbered, missing-field-initializers,
implicit-fallthrough
The following extra warnings could be added without side effects :
type-limits, shift-negative-value, shift-overflow=2 duplicated-cond,
null-dereference
As a result, -Wextra was enabled by default, hoping it will help catch
issues over the long term. If new undesired warnings pop up, it's easy
to disable them using the nowarn call.
2018-09-20 08:38:08 +00:00
|
|
|
COPTS = -Iinclude -I$(EBTREE_DIR) -Wall -Wextra
|
2018-10-22 04:22:46 +00:00
|
|
|
|
|
|
|
ifneq ($(ERR),)
|
|
|
|
COPTS += -Werror
|
|
|
|
endif
|
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
COPTS += $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE)
|
|
|
|
COPTS += $(DEBUG) $(OPTIONS_CFLAGS) $(ADDINC)
|
2005-12-17 13:08:03 +00:00
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
ifneq ($(VERSION)$(SUBVERS),)
|
|
|
|
COPTS += -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\"
|
|
|
|
endif
|
2007-01-07 01:03:04 +00:00
|
|
|
|
2008-01-02 19:48:34 +00:00
|
|
|
ifneq ($(VERDATE),)
|
|
|
|
COPTS += -DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
|
2007-01-07 01:03:04 +00:00
|
|
|
endif
|
|
|
|
|
2012-05-25 21:53:16 +00:00
|
|
|
ifneq ($(TRACE),)
|
|
|
|
# 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
|
|
|
|
endif
|
|
|
|
|
2014-11-17 14:11:45 +00:00
|
|
|
ifneq ($(USE_NS),)
|
2018-11-11 13:38:09 +00:00
|
|
|
OPTIONS_OBJS += src/namespace.o
|
2014-11-17 14:11:45 +00:00
|
|
|
endif
|
|
|
|
|
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
|
|
|
|
2018-11-19 07:15:54 +00:00
|
|
|
ifeq ($V,1)
|
|
|
|
cmd_CC = $(CC)
|
|
|
|
cmd_LD = $(LD)
|
|
|
|
cmd_AR = $(AR)
|
|
|
|
else
|
|
|
|
cmd_CC = $(Q)echo " CC $@";$(CC)
|
|
|
|
cmd_LD = $(Q)echo " LD $@";$(LD)
|
|
|
|
cmd_AR = $(Q)echo " AR $@";$(AR)
|
|
|
|
endif
|
|
|
|
|
2008-03-11 05:37:39 +00:00
|
|
|
ifeq ($(TARGET),)
|
|
|
|
all:
|
|
|
|
@echo
|
|
|
|
@echo "Due to too many reports of suboptimized setups, building without"
|
|
|
|
@echo "specifying the target is no longer supported. Please specify the"
|
|
|
|
@echo "target OS in the TARGET variable, in the following form:"
|
|
|
|
@echo
|
|
|
|
@echo " $ make TARGET=xxx"
|
|
|
|
@echo
|
|
|
|
@echo "Please choose the target among the following supported list :"
|
|
|
|
@echo
|
2019-06-14 14:32:09 +00:00
|
|
|
@echo " linux-glibc, solaris, freebsd, openbsd, netbsd, cygwin,"
|
|
|
|
@echo " haiku, aix51, aix52, osx, generic, custom"
|
2008-03-11 05:37:39 +00:00
|
|
|
@echo
|
|
|
|
@echo "Use \"generic\" if you don't want any optimization, \"custom\" if you"
|
|
|
|
@echo "want to precisely tweak every option, or choose the target which"
|
|
|
|
@echo "matches your OS the most in order to gain the maximum performance"
|
|
|
|
@echo "out of it. Please check the Makefile in case of doubts."
|
|
|
|
@echo
|
|
|
|
@exit 1
|
2019-06-16 15:53:39 +00:00
|
|
|
else
|
|
|
|
ifneq ($(filter $(TARGET), linux linux22 linux24 linux24e linux26 linux2628),)
|
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
|
|
|
else
|
2014-05-10 10:16:21 +00:00
|
|
|
all: haproxy $(EXTRA)
|
2008-03-11 05:37:39 +00:00
|
|
|
endif
|
2019-06-16 15:53:39 +00:00
|
|
|
endif
|
2005-12-17 11:21:26 +00:00
|
|
|
|
2018-11-19 06:10:59 +00:00
|
|
|
OBJS = src/proto_http.o src/cfgparse-listen.o src/proto_htx.o src/stream.o \
|
|
|
|
src/mux_h2.o src/stats.o src/flt_spoe.o src/server.o src/checks.o \
|
|
|
|
src/haproxy.o src/cfgparse.o src/flt_http_comp.o src/http_fetch.o \
|
|
|
|
src/dns.o src/stick_table.o src/mux_h1.o src/peers.o src/standard.o \
|
|
|
|
src/proxy.o src/cli.o src/log.o src/backend.o src/pattern.o \
|
|
|
|
src/sample.o src/stream_interface.o src/proto_tcp.o src/listener.o \
|
|
|
|
src/h1.o src/cfgparse-global.o src/cache.o src/http_rules.o \
|
|
|
|
src/http_act.o src/tcp_rules.o src/filters.o src/connection.o \
|
|
|
|
src/session.o src/acl.o src/vars.o src/raw_sock.o src/map.o \
|
|
|
|
src/proto_uxst.o src/payload.o src/fd.o src/queue.o src/flt_trace.o \
|
|
|
|
src/task.o src/lb_chash.o src/frontend.o src/applet.o src/mux_pt.o \
|
|
|
|
src/signal.o src/ev_select.o src/proto_sockpair.o src/compression.o \
|
|
|
|
src/http_conv.o src/memory.o src/lb_fwrr.o src/channel.o src/htx.o \
|
|
|
|
src/uri_auth.o src/regex.o src/chunk.o src/pipe.o src/lb_fas.o \
|
|
|
|
src/lb_map.o src/lb_fwlc.o src/auth.o src/time.o src/hathreads.o \
|
|
|
|
src/http_htx.o src/buffer.o src/hpack-tbl.o src/shctx.o src/sha1.o \
|
|
|
|
src/http.o src/hpack-dec.o src/action.o src/proto_udp.o src/http_acl.o \
|
|
|
|
src/xxhash.o src/hpack-enc.o src/h2.o src/freq_ctr.o src/lru.o \
|
|
|
|
src/protocol.o src/arg.o src/hpack-huff.o src/hdr_idx.o src/base64.o \
|
2019-04-01 09:29:53 +00:00
|
|
|
src/hash.o src/mailers.o src/activity.o src/http_msg.o src/version.o \
|
2019-05-27 10:09:19 +00:00
|
|
|
src/mworker.o src/mworker-prog.o src/debug.o src/wdt.o src/dict.o \
|
|
|
|
src/xprt_handshake.o
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2017-11-05 12:31:29 +00:00
|
|
|
EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o $(EBTREE_DIR)/eb32sctree.o \
|
2009-10-26 20:10:04 +00:00
|
|
|
$(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
|
|
|
|
$(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
|
|
|
|
$(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
|
|
|
|
|
2012-05-25 21:53:16 +00:00
|
|
|
ifneq ($(TRACE),)
|
|
|
|
OBJS += src/trace.o
|
|
|
|
endif
|
|
|
|
|
2019-01-10 09:01:03 +00:00
|
|
|
ifneq ($(EXTRA_OBJS),)
|
|
|
|
OBJS += $(EXTRA_OBJS)
|
|
|
|
endif
|
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
|
|
|
|
2009-10-26 20:10:04 +00:00
|
|
|
# Not used right now
|
|
|
|
LIB_EBTREE = $(EBTREE_DIR)/libebtree.a
|
|
|
|
|
2016-05-30 11:39:32 +00:00
|
|
|
# Used only for forced dependency checking. May be cleared during development.
|
|
|
|
INCLUDES = $(wildcard include/*/*.h ebtree/*.h)
|
2016-05-30 13:16:10 +00:00
|
|
|
DEP = $(INCLUDES) .build_opts
|
|
|
|
|
2018-12-13 13:02:25 +00:00
|
|
|
help:
|
2019-06-14 13:52:01 +00:00
|
|
|
$(Q)sed -ne "/^[^#]*$$/q;s/^# \?\(.*\)/\1/p" Makefile
|
|
|
|
$(Q)echo; \
|
|
|
|
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; \
|
2019-06-14 13:52:01 +00:00
|
|
|
else \
|
2019-06-14 13:52:01 +00:00
|
|
|
echo "TARGET not set, you may pass 'TARGET=xxx' to set one among :";\
|
2019-06-14 14:32:09 +00:00
|
|
|
echo " linux-glibc, solaris, freebsd, netbsd, osx, openbsd,"; \
|
|
|
|
echo " aix51, aix52, cygwin, haiku, generic, custom"; \
|
2019-06-14 13:52:01 +00:00
|
|
|
fi
|
2019-06-14 13:52:01 +00:00
|
|
|
$(Q)echo;echo "Enabled features for TARGET '$(TARGET)' (disable with 'USE_xxx=') :"
|
|
|
|
$(Q)set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),$(opt),)); echo " $$*" | (fmt || cat) 2>/dev/null
|
|
|
|
$(Q)echo;echo "Disabled features for TARGET '$(TARGET)' (enable with 'USE_xxx=1') :"
|
|
|
|
$(Q)set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),,$(opt))); echo " $$*" | (fmt || cat) 2>/dev/null
|
2018-12-13 13:02:25 +00:00
|
|
|
|
2016-05-30 13:16:10 +00:00
|
|
|
# Used only to force a rebuild if some build options change
|
2019-03-29 16:17:52 +00:00
|
|
|
build_opts = $(shell rm -f .build_opts.new; echo \'$(TARGET) $(BUILD_OPTIONS) $(VERBOSE_CFLAGS)\' > .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)
|
|
|
|
.build_opts: $(build_opts)
|
2016-05-30 11:39:32 +00:00
|
|
|
|
2018-11-19 06:10:59 +00:00
|
|
|
haproxy: $(OPTIONS_OBJS) $(OBJS) $(EBTREE_OBJS)
|
2018-11-19 07:15:54 +00:00
|
|
|
$(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
|
2005-12-17 11:21:26 +00:00
|
|
|
|
2009-10-26 20:10:04 +00:00
|
|
|
$(LIB_EBTREE): $(EBTREE_OBJS)
|
2018-11-19 07:15:54 +00:00
|
|
|
$(cmd_AR) rv $@ $^
|
2009-10-26 20:10:04 +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
|
|
|
|
2019-01-04 17:20:32 +00:00
|
|
|
# rebuild it every time
|
|
|
|
.PHONY: src/version.c
|
|
|
|
|
2016-05-30 11:39:32 +00:00
|
|
|
src/trace.o: src/trace.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))"' \
|
2009-04-11 17:45:50 +00:00
|
|
|
-DBUILD_ARCH='"$(strip $(ARCH))"' \
|
2008-01-02 19:48:34 +00:00
|
|
|
-DBUILD_CPU='"$(strip $(CPU))"' \
|
|
|
|
-DBUILD_CC='"$(strip $(CC))"' \
|
|
|
|
-DBUILD_CFLAGS='"$(strip $(VERBOSE_CFLAGS))"' \
|
|
|
|
-DBUILD_OPTIONS='"$(strip $(BUILD_OPTIONS))"' \
|
2019-03-27 12:20:08 +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:
|
2018-11-19 06:51:04 +00:00
|
|
|
$(Q)install -v -d "$(DESTDIR)$(MANDIR)"/man1
|
|
|
|
$(Q)install -v -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:
|
2018-11-19 06:51:04 +00:00
|
|
|
$(Q)install -v -d "$(DESTDIR)$(DOCDIR)"
|
|
|
|
$(Q)for x in $(DOCUMENTATION); do \
|
|
|
|
install -v -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
|
2018-11-19 06:51:04 +00:00
|
|
|
$(Q)install -v -d "$(DESTDIR)$(SBINDIR)"
|
|
|
|
$(Q)install -v 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:
|
2018-11-19 07:14:40 +00:00
|
|
|
$(Q)rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test .build_opts .build_opts.new
|
|
|
|
$(Q)for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
|
|
|
|
$(Q)rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION)$(SUBVERS).tar.gz
|
|
|
|
$(Q)rm -f haproxy-$(VERSION) haproxy-$(VERSION)$(SUBVERS) nohup.out gmon.out
|
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
|
2018-11-19 06:51:04 +00:00
|
|
|
$(Q)ln -s . haproxy-$(VERSION)$(SUBVERS)
|
|
|
|
$(Q)tar --exclude=haproxy-$(VERSION)$(SUBVERS)/.git \
|
2013-12-10 08:31:06 +00:00
|
|
|
--exclude=haproxy-$(VERSION)$(SUBVERS)/haproxy-$(VERSION)$(SUBVERS) \
|
|
|
|
--exclude=haproxy-$(VERSION)$(SUBVERS)/haproxy-$(VERSION)$(SUBVERS).tar.gz \
|
|
|
|
-cf - haproxy-$(VERSION)$(SUBVERS)/* | gzip -c9 >haproxy-$(VERSION)$(SUBVERS).tar.gz
|
2018-11-19 06:51:04 +00:00
|
|
|
$(Q)echo haproxy-$(VERSION)$(SUBVERS).tar.gz
|
|
|
|
$(Q)rm -f haproxy-$(VERSION)$(SUBVERS)
|
2006-03-19 20:16:26 +00:00
|
|
|
|
2012-12-20 14:00:44 +00:00
|
|
|
git-tar:
|
2018-11-19 06:51:04 +00:00
|
|
|
$(Q)git archive --format=tar --prefix="haproxy-$(VERSION)$(SUBVERS)/" HEAD | gzip -9 > haproxy-$(VERSION)$(SUBVERS).tar.gz
|
|
|
|
$(Q)echo haproxy-$(VERSION)$(SUBVERS).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
|
|
|
|
2018-10-03 07:40:22 +00:00
|
|
|
# just display the build options
|
|
|
|
opts:
|
|
|
|
@echo -n 'Using: '
|
|
|
|
@echo -n 'TARGET="$(strip $(TARGET))" '
|
|
|
|
@echo -n 'ARCH="$(strip $(ARCH))" '
|
|
|
|
@echo -n 'CPU="$(strip $(CPU))" '
|
|
|
|
@echo -n 'CC="$(strip $(CC))" '
|
|
|
|
@echo -n 'ARCH_FLAGS="$(strip $(ARCH_FLAGS))" '
|
|
|
|
@echo -n 'CPU_CFLAGS="$(strip $(CPU_CFLAGS))" '
|
|
|
|
@echo -n 'DEBUG_CFLAGS="$(strip $(DEBUG_CFLAGS))" '
|
|
|
|
@echo "$(strip $(BUILD_OPTIONS))"
|
|
|
|
@echo 'COPTS="$(strip $(COPTS))"'
|
|
|
|
@echo 'LDFLAGS="$(strip $(LDFLAGS))"'
|
|
|
|
@echo 'LDOPTS="$(strip $(LDOPTS))"'
|
|
|
|
@echo 'OPTIONS_OBJS="$(strip $(OPTIONS_OBJS))"'
|
|
|
|
@echo 'OBJS="$(strip $(OBJS))"'
|
|
|
|
|
2018-12-19 15:27:47 +00:00
|
|
|
ifeq (reg-tests, $(firstword $(MAKECMDGOALS)))
|
|
|
|
REGTEST_ARGS := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
|
|
|
|
$(eval $(REGTEST_ARGS):;@true)
|
|
|
|
endif
|
|
|
|
|
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
|
2019-03-29 14:07:24 +00:00
|
|
|
@echo "with 'any' as default value for REGTESTS_TYPES variable."
|
|
|
|
@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
|