Patchwork [3/4] rules/mak: make clean should blow away timestamp files

login
register
mail settings
Submitter Michael S. Tsirkin
Date Jan. 15, 2013, 4:57 p.m.
Message ID <d6a80c4d4cfb62bfa99b37d0acd466d7ed77c53b.1358267772.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/212251/
State New
Headers show

Comments

Michael S. Tsirkin - Jan. 15, 2013, 4:57 p.m.
Using a global pattern makes it easier to clean out
old generated files.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 rules.mak | 5 +++++
 1 file changed, 5 insertions(+)
Stefan Hajnoczi - Jan. 17, 2013, 10:28 a.m.
On Tue, Jan 15, 2013 at 06:57:34PM +0200, Michael S. Tsirkin wrote:
> Using a global pattern makes it easier to clean out
> old generated files.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  rules.mak | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/rules.mak b/rules.mak
> index d11a5b4..edc2552 100644
> --- a/rules.mak
> +++ b/rules.mak
> @@ -88,6 +88,11 @@ config-%.h: config-%.h-timestamp
>  config-%.h-timestamp: config-%.mak
>  	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $(TARGET_DIR)config-$*.h")
>  
> +.PHONY: clean-timestamp
> +clean-timestamp:
> +	rm -f *.timestamp

Timestamp files also live in subdirectories and I think we're slowly
moving away from recursive make, so this may not clean all timestamp
files.

Stefan
Michael S. Tsirkin - Jan. 17, 2013, 10:48 a.m.
On Thu, Jan 17, 2013 at 11:28:46AM +0100, Stefan Hajnoczi wrote:
> On Tue, Jan 15, 2013 at 06:57:34PM +0200, Michael S. Tsirkin wrote:
> > Using a global pattern makes it easier to clean out
> > old generated files.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  rules.mak | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/rules.mak b/rules.mak
> > index d11a5b4..edc2552 100644
> > --- a/rules.mak
> > +++ b/rules.mak
> > @@ -88,6 +88,11 @@ config-%.h: config-%.h-timestamp
> >  config-%.h-timestamp: config-%.mak
> >  	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $(TARGET_DIR)config-$*.h")
> >  
> > +.PHONY: clean-timestamp
> > +clean-timestamp:
> > +	rm -f *.timestamp
> 
> Timestamp files also live in subdirectories and I think we're slowly
> moving away from recursive make, so this may not clean all timestamp
> files.
> 
> Stefan

Yes but it helps whenever we include rules.mak which is in most places.
Stefan Hajnoczi - Jan. 18, 2013, 1:27 p.m.
On Thu, Jan 17, 2013 at 12:48:51PM +0200, Michael S. Tsirkin wrote:
> On Thu, Jan 17, 2013 at 11:28:46AM +0100, Stefan Hajnoczi wrote:
> > On Tue, Jan 15, 2013 at 06:57:34PM +0200, Michael S. Tsirkin wrote:
> > > Using a global pattern makes it easier to clean out
> > > old generated files.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > >  rules.mak | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/rules.mak b/rules.mak
> > > index d11a5b4..edc2552 100644
> > > --- a/rules.mak
> > > +++ b/rules.mak
> > > @@ -88,6 +88,11 @@ config-%.h: config-%.h-timestamp
> > >  config-%.h-timestamp: config-%.mak
> > >  	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $(TARGET_DIR)config-$*.h")
> > >  
> > > +.PHONY: clean-timestamp
> > > +clean-timestamp:
> > > +	rm -f *.timestamp
> > 
> > Timestamp files also live in subdirectories and I think we're slowly
> > moving away from recursive make, so this may not clean all timestamp
> > files.
> > 
> > Stefan
> 
> Yes but it helps whenever we include rules.mak which is in most places.

Okay, something to keep an eye on when Makefiles are converted to
non-recursive.

Stefan

Patch

diff --git a/rules.mak b/rules.mak
index d11a5b4..edc2552 100644
--- a/rules.mak
+++ b/rules.mak
@@ -88,6 +88,11 @@  config-%.h: config-%.h-timestamp
 config-%.h-timestamp: config-%.mak
 	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $(TARGET_DIR)config-$*.h")
 
+.PHONY: clean-timestamp
+clean-timestamp:
+	rm -f *.timestamp
+clean: clean-timestamp
+
 # will delete the target of a rule if commands exit with a nonzero exit status
 .DELETE_ON_ERROR: