Re: [PATCH] kbuild: serialize scripts after scripts_unifdef
From: Nicolas Schier
Date: Fri Dec 04 2026 - 13:39:24 EST
On Thu, Dec 03, 2026 at 07:18:20PM +0000, HONG Yifan wrote:
> 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@xxxxxxxxxxxxxxx
> Signed-off-by: HONG Yifan <elsk@xxxxxxxxxx>
> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
Reviewed-by: Nicolas Schier <n.schier@xxxxxxxxx>
--
Nicolas