PROGS	= acl-ll acl-splay acl-btree
OBJS	= splay.o tree.o
DEBUG	= -DDEBUG=1

all: $(PROGS)

acl-ll:	acl.c
	gcc -g -O2 -Wall $(DEBUG) acl.c -o $@

acl-splay: acl.c splay.o
	gcc -g -O2 -Wall $(DEBUG) -DUSE_SPLAY_TREE=1 acl.c -o $@ splay.o

splay.o: splay.c
	gcc -c -g -O2 -Wall -DUSE_SPLAY_TREE=1 splay.c

acl-btree: acl.c tree.o
	gcc -g -O2 -Wall $(DEBUG) -DUSE_BIN_TREE=1 acl.c -o $@ tree.o

tree.o: tree.c
	gcc -c -g -O2 -Wall -DUSE_BIN_TREE=1 tree.c

clean:
	rm -f $(PROGS) $(OBJS)
	
short-test: $(PROGS)
	head -4096 input | /usr/bin/time ./acl-ll
	head -4096 input | /usr/bin/time ./acl-splay
	head -4096 input | /usr/bin/time ./acl-btree

med-test: $(PROGS)
	< xaa /usr/bin/time ./acl-ll
	< xaa /usr/bin/time ./acl-splay
	< xaa /usr/bin/time ./acl-btree

long-test: $(PROGS)
	< input /usr/bin/time ./acl-ll
	< input /usr/bin/time ./acl-splay
	< input /usr/bin/time ./acl-btree

