X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=Makefile;h=7743ef52cf98f0b3babd0cd99d9c8c47f6de49bb;hb=97c7cffdc6e0047bb49a899b013516bc3022e580;hp=91ab9c02cd623f583e03b5b241858f4b0fb40f43;hpb=c5dccd851a8b79d8cedbfc8f2d2b8f9be2b7fa5a;p=obsolete%2Fnotmuch-old diff --git a/Makefile b/Makefile index 91ab9c02..7743ef52 100644 --- a/Makefile +++ b/Makefile @@ -19,14 +19,21 @@ include lib/Makefile.local %.o: %.c $(CC) -c $(CFLAGS) $(NOTMUCH_CFLAGS) $< -o $@ -.depends: $(SRCS) - $(CXX) -M $(CPPFLAGS) $(NOTMUCH_DEPENDS_FLAGS) \ - $(NOTMUCH_CXX_DEPENDS_FLAGS) $^ > $@ --include .depends - -CLEAN := $(CLEAN) .depends +.deps/%.d: %.c + @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ + $(CC) -M $(CPPFLAGS) $(NOTMUCH_DEPENDS_FLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +.deps/%.d: %.cc + @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ + $(CXX) -M $(CPPFLAGS) $(NOTMUCH_CXX_DEPENDS_FLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +DEPS := $(SRCS:%.c=.deps/%.d) +DEPS := $(DEPS:%.cc=.deps/%.d) +-include $(DEPS) clean: - rm -f $(CLEAN) - - + rm -f $(CLEAN); rm -rf .deps