willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 1 | # This makefile is dedicated to OpenBSD (and possibly other BSDs) |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 2 | # You should use it this way : |
| 3 | # make TARGET=os CPU=cpu |
| 4 | |
Willy Tarreau | 85270da | 2007-01-02 00:59:39 +0100 | [diff] [blame] | 5 | VERSION := 1.3.4 |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 6 | |
| 7 | # Select target OS. TARGET must match a system for which COPTS and LIBS are |
| 8 | # correctly defined below. |
| 9 | TARGET = openbsd |
| 10 | |
| 11 | # pass CPU=<cpu_name> to make to optimize for a particular CPU |
| 12 | CPU = generic |
| 13 | #CPU = i586 |
| 14 | #CPU = i686 |
| 15 | #CPU = ultrasparc |
| 16 | |
| 17 | # By default, we use libc's regex. WARNING! On Solaris 8/Sparc, group |
| 18 | # references seem broken using libc ! Use pcre instead. |
| 19 | REGEX=libc |
| 20 | #REGEX=pcre |
| 21 | #REGEX=static-pcre |
| 22 | |
| 23 | # tools options |
| 24 | CC = gcc |
| 25 | LD = gcc |
| 26 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 27 | # This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre |
| 28 | PCREDIR!= pcre-config --prefix 2>/dev/null || : |
| 29 | #PCREDIR=/usr/local |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 30 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 31 | # This is for OpenBSD 3.0 and above |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 32 | COPTS.openbsd = -DENABLE_POLL |
| 33 | LIBS.openbsd = |
| 34 | |
| 35 | # CPU dependant optimizations |
| 36 | COPTS.generic = -O2 |
| 37 | COPTS.i586 = -O2 -march=i586 |
| 38 | COPTS.i686 = -O2 -march=i686 |
| 39 | COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc |
| 40 | |
| 41 | # options for standard regex library |
| 42 | COPTS.libc= |
| 43 | LIBS.libc= |
| 44 | |
| 45 | # options for libpcre |
| 46 | COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include |
| 47 | LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre |
| 48 | |
| 49 | # options for static libpcre |
| 50 | COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include |
| 51 | LIBS.static-pcre=-L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic |
| 52 | |
| 53 | # you can enable debug arguments with "DEBUG=-g" or disable them with "DEBUG=" |
| 54 | #DEBUG = -g -DDEBUG_MEMORY -DDEBUG_FULL |
| 55 | DEBUG = -g |
| 56 | |
| 57 | # if small memory footprint is required, you can reduce the buffer size. There |
| 58 | # are 2 buffers per concurrent session, so 16 kB buffers will eat 32 MB memory |
| 59 | # with 1000 concurrent sessions. Putting it slightly lower than a page size |
| 60 | # will avoid the additionnal paramters to overflow a page. 8030 bytes is |
| 61 | # exactly 5.5 TCP segments of 1460 bytes. |
| 62 | #SMALL_OPTS = |
| 63 | SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024 |
| 64 | |
| 65 | # redefine this if you want to add some special PATH to include/libs |
| 66 | ADDINC = |
| 67 | ADDLIB = |
| 68 | |
| 69 | # set some defines when needed. |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 70 | # Known ones are -DENABLE_POLL |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 71 | # - use -DTPROXY to compile with transparent proxy support. |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 72 | DEFINE = -DTPROXY |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 73 | |
| 74 | # global options |
| 75 | TARGET_OPTS=$(COPTS.$(TARGET)) |
| 76 | REGEX_OPTS=$(COPTS.$(REGEX)) |
| 77 | CPU_OPTS=$(COPTS.$(CPU)) |
| 78 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 79 | COPTS=-Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE) |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 80 | LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB) |
| 81 | |
| 82 | CFLAGS = -Wall $(COPTS) $(DEBUG) |
| 83 | LDFLAGS = -g |
| 84 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 85 | OBJS = src/haproxy.o src/list.o src/chtbl.o src/hashpjw.o src/base64.o \ |
| 86 | src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \ |
| 87 | src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \ |
| 88 | src/checks.o src/queue.o src/capture.o src/client.o src/proxy.o \ |
| 89 | src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \ |
Willy Tarreau | 964c936 | 2007-01-07 00:38:00 +0100 | [diff] [blame^] | 90 | src/session.o src/hdr_idx.o src/rbtree.o |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 91 | |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 92 | all: haproxy |
| 93 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 94 | haproxy: $(OBJS) |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 95 | $(LD) $(LDFLAGS) -o $@ $> $(LIBS) |
| 96 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 97 | .SUFFIXES: .c.o |
willy tarreau | d0a05bd | 2006-05-18 01:22:27 +0200 | [diff] [blame] | 98 | |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 99 | .c.o: |
| 100 | $(CC) $(CFLAGS) -c -o $@ $> |
willy tarreau | d38e72d | 2006-03-19 20:56:52 +0100 | [diff] [blame] | 101 | |
| 102 | clean: |
Willy Tarreau | 4eeec09 | 2006-10-15 23:50:42 +0200 | [diff] [blame] | 103 | rm -f *.[oas] src/*.[oas] core haproxy test |
| 104 | for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done |
| 105 | rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out |