[PATCH 4/5] kbuild: sync the top level Kbuild file with Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 - Convert 'always' to 'always-y'

 - Remove redundant 'targets' assignment

 - Use filechk for the offset generation to avoid unneeded
   rebuilds when the content of asm-offsets.h is not changed

 - Remove the explicit build rule of asm-offsets.s because
   it can be built of the pattern rule in scripts/Makefile.build

Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
---

 Kbuild | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/Kbuild b/Kbuild
index 329609604..519be4a3c 100644
--- a/Kbuild
+++ b/Kbuild
@@ -1,14 +1,15 @@
-#####
-# 1) Generate asm-offsets.h
+# SPDX-License-Identifier: GPL-2.0
 #
+# Kbuild for top-level directory of Barebox
+
+#####
+# Generate asm-offsets.h
 
 offsets-file := include/generated/asm-offsets.h
 
-always  += $(offsets-file)
-targets += $(offsets-file)
+always-y += $(offsets-file)
 targets += arch/$(SRCARCH)/lib/asm-offsets.s
 
-
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
 	"/^->/{s:->#\(.*\):/* \1 */:; \
@@ -17,9 +18,9 @@ define sed-y
 	s:->::; p;}"
 endef
 
-quiet_cmd_offsets = GEN     $@
-define cmd_offsets
-	(set -e; \
+# Use filechk to avoid rebuilds when a header changes, but the resulting file
+# does not
+define filechk_offsets
 	 echo "#ifndef __ASM_OFFSETS_H__"; \
 	 echo "#define __ASM_OFFSETS_H__"; \
 	 echo "/*"; \
@@ -31,13 +32,8 @@ define cmd_offsets
 	 echo ""; \
 	 sed -ne $(sed-y) $<; \
 	 echo ""; \
-	 echo "#endif" ) > $@
+	 echo "#endif"
 endef
 
-# We use internal kbuild rules to avoid the "is up to date" message from make
-arch/$(SRCARCH)/lib/asm-offsets.s: arch/$(SRCARCH)/lib/asm-offsets.c FORCE
-	$(Q)mkdir -p $(dir $@)
-	$(call if_changed_dep,cc_s_c)
-
-$(obj)/$(offsets-file): arch/$(SRCARCH)/lib/asm-offsets.s Kbuild
-	$(call cmd,offsets)
+$(offsets-file): arch/$(SRCARCH)/lib/asm-offsets.s FORCE
+	$(call filechk,offsets)
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux