From: Thomas Huth <thuth@redhat.com>
To: "Steven Sistare" <steven.sistare@oracle.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: clean after distclean gobbles source files
Date: Thu, 13 Apr 2023 13:41:27 +0200 [thread overview]
Message-ID: <5caa18b7-9920-7867-77aa-5d9770cbde14@redhat.com> (raw)
In-Reply-To: <bafc456e-34be-f2a4-71fc-e52ed964484e@oracle.com>
On 07/04/2023 17.44, Steven Sistare wrote:
> Run 'make distclean', and GNUmakefile is removed.
> But, GNUmakefile is where we cd to build/.
> Run 'make distclean' or 'make clean' again, and Makefile applies
> the clean actions, such as this one, at the top level of the tree:
>
> find . \( -name '*.so' -o -name '*.dll' -o \
> -name '*.[oda]' -o -name '*.gcno' \) -type f \
> ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
> ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
> -exec rm {} +
>
> For example, it removes the .d source files in 'meson/test cases/d/*/*.d'.
> The damage could be worse in the future if more suffixes are cleaned.
>
> I don't have a suggested fix. Recursion and the GNUmakefile bootstrap
> make it non-trivial.
That's somewhat ugly, indeed.
We could maybe disallow make [dist]clean if running in-tree? Something like that:
diff a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ quiet-command-run = $(if $(V),,$(if $2,printf " %-7s %s\n" $2 $3 && ))$1
quiet-@ = $(if $(V),,@)
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
-UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
+UNCHECKED_GOALS := TAGS cscope ctags dist \
help check-help print-% \
docker docker-% vm-help vm-test vm-build-%
@@ -201,7 +201,7 @@ recurse-distclean: $(addsuffix /distclean, $(ROMS))
######################################################################
-clean: recurse-clean
+clean: config-host.mak recurse-clean
-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean || :
-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) clean-ctlist || :
find . \( -name '*.so' -o -name '*.dll' -o \
... or if we still want to allow that, maybe just make an exception for the *.d files:
diff --git a/Makefile b/Makefile
index e421f8a1f4..0cb2a7aa98 100644
--- a/Makefile
+++ b/Makefile
@@ -208,6 +208,7 @@ clean: recurse-clean
-name '*.[oda]' -o -name '*.gcno' \) -type f \
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
+ ! -path './meson/test cases/d/*/*.d' \
-exec rm {} +
rm -f TAGS cscope.* *~ */*~
What do you think?
Thomas
next prev parent reply other threads:[~2023-04-13 11:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 15:44 clean after distclean gobbles source files Steven Sistare
2023-04-13 11:41 ` Thomas Huth [this message]
2023-04-14 15:30 ` Steven Sistare
2023-04-14 15:41 ` Thomas Huth
2023-04-19 13:07 ` Steven Sistare
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=5caa18b7-9920-7867-77aa-5d9770cbde14@redhat.com \
--to=thuth@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).