blob: f588478545741b2ece218f1af3553f212689d375 [file] [log] [blame]
Willy Tarreaucec2e7a2007-03-25 16:55:56 +02001# This makefile is dedicated to darwin (and possibly other BSDs)
2# You should use it this way :
3# make TARGET=os CPU=cpu
Willy Tarreauf2ef8c52007-07-11 09:19:31 +02004#
5# Some optional components may be added, such as DLMALLOC :
6#
7# make DLMALLOC_SRC=/usr/local/src/dlmalloc.c \
8# OPT_OBJS=src/dlmalloc.o
Willy Tarreaucec2e7a2007-03-25 16:55:56 +02009
Willy Tarreaub21152b2007-06-17 23:41:40 +020010VERSION := 1.3.12
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020011
12# Select target OS. TARGET must match a system for which COPTS and LIBS are
13# correctly defined below.
14TARGET = generic
15
16# pass CPU=<cpu_name> to make to optimize for a particular CPU
17CPU = 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.
24REGEX=libc
25#REGEX=pcre
26#REGEX=static-pcre
27
28# tools options
29CC = gcc
30LD = gcc
31
32# This is the directory hosting include/pcre.h and lib/libpcre.* when REGEX=pcre
33PCREDIR!= pcre-config --prefix 2>/dev/null || :
34#PCREDIR=/usr/local
35
36# This is for darwin 3.0 and above
Willy Tarreau8ae42f42007-04-09 16:30:28 +020037COPTS.darwin = -DENABLE_POLL -DENABLE_KQUEUE
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020038LIBS.darwin =
39
40# CPU dependant optimizations
41COPTS.generic = -O2
42COPTS.i586 = -O2 -march=i586
43COPTS.i686 = -O2 -march=i686
44COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
45
46# options for standard regex library
47COPTS.libc=
48LIBS.libc=
49
50# options for libpcre
51COPTS.pcre=-DUSE_PCRE -I$(PCREDIR)/include
52LIBS.pcre=-L$(PCREDIR)/lib -lpcreposix -lpcre
53
54# options for static libpcre
55COPTS.static-pcre=-DUSE_PCRE -I$(PCREDIR)/include
56LIBS.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
60DEBUG = -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 =
68SMALL_OPTS = -DBUFSIZE=8030 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=1024
69
70# redefine this if you want to add some special PATH to include/libs
71ADDINC =
72ADDLIB =
73
74# set some defines when needed.
75# Known ones are -DENABLE_POLL
76# - use -DTPROXY to compile with transparent proxy support.
Willy Tarreau8ae42f42007-04-09 16:30:28 +020077DEFINE = -DTPROXY
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020078
Willy Tarreauf2ef8c52007-07-11 09:19:31 +020079# May be changed to patch PAGE_SIZE on every platform when using dlmalloc
80DLMALLOC_THRES=4096
81
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020082# global options
83TARGET_OPTS=$(COPTS.$(TARGET))
84REGEX_OPTS=$(COPTS.$(REGEX))
85CPU_OPTS=$(COPTS.$(CPU))
86
87COPTS=-Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) $(DEFINE)
88LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
89
90CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
91LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
92
93OBJS = src/haproxy.o src/list.o src/chtbl.o src/hashpjw.o src/base64.o \
94 src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \
95 src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \
Willy Tarreau086b3b42007-05-13 21:45:51 +020096 src/checks.o src/queue.o src/client.o src/proxy.o \
Willy Tarreaucec2e7a2007-03-25 16:55:56 +020097 src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \
Willy Tarreau50e608d2007-05-13 18:26:08 +020098 src/session.o src/hdr_idx.o src/ev_select.o src/ev_poll.o src/acl.o \
99 src/memory.o
Willy Tarreaucec2e7a2007-03-25 16:55:56 +0200100
101all: haproxy
102
103haproxy: $(OBJS)
104 $(LD) $(LDFLAGS) $(OBJS) -o $@
105
106.SUFFIXES: .c.o
107
108.c.o:
109 $(CC) $(CFLAGS) -c -o $@ $<
110
Willy Tarreauf2ef8c52007-07-11 09:19:31 +0200111src/dlmalloc.o: $(DLMALLOC_SRC)
112 $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
113
Willy Tarreaucec2e7a2007-03-25 16:55:56 +0200114clean:
115 rm -f *.[oas] src/*.[oas] core haproxy test
116 for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
117 rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out