From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111006 invoked by alias); 8 Oct 2017 21:04:52 -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 110996 invoked by uid 89); 8 Oct 2017 21:04:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=automatic, toward, puzzled, office X-HELO: mail-qt0-f178.google.com Received: from mail-qt0-f178.google.com (HELO mail-qt0-f178.google.com) (209.85.216.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Oct 2017 21:04:50 +0000 Received: by mail-qt0-f178.google.com with SMTP id v28so31100389qtv.1 for ; Sun, 08 Oct 2017 14:04:50 -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=Egqfn8Ux3BaefXTC7qxuXFDuyrwk3J8gjbh1l9QK0v8=; b=HypQO1pEZehFtuQ7BUkHNq5I/LC1k5UrUW4ZS4WpnzVs3FFHlV1l5PG2EcRVDFU/x2 W1+qMpaa/2j65mt5Fy/+jaYDWYqCFf/FnEqoH4Ky30pXxClsAvqc6gdGN29cRMQ3vXlg 4RXeIrm54iGPTvy3KN60LMzLjVQJ8dt9GSrZ7DwhRWzV71PROtIz6+MRCLp7/kOeQjai jeAj6cZR57yZ7ns8ljkAIvo/PrApO7y6HBTe7GiJIqfsRMpFY6r+2MeSmfywnD7eUxoN geRm7oMrzK4XyQKfLm+SOxZWghiOlczqmV9rf/5B+3srpmhAKlqOzCf+L4KpT9HAUUwC q9ZA== X-Gm-Message-State: AMCzsaVZRIBKxZ3q2op6v8tb4shQejGa2hM3PKzHmUNwzM56CjWkGzKH W1Sl5ZCb0IfWnK1BUSrdxUydVVxDK4xkWix8LtA= X-Google-Smtp-Source: AOwi7QB8bu9Ngcnc+kOX7i+Dti3NYi6BhKMVom6iM9w2sZlBU0fRVFWCZrw5RNPj23qjrE7lFCLL+kYNuKQZrwKKTVU= X-Received: by 10.200.26.15 with SMTP id v15mr11911416qtj.62.1507496688553; Sun, 08 Oct 2017 14:04:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.153.208 with HTTP; Sun, 8 Oct 2017 14:04:47 -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: Sun, 08 Oct 2017 21:04:00 -0000 Message-ID: Subject: Re: [RFC] Replicate src dir in build dir To: Tom Tromey Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00171.txt.bz2 On Sun, Oct 8, 2017 at 4:24 AM, Tom Tromey wrote: >>>>>> "Yao" =3D=3D Yao Qi writes: > > Yao> This patch takes the first step toward "Replicate src dir in build d= ir", > Yao> that is, we create arch/ directory in buildtree, and put amd64.o the= re > 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. > Hi Tom, Thanks for pointing them out. I will look at them after I am back to office (13th Oct). > Yao> override COMPILE.post =3D -c -o $@ -MT $@ -MMD -MP \ > Yao> - -MF $(DEPDIR)/$(basename $(@F)).Tpo > Yao> -override POSTCOMPILE =3D @mv $(DEPDIR)/$(basename $(@F)).Tpo \ > Yao> - $(DEPDIR)/$(basename $(@F)).Po > Yao> + -MF $(@D)/$(DEPDIR)/$(@F).Tpo > Yao> +override POSTCOMPILE =3D @mv $(@D)/$(DEPDIR)/$(@F).Tpo \ > Yao> + $(@D)/$(DEPDIR)/$(@F).Po > Yao> else > Yao> override COMPILE.pre =3D source=3D'$<' object=3D'$@' libtool=3Dno \ > Yao> DEPDIR=3D$(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=3D$(@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 --=20 Yao (=E9=BD=90=E5=B0=A7)