From patchwork Wed Oct 11 01:25:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 23469 Received: (qmail 123638 invoked by alias); 11 Oct 2017 01:25:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 123624 invoked by uid 89); 11 Oct 2017 01:25:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f172.google.com Received: from mail-qt0-f172.google.com (HELO mail-qt0-f172.google.com) (209.85.216.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Oct 2017 01:25:35 +0000 Received: by mail-qt0-f172.google.com with SMTP id o52so923666qtc.9 for ; Tue, 10 Oct 2017 18:25:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GYNuq390/u9d8k1BfM3l9djK6c3JE+UoT7XmVKY4E+Q=; b=PzPjF9Bo2P4E50dTuuEZlFX65puostHkGcn094ff09izcQySH4kxmCCr/s/d4ErQqC 1yv114+oFReMttM9p78RdvFSLQC5UlNWG7gWJ3IgPB2YFqsBiFJxGwEAmpkeiJGoK6ty 54axcRCu3dt7F1KJfq10GMCAWddjnGYLSj3ubWNA+cjKy7+Emg4KqyBTp35RH/I9KfYg AGdW9PBvj/KxEMydteWbHzY3J53kY99XPjFWV3qFkL6sHY0lwdCqDrhlIR0Qb6R34F1a 5gdpblQqdH0aiMBZhZLQqvNh6Z1F3RBfFWzCr7c3bEFUX5Ib0a+CJiSaaYLZ4nKWiWGd ufPQ== X-Gm-Message-State: AMCzsaXHUrE1xwK5KN6ViIpbfltQoa15X5ravAcH+GDZDVVjBYZQpAx2 jxP1zoaKjwMsppbidckKZGJ9RNq5y745ziewMWeCVQ== X-Google-Smtp-Source: AOwi7QBMe+N2KReG6o8spjYsKO489ZwNsokDd8y6hBkgDSFt56eNYb+UXhlYhsVqcxxwAU9q6JXOKd6O4mdbF26Q99g= X-Received: by 10.55.12.130 with SMTP id 124mr16874702qkm.186.1507685134185; Tue, 10 Oct 2017 18:25:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.153.208 with HTTP; Tue, 10 Oct 2017 18:25:33 -0700 (PDT) In-Reply-To: <877ew6l3t7.fsf@tromey.com> References: <1505832159-23038-1-git-send-email-yao.qi@linaro.org> <877ew6l3t7.fsf@tromey.com> From: Yao Qi Date: Wed, 11 Oct 2017 02:25:33 +0100 Message-ID: Subject: Re: [RFC] Replicate src dir in build dir To: Tom Tromey Cc: "gdb-patches@sourceware.org" X-IsSubscribed: yes [I happen to have some time today, so look into this problem a little bit] On Sun, Oct 8, 2017 at 4:24 AM, Tom Tromey wrote: > 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 Right, I should add $(basename ) back, like the patch below. > 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.) If I understand you correctly, depcomp has already taken care of it. See my reply to Simon's review. https://sourceware.org/ml/gdb-patches/2017-09/msg00489.html diff --git a/gdb/Makefile.in b/gdb/Makefile.in index da4095d..90ddc02 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2952,8 +2952,8 @@ ifeq ($(DEPMODE),depmode=gcc3) # into place if the compile succeeds. We need this because gcc does # not atomically write the dependency output file. override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \ - -MF $(@D)/$(DEPDIR)/$(@F).Tpo -override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(@F).Tpo \ + -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo +override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \ $(@D)/$(DEPDIR)/$(@F).Po else override COMPILE.pre = source='$<' object='$@' libtool=no \