[notmuch] [PATCH] Makefile: Make object targets depend on Makefiles

Jan Janak jan at ryngle.com
Wed Nov 18 16:37:25 PST 2009


All objects need to be recompiled when any of the Makefiles changes, so
we make them all depend on all the Makefiles.

Signed-off-by: Jan Janak <jan at ryngle.com>
---
 Makefile |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 96aaa73..2787aff 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,9 @@ CFLAGS=-O2
 extra_cflags = `pkg-config --cflags glib-2.0 gmime-2.4 talloc`
 extra_cxxflags = `xapian-config --cxxflags`
 
+all_deps = Makefile Makefile.local Makefile.config \
+		   lib/Makefile lib/Makefile.local
+
 # Now smash together user's values with our extra values
 override CFLAGS += $(WARN_FLAGS) $(extra_cflags)
 override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags)
@@ -21,19 +24,19 @@ include lib/Makefile.local
 # And get user settings from the output of configure
 include Makefile.config
 
-%.o: %.cc
+%.o: %.cc $(all_deps)
 	$(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@
 
-%.o: %.c
+%.o: %.c $(all_deps)
 	$(CC) -c $(CFLAGS) $< -o $@
 
-.deps/%.d: %.c
+.deps/%.d: %.c $(all_deps)
 	@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
 	$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
 	sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
 	rm -f $@.$$$$
 
-.deps/%.d: %.cc
+.deps/%.d: %.cc $(all_deps)
 	@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
 	$(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
 	sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
-- 
1.6.3.3



More information about the notmuch mailing list