On Fri, Feb 01, 2013 at 02:45:19PM -0800, Jonathan Nieder wrote: > After a change in a header file, object files in a subdirectory are > not automatically rebuilt by "make": > > $ touch cache.h > $ make builtin/add.o > $ > > Luckily we can prevent trouble by explicitly supplying the name of the > target to ccache and gcc, using the -MQ option. Do so. Thanks, I missed the original thread last year, but this does look like the same problem. The fixed version of ccache is a few years old, but the OP did mention RHEL5, so that makes sense. > missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs)) > dep_file = $(dir $@).depend/$(notdir $@).d > -dep_args = -MF $(dep_file) -MMD -MP > +dep_args = -MF $(dep_file) -MQ $@ -MMD -MP This looks like a nice simple solution. The only downside would be if -MQ is not supported by some gcc versions (in which case we would do better to improve the "can we use computed dependencies" check, and punish people on old ccache, not people on old gcc who otherwise could work without -MQ). As far as I can tell, though, -MQ came along with the other dependency generation options in 2001: http://gcc.gnu.org/news/dependencies.html which means it's not a problem to rely on. So the patch looks good to me. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html