[PATCH] kbuild: m68k: Use target specific temporary files

From: Nicolas Schier

Date: Fri Dec 04 2026 - 11:00:36 EST


Use target specific temporary files in possibly concurrently run
targets vmlinux.gz and vmlinux.bz2 to prevent mangling and build
breakage.

A later beautification may provide a central cmd_strip macro in
scripts/Makefile.lib and use that combined with cmd_gzip or cmd_bzip2
here.

Fixes: 281eff5322fd ("m68k: merge mmu and non-mmu arch Makefiles")
Reported-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/r/axLT1tUkIwtwx4W7@monoceros
Signed-off-by: Nicolas Schier <n.schier@xxxxxxxxx>
---
arch/m68k/Makefile | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 0abcf994ce55..0a8d99d62319 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -103,12 +103,12 @@ zImage compressed: vmlinux.gz
vmlinux.gz: vmlinux

ifndef CONFIG_KGDB
- cp vmlinux vmlinux.tmp
- $(STRIP) vmlinux.tmp
- $(KGZIP) -9c vmlinux.tmp >vmlinux.gz
- rm vmlinux.tmp
+ cp $< $(tmp-target).tmp
+ $(STRIP) $(tmp-target).tmp
+ $(KGZIP) -9c $(tmp-target).tmp >$@
+ rm $(tmp-target).tmp
else
- $(KGZIP) -9c vmlinux >vmlinux.gz
+ $(KGZIP) -9c $< >$@
endif

bzImage: vmlinux.bz2
@@ -116,12 +116,12 @@ bzImage: vmlinux.bz2
vmlinux.bz2: vmlinux

ifndef CONFIG_KGDB
- cp vmlinux vmlinux.tmp
- $(STRIP) vmlinux.tmp
- $(KBZIP2) -1c vmlinux.tmp >vmlinux.bz2
- rm vmlinux.tmp
+ cp $< $(tmp-target).tmp
+ $(STRIP) $(tmp-target).tmp
+ $(KBZIP2) -1c $(tmp-target).tmp >$@
+ rm $(tmp-target).tmp
else
- $(KBZIP2) -1c vmlinux >vmlinux.bz2
+ $(KBZIP2) -1c $< >$@
endif

CLEAN_FILES += vmlinux.gz vmlinux.bz2

---
base-commit: 3591da247d764905231f3a0b27bc093378508182
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next-unstable
change-id: 20261204-kbuild-m68k-use-target-specific-temp-files-7edca4a0b47c

Best regards,
--
Nicolas