2008-01-02 22:48:34 +03:00
# This GNU Makefile supports different OS and CPU combinations.
#
2005-12-17 16:08:03 +03:00
# You should use it this way :
2008-01-02 22:48:34 +03:00
# [g]make TARGET=os CPU=cpu USE_xxx=1 ...
2007-07-11 11:19:31 +04:00
#
2008-01-02 22:48:34 +03:00
# Valid USE_* options are the following. Most of them are automatically set by
# the TARGET, others have to be explictly specified :
# USE_CTTPROXY : enable CTTPROXY on Linux (needs kernel patch).
2008-02-19 12:53:32 +03:00
# USE_DLMALLOC : enable use of dlmalloc (see DLMALLOC_SRC)
2008-01-02 22:48:34 +03:00
# USE_EPOLL : enable epoll() on Linux 2.6. Automatic.
# USE_EPOLL_WORKAROUND : enable epoll() bug workaround. Automatic.
# USE_GETSOCKNAME : enable getsockname() on Linux 2.2. Automatic.
# USE_KQUEUE : enable kqueue() on BSD. Automatic.
# USE_MY_EPOLL : redefine epoll_* syscalls. Automatic.
# USE_NETFILTER : enable netfilter on Linux. Automatic.
# USE_PCRE : enable use of libpcre for regex. Recommended.
# USE_POLL : enable poll(). Automatic.
# USE_REGPARM : enable regparm optimization. Recommended on x86.
# USE_SEPOLL : enable speculative epoll(). Automatic.
# USE_STATIC_PCRE : enable static libpcre. Recommended.
# USE_TCPSPLICE : enable tcp_splice() on Linux (needs kernel patch).
# USE_TPROXY : enable transparent proxy. Automatic.
2008-01-13 16:49:51 +03:00
# USE_LINUX_TPROXY : enable full transparent proxy (need kernel patch).
2007-07-11 11:19:31 +04:00
#
2008-01-02 22:48:34 +03:00
# Options can be forced by specifying "USE_xxx=1" or can be disabled by using
# "USE_xxx=" (empty string).
#
# 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.
# CFLAGS is automatically set for the specified CPU and may be overridden.
# LDFLAGS is automatically set to -g and may be overridden.
# SMALL_OPTS may be used to specify some options to shrink memory usage.
# DEBUG may be used to set some internal debugging options.
# 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".
2008-03-12 16:25:35 +03: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 16:57:54 +03:00
# MANDIR is set to "$(PREFIX)/share/man" by default and is used for
# installation only.
2008-03-12 18:24:49 +03:00
# DOCDIR is set to "$(PREFIX)/doc/haproxy" by default and is used for
# installation only.
2008-01-02 22:48:34 +03:00
#
# Other variables :
# DLMALLOC_SRC : build with dlmalloc, indicate the location of dlmalloc.c.
# DLMALLOC_THRES : should match PAGE_SIZE on every platform (default: 4096).
# PCREDIR : force the path to libpcre.
# 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.
2008-03-12 16:25:35 +03:00
#### Installation options.
DESTDIR =
PREFIX = /usr/local
SBINDIR = $( PREFIX) /sbin
2008-03-12 16:57:54 +03:00
MANDIR = $( PREFIX) /man
2008-03-12 18:24:49 +03:00
DOCDIR = $( PREFIX) /doc/haproxy
2008-01-02 22:48:34 +03:00
#### TARGET system
# Use TARGET=<target_name> to optimize for a specifc target OS among the
# following list (use the default "generic" if uncertain) :
# generic, linux22, linux24, linux24e, linux24eold, linux26, solaris,
# freebsd, openbsd, custom
2008-03-11 08:37:39 +03:00
TARGET =
2008-01-02 22:48:34 +03:00
#### TARGET CPU
# Use CPU=<cpu_name> to optimize for a particular CPU, among the following
# list :
# generic, i586, i686, ultrasparc, custom
2005-12-17 16:08:03 +03:00
CPU = generic
2005-12-17 14:21:26 +03:00
2008-01-02 22:48:34 +03:00
#### Toolchain options.
# GCC is normally used both for compiling and linking.
2005-12-17 16:08:03 +03:00
CC = gcc
2008-03-17 20:23:12 +03:00
LD = $( CC)
2005-12-17 16:08:03 +03:00
2008-01-02 22:48:34 +03: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 14:48:26 +03:00
2008-01-02 22:48:34 +03: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 14:21:26 +03:00
2008-01-02 22:48:34 +03: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,
# DEBUG_HASH and DEBUG_PARSE_NO_SPEEDUP. Please consult sources for exact
# meaning or do not use at all.
DEBUG =
2005-12-17 16:08:03 +03:00
2008-01-02 22:48:34 +03:00
#### Additional include and library dirs
# Redefine this if you want to add some special PATH to include/libs
ADDINC =
ADDLIB =
2005-12-17 15:46:33 +03:00
2008-01-02 22:48:34 +03: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.
DEFINE =
SILENT_DEFINE =
#### 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
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) )
#### 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.
CFLAGS = $( CPU_CFLAGS) $( DEBUG_CFLAGS)
#### 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.
LDFLAGS = -g
2005-12-17 15:46:33 +03:00
2008-01-02 22:48:34 +03:00
#### Target system options
# Depending on the target platform, some options are set, as well as some
# CFLAGS and LDFLAGS. The USE_* values are set to "implicit" so that they are
# not reported in the build options string. You should not have to change
# anything there.
i f e q ( $( TARGET ) , g e n e r i c )
# generic system target has nothing specific
USE_POLL = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , l i n u x 2 2 )
# This is for Linux 2.2
USE_GETSOCKNAME = implicit
USE_POLL = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , l i n u x 2 4 )
# This is for standard Linux 2.4 with netfilter but without epoll()
USE_GETSOCKNAME = implicit
USE_NETFILTER = implicit
USE_POLL = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , l i n u x 2 4 e )
# This is for enhanced Linux 2.4 with netfilter and epoll() patch > 0.21
USE_GETSOCKNAME = implicit
USE_NETFILTER = implicit
USE_POLL = implicit
USE_EPOLL = implicit
USE_SEPOLL = implicit
USE_MY_EPOLL = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , l i n u x 2 4 e o l d )
# This is for enhanced Linux 2.4 with netfilter and epoll() patch <= 0.21,
# which needs a workaround for a very rare bug.
USE_GETSOCKNAME = implicit
USE_NETFILTER = implicit
USE_POLL = implicit
USE_EPOLL = implicit
USE_SEPOLL = implicit
USE_MY_EPOLL = implicit
USE_EPOLL_WORKAROUND = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , l i n u x 2 6 )
# This is for standard Linux 2.6 with netfilter and standard epoll()
USE_GETSOCKNAME = implicit
USE_NETFILTER = implicit
USE_POLL = implicit
USE_EPOLL = implicit
USE_SEPOLL = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , s o l a r i s )
# This is for Solaris 8
USE_POLL = implicit
TARGET_CFLAGS = -fomit-frame-pointer -DFD_SETSIZE= 65536 -D_REENTRANT
TARGET_LDFLAGS = -lnsl -lsocket
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , f r e e b s d )
# This is for FreeBSD
USE_POLL = implicit
USE_KQUEUE = implicit
USE_TPROXY = implicit
e l s e
i f e q ( $( TARGET ) , o p e n b s d )
# This is for OpenBSD >= 3.0
USE_POLL = implicit
USE_KQUEUE = implicit
USE_TPROXY = implicit
e n d i f # openbsd
e n d i f # freebsd
e n d i f # solaris
e n d i f # linux26
e n d i f # linux24eold
e n d i f # linux24e
e n d i f # linux24
e n d i f # linux22
e n d i f # generic
#### Old-style REGEX library settings for compatibility with previous setups.
# It is still possible to use REGEX=<regex_lib> to select an alternative regex
# library. By default, we use libc's regex. On Solaris 8/Sparc, grouping seems
# to be broken using libc, so consider using pcre instead. Supported values are
# "libc", "pcre", and "static-pcre". Use of this method is deprecated in favor
# of "USE_PCRE" and "USE_STATIC_PCRE" (see build options below).
REGEX = libc
i f e q ( $( REGEX ) , p c r e )
USE_PCRE = 1
$( warning WARNING ! use of "REGEX =pcre " is deprecated , consider using "USE_PCRE =1" instead .)
e n d i f
2005-12-18 03:32:31 +03:00
2008-01-02 22:48:34 +03:00
i f e q ( $( REGEX ) , s t a t i c - p c r e )
USE_STATIC_PCRE = 1
$( warning WARNING ! use of "REGEX =pcre -static " is deprecated , consider using "USE_STATIC_PCRE =1" instead .)
e n d i f
2005-12-17 14:29:56 +03:00
2008-01-02 22:48:34 +03:00
#### Old-style TPROXY settings
i f n e q ( $( findstring -DTPROXY ,$ ( DEFINE ) ) , )
USE_TPROXY = 1
$( warning WARNING ! use of "DEFINE =-DTPROXY " is deprecated , consider using "USE_TPROXY =1" instead .)
e n d i f
2005-12-18 03:02:42 +03:00
2005-12-18 03:11:29 +03:00
2008-01-02 22:48:34 +03: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 03:02:42 +03:00
2007-01-02 02:44:53 +03:00
i f e q ( $( IGNOREGIT ) , )
2007-09-10 01:31:11 +04:00
VERSION := $( shell [ -d .git/. ] && ref = ` ( git-describe --tags) 2>/dev/null` && ref = $$ { ref%-g*} && echo " $$ {ref\#v} " )
2006-12-23 13:12:04 +03:00
i f n e q ( $( VERSION ) , )
# OK git is there and works.
2007-04-10 00:07:11 +04:00
SUBVERS := $( shell comms = ` git-log --no-merges v$( VERSION) .. 2>/dev/null | grep -c ^commit ` ; [ $$ comms -gt 0 ] && echo " - $$ comms " )
VERDATE := $( shell date +%Y/%m/%d -d "`git-log HEAD^.. 2>/dev/null | grep -m 1 ^Date: | cut -f2- -d: | cut -f1 -d+`" )
2007-09-10 01:31:11 +04:00
e n d i f
e n d i f
2008-01-02 22:48:34 +03:00
# Last commit version not found, take it from the files.
2007-09-10 01:31:11 +04:00
i f e q ( $( VERSION ) , )
VERSION := $( shell cat VERSION 2>/dev/null || touch VERSION)
e n d i f
i f e q ( $( SUBVERS ) , )
SUBVERS := $( shell cat SUBVERS 2>/dev/null || touch SUBVERS)
e n d i f
i f e q ( $( VERDATE ) , )
VERDATE := $( shell cat VERDATE 2>/dev/null || touch VERDATE)
2006-12-23 13:12:04 +03:00
e n d i f
2006-11-13 01:57:19 +03:00
2008-01-02 22:48:34 +03:00
#### Build options
# Do not change these ones, enable USE_* variables instead.
OPTIONS_CFLAGS =
OPTIONS_LDFLAGS =
OPTIONS_OBJS =
# 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.
BUILD_OPTIONS =
2006-11-13 01:57:19 +03:00
2008-01-02 22:48:34 +03:00
# Return USE_xxx=$(USE_xxx) unless $(USE_xxx) = "implicit"
# Usage:
# BUILD_OPTIONS += $(call ignore_implicit,USE_xxx)
ignore_implicit = $( patsubst %= implicit,,$( 1) = $( $( 1) ) )
2006-11-13 01:57:19 +03:00
2007-01-07 04:03:04 +03:00
i f n e q ( $( USE_TCPSPLICE ) , )
2008-01-02 22:48:34 +03:00
# This is the directory hosting libtcpsplice.[ah]
TCPSPLICEDIR :=
OPTIONS_CFLAGS += -DCONFIG_HAP_TCPSPLICE -I$( TCPSPLICEDIR)
OPTIONS_LDFLAGS += -L$( TCPSPLICEDIR) -ltcpsplice
BUILD_OPTIONS += $( call ignore_implicit,USE_TCPSPLICE)
2007-01-07 04:03:04 +03:00
e n d i f
2006-11-13 01:57:19 +03:00
i f n e q ( $( USE_CTTPROXY ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DCONFIG_HAP_CTTPROXY
OPTIONS_OBJS += src/cttproxy.o
BUILD_OPTIONS += $( call ignore_implicit,USE_CTTPROXY)
2006-11-13 01:57:19 +03:00
e n d i f
i f n e q ( $( USE_TPROXY ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DTPROXY
BUILD_OPTIONS += $( call ignore_implicit,USE_TPROXY)
2006-11-13 01:57:19 +03:00
e n d i f
2008-01-13 16:49:51 +03:00
i f n e q ( $( USE_LINUX_TPROXY ) , )
OPTIONS_CFLAGS += -DCONFIG_HAP_LINUX_TPROXY
BUILD_OPTIONS += $( call ignore_implicit,USE_LINUX_TPROXY)
e n d i f
2006-11-13 01:57:19 +03:00
i f n e q ( $( USE_POLL ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DENABLE_POLL
OPTIONS_OBJS += src/ev_poll.o
BUILD_OPTIONS += $( call ignore_implicit,USE_POLL)
2006-11-13 01:57:19 +03:00
e n d i f
i f n e q ( $( USE_EPOLL ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DENABLE_EPOLL
OPTIONS_OBJS += src/ev_epoll.o
BUILD_OPTIONS += $( call ignore_implicit,USE_EPOLL)
2006-11-13 01:57:19 +03:00
e n d i f
2007-04-16 02:53:59 +04:00
i f n e q ( $( USE_SEPOLL ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DENABLE_SEPOLL
OPTIONS_OBJS += src/ev_sepoll.o
BUILD_OPTIONS += $( call ignore_implicit,USE_SEPOLL)
2007-04-16 02:53:59 +04:00
e n d i f
2006-11-13 01:57:19 +03:00
i f n e q ( $( USE_MY_EPOLL ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DUSE_MY_EPOLL
BUILD_OPTIONS += $( call ignore_implicit,USE_MY_EPOLL)
e n d i f
i f n e q ( $( USE_KQUEUE ) , )
OPTIONS_CFLAGS += -DENABLE_KQUEUE
OPTIONS_OBJS += src/ev_kqueue.o
BUILD_OPTIONS += $( call ignore_implicit,USE_KQUEUE)
2006-11-13 01:57:19 +03:00
e n d i f
i f n e q ( $( USE_NETFILTER ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DNETFILTER
BUILD_OPTIONS += $( call ignore_implicit,USE_NETFILTER)
2006-11-13 01:57:19 +03:00
e n d i f
i f n e q ( $( USE_EPOLL_WORKAROUND ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DEPOLL_CTL_MOD_WORKAROUND
BUILD_OPTIONS += $( call ignore_implicit,USE_EPOLL_WORKAROUND)
2006-11-13 01:57:19 +03:00
e n d i f
i f n e q ( $( USE_GETSOCKNAME ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DUSE_GETSOCKNAME
BUILD_OPTIONS += $( call ignore_implicit,USE_GETSOCKNAME)
2006-11-13 01:57:19 +03:00
e n d i f
i f n e q ( $( USE_REGPARM ) , )
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DCONFIG_HAP_USE_REGPARM
BUILD_OPTIONS += $( call ignore_implicit,USE_REGPARM)
2006-11-13 01:57:19 +03:00
e n d i f
2008-03-07 12:02:14 +03:00
# report DLMALLOC_SRC only if explicitly specified
i f n e q ( $( DLMALLOC_SRC ) , )
BUILD_OPTIONS += DLMALLOC_SRC = $( DLMALLOC_SRC)
e n d i f
2008-02-19 12:53:32 +03:00
i f n e q ( $( USE_DLMALLOC ) , )
BUILD_OPTIONS += $( call ignore_implicit,USE_DLMALLOC)
i f e q ( $( DLMALLOC_SRC ) , )
DLMALLOC_SRC = src/dlmalloc.c
e n d i f
e n d i f
2007-07-11 11:19:31 +04:00
i f n e q ( $( DLMALLOC_SRC ) , )
2008-03-07 12:02:14 +03:00
# DLMALLOC_THRES may be changed to match PAGE_SIZE on every platform
2008-01-02 22:48:34 +03:00
DLMALLOC_THRES = 4096
OPTIONS_OBJS += src/dlmalloc.o
2007-07-11 11:19:31 +04:00
e n d i f
2008-01-02 22:48:34 +03:00
i f n e q ( $( USE_PCRE ) , )
# PCREDIR is the directory hosting include/pcre.h and lib/libpcre.*. It is
# automatically detected but can be forced if required.
i f e q ( $( PCREDIR ) , )
PCREDIR := $( shell pcre-config --prefix 2>/dev/null || echo /usr/local)
2006-12-22 17:28:43 +03:00
e n d i f
2008-01-02 22:48:34 +03:00
OPTIONS_CFLAGS += -DUSE_PCRE -I$( PCREDIR) /include
OPTIONS_LDFLAGS += -L$( PCREDIR) /lib -lpcreposix -lpcre
BUILD_OPTIONS += $( call ignore_implicit,USE_PCRE)
2006-12-22 17:28:43 +03:00
e n d i f
2008-01-02 22:48:34 +03:00
i f n e q ( $( USE_STATIC_PCRE ) , )
# PCREDIR is the directory hosting include/pcre.h and lib/libpcre.*. It is
# automatically detected but can be forced if required.
i f e q ( $( PCREDIR ) , )
PCREDIR := $( shell pcre-config --prefix 2>/dev/null || echo /usr/local)
e n d i f
OPTIONS_CFLAGS += -DUSE_PCRE -I$( PCREDIR) /include
OPTIONS_LDFLAGS += -L$( PCREDIR) /lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
BUILD_OPTIONS += $( call ignore_implicit,USE_STATIC_PCRE)
e n d i f
2006-11-13 01:57:19 +03:00
2008-01-02 22:48:34 +03:00
#### Global compile options
VERBOSE_CFLAGS = $( CFLAGS) $( TARGET_CFLAGS) $( SMALL_OPTS) $( DEFINE)
COPTS = -Iinclude -Wall
COPTS += $( CFLAGS) $( TARGET_CFLAGS) $( SMALL_OPTS) $( DEFINE) $( SILENT_DEFINE)
COPTS += $( DEBUG) $( OPTIONS_CFLAGS) $( ADDINC)
2005-12-17 16:08:03 +03:00
2008-01-02 22:48:34 +03:00
i f n e q ( $( VERSION ) $( SUBVERS ) , )
COPTS += -DCONFIG_HAPROXY_VERSION= \" $( VERSION) $( SUBVERS) \"
e n d i f
2007-01-07 04:03:04 +03:00
2008-01-02 22:48:34 +03:00
i f n e q ( $( VERDATE ) , )
COPTS += -DCONFIG_HAPROXY_DATE= \" $( VERDATE) \"
2007-01-07 04:03:04 +03:00
e n d i f
2008-01-02 22:48:34 +03: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 14:29:56 +03:00
2008-03-11 08:37:39 +03:00
i f e q ( $( 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
@echo " linux26, linux24, linux24e, linux24eold, linux22, solaris"
@echo " freebsd, openbsd, custom, generic"
@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
e l s e
2005-12-17 14:21:26 +03:00
all : haproxy
2008-03-11 08:37:39 +03:00
e n d i f
2005-12-17 14:21:26 +03:00
2007-10-16 14:25:14 +04:00
OBJS = src/haproxy.o src/sessionhash.o src/base64.o src/protocols.o \
2006-06-26 04:48:02 +04:00
src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \
src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \
2007-10-16 19:34:28 +04:00
src/checks.o src/queue.o src/client.o src/proxy.o src/proto_uxst.o \
2006-06-26 04:48:02 +04:00
src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \
[MAJOR] add a connection error state to the stream_interface
Tracking connection status changes was hard, and some code was
redundant. A new SI_ST_CER state was added to the stream interface
to indicate a past connection error, and an SI_FL_ERR flag was
added to report past I/O error. The stream_sock code does not set
the connection to SI_ST_CLO anymore in case of I/O error, it's
the upper layer which does it. This makes it possible to know
exactly when the file descriptors are allocated.
The new SI_ST_CER state permitted to split tcp_connection_status()
in two parts, one processing SI_ST_CON and the other one SI_ST_CER.
Synchronous connection errors now make use of this last state, hence
eliminating duplicate code.
Some ib<->ob copy paste errors were found and fixed, and all entities
setting SI_ST_CLO also shut the buffers down.
Some of these stream_interface specific functions and structures
have migrated to a new stream_interface.c file.
Some types of errors are still not detected by the buffers. For
instance, let's assume the following scenario in one single pass
of process_session: a connection sits in SI_ST_TAR state during
a retry. At TAR expiration, a new connection attempt is made, the
connection is obtained and srv->cur_sess is increased. Then the
buffer timeout is fires and everything is cleared, the new state
becomes SI_ST_CLO. The cleaning code checks that previous state
was either SI_ST_CON or SI_ST_EST to release the connection. But
that's wrong because last state is still SI_ST_TAR. So the
server's connection count does not get decreased.
This means that prev_state must not be used, and must be replaced
by some transition detection instead of level detection.
The following debugging line was useful to track state changes :
fprintf(stderr, "%s:%d: cs=%d ss=%d(%d) rqf=0x%08x rpf=0x%08x\n", __FUNCTION__, __LINE__,
s->si[0].state, s->si[1].state, s->si[1].err_type, s->req->flags, s-> rep->flags);
2008-11-03 08:26:53 +03:00
src/stream_interface.o src/senddata.o src/dumpstats.o src/proto_tcp.o \
2007-11-16 01:56:17 +03:00
src/session.o src/hdr_idx.o src/ev_select.o \
src/acl.o src/memory.o \
src/ebtree.o src/eb32tree.o
2006-06-26 04:48:02 +04:00
2008-01-02 22:48:34 +03:00
haproxy : $( OBJS ) $( OPTIONS_OBJS )
$( LD) $( LDFLAGS) -o $@ $^ $( LDOPTS)
2005-12-17 14:21:26 +03:00
2006-06-26 04:48:02 +04:00
objsize : haproxy
@objdump -t $^| grep ' g ' | grep -F '.text' | awk '{print $$5 FS $$6}' | sort
2005-12-17 14:21:26 +03:00
%.o : %.c
2008-01-02 22:48:34 +03:00
$( CC) $( COPTS) -c -o $@ $<
2005-12-17 14:21:26 +03:00
2007-12-02 13:28:59 +03:00
src/haproxy.o : src /haproxy .c
2008-01-02 22:48:34 +03:00
$( CC) $( COPTS) \
-DBUILD_TARGET= '"$(strip $(TARGET))"' \
-DBUILD_CPU= '"$(strip $(CPU))"' \
-DBUILD_CC= '"$(strip $(CC))"' \
-DBUILD_CFLAGS= '"$(strip $(VERBOSE_CFLAGS))"' \
-DBUILD_OPTIONS= '"$(strip $(BUILD_OPTIONS))"' \
-c -o $@ $<
2007-12-02 13:28:59 +03:00
2007-07-11 11:19:31 +04:00
src/dlmalloc.o : $( DLMALLOC_SRC )
2008-01-02 22:48:34 +03:00
$( CC) $( COPTS) -DDEFAULT_MMAP_THRESHOLD= $( DLMALLOC_THRES) -c -o $@ $<
2007-07-11 11:19:31 +04:00
2008-03-12 16:57:54 +03:00
install-man :
2008-03-12 19:19:16 +03:00
install -d $( DESTDIR) $( MANDIR) /man1
install -m 644 doc/haproxy.1 $( DESTDIR) $( MANDIR) /man1
2008-03-12 16:57:54 +03:00
2008-03-12 18:24:49 +03:00
install-doc :
2008-03-12 19:19:16 +03:00
install -d $( DESTDIR) $( DOCDIR)
2008-03-12 18:24:49 +03:00
for x in configuration architecture haproxy-en haproxy-fr; do \
2008-03-12 19:19:16 +03:00
install -m 644 doc/$$ x.txt $( DESTDIR) $( DOCDIR) ; \
2008-03-12 18:24:49 +03:00
done
2008-06-12 02:25:46 +04:00
install-bin : haproxy
2008-03-12 19:19:16 +03:00
install -d $( DESTDIR) $( SBINDIR)
install haproxy $( DESTDIR) $( SBINDIR)
2008-03-12 16:25:35 +03:00
2008-03-12 19:28:13 +03:00
install : install -bin install -man install -doc
2008-03-12 17:21:05 +03:00
2005-12-17 14:21:26 +03:00
clean :
2006-10-16 01:40:58 +04:00
rm -f *.[ oas] src/*.[ oas] core haproxy test
for dir in . src include/* doc; do rm -f $$ dir/*~ $$ dir/*.rej; done
2006-12-23 13:12:04 +03:00
rm -f haproxy-$( VERSION) .tar.gz haproxy-$( VERSION) $( SUBVERS) .tar.gz
rm -f haproxy-$( VERSION) nohup.out gmon.out
2005-12-17 14:51:03 +03:00
2006-03-19 23:30:14 +03:00
tar : clean
2006-03-19 23:16:26 +03:00
ln -s . haproxy-$( VERSION)
2006-06-26 04:48:02 +04:00
tar --exclude= haproxy-$( VERSION) /.git \
--exclude= haproxy-$( VERSION) /haproxy-$( VERSION) \
--exclude= haproxy-$( VERSION) /haproxy-$( VERSION) .tar.gz \
-cf - haproxy-$( VERSION) /* | gzip -c9 >haproxy-$( VERSION) .tar.gz
2006-03-19 23:16:26 +03:00
rm -f haproxy-$( VERSION)
2006-10-15 16:24:14 +04:00
git-tar : clean
2006-12-23 13:12:04 +03:00
git-tar-tree HEAD haproxy-$( VERSION) | gzip -9 > haproxy-$( VERSION) $( SUBVERS) .tar.gz
2007-09-10 01:31:11 +04: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