Skip to contentSkip to conversation

kernel: Clean up generated syscall_entries.h file

PATCH Superseded Richard Weinberger 3 participants 6 messages Jun 26, 2024 – Jun 27, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel: Clean up generated syscall_entries.h file

Add it to the clean-files list, such that Kbuild will remove it up make clean.
Also drop it from the target list, this variable seems unused is most likely a copy&paste relict from the past.

---
 kernel/cobalt/posix/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cobalt/posix/Makefile +1 -1
index 5b4f3214a..9e2f3f6e0 100644
@@ -31,7 +31,7 @@ quiet_cmd_syscall_entries = GEN     $@
 $(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) FORCE
 	$(call if_changed,syscall_entries)
 
-target += syscall_entries.h
+clean-files += syscall_entries.h
 
 $(obj)/syscall.o: $(obj)/syscall_entries.h
 
Signature · 1 line
2.35.3
#1 lore raw
Quoted 15 lines · Richard Weinberger

Add it to the clean-files list, such that Kbuild will remove it up make clean.
Also drop it from the target list, this variable seems unused is most likely a copy&paste relict from the past.

---
 kernel/cobalt/posix/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cobalt/posix/Makefile +0 -0
index 5b4f3214a..9e2f3f6e0 100644

kernel/cobalt/posix/Makefile quiet_cmd_syscall_entries = GEN $@ · line 34

Quoted 5 lines
kernel/cobalt/posix/Makefile +1 -1
@@ -31,7 +31,7 @@ quiet_cmd_syscall_entries = GEN     $@
 $(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) FORCE
 	$(call if_changed,syscall_entries)
 
-target += syscall_entries.h
+clean-files += syscall_entries.h

target is generally needed to prevent re-executing the build although that target file is already present and recent. Did you check that a second build will not have this problem after that change?

Jan

Quoted 3 lines
kernel/cobalt/posix/Makefile +0 -0
 $(obj)/syscall.o: $(obj)/syscall_entries.h
 
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#2 lore raw

Am Donnerstag, 27. Juni 2024, 08:29:46 CEST schrieb 'Jan Kiszka' via upstream:

Quoted 10 lines

Review quiet_cmd_syscall_entries = GEN $@ · line 34

Quoted 6 lines
(quoted diff) +1 -1
@@ -31,7 +31,7 @@ quiet_cmd_syscall_entries = GEN     $@
 $(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) FORCE
 	$(call if_changed,syscall_entries)
 
-target += syscall_entries.h
+clean-files += syscall_entries.h

target is generally needed to prevent re-executing the build although that target file is already present and recent. Did you check that a second build will not have this problem after that change?

I thought you want re-executing because of the "FORCE" property. Why is FORCE needed then?

Why doesn't the "default" maineline work?
e.g. something like that:

kernel/cobalt/posix/Makefile +5 -5
index 5b4f3214a..e57628cf1 100644
@@ -26,13 +26,13 @@ xenomai-y :=                \
 syscall_entries := $(srctree)/$(src)/gen-syscall-entries.sh
 
 quiet_cmd_syscall_entries = GEN     $@
-      cmd_syscall_entries = $(CONFIG_SHELL) '$(syscall_entries)' $(filter-out FORCE,$^) > $@
+      cmd_syscall_entries = $^ > $@
 
-$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) FORCE
-       $(call if_changed,syscall_entries)
-
-target += syscall_entries.h
+$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c)
+       $(call cmd,syscall_entries)
 
 $(obj)/syscall.o: $(obj)/syscall_entries.h
 
+clean-files    += syscall_entries.h
+
 xenomai-$(CONFIG_XENO_ARCH_SYS3264) += compat.o syscall32.o

LG,
//richard

Signature · 2 lines
​​​​​sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT
UID/VAT Nr: ATU 66964118 | FN: 374287y
#3 lore raw
Quoted 41 lines · Richard Weinberger

Am Donnerstag, 27. Juni 2024, 08:29:46 CEST schrieb 'Jan Kiszka' via upstream:

Quoted 10 lines

kernel/cobalt/posix/Makefile quiet_cmd_syscall_entries = GEN $@ · line 34

Quoted 6 lines
kernel/cobalt/posix/Makefile +1 -1
@@ -31,7 +31,7 @@ quiet_cmd_syscall_entries = GEN     $@
 $(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) FORCE
 	$(call if_changed,syscall_entries)
 
-target += syscall_entries.h
+clean-files += syscall_entries.h

target is generally needed to prevent re-executing the build although that target file is already present and recent. Did you check that a second build will not have this problem after that change?

I thought you want re-executing because of the "FORCE" property. Why is FORCE needed then?

Why doesn't the "default" maineline work?
e.g. something like that:

kernel/cobalt/posix/Makefile +5 -5
index 5b4f3214a..e57628cf1 100644
@@ -26,13 +26,13 @@ xenomai-y :=                \
 syscall_entries := $(srctree)/$(src)/gen-syscall-entries.sh
 
 quiet_cmd_syscall_entries = GEN     $@
-      cmd_syscall_entries = $(CONFIG_SHELL) '$(syscall_entries)' $(filter-out FORCE,$^) > $@
+      cmd_syscall_entries = $^ > $@
 
-$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) FORCE
-       $(call if_changed,syscall_entries)
-
-target += syscall_entries.h
+$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c)
+       $(call cmd,syscall_entries)
 
 $(obj)/syscall.o: $(obj)/syscall_entries.h
 
+clean-files    += syscall_entries.h
+
 xenomai-$(CONFIG_XENO_ARCH_SYS3264) += compat.o syscall32.o
Quoted 3 lines

LG,
//richard

"Any target that utilizes if_changed must be listed in $(targets), otherwise the command line check will fail, and the target will always be built."

If you find a better pattern, that propose it - but test all the corner cases of required as well as unneeded rebuilding first.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#4 lore raw

Am Donnerstag, 27. Juni 2024, 09:36:27 CEST schrieb Jan Kiszka:

Quoted 3 lines

"Any target that utilizes if_changed must be listed in $(targets), otherwise the command line check will fail, and the target will always be built."

Yes, but why is if_changed needed at all?
syscall_entries is in the prerequisites list of $(obj)/syscall_entries.h.

Quoted 2 lines

If you find a better pattern, that propose it - but test all the corner cases of required as well as unneeded rebuilding first.

The diff in my last mail should fulfill all that.
I removed if_changed and replaced it with cmd.

But let's stay on the safe side, I'll send a v2 for the syscall_entries.h file and do more testing wrt. if_changed/target.

Thanks,
//richard

Signature · 2 lines
​​​​​sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT
UID/VAT Nr: ATU 66964118 | FN: 374287y
#5 lore raw
Quoted 8 lines · Richard Weinberger

Am Donnerstag, 27. Juni 2024, 09:36:27 CEST schrieb Jan Kiszka:

Quoted 3 lines

"Any target that utilizes if_changed must be listed in $(targets), otherwise the command line check will fail, and the target will always be built."

Yes, but why is if_changed needed at all?
syscall_entries is in the prerequisites list of $(obj)/syscall_entries.h.

The reason is most likely (I wrote this 9 years ago...) that the list of prerequisites is not static, rather containing a wildcard. If you add a file with a syscall entry, this won't be detected, and no rebuild will be done.

Quoted 9 lines
Quoted 2 lines

If you find a better pattern, that propose it - but test all the corner cases of required as well as unneeded rebuilding first.

The diff in my last mail should fulfill all that.
I removed if_changed and replaced it with cmd.

But let's stay on the safe side, I'll send a v2 for the syscall_entries.h file and do more testing wrt. if_changed/target.

Ack.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center