Created
February 9, 2014 21:29
-
-
Save zeux/8906196 to your computer and use it in GitHub Desktop.
Create folders for output files using things you can learn from 'man make'
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
# Before | |
$(BUILD)/%.o: % | |
@mkdir -p $(dir $@) | |
$(CXX) $< $(CXXFLAGS) -MMD -MP -o $@ | |
-include $(OBJECTS:.o=.d) | |
# After | |
.SECONDEXPANSION: | |
%/.sentinel: | |
mkdir -p $(dir $@) | |
@touch $@ | |
$(OBJECTS): $(BUILD)/%.o: % $$(dir $$@).sentinel | |
$(CXX) $< $(CXXFLAGS) -MMD -MP -o $@ | |
-include $(OBJECTS:.o=.d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment