1.PHONY: cleandeps
2
3ifneq ($(OS),Windows)
4
5.static-dep/%.dep: %.cpp
6	@mkdir -p $(dir $@)
7	$(CXX) -MM -MT $(patsubst %.cpp,%.o,$<) $(CPPFLAGS) $< > $@
8
9.shared-dep/%.dep: %.cpp
10	@mkdir -p $(dir $@)
11	$(CXX) -MM -MT $(patsubst %.cpp,%.lo,$<) $(CPPFLAGS) $< > $@
12
13ifneq ($(MAKECMDGOALS),clean)
14ifneq ($(MAKECMDGOALS),distclean)
15-include $(addprefix .static-dep/,$(SRC:.cpp=.dep))
16-include $(addprefix .shared-dep/,$(SRC:.cpp=.dep))
17endif
18endif
19
20cleandeps:
21	$(RM) -R .static-dep
22	$(RM) -R .shared-dep
23
24else
25cleandeps:
26endif
27