Patchwork [v2] allow make {dist, }clean work w/out configure

login
register
mail settings
Submitter Mike Frysinger
Date Sept. 16, 2012, 8:07 p.m.
Message ID <1347826033-4330-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/184147/
State New
Headers show

Comments

Mike Frysinger - Sept. 16, 2012, 8:07 p.m.
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>
---
v2
	- handle edge cases

 Makefile |    4 ++++
 1 file changed, 4 insertions(+)
Paolo Bonzini - Sept. 17, 2012, 8:46 a.m.
Il 16/09/2012 22:07, 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>
> ---
> v2
> 	- handle edge cases
> 
>  Makefile |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 1cd5bc8..0a37369 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:
> +ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
>  	@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
> +ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
>  Makefile: $(GENERATED_HEADERS)
> +endif
>  
>  # Include automatically generated dependency files
>  # Dependencies in Makefile.objs files come from our recursive subdir rules
> 

Looks good, thanks!

Paolo
Aurelien Jarno - Oct. 19, 2012, 7:32 p.m.
On Sun, Sep 16, 2012 at 04:07:13PM -0400, Mike Frysinger wrote:
> 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>
> ---
> v2
> 	- handle edge cases
> 
>  Makefile |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 1cd5bc8..0a37369 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:
> +ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
>  	@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
> +ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
>  Makefile: $(GENERATED_HEADERS)
> +endif
>  
>  # Include automatically generated dependency files
>  # Dependencies in Makefile.objs files come from our recursive subdir rules

Thanks, applied.

Patch

diff --git a/Makefile b/Makefile
index 1cd5bc8..0a37369 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:
+ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
 	@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
+ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
 Makefile: $(GENERATED_HEADERS)
+endif
 
 # Include automatically generated dependency files
 # Dependencies in Makefile.objs files come from our recursive subdir rules