Fix Universal build on Windows

TRACKED_TOP previously used a shell pipeline (xargs, awk, sort) to extract
unique top-level directory/file names from SRCS and HEADERS. When invoking make
from cmd.exe on Windows, $(shell ...) uses cmd.exe rather than sh.exe, so the
pipeline fails because cmd.exe does not support Unix pipe syntax. Other MSYS2
tools (e.g. the compiler) work fine because they are invoked directly as
commands, not through a shell pipeline. This caused TRACKED_TOP to be empty, so
ln -s never ran and the per-arch temp_builds subdirectories were left without a
Makefile symlink, breaking the universal build with: "No rule to make target
'universal-object-nopgo'". Fixed by replacing the shell pipeline with pure GNU
make built-in functions (sort, foreach, firstword, subst) which have no shell
or PATH dependencies and work identically on Windows, Linux and macOS.

closes https://github.com/official-stockfish/Stockfish/pull/6762

No functional change
This commit is contained in:
mstembera
2026-04-26 09:33:03 +02:00
committed by Joost VandeVondele
parent 8f181af8fb
commit 767dcfe48d
+1 -1
View File
@@ -1268,7 +1268,7 @@ UNIVERSAL_ENTRY_OBJ := $(TEMP_DIR)/entry_x86.o
NET_SENTINEL := $(TEMP_DIR)/.net-done
# Top-level tracked items in src/ (directories and files)
TRACKED_TOP := $(shell echo "$(SRCS) $(HEADERS) Makefile incbin" | xargs -n1 | awk -F/ '{print $$1}' | sort -u)
TRACKED_TOP := $(sort $(foreach f,$(SRCS) $(HEADERS) Makefile incbin,$(firstword $(subst /, ,$(f)))))
# Baseline x86-64 must come first in the final link (Windows --allow-multiple-definition
# uses the first copy of inline duplicates)