All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Makefile: A few post-meson-conversion fixes
@ 2020-09-01 14:20 Greg Kurz
  2020-09-01 14:20 ` [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules Greg Kurz
  2020-09-01 14:20 ` [PATCH 2/2] Makefile: Fix in-tree clean/distclean Greg Kurz
  0 siblings, 2 replies; 8+ messages in thread
From: Greg Kurz @ 2020-09-01 14:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

The meson conversion broke the ability to use cscope, etags and ctags
without running configure beforehand, which is a bit painful. This series
restore the previous behavior.

---

Greg Kurz (2):
      Makefile: Add back TAGS/ctags/cscope rules
      Makefile: Fix in-tree clean/distclean


 Makefile |   33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

--
Greg



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules
  2020-09-01 14:20 [PATCH 0/2] Makefile: A few post-meson-conversion fixes Greg Kurz
@ 2020-09-01 14:20 ` Greg Kurz
  2020-09-01 14:59   ` Connor Kuehl
  2020-09-01 14:20 ` [PATCH 2/2] Makefile: Fix in-tree clean/distclean Greg Kurz
  1 sibling, 1 reply; 8+ messages in thread
From: Greg Kurz @ 2020-09-01 14:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

It is a bit of a pain to be forced to run configure before being able
to use cscope and friends. Add back the rules to build them in-tree
as before commit a56650518f5b.

Fixes: a56650518f5b ("configure: integrate Meson in the build system")
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 Makefile |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 81794d5c34a2..8ffe2872915d 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ ninja-distclean::
 build.ninja: config-host.mak
 
 Makefile.ninja: build.ninja ninjatool
-	./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
+	./ninjatool -t ninja2make --omit clean dist uninstall cscope TAGS ctags < $< > $@
 -include Makefile.ninja
 
 ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
@@ -229,6 +229,21 @@ distclean: clean ninja-distclean
 	rm -f linux-headers/asm
 	rm -Rf .sdk
 
+.PHONY: ctags
+ctags:
+	rm -f tags
+	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
+
+.PHONY: TAGS
+TAGS:
+	rm -f TAGS
+	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
+
+cscope:
+	rm -f "$(SRC_PATH)"/cscope.*
+	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed -e 's,^\./,,' > "$(SRC_PATH)/cscope.files"
+	cscope -b -i"$(SRC_PATH)/cscope.files"
+
 ifdef INSTALL_BLOBS
 BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] Makefile: Fix in-tree clean/distclean
  2020-09-01 14:20 [PATCH 0/2] Makefile: A few post-meson-conversion fixes Greg Kurz
  2020-09-01 14:20 ` [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules Greg Kurz
@ 2020-09-01 14:20 ` Greg Kurz
  1 sibling, 0 replies; 8+ messages in thread
From: Greg Kurz @ 2020-09-01 14:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

Doing 'make clean' or 'make distclean' in a freshly cloned tree results in:

make: *** No rule to make target 'ninja-clean', needed by 'clean'.  Stop.

Make the fallback rules global. While here, change the ninjatool recipe to
always have a zero exit status and thus prevent make to emit a warning.

Fixes: a56650518f5b ("configure: integrate Meson in the build system")
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 Makefile |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 8ffe2872915d..08f4d3eb5c3c 100644
--- a/Makefile
+++ b/Makefile
@@ -54,13 +54,6 @@ export NINJA=./ninjatool
 # enough to prime the rest of the build.
 ninjatool: build.ninja
 
-# Only needed in case Makefile.ninja does not exist.
-.PHONY: ninja-clean ninja-distclean clean-ctlist
-clean-ctlist:
-ninja-clean::
-ninja-distclean::
-build.ninja: config-host.mak
-
 Makefile.ninja: build.ninja ninjatool
 	./ninjatool -t ninja2make --omit clean dist uninstall cscope TAGS ctags < $< > $@
 -include Makefile.ninja
@@ -115,6 +108,13 @@ ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fa
 endif
 endif
 
+# Only needed in case Makefile.ninja does not exist.
+.PHONY: ninja-clean ninja-distclean clean-ctlist
+clean-ctlist:
+ninja-clean::
+ninja-distclean::
+build.ninja: config-host.mak
+
 include $(SRC_PATH)/rules.mak
 
 # lor is defined in rules.mak
@@ -195,7 +195,7 @@ recurse-clean: $(addsuffix /clean, $(ROM_DIRS))
 ######################################################################
 
 clean: recurse-clean ninja-clean clean-ctlist
-	-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
+	if test -f ninjatool; then ./ninjatool $(if $(V),-v,) -t clean; fi
 # avoid old build problems by removing potentially incorrect old files
 	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
 	find . \( -name '*.so' -o -name '*.dll' -o -name '*.[oda]' \) -type f \




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules
  2020-09-01 14:20 ` [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules Greg Kurz
@ 2020-09-01 14:59   ` Connor Kuehl
  2020-09-01 15:18     ` Greg Kurz
  2020-09-01 16:04     ` Paolo Bonzini
  0 siblings, 2 replies; 8+ messages in thread
From: Connor Kuehl @ 2020-09-01 14:59 UTC (permalink / raw)
  To: Greg Kurz, qemu-devel; +Cc: Paolo Bonzini

On 9/1/20 9:20 AM, Greg Kurz wrote:
> It is a bit of a pain to be forced to run configure before being able
> to use cscope and friends. Add back the rules to build them in-tree
> as before commit a56650518f5b.
> 
> Fixes: a56650518f5b ("configure: integrate Meson in the build system")
> Signed-off-by: Greg Kurz <groug@kaod.org>

This might be a user error on my part, but the way I read this it sounds 
like I could do this:

	$ rm -rf build
	$ make cscope

and have it emit a cscope file,  but when I do so it complains about the 
build dir not existing. As I understand it, running ./configure (or 
meson build) is what generates that build dir. Here's the error for 
posterity:

changing dir to build for make "cscope"...
make[1]: *** build: No such file or directory.  Stop.
make: *** [GNUmakefile:11: cscope] Error 2

One comment inline

> ---
>   Makefile |   17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 81794d5c34a2..8ffe2872915d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -62,7 +62,7 @@ ninja-distclean::
>   build.ninja: config-host.mak
>   
>   Makefile.ninja: build.ninja ninjatool
> -	./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
> +	./ninjatool -t ninja2make --omit clean dist uninstall cscope TAGS ctags < $< > $@
>   -include Makefile.ninja
>   
>   ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
> @@ -229,6 +229,21 @@ distclean: clean ninja-distclean
>   	rm -f linux-headers/asm
>   	rm -Rf .sdk
>   
> +.PHONY: ctags
> +ctags:
> +	rm -f tags
> +	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
> +
> +.PHONY: TAGS
> +TAGS:
> +	rm -f TAGS
> +	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
> +
> +cscope:

Since this recipe doesn't output an artifact called "cscope" I wonder if 
this should be:

.PHONY: cscope
cscope:
	...

or alternatively:

cscope.out:
	...


> +	rm -f "$(SRC_PATH)"/cscope.*
> +	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed -e 's,^\./,,' > "$(SRC_PATH)/cscope.files"
> +	cscope -b -i"$(SRC_PATH)/cscope.files"
> +
>   ifdef INSTALL_BLOBS
>   BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
>   vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
> 
> 
> 

Connor



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules
  2020-09-01 14:59   ` Connor Kuehl
@ 2020-09-01 15:18     ` Greg Kurz
  2020-09-01 16:04     ` Paolo Bonzini
  1 sibling, 0 replies; 8+ messages in thread
From: Greg Kurz @ 2020-09-01 15:18 UTC (permalink / raw)
  To: Connor Kuehl; +Cc: Paolo Bonzini, qemu-devel

On Tue, 1 Sep 2020 09:59:23 -0500
Connor Kuehl <ckuehl@redhat.com> wrote:

> On 9/1/20 9:20 AM, Greg Kurz wrote:
> > It is a bit of a pain to be forced to run configure before being able
> > to use cscope and friends. Add back the rules to build them in-tree
> > as before commit a56650518f5b.
> > 
> > Fixes: a56650518f5b ("configure: integrate Meson in the build system")
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> 
> This might be a user error on my part, but the way I read this it sounds 
> like I could do this:
> 
> 	$ rm -rf build
> 	$ make cscope
> 
> and have it emit a cscope file,  but when I do so it complains about the 
> build dir not existing. As I understand it, running ./configure (or 
> meson build) is what generates that build dir. Here's the error for 
> posterity:
> 
> changing dir to build for make "cscope"...
> make[1]: *** build: No such file or directory.  Stop.
> make: *** [GNUmakefile:11: cscope] Error 2
> 

My use case is :

$ git clone git://git.qemu.org/qemu.git && cd qemu && make cscope
Cloning into 'qemu'...
remote: Counting objects: 510519, done.
remote: Compressing objects: 100% (91407/91407), done.
remote: Total 510519 (delta 420069), reused 507399 (delta 417643)
Receiving objects: 100% (510519/510519), 180.42 MiB | 29.30 MiB/s, done.
Resolving deltas: 100% (420069/420069), done.
make: Nothing to be done for 'cscope'.

> One comment inline
> 
> > ---
> >   Makefile |   17 ++++++++++++++++-
> >   1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 81794d5c34a2..8ffe2872915d 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -62,7 +62,7 @@ ninja-distclean::
> >   build.ninja: config-host.mak
> >   
> >   Makefile.ninja: build.ninja ninjatool
> > -	./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
> > +	./ninjatool -t ninja2make --omit clean dist uninstall cscope TAGS ctags < $< > $@
> >   -include Makefile.ninja
> >   
> >   ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
> > @@ -229,6 +229,21 @@ distclean: clean ninja-distclean
> >   	rm -f linux-headers/asm
> >   	rm -Rf .sdk
> >   
> > +.PHONY: ctags
> > +ctags:
> > +	rm -f tags
> > +	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
> > +
> > +.PHONY: TAGS
> > +TAGS:
> > +	rm -f TAGS
> > +	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
> > +
> > +cscope:
> 
> Since this recipe doesn't output an artifact called "cscope" I wonder if 
> this should be:
> 
> .PHONY: cscope

We already have it somewhere else in the makefile:

.PHONY: all clean cscope distclean install \

Since this patch is a partial revert of a56650518f5b, I didn't consider
moving it here.


Cheers,

--
Greg

> cscope:
> 	...
> 
> or alternatively:
> 
> cscope.out:
> 	...
> 
> 
> > +	rm -f "$(SRC_PATH)"/cscope.*
> > +	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed -e 's,^\./,,' > "$(SRC_PATH)/cscope.files"
> > +	cscope -b -i"$(SRC_PATH)/cscope.files"
> > +
> >   ifdef INSTALL_BLOBS
> >   BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
> >   vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
> > 
> > 
> > 
> 
> Connor
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules
  2020-09-01 14:59   ` Connor Kuehl
  2020-09-01 15:18     ` Greg Kurz
@ 2020-09-01 16:04     ` Paolo Bonzini
  2020-09-01 16:07       ` Connor Kuehl
  2020-09-01 16:23       ` Greg Kurz
  1 sibling, 2 replies; 8+ messages in thread
From: Paolo Bonzini @ 2020-09-01 16:04 UTC (permalink / raw)
  To: Connor Kuehl, Greg Kurz, qemu-devel

On 01/09/20 16:59, Connor Kuehl wrote:
> On 9/1/20 9:20 AM, Greg Kurz wrote:
>> It is a bit of a pain to be forced to run configure before being able
>> to use cscope and friends. Add back the rules to build them in-tree
>> as before commit a56650518f5b.
>>
>> Fixes: a56650518f5b ("configure: integrate Meson in the build system")
>> Signed-off-by: Greg Kurz <groug@kaod.org>
> 
> This might be a user error on my part, but the way I read this it sounds
> like I could do this:
> 
>     $ rm -rf build
>     $ make cscope
> 
> and have it emit a cscope file,  but when I do so it complains about the
> build dir not existing. As I understand it, running ./configure (or
> meson build) is what generates that build dir. Here's the error for
> posterity:
> 
> changing dir to build for make "cscope"...
> make[1]: *** build: No such file or directory.  Stop.
> make: *** [GNUmakefile:11: cscope] Error 2

You have a stray GNUmakefile in your source directory.  It's not
introduced by Greg's patch.

I suggest that you remove the GNUmakefile and just use out-of-tree builds.

> [...]
> Since this recipe doesn't output an artifact called "cscope" I wonder if
> this should be:
> 
> .PHONY: cscope
> cscope:
>     ...
> 
> or alternatively:
> 
> cscope.out:
>     ...

Yes it should be phony.  I have adjusted the patch and queued it.

Paolo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules
  2020-09-01 16:04     ` Paolo Bonzini
@ 2020-09-01 16:07       ` Connor Kuehl
  2020-09-01 16:23       ` Greg Kurz
  1 sibling, 0 replies; 8+ messages in thread
From: Connor Kuehl @ 2020-09-01 16:07 UTC (permalink / raw)
  To: Paolo Bonzini, Greg Kurz, qemu-devel

On 9/1/20 11:04 AM, Paolo Bonzini wrote:
> On 01/09/20 16:59, Connor Kuehl wrote:
>> On 9/1/20 9:20 AM, Greg Kurz wrote:
>>> It is a bit of a pain to be forced to run configure before being able
>>> to use cscope and friends. Add back the rules to build them in-tree
>>> as before commit a56650518f5b.
>>>
>>> Fixes: a56650518f5b ("configure: integrate Meson in the build system")
>>> Signed-off-by: Greg Kurz <groug@kaod.org>
>>
>> This might be a user error on my part, but the way I read this it sounds
>> like I could do this:
>>
>>      $ rm -rf build
>>      $ make cscope
>>
>> and have it emit a cscope file,  but when I do so it complains about the
>> build dir not existing. As I understand it, running ./configure (or
>> meson build) is what generates that build dir. Here's the error for
>> posterity:
>>
>> changing dir to build for make "cscope"...
>> make[1]: *** build: No such file or directory.  Stop.
>> make: *** [GNUmakefile:11: cscope] Error 2
> 
> You have a stray GNUmakefile in your source directory.  It's not
> introduced by Greg's patch.
> 
> I suggest that you remove the GNUmakefile and just use out-of-tree builds.

You're right! There was a stray GNUmakefile. Thanks!

Connor



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules
  2020-09-01 16:04     ` Paolo Bonzini
  2020-09-01 16:07       ` Connor Kuehl
@ 2020-09-01 16:23       ` Greg Kurz
  1 sibling, 0 replies; 8+ messages in thread
From: Greg Kurz @ 2020-09-01 16:23 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Connor Kuehl, qemu-devel

On Tue, 1 Sep 2020 18:04:59 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 01/09/20 16:59, Connor Kuehl wrote:
> > On 9/1/20 9:20 AM, Greg Kurz wrote:
> >> It is a bit of a pain to be forced to run configure before being able
> >> to use cscope and friends. Add back the rules to build them in-tree
> >> as before commit a56650518f5b.
> >>
> >> Fixes: a56650518f5b ("configure: integrate Meson in the build system")
> >> Signed-off-by: Greg Kurz <groug@kaod.org>
> > 
> > This might be a user error on my part, but the way I read this it sounds
> > like I could do this:
> > 
> >     $ rm -rf build
> >     $ make cscope
> > 
> > and have it emit a cscope file,  but when I do so it complains about the
> > build dir not existing. As I understand it, running ./configure (or
> > meson build) is what generates that build dir. Here's the error for
> > posterity:
> > 
> > changing dir to build for make "cscope"...
> > make[1]: *** build: No such file or directory.  Stop.
> > make: *** [GNUmakefile:11: cscope] Error 2
> 
> You have a stray GNUmakefile in your source directory.  It's not
> introduced by Greg's patch.
> 
> I suggest that you remove the GNUmakefile and just use out-of-tree builds.
> 
> > [...]
> > Since this recipe doesn't output an artifact called "cscope" I wonder if
> > this should be:
> > 
> > .PHONY: cscope
> > cscope:
> >     ...
> > 
> > or alternatively:
> > 
> > cscope.out:
> >     ...
> 
> Yes it should be phony.  I have adjusted the patch and queued it.
> 

FWIW, as said in another mail, it is phony somewhere else in the makefile.

> Paolo
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-01 16:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 14:20 [PATCH 0/2] Makefile: A few post-meson-conversion fixes Greg Kurz
2020-09-01 14:20 ` [PATCH 1/2] Makefile: Add back TAGS/ctags/cscope rules Greg Kurz
2020-09-01 14:59   ` Connor Kuehl
2020-09-01 15:18     ` Greg Kurz
2020-09-01 16:04     ` Paolo Bonzini
2020-09-01 16:07       ` Connor Kuehl
2020-09-01 16:23       ` Greg Kurz
2020-09-01 14:20 ` [PATCH 2/2] Makefile: Fix in-tree clean/distclean Greg Kurz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.