From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKjzN-0007PY-6h for qemu-devel@nongnu.org; Mon, 09 Feb 2015 03:46:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKjzK-0000qA-0s for qemu-devel@nongnu.org; Mon, 09 Feb 2015 03:46:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKjzJ-0000q6-Nv for qemu-devel@nongnu.org; Mon, 09 Feb 2015 03:46:37 -0500 Date: Mon, 9 Feb 2015 16:46:30 +0800 From: Fam Zheng Message-ID: <20150209084630.GB29334@ad.nay.redhat.com> References: <1423469297-10826-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Michael Tokarev , QEMU Developers , Stefan Hajnoczi , =?iso-8859-1?Q?Llu=EDs?= Vilanova On Mon, 02/09 08:25, Peter Maydell wrote: > On 9 February 2015 at 08:08, Fam Zheng 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 > > --- > > 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