CXX := g++ CXXFLAGS := -std=c++11 -c LDFLAGS := -g LDLIBS= -lglfw srcfiles := $(wildcard src/*.cpp) objfiles := $(subst src,obj,$(subst .cpp,.o,$(srcfiles))) all: main.out main.out: $(objfiles) $(CXX) $(LDFLAGS) -o $@ $(objfiles) $(LDLIBS) obj/%.o: src/%.cpp mkdir -p obj $(CXX) $(CXXFLAGS) -o $@ $<