blob: 361642061e38eedbeb4cd5cb09eb24ddaae1d3ef [file] [log] [blame]
willy tarreau750a4722005-12-17 13:21:24 +01001# Select target OS. TARGET must match a system for which COPTS and LIBS are
2# correctly defined below.
3# You can set it on make's command line. eg: make TARGET=solaris
4TARGET = linux24
5#TARGET = linux22
6#TARGET = solaris
7#TARGET = solarisv9
8#TARGET = openbsd
9
willy tarreau0f7af912005-12-17 12:21:26 +010010CC = gcc
11LD = gcc
12
willy tarreau036e1ce2005-12-17 13:46:33 +010013# By default, we use libc's regex.
14REGEX=libc
15#REGEX=pcre
16
17# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
willy tarreau906b2682005-12-17 13:49:52 +010018PCREDIR := $(shell pcre-config --prefix 2>/dev/null)
willy tarreau036e1ce2005-12-17 13:46:33 +010019#PCREDIR=/usr/local
20
willy tarreau5cbea6f2005-12-17 12:48:26 +010021# This is for Linux 2.4 with netfilter
22COPTS.linux24 = -O2 -DNETFILTER
23LIBS.linux24 =
willy tarreau0f7af912005-12-17 12:21:26 +010024
willy tarreau5cbea6f2005-12-17 12:48:26 +010025# This is for Linux 2.2
26COPTS.linux22 = -O2 -DUSE_GETSOCKNAME
27LIBS.linux22 =
28
29# This is for Solaris 8
willy tarreau750a4722005-12-17 13:21:24 +010030COPTS.solaris = -O2 -fomit-frame-pointer -DSOLARIS
willy tarreau9da061b2005-12-17 12:29:56 +010031LIBS.solaris = -lnsl -lsocket
32
willy tarreau750a4722005-12-17 13:21:24 +010033# This is for Solaris 8 on UltraSparc2 processor
34COPTS.solarisv9 = -O6 -mcpu=v9 -fomit-frame-pointer -DSOLARIS
35LIBS.solarisv9 = -lnsl -lsocket
36
willy tarreau5cbea6f2005-12-17 12:48:26 +010037# This is for OpenBSD 3.0
willy tarreau750a4722005-12-17 13:21:24 +010038COPTS.openbsd = -O2
willy tarreau5cbea6f2005-12-17 12:48:26 +010039LIBS.openbsd =
40
willy tarreau036e1ce2005-12-17 13:46:33 +010041COPTS.libc=
42LIBS.libs=
43
44COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
45LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
46
willy tarreau5cbea6f2005-12-17 12:48:26 +010047#DEBUG =
48DEBUG = -g
willy tarreau9da061b2005-12-17 12:29:56 +010049
willy tarreau036e1ce2005-12-17 13:46:33 +010050COPTS=$(COPTS.$(TARGET)) $(COPTS.$(REGEX))
51LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX))
willy tarreau0f7af912005-12-17 12:21:26 +010052
willy tarreau5cbea6f2005-12-17 12:48:26 +010053# - use -DSTATTIME=0 to disable statistics, else specify an interval in
54# milliseconds.
willy tarreaua1598082005-12-17 13:08:06 +010055# - use -DTPROXY to compile with transparent proxy support.
56CFLAGS = -Wall $(COPTS) $(DEBUG) -DSTATTIME=0 -DTPROXY
willy tarreau0f7af912005-12-17 12:21:26 +010057LDFLAGS = -g
58
59all: haproxy
60
61haproxy: haproxy.o
62 $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
63
64%.o: %.c
65 $(CC) $(CFLAGS) -c -o $@ $<
66
67clean:
willy tarreauc29948c2005-12-17 13:10:27 +010068 rm -f *.[oas] *~ core haproxy test nohup.out gmon.out
willy tarreauefae1842005-12-17 12:51:03 +010069