Skip to contentSkip to conversation

kbuild: fix rebuild of generic syscall headers

PATCH Applied Masahiro Yamada 3 participants 3 messages Jul 17, 2024 – Jul 18, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: fix rebuild of generic syscall headers

Commit fbb5c0606fa4 ("kbuild: add syscall table generation to scripts/Makefile.asm-headers") started to generate syscall headers for architectures using generic syscalls.

However, these headers are always rebuilt using GNU Make 4.4.1 or newer.

When using GNU Make 4.4 or older, these headers are not rebuilt when the command to generate them is changed, despite the use of the if_changed macro.

scripts/Makefile.asm-headers now uses FORCE, but it is not marked as .PHONY. To handle the command line change correctly, .*.cmd files must be included.

Fixes fbb5c0606fa4 ("kbuild: add syscall table generation to scripts/Makefile.asm-headers")

---

 scripts/Makefile.asm-headers | 8 ++++++++
 1 file changed, 8 insertions(+)
scripts/Makefile.asm-headers +8 -0
index 6b8e8318e810..8a4856e74180 100644
@@ -87,12 +87,20 @@ $(obj)/unistd_compat_%.h: $(syscalltbl) $(syshdr) FORCE
 $(obj)/syscall_table_%.h: $(syscalltbl) $(systbl) FORCE
 	$(call if_changed,systbl)
 
+targets := $(syscall-y)
+
 # Create output directory. Skip it if at least one old header exists
 # since we know the output directory already exists.
 ifeq ($(old-headers),)
 $(shell mkdir -p $(obj))
 endif
 
+PHONY += FORCE
+
 FORCE:
 
+existing-targets := $(wildcard $(sort $(targets)))
+
+-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
+
 .PHONY: $(PHONY)
Signature · 1 line
2.43.0
Tested-by on v1 1/1
#1 lore raw
Quoted 14 lines · Masahiro Yamada

Commit fbb5c0606fa4 ("kbuild: add syscall table generation to scripts/Makefile.asm-headers") started to generate syscall headers for architectures using generic syscalls.

However, these headers are always rebuilt using GNU Make 4.4.1 or newer.

When using GNU Make 4.4 or older, these headers are not rebuilt when the command to generate them is changed, despite the use of the if_changed macro.

scripts/Makefile.asm-headers now uses FORCE, but it is not marked as .PHONY. To handle the command line change correctly, .*.cmd files must be included.

Quoted 6 lines
Fixes fbb5c0606fa4 ("kbuild: add syscall table generation to

scripts/Makefile.asm-headers")

Closes:
https://lore.kernel.org/lkml/CAHk-=wibB7SvXnUftBgAt+4-3vEKRpvEgBeDEH=i=j2GvDitoA@mail.gmail.com/

Thanks a lot for the fix!

#2 lore raw
In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

Commit fbb5c0606fa4 ("kbuild: add syscall table generation to scripts/Makefile.asm-headers") started to generate syscall headers for architectures using generic syscalls.

However, these headers are always rebuilt using GNU Make 4.4.1 or newer.

Thanks, applied directly to make the rest of my merge window go more smoothly when doing my arm64 build testing,

Linus