CXX=g++
CPPFLAGS=-Wall -g -std=c++0x
SOURCES=restaurant.cc sm_array.cc collect.cc tournament.cc
OBJECTS=$(SOURCES:.cc=.o)
EXE=restaurant

all: $(EXE)

$(EXE): $(OBJECTS)
	$(CXX) $(LDFLAGS) $(OBJECTS) -o $@

sm_array.o: sm_array.cc sm_array.h
collect.o: collect.cc collect.h sm_array.h
tournament.o: tournament.cc tournament.h

test-display: test-display.cc sm_array.o collect.o test_constants.h
test-contains: test-contains.cc sm_array.o collect.o test_constants.h
test-remove: test-remove.cc sm_array.o collect.o test_constants.h
test-add: test-add.cc sm_array.o collect.o test_constants.h
test-random: test-random.cc sm_array.o collect.o test_constants.h

clean:
	@rm -vf *.o
	@rm -rvf *.dSYM
	@rm -vf restaurant
	@rm -vf test-display
	@rm -vf test-random
	@rm -vf test-contains
	@rm -vf test-remove
	@rm -vf test-add

test: test-random test-display test-contains test-remove test-add
	./test-display
	./test-contains
	./test-remove
	./test-add
	@echo "remember to manually inspect test-random"

run: restaurant
	./restaurant
