diff mbox

allow make {dist,}clean work w/out configure

Message ID 1347755441-6499-1-git-send-email-vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger Sept. 16, 2012, 12:30 a.m. UTC
There's no reason to require configure to run before running a clean
target, so check MAKECMDGOALS before.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Makefile |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Paolo Bonzini Sept. 16, 2012, 9:52 a.m. UTC | #1
Il 16/09/2012 02:30, Mike Frysinger ha scritto:
> There's no reason to require configure to run before running a clean
> target, so check MAKECMDGOALS before.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  Makefile |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 1cd5bc8..e75740c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -14,9 +14,11 @@ config-host.mak: $(SRC_PATH)/configure
>  	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
>  else
>  config-host.mak:
> +ifeq ($(findstring clean,$(MAKECMDGOALS)),)

Please use instead:

ifneq ($(filter-out %clean,$(MAKECMDGOALS)),)

so that "make clean all" still gives error.

Paolo

>  	@echo "Please call configure before running make!"
>  	@exit 1
>  endif
> +endif
>  
>  GENERATED_HEADERS = config-host.h trace.h qemu-options.def
>  ifeq ($(TRACE_BACKEND),dtrace)
> @@ -398,7 +400,9 @@ qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
>  
>  # Add a dependency on the generated files, so that they are always
>  # rebuilt before other object files
> +ifeq ($(findstring clean,$(MAKECMDGOALS)),)
>  Makefile: $(GENERATED_HEADERS)
> +endif
>  
>  # Include automatically generated dependency files
>  # Dependencies in Makefile.objs files come from our recursive subdir rules
>
Mike Frysinger Sept. 16, 2012, 8:03 p.m. UTC | #2
On Sunday 16 September 2012 05:52:47 Paolo Bonzini wrote:
> Il 16/09/2012 02:30, Mike Frysinger ha scritto:
> > There's no reason to require configure to run before running a clean
> > target, so check MAKECMDGOALS before.
> > 
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -14,9 +14,11 @@ config-host.mak: $(SRC_PATH)/configure
> >  	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
> >  else
> >  config-host.mak:
> > +ifeq ($(findstring clean,$(MAKECMDGOALS)),)
> 
> Please use instead:
> 
> ifneq ($(filter-out %clean,$(MAKECMDGOALS)),)
> 
> so that "make clean all" still gives error.

that breaks `make` though.  or rather, `make` no longer errors out.  need to 
make it a little more complicated to handle this.
-mike
Paolo Bonzini Sept. 17, 2012, 7:55 a.m. UTC | #3
Il 16/09/2012 22:03, Mike Frysinger ha scritto:
>>> > > +ifeq ($(findstring clean,$(MAKECMDGOALS)),)
>> > 
>> > Please use instead:
>> > 
>> > ifneq ($(filter-out %clean,$(MAKECMDGOALS)),)
>> > 
>> > so that "make clean all" still gives error.
> that breaks `make` though.  or rather, `make` no longer errors out.  need to 
> make it a little more complicated to handle this.

Perhaps

MAKECMDGOALS ?= all

does it?

Paolo
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 1cd5bc8..e75740c 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,11 @@  config-host.mak: $(SRC_PATH)/configure
 	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
 else
 config-host.mak:
+ifeq ($(findstring clean,$(MAKECMDGOALS)),)
 	@echo "Please call configure before running make!"
 	@exit 1
 endif
+endif
 
 GENERATED_HEADERS = config-host.h trace.h qemu-options.def
 ifeq ($(TRACE_BACKEND),dtrace)
@@ -398,7 +400,9 @@  qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
 
 # Add a dependency on the generated files, so that they are always
 # rebuilt before other object files
+ifeq ($(findstring clean,$(MAKECMDGOALS)),)
 Makefile: $(GENERATED_HEADERS)
+endif
 
 # Include automatically generated dependency files
 # Dependencies in Makefile.objs files come from our recursive subdir rules