CXXFLAGS=-Wall -g -std=c++0x -Ijsoncpp -DJSON_IS_AMALGAMATION
all: app iotest

app: main.o tournament.o restaurant.o json.o io.o
	$(CXX) $(CXXFLAGS)  main.o restaurant.o tournament.o io.o json.o -o $@

main.o: main.cpp
restaurant.o: restaurant.cpp restaurant.h
tournament.o: tournament.cpp tournament.h
io.o: io.h io.cpp
json.o: jsoncpp/jsoncpp.cpp
	$(CXX) $(CXXFLAGS)  $< -c -o $@

iotest: iotest.cpp io.o json.o restaurant.o

clean:
	@rm -vf *.o
	@rm -vf app
	@rm -vf iotest
	@rm -rvf *.dSYM

test: all
	@./app

io: iotest
	@./iotest restaurants.db

debug: all
	gdb rest
