From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: [PATCH resend] Makefile: explicitly set target name for autogenerated dependencies Date: Fri, 1 Feb 2013 19:03:13 -0500 Message-ID: <20130202000313.GA30191@sigill.intra.peff.net> References: <27376267.797831359716377823.JavaMail.weblogic@epml01> <20130201224519.GI12368@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Junio C Hamano , Jongman Heo , Thomas Rast , git , Antoine Pelisse , =?utf-8?B?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy To: Jonathan Nieder X-From: git-owner@vger.kernel.org Sat Feb 02 01:03:40 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U1Qa3-000241-Uz for gcvg-git-2@plane.gmane.org; Sat, 02 Feb 2013 01:03:40 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756419Ab3BBADS (ORCPT ); Fri, 1 Feb 2013 19:03:18 -0500 Received: from 75-15-5-89.uvs.iplsin.sbcglobal.net ([75.15.5.89]:55772 "EHLO peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755973Ab3BBADQ (ORCPT ); Fri, 1 Feb 2013 19:03:16 -0500 Received: (qmail 1285 invoked by uid 107); 2 Feb 2013 00:04:40 -0000 Received: from c-71-206-173-132.hsd1.va.comcast.net (HELO sigill.intra.peff.net) (71.206.173.132) (smtp-auth username relayok, mechanism cram-md5) by peff.net (qpsmtpd/0.84) with ESMTPA; Fri, 01 Feb 2013 19:04:40 -0500 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Fri, 01 Feb 2013 19:03:13 -0500 Content-Disposition: inline In-Reply-To: <20130201224519.GI12368@google.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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