[PATCH 1/7] kbuild: support generated asm-headers in subdirectories
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Thu Jul 9 04:32:37 PDT 2026
Extend the asm-header stub generation to also handle subdirectories.
An upcoming vdso/ header refactoring requires this.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
scripts/Makefile.asm-headers | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index 8a4856e74180..772b53ffdeb4 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -48,14 +48,13 @@ syscall-y := $(addprefix $(obj)/, $(syscall-y))
generated-y := $(addprefix $(obj)/, $(generated-y))
# Remove stale wrappers when the corresponding files are removed from generic-y
-old-headers := $(wildcard $(obj)/*.h)
+old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
unwanted := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
-quiet_cmd_wrap = WRAP $@
- cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
+filechk_wrap = echo "\#include <asm-generic/$*.h>"
quiet_cmd_remove = REMOVE $(unwanted)
- cmd_remove = rm -f $(unwanted)
+ cmd_remove = rm -f $(unwanted); find $(obj) -type -d -empty -delete
quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) \
@@ -74,8 +73,8 @@ all: $(generic-y) $(syscall-y)
$(if $(unwanted),$(call cmd,remove))
@:
-$(obj)/%.h: $(srctree)/$(generic)/%.h
- $(call cmd,wrap)
+$(obj)/%.h: $(srctree)/$(generic)/%.h FORCE
+ $(call filechk,wrap)
$(obj)/unistd_%.h: $(syscalltbl) $(syshdr) FORCE
$(call if_changed,syshdr)
--
2.55.0
More information about the linux-riscv
mailing list