diff options
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 140 |
1 files changed, 123 insertions, 17 deletions
diff --git a/src/Makefile b/src/Makefile index f881c87e..a2c6f834 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,6 +24,7 @@ # 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) #------ Targets ------ # all @@ -49,6 +50,7 @@ C_CXX_FLAGS := -MMD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -I export ASFLAGS := -D __GNUC__ -D __YASM__ export LFLAGS := +export PKG_CONFIG ?= pkg-config export PKG_CONFIG_PATH ?= /usr/local/lib/pkgconfig export WX_CONFIG ?= wx-config @@ -56,8 +58,7 @@ export WX_CONFIG_ARGS := --unicode WX_CONFIGURE_FLAGS := export WXCONFIG_CFLAGS := export WXCONFIG_CXXFLAGS := -WX_ROOT ?= .. - +WX_ROOT ?= $(BASE_DIR)/wxWidgets export TC_BUILD_CONFIG := Release @@ -96,6 +97,15 @@ 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 ------ @@ -135,6 +145,11 @@ export PLATFORM_UNSUPPORTED := 0 export CPU_ARCH ?= unknown export SIMD_SUPPORTED := 0 +export DISABLE_AESNI ?= 0 +export ENABLE_WOLFCRYPT ?= 0 + +export GCC_GTEQ_440 := 0 +export GCC_GTEQ_430 := 0 ARCH ?= $(shell uname -m) @@ -168,6 +183,16 @@ ifeq "$(origin NOSSE2)" "command line" SIMD_SUPPORTED := 0 endif +ifeq "$(origin NOAESNI)" "command line" + DISABLE_AESNI := 1 +endif + +ifeq "$(origin WOLFCRYPT)" "command line" + ENABLE_WOLFCRYPT := 1 + C_CXX_FLAGS += -DWOLFCRYPT_BACKEND + export LIBS += -lwolfssl + export LD_LIBRARY_PATH=/usr/local/lib +endif #------ Linux configuration ------ @@ -176,15 +201,41 @@ ifeq "$(shell uname -s)" "Linux" PLATFORM := Linux C_CXX_FLAGS += -DTC_UNIX -DTC_LINUX + # PCSC + 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}') + + # Set the C++ standard based on the version numbers + ifeq ($(shell expr $(GCC_VERSION) \< 408), 1) + # GCC version below 4.8 support minimal C++11 features through the switch -std=c++0x + CXXFLAGS += -std=c++0x + else ifeq ($(GCC_VERSION), 408) + # GCC version 4.8 supports C++11 features through the switch -std=c++11 + CXXFLAGS += -std=c++11 + else ifeq ($(shell expr $(GCC_VERSION) \>= 1100), 1) + # GNU GCC version 11 and higher compile with -std=gnu++17 by default + # which breaks "byte" definitions in Crypto++ library. So set -std=gnu++14 instead. + CXXFLAGS += -std=gnu++14 + endif + + ifeq "$(SIMD_SUPPORTED)" "1" CFLAGS += -msse2 CXXFLAGS += -msse2 - GCC_GTEQ_440 := $(shell expr `gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40400) - GCC_GTEQ_430 := $(shell expr `gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40300) - ifeq "$(GCC_GTEQ_440)" "1" - CFLAGS += -maes - CXXFLAGS += -maes + GCC_GTEQ_440 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40400) + GCC_GTEQ_430 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40300) + + ifeq "$(DISABLE_AESNI)" "1" + CFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI + CXXFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI + else + ifeq "$(GCC_GTEQ_440)" "1" + CFLAGS += -maes + CXXFLAGS += -maes + endif endif ifeq "$(GCC_GTEQ_430)" "1" @@ -215,7 +266,7 @@ ifeq "$(shell uname -s)" "Linux" ifneq "$(origin WXSTATIC)" "command line" LFLAGS += -ldl else - GCC5USED := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 5) + GCC5USED := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 5) ifeq "$(GCC5USED)" "1" CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 WXCONFIG_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 @@ -231,6 +282,8 @@ ifeq "$(shell uname -s)" "Linux" ifeq "$(origin WITHGTK3)" "command line" WX_CONFIGURE_FLAGS += --with-gtk=3 + else + WX_CONFIGURE_FLAGS += --with-gtk=2 endif endif @@ -246,7 +299,7 @@ ifeq "$(shell uname -s)" "Darwin" export VC_OSX_SDK ?= $(VC_OSX_TARGET) #check to see if XCode 3 path exists.Otherwise, use XCode 4 path - VC_OSX_SDK_PATH := /Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk + 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 endif @@ -259,6 +312,8 @@ ifeq "$(shell uname -s)" "Darwin" CC := gcc CXX := g++ + GCC_GTEQ_430 := 1 + 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) WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH) @@ -266,6 +321,10 @@ ifeq "$(shell uname -s)" "Darwin" ifeq "$(CPU_ARCH)" "x64" CPU_ARCH = x86 endif + + ifeq "$(CPU_ARCH)" "arm64" + CPU_ARCH = x86 + endif CFLAGS += -msse2 CXXFLAGS += -msse2 @@ -294,13 +353,18 @@ ifeq "$(shell uname -s)" "Darwin" 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 + #----- 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 else - WX_CONFIGURE_FLAGS += --disable-universal_binary + CXXFLAGS += -std=c++11 + C_CXX_FLAGS += -arch arm64 + LFLAGS += -arch arm64 + WX_CONFIGURE_FLAGS += --enable-universal_binary=arm64,x86_64 endif WXCONFIG_CFLAGS += -gfull @@ -322,9 +386,14 @@ ifeq "$(shell uname -s)" "FreeBSD" PLATFORM := FreeBSD PLATFORM_UNSUPPORTED := 1 C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_FREEBSD + + # PCSC + C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite) CC := cc CXX := c++ + + GCC_GTEQ_430 := 1 ifeq "$(TC_BUILD_CONFIG)" "Release" C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie @@ -339,8 +408,16 @@ ifeq "$(shell uname -s)" "FreeBSD" endif ifeq "$(SIMD_SUPPORTED)" "1" - CFLAGS += -msse2 -maes - CXXFLAGS += -msse2 -maes + CFLAGS += -msse2 + CXXFLAGS += -msse2 + + ifeq "$(DISABLE_AESNI)" "1" + CFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI + CXXFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI + else + CFLAGS += -maes + CXXFLAGS += -maes + endif ifeq "$(origin SSSE3)" "command line" CFLAGS += -mssse3 @@ -363,6 +440,32 @@ ifeq "$(shell uname -s)" "FreeBSD" endif +#------ OpenBSD configuration ------ + +ifeq "$(shell uname -s)" "OpenBSD" + + PLATFORM := OpenBSD + PLATFORM_UNSUPPORTED := 1 + C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_OPENBSD + + # PCSC + C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite) + + CC := cc + CXX := c++ + + GCC_GTEQ_430 := 1 + + ifeq "$(TC_BUILD_CONFIG)" "Release" + C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie + LFLAGS += -Wl,--gc-sections -pie + + WXCONFIG_CFLAGS += -fpie -fPIC + WXCONFIG_CXXFLAGS += -fpie -fPIC + endif +endif + + #------ Solaris configuration ------ ifeq "$(shell uname -s)" "SunOS" @@ -372,6 +475,9 @@ ifeq "$(shell uname -s)" "SunOS" C_CXX_FLAGS += -DTC_UNIX -DTC_SOLARIS WX_CONFIGURE_FLAGS += --with-gtk + # PCSC + C_CXX_FLAGS += $(shell pkg-config --cflags libpcsclite) + endif @@ -384,13 +490,13 @@ LFLAGS := $(LFLAGS) $(TC_EXTRA_LFLAGS) WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-tracking --enable-exceptions --enable-std_string --enable-dataobj --enable-mimetype ifdef VC_WX_MINIMAL -WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --disable-ipc --disable-sockets --disable-fs_inet --disable-ole --disable-docview --disable-clipboard \ - --disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-webkit --disable-webview \ +WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --disable-ipc --disable-sockets --without-libcurl --disable-fs_inet --disable-ole --disable-docview --disable-clipboard \ + --disable-help --disable-html --disable-mshtmlhelp --disable-htmlhelp --disable-mdi --disable-metafile --disable-addremovectrl --disable-webview \ --disable-xrc --disable-aui --disable-postscript --disable-printarch \ --disable-arcstream --disable-fs_archive --disable-fs_zip --disable-tarstream --disable-zipstream \ --disable-animatectrl --disable-bmpcombobox --disable-calendar --disable-caret --disable-checklst --disable-collpane --disable-colourpicker --disable-comboctrl \ - --disable-datepick --disable-display --disable-dirpicker --disable-filepicker --disable-fontpicker --disable-grid --disable-dataviewctrl \ - --disable-listbook --disable-odcombobox --disable-sash --disable-searchctrl --disable-slider --disable-splitter --disable-togglebtn \ + --disable-datepick --disable-display --disable-dirpicker --disable-filepicker --disable-fontpicker --disable-grid --disable-dataviewctrl \ + --disable-listbook --disable-odcombobox --disable-sash --disable-searchctrl --disable-slider --disable-splitter --disable-togglebtn \ --disable-toolbar --disable-tbarnative --disable-treebook --disable-toolbook --disable-tipwindow --disable-popupwin \ --disable-commondlg --disable-aboutdlg --disable-coldlg --disable-finddlg --disable-fontdlg --disable-numberdlg --disable-splash \ --disable-tipdlg --disable-progressdlg --disable-wizarddlg --disable-miniframe --disable-splines --disable-palette \ @@ -401,7 +507,7 @@ WX_CONFIGURE_FLAGS += --disable-protocol --disable-protocols --disable-url --dis --disable-gif --disable-pcx --disable-tga --disable-iff --disable-gif --disable-pnm --disable-svg \ --without-expat --without-libtiff --without-libjpeg --without-libpng -without-regex --without-zlib -ifeq "$(PLATFORM)" "Linux" +ifneq (,$(filter Linux FreeBSD,$(PLATFORM))) WX_CONFIGURE_FLAGS += --disable-tooltips ifneq "$(origin WITHGTK3)" "command line" WX_CONFIGURE_FLAGS += --disable-graphics_ctx |