mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] Kbuild: make sure to build fixdep first
Date: Wed, 22 Oct 2025 15:37:38 +0200	[thread overview]
Message-ID: <20251022133738.1395366-1-s.hauer@pengutronix.de> (raw)

A host tool is built with:

$(host-csingle): $(obj)/%: $(src)/%.c FORCE
	$(call if_changed_dep,host-csingle)

if_changed_dep calls fixdep after successful compilation. fixdep is a
host tool itself, so this only works when fixdep ist the first host tool
that is being built.

Recently the sconfigpost tool was added to scripts/basic, so it can
happen that this is built before fixdep so that the fixdep call fails.

Fix this by moving sconfigpost to a separate directory and adding
scripts_basic as a dependency.

The erroneous behaviour can be reproduced with:
make ARCH=arm --shuffle=2659722306 O=build-foo imx_v8_defconfig

Fixes: b720fb9a90 ("Add security policy support")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Makefile                                     | 10 +++++++---
 scripts/basic/Makefile                       |  1 -
 scripts/sconfigpost/Makefile                 |  1 +
 scripts/{basic => sconfigpost}/sconfigpost.c |  0
 4 files changed, 8 insertions(+), 4 deletions(-)
 create mode 100644 scripts/sconfigpost/Makefile
 rename scripts/{basic => sconfigpost}/sconfigpost.c (100%)

diff --git a/Makefile b/Makefile
index 7884953539..3774b4f9c1 100644
--- a/Makefile
+++ b/Makefile
@@ -450,7 +450,7 @@ AWK		= awk
 GENKSYMS	= scripts/genksyms/genksyms
 DEPMOD		= /sbin/depmod
 KALLSYMS	= scripts/kallsyms
-SCONFIGPOST	= scripts/basic/sconfigpost
+SCONFIGPOST	= scripts/sconfigpost/sconfigpost
 PERL		= perl
 PYTHON3		= python3
 CHECK		= sparse
@@ -556,6 +556,10 @@ PHONY += scripts_basic
 scripts_basic:
 	$(Q)$(MAKE) $(build)=scripts/basic
 
+PHONY += scripts_sconfigpost
+scripts_sconfigpost: scripts_basic
+	$(Q)$(MAKE) $(build)=scripts/sconfigpost
+
 PHONY += outputmakefile
 # Before starting out-of-tree build, make sure the source tree is clean.
 # outputmakefile generates a Makefile in the output directory, if using a
@@ -1223,10 +1227,10 @@ endif
 quiet_cmd_sconfigpost = SCONFPP $@
       cmd_sconfigpost = $(SCONFIGPOST) $2 -D $(depfile) -o $@ $<
 
-include/generated/security_autoconf.h: .security_config scripts_basic FORCE
+include/generated/security_autoconf.h: .security_config scripts_sconfigpost FORCE
 	$(call if_changed_dep,sconfigpost,-e)
 
-include/generated/sconfig_names.h: .security_config scripts_basic include/generated/security_autoconf.h FORCE
+include/generated/sconfig_names.h: .security_config scripts_sconfigpost include/generated/security_autoconf.h FORCE
 	$(call if_changed_dep,sconfigpost,-s)
 
 archprepare: include/generated/security_autoconf.h include/generated/sconfig_names.h
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
index cd4d9f321d..65a714b578 100644
--- a/scripts/basic/Makefile
+++ b/scripts/basic/Makefile
@@ -4,4 +4,3 @@
 # sconfigpost: used to postprocess security configs
 
 hostprogs-always-y	+= fixdep
-hostprogs-always-y	+= sconfigpost
diff --git a/scripts/sconfigpost/Makefile b/scripts/sconfigpost/Makefile
new file mode 100644
index 0000000000..6120c30459
--- /dev/null
+++ b/scripts/sconfigpost/Makefile
@@ -0,0 +1 @@
+hostprogs-always-y	+= sconfigpost
diff --git a/scripts/basic/sconfigpost.c b/scripts/sconfigpost/sconfigpost.c
similarity index 100%
rename from scripts/basic/sconfigpost.c
rename to scripts/sconfigpost/sconfigpost.c
-- 
2.47.3




             reply	other threads:[~2025-10-22 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 13:37 Sascha Hauer [this message]
2025-10-22 14:01 ` Ahmad Fatoum
2025-10-22 14:13 Sascha Hauer
2025-10-22 15:55 ` 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=20251022133738.1395366-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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