2005-12-17 16:08:03 +03:00
# This makefile supports different OS and CPU setups.
# You should use it this way :
# make TARGET=os CPU=cpu
2005-12-17 15:21:24 +03:00
# Select target OS. TARGET must match a system for which COPTS and LIBS are
# correctly defined below.
2005-12-18 03:11:29 +03:00
#TARGET = linux26
2005-12-17 15:21:24 +03:00
TARGET = linux24
2005-12-18 03:13:11 +03:00
#TARGET = linux24e
2005-12-17 15:21:24 +03:00
#TARGET = linux22
#TARGET = solaris
#TARGET = openbsd
2005-12-17 16:08:03 +03:00
# pass CPU=<cpu_name> to make to optimize for a particular CPU
CPU = generic
#CPU = i586
#CPU = i686
#CPU = ultrasparc
2005-12-17 14:21:26 +03:00
2005-12-18 03:32:31 +03:00
# By default, we use libc's regex. WARNING! On Solaris 8/Sparc, group
# references seem broken using libc ! Use pcre instead.
2005-12-17 15:46:33 +03:00
REGEX = libc
#REGEX=pcre
2005-12-18 03:32:31 +03:00
#REGEX=static-pcre
2005-12-17 15:46:33 +03:00
2005-12-17 16:08:03 +03:00
# tools options
CC = gcc
LD = gcc
2005-12-17 15:46:33 +03:00
# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
2005-12-17 15:57:42 +03:00
PCREDIR := $( shell pcre-config --prefix 2>/dev/null || :)
2005-12-17 15:46:33 +03:00
#PCREDIR=/usr/local
2005-12-18 03:13:11 +03:00
# This is for standard Linux 2.6 with netfilter and epoll()
2005-12-18 03:11:29 +03:00
COPTS.linux26 = -DNETFILTER -DENABLE_POLL -DENABLE_EPOLL
LIBS.linux26 =
2005-12-18 03:31:20 +03:00
# This is for enhanced Linux 2.4 with netfilter and epoll() patch.
# Warning! If kernel is 2.4 with epoll-lt <= 0.21, then you must add
# -DEPOLL_CTL_MOD_WORKAROUND to workaround a very rare bug.
#COPTS.linux24e = -DNETFILTER -DENABLE_POLL -DENABLE_EPOLL -DUSE_MY_EPOLL -DEPOLL_CTL_MOD_WORKAROUND
2005-12-18 03:13:11 +03:00
COPTS.linux24e = -DNETFILTER -DENABLE_POLL -DENABLE_EPOLL -DUSE_MY_EPOLL
LIBS.linux24e =
# This is for standard Linux 2.4 with netfilter but without epoll()
2005-12-18 03:11:29 +03:00
COPTS.linux24 = -DNETFILTER -DENABLE_POLL
2005-12-17 14:48:26 +03:00
LIBS.linux24 =
2005-12-17 14:21:26 +03:00
2005-12-17 14:48:26 +03:00
# This is for Linux 2.2
2005-12-18 03:11:29 +03:00
COPTS.linux22 = -DUSE_GETSOCKNAME -DENABLE_POLL
2005-12-17 14:48:26 +03:00
LIBS.linux22 =
# This is for Solaris 8
2005-12-18 03:13:11 +03:00
COPTS.solaris = -fomit-frame-pointer -DENABLE_POLL -DFD_SETSIZE= 65536
2005-12-17 14:29:56 +03:00
LIBS.solaris = -lnsl -lsocket
2005-12-17 14:21:26 +03:00
2005-12-17 14:48:26 +03:00
# This is for OpenBSD 3.0
2005-12-18 03:11:29 +03:00
COPTS.openbsd = -DENABLE_POLL
2005-12-17 14:48:26 +03:00
LIBS.openbsd =
2005-12-17 16:08:03 +03:00
# CPU dependant optimizations
COPTS.generic = -O2
COPTS.i586 = -O2 -march= i586
COPTS.i686 = -O2 -march= i686
COPTS.ultrasparc = -O6 -mcpu= v9 -mtune= ultrasparc
# options for standard regex library
2005-12-17 15:46:33 +03:00
COPTS.libc =
2005-12-17 16:08:03 +03:00
LIBS.libc =
2005-12-17 15:46:33 +03:00
2005-12-17 16:08:03 +03:00
# options for libpcre
2005-12-17 15:46:33 +03:00
COPTS.pcre = -DUSE_PCRE -I$( PCREDIR) /include
LIBS.pcre = -L$( PCREDIR) /lib -lpcreposix -lpcre
2005-12-18 03:32:31 +03:00
# options for static libpcre
COPTS.static-pcre = -DUSE_PCRE -I$( PCREDIR) /include
LIBS.static-pcre = -L$( PCREDIR) /lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
2005-12-17 16:08:03 +03:00
# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
2005-12-18 03:13:11 +03:00
#DEBUG = -g -DDEBUG_MEMORY
2005-12-17 14:48:26 +03:00
DEBUG = -g
2005-12-17 14:29:56 +03:00
2005-12-18 03:02:42 +03:00
# 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
2005-12-18 03:13:11 +03:00
# with 1000 concurrent sessions. Putting it slightly lower than a page size
# will avoid the additionnal paramters to overflow a page.
2006-03-12 19:31:45 +03:00
#SMALL_OPTS = -DBUFSIZE=8100 -DMAXREWRITE=1000 -DSYSTEM_MAXCONN=1024
2005-12-18 03:02:42 +03:00
SMALL_OPTS =
2005-12-18 03:11:29 +03:00
# redefine this if you want to add some special PATH to include/libs
ADDINC =
ADDLIB =
# set some defines when needed.
# Known ones are -DENABLE_POLL, -DENABLE_EPOLL, and -DUSE_MY_EPOLL
DEFINE =
2005-12-18 03:02:42 +03:00
2005-12-17 16:08:03 +03:00
# global options
TARGET_OPTS = $( COPTS.$( TARGET) )
REGEX_OPTS = $( COPTS.$( REGEX) )
CPU_OPTS = $( COPTS.$( CPU) )
2005-12-18 03:11:29 +03:00
COPTS = -I. $( ADDINC) $( CPU_OPTS) $( TARGET_OPTS) $( REGEX_OPTS) $( SMALL_OPTS) $( DEFINE)
2005-12-18 03:09:15 +03:00
LIBS = $( LIBS.$( TARGET) ) $( LIBS.$( REGEX) ) $( ADDLIB)
2005-12-17 14:29:56 +03:00
2005-12-17 14:48:26 +03:00
# - use -DSTATTIME=0 to disable statistics, else specify an interval in
# milliseconds.
2005-12-17 15:08:06 +03:00
# - use -DTPROXY to compile with transparent proxy support.
CFLAGS = -Wall $( COPTS) $( DEBUG) -DSTATTIME= 0 -DTPROXY
2005-12-17 14:21:26 +03:00
LDFLAGS = -g
all : haproxy
2006-01-30 01:19:04 +03:00
# on OpenBSD, you have to do it this way :
haproxy.bsd : src /list .o src /chtbl .o src /hashpjw .o haproxy .o
$( LD) $( LDFLAGS) -o $@ $> $( LIBS)
2005-12-18 03:03:27 +03:00
haproxy : src /list .o src /chtbl .o src /hashpjw .o haproxy .o
2005-12-17 14:21:26 +03:00
$( LD) $( LDFLAGS) -o $@ $^ $( LIBS)
%.o : %.c
$( CC) $( CFLAGS) -c -o $@ $<
clean :
2005-12-18 03:03:27 +03:00
rm -f *.[ oas] *~ *.rej core haproxy test nohup.out gmon.out src/*.[ oas]
2005-12-17 14:51:03 +03:00