blob: 5e37f987869bc83bc8353d55c8122c40e146c35b [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 Tarreaud661cc02007-03-26 00:24:56 +02005VERSION := 1.3.8
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
32COPTS.darwin = -DENABLE_POLL
33LIBS.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.
72DEFINE = -DTPROXY
73
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 \
90 src/session.o src/hdr_idx.o src/rbtree.o
91
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