Makefile: detect Windows from $(OS)=Windows_NT before uname so make works from native PowerShell/CMD (#129)

On Windows $(OS) is Windows_NT in every shell; check it first so native PowerShell/CMD (no uname on PATH) doesn't fall through to the Linux branch. Non-Windows unchanged (else branch still uses uname). Linux build verified green.
This commit is contained in:
bopof
2026-07-13 20:47:23 +02:00
committed by GitHub
parent 5dd7503ee7
commit afc259c599
+15 -4
View File
@@ -1,7 +1,18 @@
UNAME_S := $(shell uname -s) # --- OS detection ---
MINGW := $(findstring MINGW,$(UNAME_S)) # On Windows the OS env var is 'Windows_NT' in EVERY shell (cmd, PowerShell,
MSYS := $(findstring MSYS,$(UNAME_S)) # MSYS2, Git-Bash), and GNU Make imports it. Detect Windows from it FIRST so
IS_WIN := $(MINGW)$(MSYS) # `make` works from a native PowerShell/CMD shell — there `uname` is not on
# PATH, so the old uname-only check returned empty and fell through to the
# Linux branch (no .exe, no -static). We only call `uname` when NOT on Windows.
ifeq ($(OS),Windows_NT)
IS_WIN := 1
UNAME_S :=
UNAME_M :=
else
IS_WIN :=
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
endif
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
# --- macOS / Apple Silicon --- # --- macOS / Apple Silicon ---