From afc259c5995f551ddd8789d10b3261c72a478a2b Mon Sep 17 00:00:00 2001 From: bopof Date: Mon, 13 Jul 2026 20:47:23 +0200 Subject: [PATCH] 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. --- c/Makefile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/c/Makefile b/c/Makefile index 29cc932..58dbc7f 100644 --- a/c/Makefile +++ b/c/Makefile @@ -1,7 +1,18 @@ -UNAME_S := $(shell uname -s) -MINGW := $(findstring MINGW,$(UNAME_S)) -MSYS := $(findstring MSYS,$(UNAME_S)) -IS_WIN := $(MINGW)$(MSYS) +# --- 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_M := $(shell uname -m) +endif ifeq ($(UNAME_S),Darwin) # --- macOS / Apple Silicon ---