willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 1 | CC = gcc |
| 2 | LD = gcc |
| 3 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 4 | # This is for Linux 2.4 with netfilter |
| 5 | COPTS.linux24 = -O2 -DNETFILTER |
| 6 | LIBS.linux24 = |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 7 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 8 | # This is for Linux 2.2 |
| 9 | COPTS.linux22 = -O2 -DUSE_GETSOCKNAME |
| 10 | LIBS.linux22 = |
| 11 | |
| 12 | # This is for Solaris 8 |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 13 | COPTS.solaris = -O2 -fomit-frame-pointer -DSOLARIS -DHAVE_STRLCPY |
| 14 | LIBS.solaris = -lnsl -lsocket |
| 15 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 16 | # This is for OpenBSD 3.0 |
| 17 | COPTS.openbsd = -O2 -DHAVE_STRLCPY |
| 18 | LIBS.openbsd = |
| 19 | |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 20 | # Select target OS. TARGET must match a system for which COPTS and LIBS are |
| 21 | # correctly defined above. |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 22 | TARGET = linux24 |
| 23 | #TARGET = linux22 |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 24 | #TARGET = solaris |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 25 | #TARGET = openbsd |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 26 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 27 | #DEBUG = |
| 28 | DEBUG = -g |
willy tarreau | 9da061b | 2005-12-17 12:29:56 +0100 | [diff] [blame] | 29 | |
| 30 | COPTS=$(COPTS.$(TARGET)) |
| 31 | LIBS=$(LIBS.$(TARGET)) |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 32 | |
willy tarreau | 5cbea6f | 2005-12-17 12:48:26 +0100 | [diff] [blame] | 33 | # - use -DSTATTIME=0 to disable statistics, else specify an interval in |
| 34 | # milliseconds. |
willy tarreau | a159808 | 2005-12-17 13:08:06 +0100 | [diff] [blame] | 35 | # - use -DTPROXY to compile with transparent proxy support. |
| 36 | CFLAGS = -Wall $(COPTS) $(DEBUG) -DSTATTIME=0 -DTPROXY |
willy tarreau | 0f7af91 | 2005-12-17 12:21:26 +0100 | [diff] [blame] | 37 | LDFLAGS = -g |
| 38 | |
| 39 | all: haproxy |
| 40 | |
| 41 | haproxy: haproxy.o |
| 42 | $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 43 | |
| 44 | %.o: %.c |
| 45 | $(CC) $(CFLAGS) -c -o $@ $< |
| 46 | |
| 47 | clean: |
willy tarreau | c29948c | 2005-12-17 13:10:27 +0100 | [diff] [blame] | 48 | rm -f *.[oas] *~ core haproxy test nohup.out gmon.out |
willy tarreau | efae184 | 2005-12-17 12:51:03 +0100 | [diff] [blame] | 49 | |