[PATCH] Makefile: Make object targets depend on Makefiles

classic Classic list List threaded Threaded
2 messages Options
Jan Janak-2 Jan Janak-2
Reply | Threaded
Open this post in threaded view
|

[PATCH] Makefile: Make object targets depend on Makefiles

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 <[hidden email]>
---
 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


Carl Worth-2 Carl Worth-2
Reply | Threaded
Open this post in threaded view
|

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

On Thu, 19 Nov 2009 01:37:25 +0100, Jan Janak <[hidden email]> wrote:
> All objects need to be recompiled when any of the Makefiles changes, so
> we make them all depend on all the Makefiles.

An excellent fix, Jan. Pushed!

-Carl