* [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree
@ 2015-02-09 8:08 Fam Zheng
2015-02-09 8:25 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2015-02-09 8:08 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Michael Tokarev, Fam Zheng, Lluís Vilanova,
Stefan Hajnoczi
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))
@echo "Please call configure before running make!"
@exit 1
endif
@@ -433,9 +436,9 @@ TAGS:
find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
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"
# documentation
MAKEINFO=makeinfo
@@ -556,7 +559,7 @@ endif # CONFIG_WIN
# Add a dependency on the generated files, so that they are always
# rebuilt before other object files
-ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
+ifneq ($(filter-out %clean TAGS cscope,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
Makefile: $(GENERATED_HEADERS)
endif
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree
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
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2015-02-09 8:25 UTC (permalink / raw)
To: Fam Zheng
Cc: Paolo Bonzini, Michael Tokarev, QEMU Developers, Stefan Hajnoczi,
Lluís Vilanova
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).
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree
2015-02-09 8:25 ` Peter Maydell
@ 2015-02-09 8:46 ` Fam Zheng
0 siblings, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2015-02-09 8:46 UTC (permalink / raw)
To: Peter Maydell
Cc: Paolo Bonzini, Michael Tokarev, QEMU Developers, Stefan Hajnoczi,
Lluís Vilanova
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-09 8:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).