# This makefile supports different OS and CPU setups.
# You should use it this way :
# make TARGET=os CPU=cpu REGEX=lib
-
+#
+# Some external components may be build with it, such dlmalloc :
+#
+# make DLMALLOC_SRC=/usr/local/src/dlmalloc.c
# Select target OS. TARGET must match a system for which COPTS and LIBS are
# correctly defined below.
OPTIONS += -DCONFIG_HAP_USE_REGPARM
endif
+ifneq ($(DLMALLOC_SRC),)
+# May be changed to patch PAGE_SIZE on every platform
+DLMALLOC_THRES=4096
+OPT_OBJS += src/dlmalloc.o
+endif
+
ifneq ($(VERSION),)
OPTIONS += -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\"
endif
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
+src/dlmalloc.o: $(DLMALLOC_SRC)
+ $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
+
clean:
rm -f *.[oas] src/*.[oas] core haproxy test
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
# This makefile is dedicated to OpenBSD (and possibly other BSDs)
# You should use it this way :
# make TARGET=os CPU=cpu
+#
+# Some optional components may be added, such as DLMALLOC :
+#
+# make TARGET=freebsd CPU=i686 DLMALLOC_SRC=/usr/local/src/dlmalloc.c \
+# OPT_OBJS=src/dlmalloc.o
VERSION := 1.3.12
ADDINC =
ADDLIB =
+# redefine this if you want to add some special .o files
+OPT_OBJS =
+
# set some defines when needed.
# Known ones are -DENABLE_POLL
# - use -DTPROXY to compile with transparent proxy support.
DEFINE = -DTPROXY
+# May be changed to patch PAGE_SIZE on every platform when using dlmalloc
+DLMALLOC_THRES=4096
+
# global options
TARGET_OPTS=$(COPTS.$(TARGET))
REGEX_OPTS=$(COPTS.$(REGEX))
all: haproxy
-haproxy: $(OBJS)
+haproxy: $(OBJS) $(OPT_OBJS)
$(LD) $(LDFLAGS) -o $@ $> $(LIBS)
.SUFFIXES: .c.o
.c.o:
$(CC) $(CFLAGS) -c -o $@ $>
+src/dlmalloc.o: $(DLMALLOC_SRC)
+ $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $>
+
clean:
rm -f *.[oas] src/*.[oas] core haproxy test
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
# This makefile is dedicated to darwin (and possibly other BSDs)
# You should use it this way :
# make TARGET=os CPU=cpu
+#
+# Some optional components may be added, such as DLMALLOC :
+#
+# make DLMALLOC_SRC=/usr/local/src/dlmalloc.c \
+# OPT_OBJS=src/dlmalloc.o
VERSION := 1.3.12
# - use -DTPROXY to compile with transparent proxy support.
DEFINE = -DTPROXY
+# May be changed to patch PAGE_SIZE on every platform when using dlmalloc
+DLMALLOC_THRES=4096
+
# global options
TARGET_OPTS=$(COPTS.$(TARGET))
REGEX_OPTS=$(COPTS.$(REGEX))
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
+src/dlmalloc.o: $(DLMALLOC_SRC)
+ $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
+
clean:
rm -f *.[oas] src/*.[oas] core haproxy test
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done