Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: HONG Yifan <elsk@google.com>
To: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	linux-kbuild@vger.kernel.org,  linux-kernel@vger.kernel.org,
	kernel-team@android.com,  HONG Yifan <elsk@google.com>,
	stable@vger.kernel.org
Subject: [PATCH] kbuild: serialize scripts after scripts_unifdef
Date: Thu,  3 Dec 2026 19:18:20 +0000	[thread overview]
Message-ID: <20261203191820.2576904-1-elsk@google.com> (raw)

When CONFIG_HEADERS_INSTALL is enabled, the prepare target depends on
both prepare0 -> archprepare -> scripts and headers -> scripts_unifdef
with no ordering between scripts and scripts_unifdef. Both targets
invoke $(MAKE) $(build)=scripts concurrently:

  scripts:         $(MAKE) $(build)=scripts
  scripts_unifdef: $(MAKE) $(build)=scripts scripts/unifdef

Because scripts/Makefile lists unifdef in hostprogs,
scripts/Makefile.host adds scripts/unifdef to targets, causing
scripts/Makefile.build to include scripts/.unifdef.cmd as soon as
scripts/unifdef exists. If scripts reads scripts/.unifdef.cmd while
scripts_unifdef is still writing it via fixdep, make aborts with:

  scripts/.unifdef.cmd:1: *** missing separator.  Stop.
  make[2]: *** [Makefile:1400: scripts] Error 2

Make scripts depend on scripts_unifdef under CONFIG_HEADERS_INSTALL so
scripts_unifdef finishes before scripts enters scripts/. Keeping the
dependency under CONFIG_HEADERS_INSTALL avoids building scripts/unifdef
when it is not needed and preserves "make headers" without a .config.

Bug triage, instrumented reproduction, and patch drafting were assisted
by Gemini.

Fixes: e949f4c2d6a3 ("kbuild: add CONFIG_HEADERS_INSTALL and loosen the dependency of samples")
Cc: stable@vger.kernel.org
Signed-off-by: HONG Yifan <elsk@google.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 5aac6f1b011e..787e041b5d7e 100644
--- a/Makefile
+++ b/Makefile
@@ -1518,6 +1518,7 @@ endif
 
 ifdef CONFIG_HEADERS_INSTALL
 prepare: headers
+scripts: scripts_unifdef
 endif
 
 PHONY += scripts_gen_init_cpio

base-commit: 63fdb511c27afcebce797e3db580b3534ddfa639
-- 
2.56.1.915.g69d5ec7298-goog


             reply	other threads:[~2026-12-03 19:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 19:18 HONG Yifan [this message]
2026-12-04 18:39 ` [PATCH] kbuild: serialize scripts after scripts_unifdef Nicolas Schier
2026-12-04 19:18 ` sashiko-bot
2026-12-04 23:07   ` Hong, Yifan

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=20261203191820.2576904-1-elsk@google.com \
    --to=elsk@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=stable@vger.kernel.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