From: Willy Tarreau Date: Mon, 26 Oct 2009 20:10:04 +0000 (+0100) Subject: [MEDIUM] build: switch ebtree users to use new ebtree version X-Git-Tag: v1.4-dev5~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45cb4fb640178e680135fe0bcca1e9ee94114567;p=thirdparty%2Fhaproxy.git [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. --- diff --git a/Makefile b/Makefile index 46b762c297..824e8e19b6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/Makefile.bsd b/Makefile.bsd index 7957f9427b..015a3651b5 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -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: diff --git a/Makefile.osx b/Makefile.osx index 19fb720608..5fa0da0250 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -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: diff --git a/contrib/halog/Makefile b/contrib/halog/Makefile index 2215e03a9a..f85acc7c17 100644 --- a/contrib/halog/Makefile +++ b/contrib/halog/Makefile @@ -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) diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c index 27e09617db..fcf99c49d1 100644 --- a/contrib/halog/halog.c +++ b/contrib/halog/halog.c @@ -27,7 +27,7 @@ #include #include -#include +#include #define ACCEPT_FIELD 6 #define TIME_FIELD 9 diff --git a/include/common/standard.h b/include/common/standard.h index ce70f2e5fa..0a6b68bf9d 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include /****** string-specific macros and functions ******/ diff --git a/include/proto/task.h b/include/proto/task.h index 62f83e3f54..0cfe28f209 100644 --- a/include/proto/task.h +++ b/include/proto/task.h @@ -26,11 +26,11 @@ #include #include -#include #include #include #include #include +#include #include diff --git a/include/types/lb_chash.h b/include/types/lb_chash.h index 3eee12c401..5991ce961b 100644 --- a/include/types/lb_chash.h +++ b/include/types/lb_chash.h @@ -23,8 +23,8 @@ #define _TYPES_LB_CHASH_H #include -#include -#include +#include +#include struct lb_chash { struct eb_root act; /* weighted chash entries of active servers */ diff --git a/include/types/lb_fwlc.h b/include/types/lb_fwlc.h index cad4d134b6..170eb241c5 100644 --- a/include/types/lb_fwlc.h +++ b/include/types/lb_fwlc.h @@ -23,7 +23,7 @@ #define _TYPES_LB_FWLC_H #include -#include +#include struct lb_fwlc { struct eb_root act; /* weighted least conns on the active servers */ diff --git a/include/types/lb_fwrr.h b/include/types/lb_fwrr.h index 600a511a1c..731f055f9d 100644 --- a/include/types/lb_fwrr.h +++ b/include/types/lb_fwrr.h @@ -23,7 +23,7 @@ #define _TYPES_LB_FWRR_H #include -#include +#include /* This structure is used to apply fast weighted round robin on a server group */ struct fwrr_group { diff --git a/include/types/protocols.h b/include/types/protocols.h index 66c742b093..c13c73d361 100644 --- a/include/types/protocols.h +++ b/include/types/protocols.h @@ -28,8 +28,8 @@ #include #include -#include #include +#include #include #include diff --git a/include/types/proxy.h b/include/types/proxy.h index ec00d741ee..8348f92ed3 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -29,11 +29,11 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/include/types/server.h b/include/types/server.h index b3fe83dc71..935992d40c 100644 --- a/include/types/server.h +++ b/include/types/server.h @@ -26,8 +26,8 @@ #include #include -#include #include +#include #include #include diff --git a/include/types/task.h b/include/types/task.h index 641cb17cd9..41f889c88c 100644 --- a/include/types/task.h +++ b/include/types/task.h @@ -25,8 +25,8 @@ #include #include -#include #include +#include /* values for task->state */ #define TASK_SLEEPING 0x00 /* task sleeping */ diff --git a/src/lb_chash.c b/src/lb_chash.c index bfd4cd0470..58c029a4ad 100644 --- a/src/lb_chash.c +++ b/src/lb_chash.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/lb_fwlc.c b/src/lb_fwlc.c index 5d1a31be2e..c2fcb4efe7 100644 --- a/src/lb_fwlc.c +++ b/src/lb_fwlc.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/lb_fwrr.c b/src/lb_fwrr.c index 84d179da3f..d92b6eb827 100644 --- a/src/lb_fwrr.c +++ b/src/lb_fwrr.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/lb_map.c b/src/lb_map.c index 2918c26be7..d3264bb6ba 100644 --- a/src/lb_map.c +++ b/src/lb_map.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/standard.c b/src/standard.c index 6b0be2d0a1..6a8724a86c 100644 --- a/src/standard.c +++ b/src/standard.c @@ -20,8 +20,8 @@ #include #include -#include #include +#include #include /* enough to store 10 integers of : diff --git a/src/task.c b/src/task.c index cc455f58fe..9b21fd9df7 100644 --- a/src/task.c +++ b/src/task.c @@ -13,11 +13,11 @@ #include #include -#include #include #include #include #include +#include #include #include