From: Masahiro Yamada <masahiroy@kernel.org>
To: barebox@lists.infradead.org
Cc: Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 4/5] kbuild: sync the top level Kbuild file with Linux
Date: Tue, 18 Aug 2020 19:55:19 +0900 [thread overview]
Message-ID: <20200818105520.32326-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20200818105520.32326-1-masahiroy@kernel.org>
- 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@kernel.org>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-08-18 10:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 10:55 [PATCH 1/5] scripts: remove redundant setupmbr addition to subdir- Masahiro Yamada
2020-08-18 10:55 ` [PATCH 2/5] kvx,riscv: remove unused $(dtb-y) assignment Masahiro Yamada
2020-08-18 10:55 ` [PATCH 3/5] sandbox: add sandbox.dtb to always-y Masahiro Yamada
2020-08-18 10:55 ` Masahiro Yamada [this message]
2020-08-18 10:55 ` [PATCH 5/5] kbuild: introduce hostprogs-always-y and userprogs-always-y Masahiro Yamada
2020-08-19 6:52 ` [PATCH 1/5] scripts: remove redundant setupmbr addition to subdir- Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200818105520.32326-4-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox