CFLAGS=-Wall -g

FILES = *.c *.h Makefile

######################################################################
# Standard Targets

default: list-expt list-utest

.PHONY: clean
clean:
	rm -f *.o 
	rm -f *.gch

.PHONY: distclean
distclean: clean
	rm -f node.utest node.expt list1.expt

.PHONY: tarball
tarball: lists.tar


######################################################################
# Primary Targets

list-utest: list-utest.o utest.o node.o mem.o
	$(LINK.o) -o $@ $^

list-utest.o: list.c
	$(COMPILE.c) -DUNIT_TESTS -o $@ $<

list-expt: list-expt.o node.o mem.o
	$(CC) $(CFLAGS) -DEXPERIMENTS -o $@ $^

list-expt.o: list.c
	$(COMPILE.c) -DEXPERIMENTS -o $@ $<

lists.tar: $(FILES)
	tar cvf $@ $(FILES)


######################################################################
# Random Stuff

syd: sydney.o mem.o
	$(LINK.o) -o $@ $^

######################################################################
# Dependencies

node.o: node.h

list-utest.o: list.h
list-utest.o: node.h
list-utest.o: utest.h

list-expt.o: list.h
list-expt.o: node.h
list-expt.o: expt.h

mem.o: mem.h

