All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	stefanha@redhat.com, Michael Roth <mdroth@linux.vnet.ibm.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] Makefile: Don't find and delete when $(DSOSUF) is empty in "make clean"
Date: Fri, 14 Mar 2014 18:49:38 +0100	[thread overview]
Message-ID: <53234132.8040301@weilnetz.de> (raw)
In-Reply-To: <1394786300-18017-1-git-send-email-famz@redhat.com>

Am 14.03.2014 09:38, schrieb Fam Zheng:
> DANGEROUS: don't try it before you read to the end.
>
> A first "make distclean" will unset $(DSOSUF), a following "make
> distclean" or "make clean" will find all the files and delete it.
>
> Including all the files in the .git directory!

If you only use out-of-tree build, you are safe here. Maybe we should no
longer support in-tree builds. Personally, I nearly never use them.

> Fix it by only do it when $(DSOSUF) is not empty.

s/do/doing/

> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index bd9cd4f..0666d6e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -267,7 +267,7 @@ clean:
>  	rm -f qemu-options.def
>  	find . -name '*.[oda]' -type f -exec rm -f {} +
>  	find . -name '*.l[oa]' -type f -exec rm -f {} +
> -	find . -name '*$(DSOSUF)' -type f -exec rm -f {} +
> +	if test -n "$(DSOSUF)"; then find . -name '*$(DSOSUF)' -type f -exec rm -f {} +; fi
>  	find . -name '*.mo' -type f -exec rm -f {} +
>  	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
>  	rm -f fsdev/*.pod

No, I think it is still too dangerous to use a macro here. There are
only two valid possibilities, so it's easy to name them explicitly:

        find -name "*.dll" -o -name "*.so"

Is there a good reason why rm is called with option -f? Normally, -f
should not be needed when cleaning generated files because those files
are not write protected. The only other reason for -f would be
suppressing an error message if rm tries to remove a non existing files,
but that does not apply here.

I'd also combine all find statements in a single statement. It is not
necessary to parse the directory tree several times. That can be done in
a separate patch.

Regards,
Stefan

  parent reply	other threads:[~2014-03-14 17:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  8:38 [Qemu-devel] [PATCH] Makefile: Don't find and delete when $(DSOSUF) is empty in "make clean" Fam Zheng
2014-03-14 12:13 ` Stefan Hajnoczi
2014-03-14 17:49 ` Stefan Weil [this message]
2014-03-17  1:34   ` Fam Zheng
2014-03-17  8:30   ` Markus Armbruster
2014-03-17 18:51     ` Andreas Färber
2014-03-17 19:15       ` Peter Maydell
2014-03-18  9:19         ` Markus Armbruster
2014-03-18  8:24       ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53234132.8040301@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=anthony@codemonkey.ws \
    --cc=famz@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.