2007-03-25 14:55:56 +00:00
|
|
|
# This makefile is dedicated to darwin (and possibly other BSDs)
|
|
|
|
# You should use it this way :
|
|
|
|
# make TARGET=os CPU=cpu
|
2007-07-11 07:19:31 +00:00
|
|
|
#
|
|
|
|
# Some optional components may be added, such as DLMALLOC :
|
|
|
|
#
|
|
|
|
# make DLMALLOC_SRC=/usr/local/src/dlmalloc.c \
|
|
|
|
# OPT_OBJS=src/dlmalloc.o
|
2007-03-25 14:55:56 +00:00
|
|
|
|
|
|
|
# Select target OS. TARGET must match a system for which COPTS and LIBS are
|
|
|
|
# correctly defined below.
|
|
|
|
TARGET = generic
|
|
|
|
|
|
|
|
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
|
|
|
CPU = generic
|
|
|
|
#CPU = i586
|
|
|
|
#CPU = i686
|
|
|
|
#CPU = ultrasparc
|
|
|
|
|
|
|
|
# By default, we use libc's regex. WARNING! On Solaris 8/Sparc, group
|
|
|
|
# references seem broken using libc ! Use pcre instead.
|
|
|
|
REGEX=libc
|
|
|
|
#REGEX=pcre
|
|
|
|
#REGEX=static-pcre
|
|
|
|
|
|
|
|
# tools options
|
|
|
|
CC = gcc
|
|
|
|
LD = gcc
|
|
|
|
|
|
|
|
# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
|
|
|
|
PCREDIR!= pcre-config --prefix 2>/dev/null || :
|
|
|
|
#PCREDIR=/usr/local
|
|
|
|
|
|
|
|
# This is for darwin 3.0 and above
|
2007-04-09 14:30:28 +00:00
|
|
|
COPTS.darwin = -DENABLE_POLL -DENABLE_KQUEUE
|
2007-03-25 14:55:56 +00:00
|
|
|
LIBS.darwin =
|
|
|
|
|
|
|
|
# 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
|
|
|
|
COPTS.libc=
|
|
|
|
LIBS.libc=
|
|
|
|
|
|
|
|
# options for libpcre
|
|
|
|
COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
|
|
|
|
LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
|
|
|
|
|
|
|
|
# options for static libpcre
|
|
|
|
COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include
|
|
|
|
LIBS.static-pcre=-L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
|
|
|
|
|
|
|
|
# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
|
|
|
|
#DEBUG = -g -DDEBUG_MEMORY -DDEBUG_FULL
|
|
|
|
DEBUG = -g
|
|
|
|
|
|
|
|
# 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 avoid the additionnal paramters to overflow a page. 8030 bytes is
|
|
|
|
# exactly 5.5 TCP segments of 1460 bytes.
|
|
|
|
#SMALL_OPTS =
|
|
|
|
SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# - use -DTPROXY to compile with transparent proxy support.
|
2007-04-09 14:30:28 +00:00
|
|
|
DEFINE = -DTPROXY
|
2007-03-25 14:55:56 +00:00
|
|
|
|
2007-07-11 07:19:31 +00:00
|
|
|
# May be changed to patch PAGE_SIZE on every platform when using dlmalloc
|
|
|
|
DLMALLOC_THRES=4096
|
|
|
|
|
2007-03-25 14:55:56 +00:00
|
|
|
# global options
|
|
|
|
TARGET_OPTS=$(COPTS.$(TARGET))
|
|
|
|
REGEX_OPTS=$(COPTS.$(REGEX))
|
|
|
|
CPU_OPTS=$(COPTS.$(CPU))
|
|
|
|
|
2007-09-09 21:31:11 +00:00
|
|
|
VERSION != cat VERSION 2>/dev/null || touch VERSION
|
|
|
|
SUBVERS != cat SUBVERS 2>/dev/null || touch SUBVERS
|
|
|
|
VERDATE != cat VERDATE 2>/dev/null || touch VERDATE
|
|
|
|
|
|
|
|
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
|
|
|
|
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
|
2007-03-25 14:55:56 +00:00
|
|
|
|
2007-09-09 21:31:11 +00:00
|
|
|
COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
|
|
|
|
$(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
|
|
|
|
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
|
|
|
|
CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
|
2007-03-25 14:55:56 +00:00
|
|
|
LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
|
|
|
|
|
2007-09-09 19:56:53 +00:00
|
|
|
OBJS = src/haproxy.o src/sessionhash.o src/base64.o \
|
2007-03-25 14:55:56 +00: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-05-13 19:45:51 +00:00
|
|
|
src/checks.o src/queue.o src/client.o src/proxy.o \
|
2007-03-25 14:55:56 +00:00
|
|
|
src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \
|
2007-05-13 16:26:08 +00:00
|
|
|
src/session.o src/hdr_idx.o src/ev_select.o src/ev_poll.o src/acl.o \
|
|
|
|
src/memory.o
|
2007-03-25 14:55:56 +00:00
|
|
|
|
|
|
|
all: haproxy
|
|
|
|
|
|
|
|
haproxy: $(OBJS)
|
|
|
|
$(LD) $(LDFLAGS) $(OBJS) -o $@
|
|
|
|
|
|
|
|
.SUFFIXES: .c.o
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
2007-07-11 07:19:31 +00:00
|
|
|
src/dlmalloc.o: $(DLMALLOC_SRC)
|
|
|
|
$(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
|
|
|
|
|
2007-03-25 14:55:56 +00:00
|
|
|
clean:
|
|
|
|
rm -f *.[oas] src/*.[oas] core haproxy test
|
|
|
|
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
|
|
|
|
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
|
2007-09-09 21:31:11 +00:00
|
|
|
|
|
|
|
version:
|
|
|
|
@echo "VERSION: $(VERSION)"
|
|
|
|
@echo "SUBVERS: $(SUBVERS)"
|
|
|
|
@echo "VERDATE: $(VERDATE)"
|