blob: 4d3951ef649f0dfc1bf573dfa2dda2a407de7cba [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
65# - use -DSTATTIME=0 to disable statistics, else specify an interval in
66# milliseconds.
67# - use -DTPROXY to compile with transparent proxy support.
68DEFINE = -DSTATTIME=0 -DTPROXY
69
70# global options
71TARGET_OPTS=$(COPTS.$(TARGET))
72REGEX_OPTS=$(COPTS.$(REGEX))
73CPU_OPTS=$(COPTS.$(CPU))
74
75COPTS=-I. $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
76LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
77
78CFLAGS = -Wall $(COPTS) $(DEBUG)
79LDFLAGS = -g
80
81all: haproxy
82
83haproxy: src/list.o src/chtbl.o src/hashpjw.o haproxy.o
84 $(LD) $(LDFLAGS) -o $@ $> $(LIBS)
85
86src/list.o: src/list.c
87 $(CC) $(CFLAGS) -c -o $@ $<
88
89src/chtbl.o: src/chtbl.c
90 $(CC) $(CFLAGS) -c -o $@ $<
91
92src/hashpjw.o: src/hashpjw.c
93 $(CC) $(CFLAGS) -c -o $@ $<
94
95haproxy.o: haproxy.c
96 $(CC) $(CFLAGS) -c -o $@ $<
97
98clean:
99 rm -f *.[oas] *~ *.rej core haproxy test nohup.out gmon.out src/*.[oas]
100