CXX=g++
CPPFLAGS=-Wall -g -std=c++0x
SOURCES=main.cc util.cc person.cc
OBJECTS=$(SOURCES:.cc=.o)
EXE=restaurant

all: $(EXE)

main.o: main.cc util.o person.o
util.o: util.h util.cc
person.o: person.cc person.h

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

run: $(EXE)
	./$(EXE) people.db /tmp/output.db
	cat /tmp/output.db

clean:
	@rm -vf *.o
	@rm -rvf *.dSYM
	@rm -vf $(EXE)

debug: $(EXE)
	gdb $(EXE)

valgrind: $(EXE)
	valgrind --tool=memcheck --leak-check=yes ./$(EXE) people.db /tmp/output.db
