Compare commits

...
2 Commits
Author SHA1 Message Date
anth64 8a44bb1665 docs: add CHANGELOG.md 2026-11-10 07:49:42 +01:00
anth64 9f036ab00f 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.
2026-11-10 07:49:42 +01:00
3 changed files with 40 additions and 8 deletions

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This template is copied into new games rather than versioned/released itself,
so entries here track the template's own history, not a game built from it.
## [Unreleased]
### Fixed
- `build.sh`: `uname -s` exported once and reused by make instead of being re-run
- `gmake.mk`: stopped relying on the `OS` env var alone (unset under MSYS2), now also detects Windows via `uname -s` (`MINGW*`/`MSYS*`/`UCRT*`/`CLANG*`/`CYGWIN*`), with the native-Windows `cmd.exe` mkdir/rd path reserved for environments without a POSIX shell; fixes MSYS2 builds silently falling through to the Linux `mkdir -p`/`rm -rf` path mismatch
+4 -1
View File
@@ -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"
+23 -7
View File
@@ -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