willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 1 | # 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. |
| 5 | TARGET = openbsd |
| 6 | |
| 7 | # pass CPU=<cpu_name> to make to optimize for a particular CPU |
| 8 | CPU = 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. |
| 15 | REGEX=libc |
| 16 | #REGEX=pcre |
| 17 | #REGEX=static-pcre |
| 18 | |
| 19 | # tools options |
| 20 | CC = gcc |
| 21 | LD = gcc |
| 22 | |
| 23 | PCREDIR=/usr/local |
| 24 | |
| 25 | # This is for OpenBSD 3.0 |
| 26 | COPTS.openbsd = -DENABLE_POLL |
| 27 | LIBS.openbsd = |
| 28 | |
| 29 | # CPU dependant optimizations |
| 30 | COPTS.generic = -O2 |
| 31 | COPTS.i586 = -O2 -march=i586 |
| 32 | COPTS.i686 = -O2 -march=i686 |
| 33 | COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc |
| 34 | |
| 35 | # options for standard regex library |
| 36 | COPTS.libc= |
| 37 | LIBS.libc= |
| 38 | |
| 39 | # options for libpcre |
| 40 | COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include |
| 41 | LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre |
| 42 | |
| 43 | # options for static libpcre |
| 44 | COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include |
| 45 | LIBS.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 |
| 49 | DEBUG = -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 = |
| 57 | SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024 |
| 58 | |
| 59 | # redefine this if you want to add some special PATH to include/libs |
| 60 | ADDINC = |
| 61 | ADDLIB = |
| 62 | |
| 63 | # set some defines when needed. |
| 64 | # Known ones are -DENABLE_POLL, -DENABLE_EPOLL, and -DUSE_MY_EPOLL |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 65 | # - use -DTPROXY to compile with transparent proxy support. |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame^] | 66 | DEFINE = -DTPROXY |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 67 | |
| 68 | # global options |
| 69 | TARGET_OPTS=$(COPTS.$(TARGET)) |
| 70 | REGEX_OPTS=$(COPTS.$(REGEX)) |
| 71 | CPU_OPTS=$(COPTS.$(CPU)) |
| 72 | |
| 73 | COPTS=-I. $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE) |
| 74 | LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB) |
| 75 | |
| 76 | CFLAGS = -Wall $(COPTS) $(DEBUG) |
| 77 | LDFLAGS = -g |
| 78 | |
| 79 | all: haproxy |
| 80 | |
willy tarreau | d0a05bd | 2006-05-18 01:22:27 +0200 | [diff] [blame] | 81 | haproxy: src/list.o src/chtbl.o src/hashpjw.o haproxy.o src/base64.o src/uri_auth.o |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 82 | $(LD) $(LDFLAGS) -o $@ $> $(LIBS) |
| 83 | |
willy tarreau | d0a05bd | 2006-05-18 01:22:27 +0200 | [diff] [blame] | 84 | src/base64.o: src/base64.c |
| 85 | $(CC) $(CFLAGS) -c -o $@ $< |
| 86 | |
| 87 | src/uri_auth.o: src/uri_auth.c |
| 88 | $(CC) $(CFLAGS) -c -o $@ $< |
| 89 | |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 90 | src/list.o: src/list.c |
| 91 | $(CC) $(CFLAGS) -c -o $@ $< |
| 92 | |
| 93 | src/chtbl.o: src/chtbl.c |
| 94 | $(CC) $(CFLAGS) -c -o $@ $< |
| 95 | |
| 96 | src/hashpjw.o: src/hashpjw.c |
| 97 | $(CC) $(CFLAGS) -c -o $@ $< |
| 98 | |
| 99 | haproxy.o: haproxy.c |
| 100 | $(CC) $(CFLAGS) -c -o $@ $< |
| 101 | |
| 102 | clean: |
| 103 | rm -f *.[oas] *~ *.rej core haproxy test nohup.out gmon.out src/*.[oas] |
| 104 | |