[MEDIUM] build: switch ebtree users to use new ebtree version

All files referencing the previous ebtree code were changed to point
to the new one in the ebtree directory. A makefile variable (EBTREE_DIR)
is also available to use files from another directory.

The ability to build the libebtree library temporarily remains disabled
because it can have an impact on some existing toolchains and does not
appear worth it in the medium term if we add support for multi-criteria
stickiness for instance.
This commit is contained in:
Willy Tarreau 2009-10-26 21:10:04 +01:00
parent c218602b1d
commit 45cb4fb640
20 changed files with 69 additions and 42 deletions

View File

@ -410,10 +410,12 @@ OPTIONS_LDFLAGS += -L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynami
BUILD_OPTIONS += $(call ignore_implicit,USE_STATIC_PCRE)
endif
# This one can be changed to look for ebtree files in an external directory
EBTREE_DIR := ebtree
#### Global compile options
VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE)
COPTS = -Iinclude -Wall
COPTS = -Iinclude -I$(EBTREE_DIR) -Wall
COPTS += $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE)
COPTS += $(DEBUG) $(OPTIONS_CFLAGS) $(ADDINC)
@ -462,12 +464,22 @@ OBJS = src/haproxy.o src/sessionhash.o src/base64.o src/protocols.o \
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o \
src/stream_interface.o src/dumpstats.o src/proto_tcp.o \
src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \
src/acl.o src/memory.o src/freq_ctr.o \
src/ebtree.o src/eb32tree.o
src/acl.o src/memory.o src/freq_ctr.o
haproxy: $(OBJS) $(OPTIONS_OBJS)
EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
$(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
$(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
$(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
# Not used right now
LIB_EBTREE = $(EBTREE_DIR)/libebtree.a
haproxy: $(OBJS) $(OPTIONS_OBJS) $(EBTREE_OBJS)
$(LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
$(LIB_EBTREE): $(EBTREE_OBJS)
$(AR) rv $@ $^
objsize: haproxy
@objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort
@ -504,8 +516,8 @@ install-bin: haproxy
install: install-bin install-man install-doc
clean:
rm -f *.[oas] src/*.[oas] core haproxy test
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION)$(SUBVERS).tar.gz
rm -f haproxy-$(VERSION) nohup.out gmon.out

View File

@ -92,8 +92,11 @@ VERDATE != cat VERDATE 2>/dev/null || touch VERDATE
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
$(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
# This one can be changed to look for ebtree files in an external directory
EBTREE_DIR := ebtree
COPTS = -Iinclude -I$(EBTREE_DIR) $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) \
$(REGEX_OPTS) $(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
CFLAGS = -Wall $(COPTS) $(DEBUG)
LDFLAGS = -g
@ -107,12 +110,16 @@ OBJS = src/haproxy.o src/sessionhash.o src/base64.o src/protocols.o \
src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o \
src/ev_poll.o src/ev_kqueue.o \
src/acl.o src/memory.o src/freq_ctr.o \
src/ebtree.o src/eb32tree.o
src/acl.o src/memory.o src/freq_ctr.o
EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
$(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
$(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
$(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
all: haproxy
haproxy: $(OBJS) $(OPT_OBJS)
haproxy: $(OBJS) $(OPT_OBJS) $(EBTREE_OBJS)
$(LD) $(LDFLAGS) -o $@ $> $(LIBS)
.SUFFIXES: .c.o
@ -129,8 +136,8 @@ 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
rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
version:

View File

@ -31,6 +31,9 @@ LD = gcc
PCREDIR!= pcre-config --prefix 2>/dev/null || :
#PCREDIR=/usr/local
# This one can be changed to look for ebtree files in an external directory
EBTREE_DIR = ebtree
# This is for darwin 3.0 and above
COPTS.darwin = -DENABLE_POLL -DENABLE_KQUEUE
LIBS.darwin =
@ -89,8 +92,8 @@ VERDATE != cat VERDATE 2>/dev/null || touch VERDATE
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
$(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
COPTS = -Iinclude -I$(EBTREE_DIR) $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) \
$(REGEX_OPTS) $(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -mmacosx-version-min=10.4
LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -mmacosx-version-min=10.4
@ -104,13 +107,17 @@ OBJS = src/haproxy.o src/sessionhash.o src/base64.o src/protocols.o \
src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o \
src/ev_poll.o \
src/acl.o src/memory.o src/freq_ctr.o \
src/ebtree.o src/eb32tree.o
src/acl.o src/memory.o src/freq_ctr.o
EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
$(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
$(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
$(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
all: haproxy
haproxy: $(OBJS)
$(LD) $(LDFLAGS) $(OBJS) -o $@
haproxy: $(OBJS) $(EBTREE_OBJS)
$(LD) $(LDFLAGS) $(OBJS) $(EBTREE_OBJS) -o $@
.SUFFIXES: .c.o
@ -126,8 +133,8 @@ 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
rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
version:

View File

@ -1,13 +1,14 @@
INCLUDE = -I../../include
OPTIMIZE = -O3 -mtune=pentium-m
EBTREE_DIR = ../../ebtree
INCLUDE = -I$(EBTREE_DIR)
OPTIMIZE = -O3 #-mtune=pentium-m
OBJS = halog halog64
halog: halog.c fgets2.c
$(CC) $(OPTIMIZE) -o $@ $(INCLUDE) ../../src/ebtree.c ../../src/eb32tree.c $^
$(CC) $(OPTIMIZE) -o $@ $(INCLUDE) $(EBTREE_DIR)/ebtree.c $(EBTREE_DIR)/eb32tree.c $^
halog64: halog.c fgets2-64.c
$(CC) $(OPTIMIZE) -o $@ $(INCLUDE) ../../src/ebtree.c ../../src/eb32tree.c $^
$(CC) $(OPTIMIZE) -o $@ $(INCLUDE) $(EBTREE_DIR)/ebtree.c $(EBTREE_DIR)/eb32tree.c $^
clean:
rm -vf $(OBJS)

View File

@ -27,7 +27,7 @@
#include <unistd.h>
#include <ctype.h>
#include <common/eb32tree.h>
#include <eb32tree.h>
#define ACCEPT_FIELD 6
#define TIME_FIELD 9

View File

@ -27,7 +27,7 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <eb32tree.h>
#include <proto/fd.h>
/****** string-specific macros and functions ******/

View File

@ -26,11 +26,11 @@
#include <sys/time.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/standard.h>
#include <common/ticks.h>
#include <eb32tree.h>
#include <types/task.h>

View File

@ -23,8 +23,8 @@
#define _TYPES_LB_CHASH_H
#include <common/config.h>
#include <common/ebtree.h>
#include <common/eb32tree.h>
#include <ebtree.h>
#include <eb32tree.h>
struct lb_chash {
struct eb_root act; /* weighted chash entries of active servers */

View File

@ -23,7 +23,7 @@
#define _TYPES_LB_FWLC_H
#include <common/config.h>
#include <common/ebtree.h>
#include <ebtree.h>
struct lb_fwlc {
struct eb_root act; /* weighted least conns on the active servers */

View File

@ -23,7 +23,7 @@
#define _TYPES_LB_FWRR_H
#include <common/config.h>
#include <common/ebtree.h>
#include <ebtree.h>
/* This structure is used to apply fast weighted round robin on a server group */
struct fwrr_group {

View File

@ -28,8 +28,8 @@
#include <sys/un.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/mini-clist.h>
#include <eb32tree.h>
#include <types/counters.h>
#include <types/task.h>

View File

@ -29,11 +29,11 @@
#include <common/appsession.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/mini-clist.h>
#include <common/regex.h>
#include <common/sessionhash.h>
#include <common/tools.h>
#include <eb32tree.h>
#include <types/acl.h>
#include <types/backend.h>

View File

@ -26,8 +26,8 @@
#include <arpa/inet.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/mini-clist.h>
#include <eb32tree.h>
#include <types/buffers.h>
#include <types/counters.h>

View File

@ -25,8 +25,8 @@
#include <sys/time.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/mini-clist.h>
#include <eb32tree.h>
/* values for task->state */
#define TASK_SLEEPING 0x00 /* task sleeping */

View File

@ -19,7 +19,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
#include <common/eb32tree.h>
#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>

View File

@ -13,7 +13,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
#include <common/eb32tree.h>
#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>

View File

@ -13,7 +13,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
#include <common/eb32tree.h>
#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>

View File

@ -13,7 +13,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
#include <common/eb32tree.h>
#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>

View File

@ -20,8 +20,8 @@
#include <arpa/inet.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/standard.h>
#include <eb32tree.h>
#include <proto/log.h>
/* enough to store 10 integers of :

View File

@ -13,11 +13,11 @@
#include <string.h>
#include <common/config.h>
#include <common/eb32tree.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/standard.h>
#include <common/time.h>
#include <eb32tree.h>
#include <proto/proxy.h>
#include <proto/session.h>