blob: cf190ef1f34eb64fddbaa3bb48e43aeb8b11472f [file] [log] [blame]
willy tarreaud38e72d2006-03-19 20:56:52 +01001# This makefile is dedicated to OpenBSD (and possibly other BSDs)
2
3# Select target OS. TARGET must match a system for which COPTS and LIBS are
4# correctly defined below.
5TARGET = openbsd
6
7# pass CPU=<cpu_name> to make to optimize for a particular CPU
8CPU = generic
9#CPU = i586
10#CPU = i686
11#CPU = ultrasparc
12
13# By default, we use libc's regex. WARNING! On Solaris 8/Sparc, group
14# references seem broken using libc ! Use pcre instead.
15REGEX=libc
16#REGEX=pcre
17#REGEX=static-pcre
18
19# tools options
20CC = gcc
21LD = gcc
22
23PCREDIR=/usr/local
24
25# This is for OpenBSD 3.0
26COPTS.openbsd = -DENABLE_POLL
27LIBS.openbsd =
28
29# CPU dependant optimizations
30COPTS.generic = -O2
31COPTS.i586 = -O2 -march=i586
32COPTS.i686 = -O2 -march=i686
33COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
34
35# options for standard regex library
36COPTS.libc=
37LIBS.libc=
38
39# options for libpcre
40COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
41LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
42
43# options for static libpcre
44COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include
45LIBS.static-pcre=-L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
46
47# you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG="
48#DEBUG = -g -DDEBUG_MEMORY -DDEBUG_FULL
49DEBUG = -g
50
51# if small memory footprint is required, you can reduce the buffer size. There
52# are 2 buffers per concurrent session, so 16 kB buffers will eat 32 MB memory
53# with 1000 concurrent sessions. Putting it slightly lower than a page size
54# will avoid the additionnal paramters to overflow a page. 8030 bytes is
55# exactly 5.5 TCP segments of 1460 bytes.
56#SMALL_OPTS =
57SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024
58
59# redefine this if you want to add some special PATH to include/libs
60ADDINC =
61ADDLIB =
62
63# set some defines when needed.
64# Known ones are -DENABLE_POLL, -DENABLE_EPOLL, and -DUSE_MY_EPOLL
willy tarreaud38e72d2006-03-19 20:56:52 +010065# - use -DTPROXY to compile with transparent proxy support.
Willy Tarreaubaaee002006-06-26 02:48:02 +020066DEFINE = -DTPROXY
willy tarreaud38e72d2006-03-19 20:56:52 +010067
68# global options
69TARGET_OPTS=$(COPTS.$(TARGET))
70REGEX_OPTS=$(COPTS.$(REGEX))
71CPU_OPTS=$(COPTS.$(CPU))
72
73COPTS=-I. $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
74LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
75
76CFLAGS = -Wall $(COPTS) $(DEBUG)
77LDFLAGS = -g
78
79all: haproxy
80
willy tarreaud0a05bd2006-05-18 01:22:27 +020081haproxy: src/list.o src/chtbl.o src/hashpjw.o haproxy.o src/base64.o src/uri_auth.o
willy tarreaud38e72d2006-03-19 20:56:52 +010082 $(LD) $(LDFLAGS) -o $@ $> $(LIBS)
83
willy tarreaud0a05bd2006-05-18 01:22:27 +020084src/base64.o: src/base64.c
85 $(CC) $(CFLAGS) -c -o $@ $<
86
87src/uri_auth.o: src/uri_auth.c
88 $(CC) $(CFLAGS) -c -o $@ $<
89
willy tarreaud38e72d2006-03-19 20:56:52 +010090src/list.o: src/list.c
91 $(CC) $(CFLAGS) -c -o $@ $<
92
93src/chtbl.o: src/chtbl.c
94 $(CC) $(CFLAGS) -c -o $@ $<
95
96src/hashpjw.o: src/hashpjw.c
97 $(CC) $(CFLAGS) -c -o $@ $<
98
99haproxy.o: haproxy.c
100 $(CC) $(CFLAGS) -c -o $@ $<
101
102clean:
103 rm -f *.[oas] *~ *.rej core haproxy test nohup.out gmon.out src/*.[oas]
104