blob: 4b028715fef7640ee2d119a519c43434464cc51c [file] [log] [blame]
Willy Tarreaucec2e7a2007-03-25 16:55:56 +02001# This makefile is dedicated to darwin (and possibly other BSDs)
2# You should use it this way :
3# make TARGET=os CPU=cpu
4
Willy Tarreau6e0433f2007-04-16 01:18:12 +02005VERSION := 1.3.9
Willy Tarreaucec2e7a2007-03-25 16:55:56 +02006
7# Select target OS. TARGET must match a system for which COPTS and LIBS are
8# correctly defined below.
9TARGET = generic
10
11# pass CPU=<cpu_name> to make to optimize for a particular CPU
12CPU = generic
13#CPU = i586
14#CPU = i686
15#CPU = ultrasparc
16
17# By default, we use libc's regex. WARNING! On Solaris 8/Sparc, group
18# references seem broken using libc ! Use pcre instead.
19REGEX=libc
20#REGEX=pcre
21#REGEX=static-pcre
22
23# tools options
24CC = gcc
25LD = gcc
26
27# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
28PCREDIR!= pcre-config --prefix 2>/dev/null || :
29#PCREDIR=/usr/local
30
31# This is for darwin 3.0 and above
Willy Tarreau8ae42f42007-04-09 16:30:28 +020032COPTS.darwin = -DENABLE_POLL -DENABLE_KQUEUE
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020033LIBS.darwin =
34
35# CPU dependant optimizations
36COPTS.generic = -O2
37COPTS.i586 = -O2 -march=i586
38COPTS.i686 = -O2 -march=i686
39COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
40
41# options for standard regex library
42COPTS.libc=
43LIBS.libc=
44
45# options for libpcre
46COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
47LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
48
49# options for static libpcre
50COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include
51LIBS.static-pcre=-L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
52
53# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
54#DEBUG = -g -DDEBUG_MEMORY -DDEBUG_FULL
55DEBUG = -g
56
57# if small memory footprint is required, you can reduce the buffer size. There
58# are 2 buffers per concurrent session, so 16 kB buffers will eat 32 MB memory
59# with 1000 concurrent sessions. Putting it slightly lower than a page size
60# will avoid the additionnal paramters to overflow a page. 8030 bytes is
61# exactly 5.5 TCP segments of 1460 bytes.
62#SMALL_OPTS =
63SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024
64
65# redefine this if you want to add some special PATH to include/libs
66ADDINC =
67ADDLIB =
68
69# set some defines when needed.
70# Known ones are -DENABLE_POLL
71# - use -DTPROXY to compile with transparent proxy support.
Willy Tarreau8ae42f42007-04-09 16:30:28 +020072DEFINE = -DTPROXY
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020073
74# global options
75TARGET_OPTS=$(COPTS.$(TARGET))
76REGEX_OPTS=$(COPTS.$(REGEX))
77CPU_OPTS=$(COPTS.$(CPU))
78
79COPTS=-Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
80LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
81
82CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
83LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
84
85OBJS = src/haproxy.o src/list.o src/chtbl.o src/hashpjw.o src/base64.o \
86 src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \
87 src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \
88 src/checks.o src/queue.o src/capture.o src/client.o src/proxy.o \
89 src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \
Willy Tarreau2e8eb672007-04-30 17:30:59 +020090 src/session.o src/hdr_idx.o src/ev_select.o src/ev_poll.o
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020091
92all: haproxy
93
94haproxy: $(OBJS)
95 $(LD) $(LDFLAGS) $(OBJS) -o $@
96
97.SUFFIXES: .c.o
98
99.c.o:
100 $(CC) $(CFLAGS) -c -o $@ $<
101
102clean:
103 rm -f *.[oas] src/*.[oas] core haproxy test
104 for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
105 rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out