EXE_W		= wilf-worker
EXE_S 		= wilf-server
EXE_I 		= wilf-interface
EXE_A   	= wilf-alone
CPP 		= g++  -g
CFLAGS		= --std=c++11 -march=corei7 -O3 -DNDEBUG

all: $(EXE_S) $(EXE_W) $(EXE_I) $(EXE_A)

dist/message.o:dist/message.cpp dist/message.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

dist/client.o:dist/client.cpp dist/client.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

dist/server.o:dist/server.cpp dist/server.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

dist/interface.o:dist/interface.cpp dist/interface.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

dist/worker.o:dist/worker.cpp dist/worker.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

src/gtask.o:src/gtask.cpp src/gtask.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

src/semigroup.o:src/semigroup.cpp src/semigroup.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

src/treewalk.o:src/treewalk.cpp src/treewalk.hpp
	$(CPP) $(CFLAGS) -c $< -o $@

$(EXE_W):dist/message.o dist/client.o dist/worker.o src/semigroup.o src/treewalk.o src/main-worker.cpp
	$(CPP) $(CFLAGS) $^ -o $@ $(LIBS)

$(EXE_S):dist/message.o dist/server.o src/gtask.o src/semigroup.o src/treewalk.o src/main-server.cpp
	$(CPP) $(CFLAGS) $^ -o $@ $(LIBS)

$(EXE_I):dist/message.o dist/client.o dist/interface.o src/main-interface.cpp
	$(CPP) $(CFLAGS) $^ -o $@ $(LIBS)

$(EXE_A):src/semigroup.o src/treewalk.o src/main-alone.cpp
	$(CPP) $(CFLAGS) $^ -o $@ $(LIBS)


clean:
	$(RM) -rf $(EXE_W) $(EXE_S) $(EXE_I) $(EXE_A)  data/* dist/*.o dist/*~ src/*.o src/*~