VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile94
1 files changed, 59 insertions, 35 deletions
diff --git a/src/Makefile b/src/Makefile
index 799a8ff5..15af9c6c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -23,8 +23,8 @@
# SSSE3: Enable SSSE3 support in compiler
# SSE41: Enable SSE4.1 support in compiler
# NOSSE2: Disable SEE2 support in compiler
-# WITHGTK3: Build wxWidgets against GTK3
-# WOLFCRYPT: Build with wolfCrypt as crypto provider (see Crypto/wolfCrypt.md)
+# WOLFCRYPT: Build with wolfCrypt as crypto provider (see Crypto/wolfCrypt.md)
+# WITHFUSET: Build with FUSE-T support on macOS instead of MacFUSE
#------ Targets ------
# all
@@ -52,6 +52,8 @@ export LFLAGS :=
export PKG_CONFIG ?= pkg-config
export PKG_CONFIG_PATH ?= /usr/local/lib/pkgconfig
+export VC_FUSE_PACKAGE := fuse
+export VC_OSX_FUSET ?= 0
export WX_CONFIG ?= wx-config
export WX_CONFIG_ARGS := --unicode
@@ -62,6 +64,12 @@ WX_ROOT ?= $(BASE_DIR)/wxWidgets
export TC_BUILD_CONFIG := Release
+ifeq "$(origin WITHFUSET)" "command line"
+ ifneq "$(WITHFUSET)" "0"
+ VC_OSX_FUSET := 1
+ endif
+endif
+
ifeq "$(origin DEBUG)" "command line"
ifneq "$(DEBUG)" "0"
TC_BUILD_CONFIG := Debug
@@ -97,16 +105,6 @@ ifeq "$(origin WXSTATIC)" "command line"
endif
endif
-ifeq "$(origin INDICATOR)" "command line"
- ifneq (,$(findstring gtk3,$(shell $(WX_CONFIG) --selected-config)))
- INDICATOR_LIBRARY=ayatana-appindicator3-0.1
- else
- INDICATOR_LIBRARY=ayatana-appindicator-0.1
- endif
- export AYATANA_LIBS += $(shell $(PKG_CONFIG) --libs $(INDICATOR_LIBRARY))
- C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags $(INDICATOR_LIBRARY)) -DHAVE_INDICATORS
-endif
-
#------ Release configuration ------
ifeq "$(TC_BUILD_CONFIG)" "Release"
@@ -150,6 +148,7 @@ export ENABLE_WOLFCRYPT ?= 0
export GCC_GTEQ_440 := 0
export GCC_GTEQ_430 := 0
+export GTK_VERSION := 0
ARCH ?= $(shell uname -m)
@@ -202,7 +201,7 @@ ifeq "$(shell uname -s)" "Linux"
C_CXX_FLAGS += -DTC_UNIX -DTC_LINUX
# PCSC
- C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+ C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags libpcsclite)
# Extract the major and minor version numbers of GCC in a combined format for easy comparison
GCC_VERSION := $(shell $(CC) -dumpversion | awk -F. '{printf "%d%02d", $$1, $$2}')
@@ -220,6 +219,12 @@ ifeq "$(shell uname -s)" "Linux"
CXXFLAGS += -std=gnu++14
endif
+ # Linked in GCC versions below 6 was setting large value for MAXPAGESIZE which is not good for ASLR security
+ # So, we need to manually add the linker flag "-z max-page-size=4096" to set the maximum page size to 4KB
+ # in order to improve ASLR security. Starting from GCC 6, the default value of MAXPAGESIZE is 4KB.
+ ifeq ($(shell expr $(GCC_VERSION) \< 600), 1)
+ LFLAGS += -Wl,-z,max-page-size=4096
+ endif
ifeq "$(SIMD_SUPPORTED)" "1"
CFLAGS += -msse2
@@ -279,13 +284,6 @@ ifeq "$(shell uname -s)" "Linux"
WXCONFIG_CFLAGS += -mno-sse2
WXCONFIG_CXXFLAGS += -mno-sse2
endif
-
- ifeq "$(origin WITHGTK3)" "command line"
- WX_CONFIGURE_FLAGS += --with-gtk=3
- else
- WX_CONFIGURE_FLAGS += --with-gtk=2
- endif
-
endif
#------ Mac OS X configuration ------
@@ -302,7 +300,10 @@ ifeq "$(shell uname -s)" "Darwin"
#check to see if XCode 3 path exists.Otherwise, use XCode 4 path
VC_OSX_SDK_PATH := /Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk
ifeq ($(wildcard $(VC_OSX_SDK_PATH)/SDKSettings.plist),)
- VC_OSX_SDK_PATH := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk
+ VC_OSX_SDK_PATH := $(shell xcrun --sdk macosx$(VC_OSX_SDK) --show-sdk-path)
+ ifeq ($(VC_OSX_SDK_PATH),)
+$(error Specified SDK version was not found, ensure your active developer directory is correct through xcode-select)
+ endif
endif
#----- Legacy build if OSX <= 10.8: we build both 32-bit and 64-bit ----
@@ -315,23 +316,23 @@ ifeq "$(shell uname -s)" "Darwin"
GCC_GTEQ_430 := 1
+ CXXFLAGS += -std=c++11
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
+ # 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)
+ # We can check whether newer linker is in use if ld -v reports dyld instead of ld64.
+ ifeq ($(shell xcrun --sdk macosx$(VC_OSX_SDK) ld -v 2>&1 | grep -oE 'PROJECT:[^-]+' | cut -d: -f2),dyld)
+ LFLAGS += -Wl,-ld_classic
endif
WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH)
+ ifneq "$(VC_OSX_FUSET)" "0"
+ C_CXX_FLAGS += -DVC_MACOSX_FUSET
+ VC_FUSE_PACKAGE := fuse-t
+ endif
# 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)
@@ -380,7 +381,6 @@ ifeq "$(shell uname -s)" "Darwin"
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
@@ -413,7 +413,7 @@ ifeq "$(shell uname -s)" "FreeBSD"
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_FREEBSD
# PCSC
- C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+ C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags libpcsclite)
CC := cc
CXX := c++
@@ -474,7 +474,7 @@ ifeq "$(shell uname -s)" "OpenBSD"
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_OPENBSD
# PCSC
- C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+ C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags libpcsclite)
CC := cc
CXX := c++
@@ -501,10 +501,29 @@ ifeq "$(shell uname -s)" "SunOS"
WX_CONFIGURE_FLAGS += --with-gtk
# PCSC
- C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite)
+ C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags libpcsclite)
endif
+ifneq (,$(filter Linux FreeBSD OpenBSD,$(PLATFORM)))
+ # Determine GTK version
+ GTK_VERSION := $(shell $(PKG_CONFIG) --modversion gtk+-3.0 2>/dev/null | grep -o '^3' || echo 2)
+ ifeq ($(GTK_VERSION),3)
+ WX_CONFIGURE_FLAGS += --with-gtk=3
+ else
+ WX_CONFIGURE_FLAGS += --with-gtk=2
+ endif
+
+ ifeq "$(origin INDICATOR)" "command line"
+ ifeq ($(GTK_VERSION),3)
+ INDICATOR_LIBRARY=ayatana-appindicator3-0.1
+ else
+ INDICATOR_LIBRARY=ayatana-appindicator-0.1
+ endif
+ export AYATANA_LIBS += $(shell $(PKG_CONFIG) --libs $(INDICATOR_LIBRARY))
+ C_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags $(INDICATOR_LIBRARY)) -DHAVE_INDICATORS
+ endif
+endif
#------ Common configuration ------
@@ -534,12 +553,17 @@ WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --dis
ifneq (,$(filter Linux FreeBSD,$(PLATFORM)))
WX_CONFIGURE_FLAGS += --disable-tooltips
-ifneq "$(origin WITHGTK3)" "command line"
+ifneq ($(GTK_VERSION),3)
WX_CONFIGURE_FLAGS += --disable-graphics_ctx
endif
else
WX_CONFIGURE_FLAGS += --disable-graphics_ctx
endif
+else
+# Disable libtiff on macOS
+ifeq "$(PLATFORM)" "MacOSX"
+ WX_CONFIGURE_FLAGS += --without-libtiff
+endif
endif