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:
+14
-3
@@ -1,7 +1,18 @@
|
|||||||
|
# --- OS detection ---
|
||||||
|
# On Windows the OS env var is 'Windows_NT' in EVERY shell (cmd, PowerShell,
|
||||||
|
# MSYS2, Git-Bash), and GNU Make imports it. Detect Windows from it FIRST so
|
||||||
|
# `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_S := $(shell uname -s)
|
||||||
MINGW := $(findstring MINGW,$(UNAME_S))
|
UNAME_M := $(shell uname -m)
|
||||||
MSYS := $(findstring MSYS,$(UNAME_S))
|
endif
|
||||||
IS_WIN := $(MINGW)$(MSYS)
|
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
# --- macOS / Apple Silicon ---
|
# --- macOS / Apple Silicon ---
|
||||||
|
|||||||
Reference in New Issue
Block a user