diff --git a/Makefile b/Makefile index 6767bf89..598320ef 100644 --- a/Makefile +++ b/Makefile @@ -35,18 +35,33 @@ NODRAWINGDISTANCE ?= 0 TEXTURE_FIX ?= 0 # Enable extended options menu by default EXT_OPTIONS_MENU ?= 1 +# Disable no bzero/bcopy workaround by default +# Enable by default for MXE builds +ifeq ($(WINDOWS_BUILD),1) + ifeq ($(CROSS),i686-w64-mingw32.static-) + NO_BZERO_BCOPY := 1 + else ifeq ($(CROSS),x86_64-w64-mingw32.static-) + NO_BZERO_BCOPY := 1 + else + NO_BZERO_BCOPY ?= 0 + endif +else + NO_BZERO_BCOPY ?= 0 +endif # Build for Emscripten/WebGL TARGET_WEB ?= 0 # Specify the target you are building for, 0 means native -TARGET_ARCH ?= native - -ifeq ($(CROSS),i686-w64-mingw32.static-) - TARGET_ARCH = i386pe -else ifeq ($(CROSS),x86_64-w64-mingw32.static-) - TARGET_ARCH = i386pe +ifeq ($(WINDOWS_BUILD),1) + ifeq ($(CROSS),i686-w64-mingw32.static-) + TARGET_ARCH = i386pe + else ifeq ($(CROSS),x86_64-w64-mingw32.static-) + TARGET_ARCH = i386pe + else + TARGET_ARCH ?= native + endif else - TARGET_ARCH = native + TARGET_ARCH ?= native endif TARGET_BITS ?= 0 @@ -508,6 +523,12 @@ ifeq ($(EXT_OPTIONS_MENU),1) CFLAGS += -DEXT_OPTIONS_MENU endif +# Check for no bzero/bcopy workaround option +ifeq ($(NO_BZERO_BCOPY),1) + CC_CHECK += -DNO_BZERO_BCOPY + CFLAGS += -DNO_BZERO_BCOPY +endif + ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS) ifeq ($(TARGET_WEB),1) diff --git a/include/PR/os_libc.h b/include/PR/os_libc.h index e7567516..9eb872e7 100644 --- a/include/PR/os_libc.h +++ b/include/PR/os_libc.h @@ -10,7 +10,7 @@ // macOS libc has them #include -#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) +#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) || defined(NO_BZERO_BCOPY) // there's no way that shit's defined, use memcpy/memset #include