blob: 55c5a566821610bf6398e1eedb2d6e0c13f8efc1 [file] [log] [blame]
willy tarreaud38e72d2006-03-19 20:56:52 +01001# This makefile is dedicated to OpenBSD (and possibly other BSDs)
Willy Tarreau4eeec092006-10-15 23:50:42 +02002# 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 tarreaud38e72d2006-03-19 20:56:52 +01006
7# Select target OS. TARGET must match a system for which COPTS and LIBS are
8# correctly defined below.
9TARGET = openbsd
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
Willy Tarreau4eeec092006-10-15 23:50:42 +020027# 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
willy tarreaud38e72d2006-03-19 20:56:52 +010030
Willy Tarreau4eeec092006-10-15 23:50:42 +020031# This is for OpenBSD 3.0 and above
Willy Tarreau1e63130a2007-04-09 12:03:06 +020032COPTS.openbsd = -DENABLE_POLL -DENABLE_KQUEUE
willy tarreaud38e72d2006-03-19 20:56:52 +010033LIBS.openbsd =
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.
Willy Tarreau4eeec092006-10-15 23:50:42 +020070# Known ones are -DENABLE_POLL
willy tarreaud38e72d2006-03-19 20:56:52 +010071# - use -DTPROXY to compile with transparent proxy support.
Willy Tarreaubaaee002006-06-26 02:48:02 +020072DEFINE = -DTPROXY
willy tarreaud38e72d2006-03-19 20:56:52 +010073
74# global options
75TARGET_OPTS=$(COPTS.$(TARGET))
76REGEX_OPTS=$(COPTS.$(REGEX))
77CPU_OPTS=$(COPTS.$(CPU))
78
Willy Tarreau4eeec092006-10-15 23:50:42 +020079COPTS=-Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
willy tarreaud38e72d2006-03-19 20:56:52 +010080LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
81
82CFLAGS = -Wall $(COPTS) $(DEBUG)
83LDFLAGS = -g
84
Willy Tarreau4eeec092006-10-15 23:50:42 +020085OBJS = 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 Tarreaua84d3742007-05-07 00:36:48 +020091 src/ev_kqueue.o src/acl.o
Willy Tarreau4eeec092006-10-15 23:50:42 +020092
willy tarreaud38e72d2006-03-19 20:56:52 +010093all: haproxy
94
Willy Tarreau4eeec092006-10-15 23:50:42 +020095haproxy: $(OBJS)
willy tarreaud38e72d2006-03-19 20:56:52 +010096 $(LD) $(LDFLAGS) -o $@ $> $(LIBS)
97
Willy Tarreau4eeec092006-10-15 23:50:42 +020098.SUFFIXES: .c.o
willy tarreaud0a05bd2006-05-18 01:22:27 +020099
Willy Tarreau4eeec092006-10-15 23:50:42 +0200100.c.o:
101 $(CC) $(CFLAGS) -c -o $@ $>
willy tarreaud38e72d2006-03-19 20:56:52 +0100102
103clean:
Willy Tarreau4eeec092006-10-15 23:50:42 +0200104 rm -f *.[oas] src/*.[oas] core haproxy test
105 for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
106 rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out