From: Ian Campbell Subject: Re: [PATCH] tools: fix dependency file generation Date: Mon, 20 May 2013 16:56:28 +0100 Message-ID: <1369065388.21246.8.camel@zakaz.uk.xensource.com> References: <51950DC402000078000D6CA5@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51950DC402000078000D6CA5@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Ian Jackson , xen-devel List-Id: xen-devel@lists.xenproject.org On Thu, 2013-05-16 at 15:48 +0100, Jan Beulich wrote: > There is a small set of places where files in subdirectories get > compiled from the parent directory. Dependency file wise this is no > problem as long as the files use names distinct without regard to the > directories they sit in, and tools/console/ violates this (in having > two main.c files). Hence we need to avoid losing the directory name, > both to ensure the two compiler instances don't simultaneously write > to the same file (happening of which is what triggered me looking > into this) and to guarantee dependencies for all files will be seen > by make on an incremental rebuild. > > Signed-off-by: Jan Beulich Took me a while to grok the make functions (short answer foo/bar.o => .foo@bar.o.d). Looks good: Acked-by: Ian Campbell > > --- a/tools/Rules.mk > +++ b/tools/Rules.mk > @@ -62,7 +62,7 @@ SHLIB_libxenlight = -Wl,-rpath-link=$(X > CFLAGS += -D__XEN_TOOLS__ > > # Get gcc to generate the dependencies for us. > -CFLAGS += -MMD -MF .$(@F).d > +CFLAGS += -MMD -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d > DEPS = .*.d > > ifneq ($(FILE_OFFSET_BITS),) > > >