# ktcpvs: Kernel TCP Virtaul Server Module

NAME	= ktcpvs
VERSION	= 0.0.6

# uncomment the following line on an SMP system
#SMPFLAGS= -D__SMP__

# uncomment the following line for DEBUG
DEBUGFLAGS= -g -DCONFIG_TCP_VS_DEBUG


CC=gcc
CFLAGS= -D__KERNEL__ -DMODULE  -DEXPORT_SYMTAB -DMODVERSIONS \
	$(SMPFLAGS) $(DEBUGFLAGS) -O2 -Wall \
	-Wstrict-prototypes -I/usr/src/linux/include \
	-include /usr/src/linux/include/linux/modversions.h

LIBS =  regex/librxspencer.a


all:	ktcpvs.o tcp_vs_wlc.o tcp_vs_http.o
	make -C userspace

ktcpvs.o:	tcp_vs_ctl.o misc.o tcp_vs_sched.o tcp_vs.o $(LIBS)
	$(LD) -r $^ -o $@

tcp_vs_ctl.o:	tcp_vs_ctl.c tcp_vs.h $(LIBS)

tcp_vs_http.o:	tcp_vs_http.c tcp_vs.h $(LIBS)
	$(CC) $(CFLAGS) -c tcp_vs_http.c -o tcp_vs_http_obj.o
	$(LD) -r tcp_vs_http_obj.o $(LIBS) -o $@

$(LIBS):
	(cd regex && ./configure && make)

tcp_vs.o:	$(LIBS)

install:	ktcpvs.o
	-rmmod ktcpvs
	insmod ktcpvs.o
	lsmod

clean:
	rm -f *.o *~ *.bak *.orig *.rej $(NAME)-$(VERSION).tar.gz
	make -C userspace clean

distclean: clean
	-make -C regex distclean

dist:	distclean
	(cd .. ; tar czvf $(NAME)-$(VERSION).tar.gz --exclude CVS ktcpvs)
	mv ../$(NAME)-$(VERSION).tar.gz .