diff mbox series

kbuild, link-vmlinux: Don't delete output files with make -i

Message ID 20210425213521.3159899-1-ak@linux.intel.com (mailing list archive)
State New
Headers show
Series kbuild, link-vmlinux: Don't delete output files with make -i | expand

Commit Message

Andi Kleen April 25, 2021, 9:35 p.m. UTC
From: Andi Kleen <andi@firstfloor.org>

make -i is useful to see output files which normally get deleted on an
error.  Make this work with link-vmlinux.sh too. Don't delete the output
files on error when make -i is used.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/link-vmlinux.sh | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Masahiro Yamada April 26, 2021, 9:01 a.m. UTC | #1
On Mon, Apr 26, 2021 at 6:35 AM Andi Kleen <ak@linux.intel.com> wrote:
>
> From: Andi Kleen <andi@firstfloor.org>
>
> make -i is useful to see output files which normally get deleted on an
> error.  Make this work with link-vmlinux.sh too. Don't delete the output
> files on error when make -i is used.
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  scripts/link-vmlinux.sh | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 0e039a4cf2cb..a1a57f214c58 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -300,6 +300,11 @@ sorttable()
>  # Delete output files in case of error
>  cleanup()
>  {
> +       # don't delete for make -i
> +       case "$MFLAGS" in
> +       *-i*) return ;;
> +       esac
> +
>         rm -f .btf.*
>         rm -f .tmp_System.map
>         rm -f .tmp_initcalls.lds
> --
> 2.25.4
>


How about removing on_exit() and on_signals() entirely?

.DELETE_ON_ERROR target removes vmlinux on error anyway.

Leaving intermediate files is safe, I think.
Andi Kleen April 26, 2021, 2:20 p.m. UTC | #2
> How about removing on_exit() and on_signals() entirely?
> 
> .DELETE_ON_ERROR target removes vmlinux on error anyway.
> 
> Leaving intermediate files is safe, I think.

My guess is it because the tmp vmlinux can be rather big.
But makes sense. Build dirs shouldn't be that space
constrained.

We just need to make sure make clean cleans them too.

-Andi
diff mbox series

Patch

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 0e039a4cf2cb..a1a57f214c58 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -300,6 +300,11 @@  sorttable()
 # Delete output files in case of error
 cleanup()
 {
+	# don't delete for make -i
+	case "$MFLAGS" in
+	*-i*) return ;;
+	esac
+
 	rm -f .btf.*
 	rm -f .tmp_System.map
 	rm -f .tmp_initcalls.lds