fix: support MSYS2 builds on gmake
uname -s under MSYS2 never reports Windows_NT, so gmake.mk's Windows_NT checks could silently fall through to the Linux path. Detect MINGW/MSYS/UCRT/CLANG/CYGWIN uname prefixes in build.sh and gmake.mk, separating "building for Windows" (binary names, libs) from "running under cmd.exe" (mkdir/rd vs mkdir -p/rm -rf) — MSYS2 keeps the posix shell builtins even when targeting Windows. Mirrors the same fix already applied to stk.
This commit is contained in:
1 parent
26d08228a7
commit
e143adca2b
2 files changed
+27
-8
No files matched your search
@@ -1,6 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
UNAME_S=$(uname -s)
|
||||
export UNAME_S
|
||||
|
||||
OS=$(echo "$UNAME_S" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [ "$OS" = "freebsd" ]; then
|
||||
MK_FILE="bmake.mk"
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(UNAME_S),)
|
||||
UNAME_S := $(shell uname -s)
|
||||
endif
|
||||
ifneq (,$(filter MINGW% MSYS% UCRT% CLANG% CYGWIN%,$(UNAME_S)))
|
||||
IS_WINDOWS := 1
|
||||
IS_POSIX_SHELL := 1
|
||||
else ifeq ($(OS),Windows_NT)
|
||||
IS_WINDOWS := 1
|
||||
IS_POSIX_SHELL :=
|
||||
else
|
||||
IS_WINDOWS :=
|
||||
IS_POSIX_SHELL := 1
|
||||
endif
|
||||
|
||||
ifeq ($(IS_WINDOWS),1)
|
||||
CLOCK_SRC := src/platform/clock/win32.c
|
||||
else
|
||||
CLOCK_SRC := src/platform/clock/posix.c
|
||||
@@ -6,8 +20,7 @@ endif
|
||||
|
||||
include config.mk
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SHELL := cmd.exe
|
||||
ifeq ($(IS_WINDOWS),1)
|
||||
GL_LIB := -lopengl32
|
||||
LDFLAGS_PLAT :=
|
||||
CFLAGS_PLAT :=
|
||||
@@ -16,8 +29,6 @@ ifeq ($(OS),Windows_NT)
|
||||
CLIENT_BIN := $(GAME_NAME)_client.exe
|
||||
GLCLIENT_BIN := $(GAME_NAME)_glclient.exe
|
||||
SERVER_BIN := $(GAME_NAME)_server.exe
|
||||
MKDIR = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1))
|
||||
RMDIR = if exist $(subst /,\,$(1)) rd /s /q $(subst /,\,$(1))
|
||||
else ifeq ($(shell uname),FreeBSD)
|
||||
GL_LIB := -lGL
|
||||
LDFLAGS_PLAT := -L/usr/local/lib
|
||||
@@ -27,8 +38,6 @@ else ifeq ($(shell uname),FreeBSD)
|
||||
CLIENT_BIN := $(GAME_NAME)_client
|
||||
GLCLIENT_BIN := $(GAME_NAME)_glclient
|
||||
SERVER_BIN := $(GAME_NAME)_server
|
||||
MKDIR = mkdir -p $(1)
|
||||
RMDIR = rm -rf $(1)
|
||||
else
|
||||
GL_LIB := -lGL
|
||||
LDFLAGS_PLAT :=
|
||||
@@ -38,8 +47,15 @@ else
|
||||
CLIENT_BIN := $(GAME_NAME)_client
|
||||
GLCLIENT_BIN := $(GAME_NAME)_glclient
|
||||
SERVER_BIN := $(GAME_NAME)_server
|
||||
endif
|
||||
|
||||
ifeq ($(IS_POSIX_SHELL),1)
|
||||
MKDIR = mkdir -p $(1)
|
||||
RMDIR = rm -rf $(1)
|
||||
else
|
||||
SHELL := cmd.exe
|
||||
MKDIR = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1))
|
||||
RMDIR = if exist $(subst /,\,$(1)) rd /s /q $(subst /,\,$(1))
|
||||
endif
|
||||
|
||||
# linking
|
||||
|
||||
Reference in new issue
Block a user