[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 46b762c..824e8e1 100644
--- a/Makefile
+++ b/Makefile
@@ -410,10 +410,12 @@
 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 @@
        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: 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