Skip to content

Instantly share code, notes, and snippets.

@corburn
Created December 7, 2013 16:03
Show Gist options
  • Save corburn/7844384 to your computer and use it in GitHub Desktop.
Save corburn/7844384 to your computer and use it in GitHub Desktop.
Makefile with Auto-Dependency Generation
NAMES=main newClass newClass1
test: $(addsuffix .o, $(NAMES))
$(CXX) -o $@ $^
%.o: %.cpp
$(COMPILE.cc) -MMD -MP -o $@ $<
.PHONY: clean
clean:
$(RM) test $(addsuffix .o, $(NAMES)) $(addsuffix .d, $(NAMES))
include $(addsuffix *.d, $(NAMES))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment