willy tarreau | 750a472 | 2005-12-17 13:21:24 +0100 | [diff] [blame] | 1 | # 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 |
| 4 | TARGET = linux24 |
| 5 | #TARGET = linux22 |
| 6 | #TARGET = solaris |
| 7 | #TARGET = solarisv9 |
| 8 | #TARGET = openbsd |
| 9 | |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 10 | CC = gcc |
| 11 | LD = gcc |
| 12 | |
willy tarreau | 036e1ce | 2005-12-17 13:46:33 +0100 | [diff] [blame] | 13 | # By default, we use libc's regex. |
| 14 | REGEX=libc |
| 15 | #REGEX=pcre |
| 16 | |
| 17 | # This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre |
willy tarreau | 2f6ba65 | 2005-12-17 13:57:42 +0100 | [diff] [blame^] | 18 | PCREDIR := $(shell pcre-config --prefix 2>/dev/null || :) |
willy tarreau | 036e1ce | 2005-12-17 13:46:33 +0100 | [diff] [blame] | 19 | #PCREDIR=/usr/local |
| 20 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 21 | # This is for Linux 2.4 with netfilter |
| 22 | COPTS.linux24 = -O2 -DNETFILTER |
| 23 | LIBS.linux24 = |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 24 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 25 | # This is for Linux 2.2 |
| 26 | COPTS.linux22 = -O2 -DUSE_GETSOCKNAME |
| 27 | LIBS.linux22 = |
| 28 | |
| 29 | # This is for Solaris 8 |
willy tarreau | 750a472 | 2005-12-17 13:21:24 +0100 | [diff] [blame] | 30 | COPTS.solaris = -O2 -fomit-frame-pointer -DSOLARIS |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 31 | LIBS.solaris = -lnsl -lsocket |
| 32 | |
willy tarreau | 750a472 | 2005-12-17 13:21:24 +0100 | [diff] [blame] | 33 | # This is for Solaris 8 on UltraSparc2 processor |
| 34 | COPTS.solarisv9 = -O6 -mcpu=v9 -fomit-frame-pointer -DSOLARIS |
| 35 | LIBS.solarisv9 = -lnsl -lsocket |
| 36 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 37 | # This is for OpenBSD 3.0 |
willy tarreau | 750a472 | 2005-12-17 13:21:24 +0100 | [diff] [blame] | 38 | COPTS.openbsd = -O2 |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 39 | LIBS.openbsd = |
| 40 | |
willy tarreau | 036e1ce | 2005-12-17 13:46:33 +0100 | [diff] [blame] | 41 | COPTS.libc= |
| 42 | LIBS.libs= |
| 43 | |
| 44 | COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include |
| 45 | LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre |
| 46 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 47 | #DEBUG = |
| 48 | DEBUG = -g |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 49 | |
willy tarreau | 036e1ce | 2005-12-17 13:46:33 +0100 | [diff] [blame] | 50 | COPTS=$(COPTS.$(TARGET)) $(COPTS.$(REGEX)) |
| 51 | LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 52 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 53 | # - use -DSTATTIME=0 to disable statistics, else specify an interval in |
| 54 | # milliseconds. |
willy tarreau | a159808 | 2005-12-17 13:08:06 +0100 | [diff] [blame] | 55 | # - use -DTPROXY to compile with transparent proxy support. |
| 56 | CFLAGS = -Wall $(COPTS) $(DEBUG) -DSTATTIME=0 -DTPROXY |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 57 | LDFLAGS = -g |
| 58 | |
| 59 | all: haproxy |
| 60 | |
| 61 | haproxy: haproxy.o |
| 62 | $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 63 | |
| 64 | %.o: %.c |
| 65 | $(CC) $(CFLAGS) -c -o $@ $< |
| 66 | |
| 67 | clean: |
willy tarreau | c29948c | 2005-12-17 13:10:27 +0100 | [diff] [blame] | 68 | rm -f *.[oas] *~ core haproxy test nohup.out gmon.out |
willy tarreau | efae184 | 2005-12-17 12:51:03 +0100 | [diff] [blame] | 69 | |