From: Tom Tromey <tom@tromey.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Replicate src dir in build dir
Date: Sun, 08 Oct 2017 03:24:00 -0000 [thread overview]
Message-ID: <877ew6l3t7.fsf@tromey.com> (raw)
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")
>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> 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
next prev parent reply other threads:[~2017-10-08 3:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 14:42 Yao Qi
2017-09-19 20:44 ` Simon Marchi
2017-09-20 8:04 ` Yao Qi
2017-09-20 8:17 ` Simon Marchi
2017-09-20 14:26 ` Yao Qi
2017-09-20 11:26 ` Pedro Alves
2017-09-20 16:49 ` Yao Qi
2017-09-20 17:45 ` Pedro Alves
2017-09-29 19:23 ` Yao Qi
2017-10-03 20:02 ` Pedro Alves
2017-10-03 20:14 ` Kamil Rytarowski
2017-10-03 22:04 ` Pedro Alves
2017-10-04 9:46 ` Kamil Rytarowski
2017-10-06 9:29 ` Yao Qi
2017-10-04 11:41 ` Pedro Alves
2017-10-06 10:21 ` Yao Qi
2017-10-08 3:24 ` Tom Tromey [this message]
2017-10-08 21:04 ` Yao Qi
2017-10-11 1:25 ` Yao Qi
2017-10-11 3:26 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877ew6l3t7.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox