fix: support MSYS2 builds on gmake
uname -s under MSYS2 never reports Windows_NT, so build.sh picked bmake.mk and gmake.mk's platform branches silently fell through to the Linux path (.so + -ldl), breaking the link. Detect MINGW/MSYS/ UCRT/CLANG uname prefixes in build.sh and route to gmake.mk; export UNAME_S once so make doesn't call uname again. gmake.mk, test/gmake.mk, and module_template/gmake.mk now derive Windows-vs-Unix from uname instead of $(OS), with the cmd.exe/batch command path reserved for environments without a POSIX shell (MSYS2 keeps mkdir -p/rm -rf).
This commit is contained in:
1 parent
270808e602
commit
9462006028
7 files changed
+99
-36
No files matched your search
@@ -1,22 +1,40 @@
|
||||
include config.mk
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SHELL := cmd.exe
|
||||
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)
|
||||
FULL_LIB := $(LIB_NAME).dll
|
||||
STATIC_LIB := lib$(LIB_NAME).a
|
||||
LDFLAGS_PLAT :=
|
||||
CFLAGS_PLAT :=
|
||||
CFLAGS_STATIC :=
|
||||
MKDIR = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1))
|
||||
RMDIR = if exist $(subst /,\,$(1)) rd /s /q $(subst /,\,$(1))
|
||||
else
|
||||
FULL_LIB := lib$(LIB_NAME).so
|
||||
STATIC_LIB := lib$(LIB_NAME).a
|
||||
LDFLAGS_PLAT := -ldl
|
||||
CFLAGS_PLAT := -fPIC
|
||||
CFLAGS_STATIC :=
|
||||
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
|
||||
|
||||
RELEASE_LDFLAGS := -s
|
||||
|
||||
Reference in new issue
Block a user