From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46482 invoked by alias); 8 Oct 2017 03:24:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 46399 invoked by uid 89); 8 Oct 2017 03:24:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=toward, puzzled, automatic, serious X-HELO: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Oct 2017 03:24:41 +0000 Received: from cmgw4 (unknown [10.0.90.85]) by gproxy7.mail.unifiedlayer.com (Postfix) with ESMTP id 7A368215D6E for ; Sat, 7 Oct 2017 21:24:40 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id JrQd1w00A2f2jeq01rQgiA; Sat, 07 Oct 2017 21:24:40 -0600 X-Authority-Analysis: v=2.2 cv=OZLoNlbY c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=02M-m0pO-4AA:10 a=pGLkceISAAAA:8 a=roo2R-DW-f-Er_MXOi8A:9 Received: from 75-166-4-236.hlrn.qwest.net ([75.166.4.236]:38728 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1e12Ci-002LEE-SS; Sat, 07 Oct 2017 21:24:36 -0600 From: Tom Tromey To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Replicate src dir in build dir References: <1505832159-23038-1-git-send-email-yao.qi@linaro.org> Date: Sun, 08 Oct 2017 03:24:00 -0000 In-Reply-To: <1505832159-23038-1-git-send-email-yao.qi@linaro.org> (Yao Qi's message of "Tue, 19 Sep 2017 15:42:39 +0100") Message-ID: <877ew6l3t7.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1e12Ci-002LEE-SS X-Source-Sender: 75-166-4-236.hlrn.qwest.net (bapiya) [75.166.4.236]:38728 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-10/txt/msg00158.txt.bz2 >>>>> "Yao" == Yao Qi writes: Yao> This patch takes the first step toward "Replicate src dir in build dir", Yao> that is, we create arch/ directory in buildtree, and put amd64.o there Yao> as an example. I think this is very nice. Thanks for doing it. But, there are a couple of bugs; one serious, one probably not. Yao> override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \ Yao> - -MF $(DEPDIR)/$(basename $(@F)).Tpo Yao> -override POSTCOMPILE = @mv $(DEPDIR)/$(basename $(@F)).Tpo \ Yao> - $(DEPDIR)/$(basename $(@F)).Po Yao> + -MF $(@D)/$(DEPDIR)/$(@F).Tpo Yao> +override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(@F).Tpo \ Yao> + $(@D)/$(DEPDIR)/$(@F).Po Yao> else Yao> override COMPILE.pre = source='$<' object='$@' libtool=no \ Yao> DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) $(CC) This hunk removed the $(basename ...) wrapper. This renames the dependency files from "basename.Tpo" to "basename.o.Tpo". However, it didn't change the dependencies include near the end of the Makefile: -include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files)) So, because the names differ, automatic dependency tracking no longer works. I was really puzzled today when my rebuilds were so fast! :-) I think the correct solution is to add the $(basename ...) back. I thought at first that the "-include" line could be fixed, but this won't work in case where "depcomp" is used -- because the name choice also has to coincide with what depcomp does. Finally, I think the arch/ change might not work properly with depcomp. The COMPILE.pre override (quoted in the context of the patch hunk above) probably needs a tweak to DEPDIR, I would guess DEPDIR=$(@D)/$(DEPDIR). However, I didn't try this case. (I think when I wrote this I tested the depcomp case by hacking the generated Makefile to ensure that the depcomp code was used; otherwise you need a non-capable compiler.) Tom