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