qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Lluís Vilanova" <vilanova@ac.upc.edu>
Subject: Re: [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree
Date: Mon, 9 Feb 2015 16:46:30 +0800	[thread overview]
Message-ID: <20150209084630.GB29334@ad.nay.redhat.com> (raw)
In-Reply-To: <CAFEAcA_kH9L2DY9yjC4OAvV8aeB7Hvxj7ACwX8Vj4DDdGjTZBg@mail.gmail.com>

On Mon, 02/09 08:25, Peter Maydell wrote:
> On 9 February 2015 at 08:08, Fam Zheng <famz@redhat.com> wrote:
> > It doesn't make much sense to ask one to switch to build dir in order to
> > make these two targets.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  Makefile | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 6817c6f..257bef6 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -3,6 +3,9 @@
> >  # Always point to the root of the build tree (needs GNU make).
> >  BUILD_DIR=$(CURDIR)
> >
> > +# Before including a proper config-host.mak, assume we are in the source tree
> > +SRC_PATH=.
> > +
> >  # All following code might depend on configuration variables
> >  ifneq ($(wildcard config-host.mak),)
> >  # Put the all: rule here so that config-host.mak can contain dependencies.
> > @@ -38,7 +41,7 @@ config-host.mak: $(SRC_PATH)/configure
> >         fi
> >  else
> >  config-host.mak:
> > -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
> > +ifneq ($(filter-out %clean TAGS cscope,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
> 
> Probably better to define a variable for the targets which can be
> called on an unconfigured directory rather than having "clean TAGS cscope"
> in two places.
> 
> >  cscope:
> > -       rm -f ./cscope.*
> > -       find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
> > -       cscope -b
> > +       rm -f "$(SRC_PATH)"/cscope.*
> > +       find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
> > +       cscope -b -i"$(SRC_PATH)/cscope.files"
> 
> Isn't this going to result in our writing the cscope.files into the
> source tree but the cross-reference into the build directory?
> That seems inconsistent (and I'm not really convinced about the
> wisdom of anything in the makefile writing to the source tree).

This patch is useful when you really want "make cscope", when you're already at
your $(SRC_PATH). The "find | sed; cscope" command sequence is way too
cumbersome.

For those who are not the in-tree build type, I assume leaving out '-f
"$(SRC_PATH)/cscope.out"' should slightly ease the concern about writing to
source tree? :)

I don't know a better place to put the reference. I always start vim from
$(SRC_PATH).

Fam

      reply	other threads:[~2015-02-09  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  8:08 [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree Fam Zheng
2015-02-09  8:25 ` Peter Maydell
2015-02-09  8:46   ` Fam Zheng [this message]

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=20150209084630.GB29334@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /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;
as well as URLs for NNTP newsgroup(s).