diff options
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 93 |
1 files changed, 59 insertions, 34 deletions
diff --git a/src/Makefile b/src/Makefile index a2c6f834..799a8ff5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -295,8 +295,9 @@ ifeq "$(shell uname -s)" "Darwin" PLATFORM := MacOSX APPNAME := VeraCrypt - export VC_OSX_TARGET ?= 10.7 - export VC_OSX_SDK ?= $(VC_OSX_TARGET) + export VC_OSX_TARGET ?= 12 + # use the output of the command "xcrun --show-sdk-version" to set the SDK version if not set + export VC_OSX_SDK ?= $(shell xcrun --show-sdk-version) #check to see if XCode 3 path exists.Otherwise, use XCode 4 path VC_OSX_SDK_PATH := /Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk @@ -316,57 +317,81 @@ ifeq "$(shell uname -s)" "Darwin" C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK_PATH) LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK_PATH) + #Xcode 15 linker emits a warning "no platform load command found" when linking object files generated by yasm + # To suppress this warning, we need to use -Wl,-ld_classic flag in order to use the old ld64 linker + # https://mjtsai.com/blog/2024/03/15/xcode-15-no-platform-load-command-found/ + # Check Xcode version for using specific linker flag + XCODE_VERSION := $(shell xcodebuild -version 2>/dev/null | grep 'Xcode' | sed -E 's/Xcode ([0-9]+).*/\1/') + ifneq ($(XCODE_VERSION),) + ifeq "$(shell expr $(XCODE_VERSION) \>= 15)" "1" + LFLAGS += -Wl,-ld_classic + endif + else + $(error Xcode not found, please check your installation) + endif + WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH) - ifeq "$(CPU_ARCH)" "x64" - CPU_ARCH = x86 - endif - - ifeq "$(CPU_ARCH)" "arm64" - CPU_ARCH = x86 + + # Set x86 assembly flags (-msse2, -mssse3, -msse4.1) + # Apply flags if SIMD_SUPPORTED is 1 or if not in local development build (we are creating universal binary in this case) + ifneq "$(LOCAL_DEVELOPMENT_BUILD)" "true" + SIMD_SUPPORTED = 1 endif - CFLAGS += -msse2 - CXXFLAGS += -msse2 + ifeq "$(SIMD_SUPPORTED)" "1" + CFLAGS += -msse2 + CXXFLAGS += -msse2 - ifeq "$(origin SSSE3)" "command line" - CFLAGS += -mssse3 - CXXFLAGS += -mssse3 - endif + ifeq "$(origin SSSE3)" "command line" + CFLAGS += -mssse3 + CXXFLAGS += -mssse3 + endif - ifeq "$(origin SSE41)" "command line" - CFLAGS += -mssse3 -msse4.1 - CXXFLAGS += -mssse3 -msse4.1 + ifeq "$(origin SSE41)" "command line" + CFLAGS += -mssse3 -msse4.1 + CXXFLAGS += -mssse3 -msse4.1 + endif endif - AS := $(BASE_DIR)/Build/Tools/MacOSX/yasm + AS ?= $(BASE_DIR)/Build/Tools/MacOSX/yasm export ASFLAGS32 := -D __GNUC__ -D __YASM__ -D __BITS__=32 --prefix=_ -f macho32 export ASFLAGS64 := -D __GNUC__ -D __YASM__ -D __BITS__=64 --prefix=_ -f macho64 ifeq "$(TC_BUILD_CONFIG)" "Release" - export DISABLE_PRECOMPILED_HEADERS := 1 + export DISABLE_PRECOMPILED_HEADERS := 1 - S := $(C_CXX_FLAGS) - C_CXX_FLAGS = $(subst -MMD,,$(S)) + C_CXX_FLAGS := $(subst -MMD,,$(C_CXX_FLAGS)) -gfull + LFLAGS += -Wl,-dead_strip - C_CXX_FLAGS += -gfull -arch x86_64 - LFLAGS += -Wl,-dead_strip -arch x86_64 - - WX_CONFIGURE_FLAGS += --without-libpng --disable-gif --disable-pcx --disable-tga --disable-iff --disable-gif --disable-svg + # Initialize architecture flag + ARCH_FLAG := -arch x86_64 - #----- Legacy build: we build both 32-bit and 64-bit ---- - ifdef VC_LEGACY_BUILD - C_CXX_FLAGS += -arch i386 - LFLAGS += -arch i386 - WX_CONFIGURE_FLAGS += --enable-universal_binary=i386,x86_64 + # Set architecture flags based on build type and CPU architecture + ifeq "$(LOCAL_DEVELOPMENT_BUILD)" "true" + ifeq "$(CPU_ARCH)" "arm64" + ARCH_FLAG := -arch arm64 + endif + WX_CONFIGURE_FLAGS += --disable-universal_binary else - CXXFLAGS += -std=c++11 - C_CXX_FLAGS += -arch arm64 - LFLAGS += -arch arm64 - WX_CONFIGURE_FLAGS += --enable-universal_binary=arm64,x86_64 + # Legacy build settings + ifdef VC_LEGACY_BUILD + ARCH_FLAG += -arch i386 + WX_CONFIGURE_FLAGS += --enable-universal_binary=i386,x86_64 + else + CXXFLAGS += -std=c++11 + # Non-development build defaults to universal binary for arm64 and x86_64 + ARCH_FLAG += -arch arm64 + WX_CONFIGURE_FLAGS += --enable-universal_binary=arm64,x86_64 + endif endif + # Apply architecture flags + C_CXX_FLAGS += $(ARCH_FLAG) + LFLAGS += $(ARCH_FLAG) + + WX_CONFIGURE_FLAGS += --without-libpng --disable-gif --disable-pcx --disable-tga --disable-iff --disable-svg WXCONFIG_CFLAGS += -gfull WXCONFIG_CXXFLAGS += -gfull |