diff mbox

[PATCH-repost] Makefile: avoid defconfig annoyance

Message ID 20091224122347.GA31513@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin Dec. 24, 2009, 12:23 p.m. UTC
This will be the last time you get
'config-devices.mak out of date' warning.

We have a config-devices.mak feature, which
makes it possile for distros to disable devices
they do not want. However, this is annoyng
for development where you just want
to use the default most of the time.

We want to distinguish between user overriding
config manually and just updating from git.
Do this, by sticking include directive in the generated files,
and avoiding error if the generated file only has such include
directives.

This patch is also careful to:
- not print warning while defconfig target is run
- tell user what will happen if make defconfig is run
  instead of just telling her what to do
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Any comments? If no, please apply to master.

 Makefile |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Comments

Stefan Weil Dec. 24, 2009, 12:46 p.m. UTC | #1
Michael S. Tsirkin schrieb:
> This will be the last time you get
> 'config-devices.mak out of date' warning.
>
> We have a config-devices.mak feature, which
> makes it possile for distros to disable devices
> they do not want. However, this is annoyng
> for development where you just want
> to use the default most of the time.
>
> We want to distinguish between user overriding
> config manually and just updating from git.
> Do this, by sticking include directive in the generated files,
> and avoiding error if the generated file only has such include
> directives.
>
> This patch is also careful to:
> - not print warning while defconfig target is run
> - tell user what will happen if make defconfig is run
>   instead of just telling her what to do
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Any comments? If no, please apply to master.
>
>  Makefile |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index a662d96..469ce43 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -39,18 +39,21 @@ SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
>  SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
>  
>  config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
> -	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@,"  GEN   $@")
> +	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | \
> +		grep -e =y -e ^-include | sort -u > $@,"  GEN   $@")
>  
>  %/config-devices.mak: default-configs/%.mak
> -	$(call quiet-command,cat $< > $@.tmp, "  GEN   $@")
> -	@if test -f $@ ; then \
> +	$(call quiet-command,echo '-include $<'> $@.tmp, "  GEN   $@")
> +	@if test -z "${QEMU_MAKE_DEFCONFIG}" -a -f $@ && \
> +            grep -v '^-?include' $@ ; then \
>  	  echo "WARNING: $@ out of date." ;\
> -	  echo "Run \"make defconfig\" to regenerate." ; \
> +	  echo "Update it or run \"make defconfig\" to remove it." ; \
>  	  rm $@.tmp ; \
>  	 else \
>  	  mv $@.tmp $@ ; \
>  	 fi
>  
> +defconfig: QEMU_MAKE_DEFCONFIG=yes
>  defconfig:
>  	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
>   

There is already a patch waiting for integration which fixes
the same problem: http://patchwork.ozlabs.org/patch/41507/

Stefan
Michael S. Tsirkin Dec. 24, 2009, 1:01 p.m. UTC | #2
On Thu, Dec 24, 2009 at 01:46:49PM +0100, Stefan Weil wrote:
> Michael S. Tsirkin schrieb:
> > This will be the last time you get
> > 'config-devices.mak out of date' warning.
> >
> > We have a config-devices.mak feature, which
> > makes it possile for distros to disable devices
> > they do not want. However, this is annoyng
> > for development where you just want
> > to use the default most of the time.
> >
> > We want to distinguish between user overriding
> > config manually and just updating from git.
> > Do this, by sticking include directive in the generated files,
> > and avoiding error if the generated file only has such include
> > directives.
> >
> > This patch is also careful to:
> > - not print warning while defconfig target is run
> > - tell user what will happen if make defconfig is run
> >   instead of just telling her what to do
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >
> > Any comments? If no, please apply to master.
> >
> >  Makefile |   11 +++++++----
> >  1 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index a662d96..469ce43 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -39,18 +39,21 @@ SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
> >  SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
> >  
> >  config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
> > -	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@,"  GEN   $@")
> > +	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | \
> > +		grep -e =y -e ^-include | sort -u > $@,"  GEN   $@")
> >  
> >  %/config-devices.mak: default-configs/%.mak
> > -	$(call quiet-command,cat $< > $@.tmp, "  GEN   $@")
> > -	@if test -f $@ ; then \
> > +	$(call quiet-command,echo '-include $<'> $@.tmp, "  GEN   $@")
> > +	@if test -z "${QEMU_MAKE_DEFCONFIG}" -a -f $@ && \
> > +            grep -v '^-?include' $@ ; then \
> >  	  echo "WARNING: $@ out of date." ;\
> > -	  echo "Run \"make defconfig\" to regenerate." ; \
> > +	  echo "Update it or run \"make defconfig\" to remove it." ; \
> >  	  rm $@.tmp ; \
> >  	 else \
> >  	  mv $@.tmp $@ ; \
> >  	 fi
> >  
> > +defconfig: QEMU_MAKE_DEFCONFIG=yes
> >  defconfig:
> >  	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
> >   
> 
> There is already a patch waiting for integration which fixes
> the same problem: http://patchwork.ozlabs.org/patch/41507/
> 
> Stefan

Hmm, yes ... I originally posted mine Dec 13 though, about 1 week before
you did on Dec 20 - I guess you missed mine in the same way I missed
yours?

There are some features in my patch that yours lacks,
for example make defconfig itself will still print
a warning with your patch, which is silly ...
diff mbox

Patch

diff --git a/Makefile b/Makefile
index a662d96..469ce43 100644
--- a/Makefile
+++ b/Makefile
@@ -39,18 +39,21 @@  SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
 
 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
-	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@,"  GEN   $@")
+	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | \
+		grep -e =y -e ^-include | sort -u > $@,"  GEN   $@")
 
 %/config-devices.mak: default-configs/%.mak
-	$(call quiet-command,cat $< > $@.tmp, "  GEN   $@")
-	@if test -f $@ ; then \
+	$(call quiet-command,echo '-include $<'> $@.tmp, "  GEN   $@")
+	@if test -z "${QEMU_MAKE_DEFCONFIG}" -a -f $@ && \
+            grep -v '^-?include' $@ ; then \
 	  echo "WARNING: $@ out of date." ;\
-	  echo "Run \"make defconfig\" to regenerate." ; \
+	  echo "Update it or run \"make defconfig\" to remove it." ; \
 	  rm $@.tmp ; \
 	 else \
 	  mv $@.tmp $@ ; \
 	 fi
 
+defconfig: QEMU_MAKE_DEFCONFIG=yes
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)