Created
December 7, 2013 16:03
-
-
Save corburn/7844384 to your computer and use it in GitHub Desktop.
Makefile with Auto-Dependency Generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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