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 <jan@ryngle.com>
This commit is contained in:
Jan Janak 2009-11-19 01:37:25 +01:00 committed by Carl Worth
parent dbb29a77fa
commit 5150b15b87

View file

@ -13,6 +13,9 @@ ifeq ($(emacs_lispdir),)
emacs_lispdir = $(prefix)/share/site-lisp emacs_lispdir = $(prefix)/share/site-lisp
endif endif
all_deps = Makefile Makefile.local Makefile.config \
lib/Makefile lib/Makefile.local
# Now smash together user's values with our extra values # Now smash together user's values with our extra values
override CFLAGS += $(WARN_FLAGS) $(extra_cflags) override CFLAGS += $(WARN_FLAGS) $(extra_cflags)
override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags)
@ -28,22 +31,22 @@ include lib/Makefile.local
# And get user settings from the output of configure # And get user settings from the output of configure
include Makefile.config include Makefile.config
%.o: %.cc %.o: %.cc $(all_deps)
$(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@ $(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@
%.o: %.c %.o: %.c $(all_deps)
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
%.elc: %.el %.elc: %.el
emacs -batch -f batch-byte-compile $< emacs -batch -f batch-byte-compile $<
.deps/%.d: %.c .deps/%.d: %.c $(all_deps)
@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \ $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \ sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$ rm -f $@.$$$$
.deps/%.d: %.cc .deps/%.d: %.cc $(all_deps)
@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
$(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \ $(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \ sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \