CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++11 -fwrapv -g
ifneq ($(DEBUG),)
	CXXFLAGS += -g
else
	CXXFLAGS += -O2
endif
BIN = solve

.PHONY: all clean remake

all: $(BIN)

clean:
	rm -rf $(BIN) *.o *.dSYM

remake: clean all


$(BIN): $(patsubst %.cpp,%.o,$(wildcard *.cpp))
	$(CXX) -o $@ $^

%.o: %.cpp $(wildcard *.h)
	$(CXX) $(CXXFLAGS) -c -o $@ $<