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 |
| 65 | # - use -DSTATTIME=0 to disable statistics, else specify an interval in |
| 66 | # milliseconds. |
| 67 | # - use -DTPROXY to compile with transparent proxy support. |
| 68 | DEFINE = -DSTATTIME=0 -DTPROXY |
| 69 | |
| 70 | # global options |
| 71 | TARGET_OPTS=$(COPTS.$(TARGET)) |
| 72 | REGEX_OPTS=$(COPTS.$(REGEX)) |
| 73 | CPU_OPTS=$(COPTS.$(CPU)) |
| 74 | |
| 75 | COPTS=-I. $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE) |
| 76 | LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB) |
| 77 | |
| 78 | CFLAGS = -Wall $(COPTS) $(DEBUG) |
| 79 | LDFLAGS = -g |
| 80 | |
| 81 | all: haproxy |
| 82 | |
willy tarreau | d0a05bd | 2006-05-18 01:22:27 +0200 | [diff] [blame] | 83 | 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] | 84 | $(LD) $(LDFLAGS) -o $@ $> $(LIBS) |
| 85 | |
willy tarreau | d0a05bd | 2006-05-18 01:22:27 +0200 | [diff] [blame] | 86 | src/base64.o: src/base64.c |
| 87 | $(CC) $(CFLAGS) -c -o $@ $< |
| 88 | |
| 89 | src/uri_auth.o: src/uri_auth.c |
| 90 | $(CC) $(CFLAGS) -c -o $@ $< |
| 91 | |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 92 | src/list.o: src/list.c |
| 93 | $(CC) $(CFLAGS) -c -o $@ $< |
| 94 | |
| 95 | src/chtbl.o: src/chtbl.c |
| 96 | $(CC) $(CFLAGS) -c -o $@ $< |
| 97 | |
| 98 | src/hashpjw.o: src/hashpjw.c |
| 99 | $(CC) $(CFLAGS) -c -o $@ $< |
| 100 | |
| 101 | haproxy.o: haproxy.c |
| 102 | $(CC) $(CFLAGS) -c -o $@ $< |
| 103 | |
| 104 | clean: |
| 105 | rm -f *.[oas] *~ *.rej core haproxy test nohup.out gmon.out src/*.[oas] |
| 106 | |