2005-12-17 13:08:03 +00:00
|
|
|
# This makefile supports different OS and CPU setups.
|
|
|
|
# You should use it this way :
|
|
|
|
# make TARGET=os CPU=cpu
|
|
|
|
|
2005-12-17 12:21:24 +00:00
|
|
|
# Select target OS. TARGET must match a system for which COPTS and LIBS are
|
|
|
|
# correctly defined below.
|
|
|
|
TARGET = linux24
|
|
|
|
#TARGET = linux22
|
|
|
|
#TARGET = solaris
|
|
|
|
#TARGET = openbsd
|
|
|
|
|
2005-12-17 13:08:03 +00:00
|
|
|
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
|
|
|
CPU = generic
|
|
|
|
#CPU = i586
|
|
|
|
#CPU = i686
|
|
|
|
#CPU = ultrasparc
|
2005-12-17 11:21:26 +00:00
|
|
|
|
2005-12-17 12:46:33 +00:00
|
|
|
# By default, we use libc's regex.
|
|
|
|
REGEX=libc
|
|
|
|
#REGEX=pcre
|
|
|
|
|
2005-12-17 13:08:03 +00:00
|
|
|
# tools options
|
|
|
|
CC = gcc
|
|
|
|
LD = gcc
|
|
|
|
|
2005-12-17 12:46:33 +00:00
|
|
|
# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
|
2005-12-17 12:57:42 +00:00
|
|
|
PCREDIR := $(shell pcre-config --prefix 2>/dev/null || :)
|
2005-12-17 12:46:33 +00:00
|
|
|
#PCREDIR=/usr/local
|
|
|
|
|
2005-12-17 11:48:26 +00:00
|
|
|
# This is for Linux 2.4 with netfilter
|
2005-12-17 13:08:03 +00:00
|
|
|
COPTS.linux24 = -DNETFILTER
|
2005-12-17 11:48:26 +00:00
|
|
|
LIBS.linux24 =
|
2005-12-17 11:21:26 +00:00
|
|
|
|
2005-12-17 11:48:26 +00:00
|
|
|
# This is for Linux 2.2
|
2005-12-17 13:08:03 +00:00
|
|
|
COPTS.linux22 = -DUSE_GETSOCKNAME
|
2005-12-17 11:48:26 +00:00
|
|
|
LIBS.linux22 =
|
|
|
|
|
|
|
|
# This is for Solaris 8
|
2005-12-17 13:08:03 +00:00
|
|
|
COPTS.solaris = -fomit-frame-pointer -DSOLARIS
|
2005-12-17 11:29:56 +00:00
|
|
|
LIBS.solaris = -lnsl -lsocket
|
2005-12-17 11:21:26 +00:00
|
|
|
|
2005-12-17 11:48:26 +00:00
|
|
|
# This is for OpenBSD 3.0
|
2005-12-17 13:08:03 +00:00
|
|
|
COPTS.openbsd =
|
2005-12-17 11:48:26 +00:00
|
|
|
LIBS.openbsd =
|
|
|
|
|
2005-12-17 13:08:03 +00: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 12:46:33 +00:00
|
|
|
COPTS.libc=
|
2005-12-17 13:08:03 +00:00
|
|
|
LIBS.libc=
|
2005-12-17 12:46:33 +00:00
|
|
|
|
2005-12-17 13:08:03 +00:00
|
|
|
# options for libpcre
|
2005-12-17 12:46:33 +00:00
|
|
|
COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
|
|
|
|
LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
|
|
|
|
|
2005-12-17 13:08:03 +00:00
|
|
|
# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
|
2005-12-17 11:48:26 +00:00
|
|
|
#DEBUG =
|
|
|
|
DEBUG = -g
|
2005-12-17 11:29:56 +00:00
|
|
|
|
2005-12-17 13:08:03 +00:00
|
|
|
# global options
|
|
|
|
TARGET_OPTS=$(COPTS.$(TARGET))
|
|
|
|
REGEX_OPTS=$(COPTS.$(REGEX))
|
|
|
|
CPU_OPTS=$(COPTS.$(CPU))
|
|
|
|
|
|
|
|
COPTS=$(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS)
|
2005-12-17 12:46:33 +00:00
|
|
|
LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX))
|
2005-12-17 11:29:56 +00:00
|
|
|
|
2005-12-17 11:48:26 +00:00
|
|
|
# - use -DSTATTIME=0 to disable statistics, else specify an interval in
|
|
|
|
# milliseconds.
|
2005-12-17 12:08:06 +00:00
|
|
|
# - use -DTPROXY to compile with transparent proxy support.
|
|
|
|
CFLAGS = -Wall $(COPTS) $(DEBUG) -DSTATTIME=0 -DTPROXY
|
2005-12-17 11:21:26 +00:00
|
|
|
LDFLAGS = -g
|
|
|
|
|
|
|
|
all: haproxy
|
|
|
|
|
|
|
|
haproxy: haproxy.o
|
|
|
|
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
2005-12-17 12:10:27 +00:00
|
|
|
rm -f *.[oas] *~ core haproxy test nohup.out gmon.out
|
2005-12-17 11:51:03 +00:00
|
|
|
|