mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-27 11:50:29 +00:00
cdc2a4aaf5
This commit updates Android and iOS to modern SDKs, NDKs and Xcode.
974 lines
32 KiB
Plaintext
Executable File
974 lines
32 KiB
Plaintext
Executable File
# https://www.gnu.org/software/make/manual/make.html#Makefile-Conventions
|
|
# and https://www.gnu.org/prep/standards/standards.html
|
|
|
|
SHELL = /bin/sh
|
|
|
|
# If needed
|
|
TMPDIR ?= /tmp
|
|
# Used for ARMv7a and NEON. Android hard codes softfp
|
|
FP_ABI ?= hard
|
|
# Used for feature tests
|
|
TOUT ?= a.out
|
|
TOUT := $(strip $(TOUT))
|
|
|
|
# Allow override for the cryptest.exe recipe. Change to
|
|
# ./libcryptopp.so or ./libcryptopp.dylib to suit your
|
|
# taste. https://github.com/weidai11/cryptopp/issues/866
|
|
LINK_LIBRARY ?= ./libcryptopp.a
|
|
LINK_LIBRARY_PATH ?= ./
|
|
|
|
# Default CXXFLAGS if none were provided
|
|
CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe
|
|
|
|
AR ?= ar
|
|
ARFLAGS ?= cr
|
|
RANLIB ?= ranlib
|
|
CP ?= cp
|
|
MV ?= mv
|
|
CHMOD ?= chmod
|
|
MKDIR ?= mkdir -p
|
|
GREP ?= grep
|
|
SED ?= sed
|
|
|
|
LN ?= ln -sf
|
|
LDCONF ?= /sbin/ldconfig -n
|
|
|
|
IS_IOS ?= 0
|
|
IS_ANDROID ?= 0
|
|
IS_ARM_EMBEDDED ?= 0
|
|
|
|
# Yet another Clang hack. I think the LLVM devs are making the shit up
|
|
# as they go. Also see https://github.com/weidai11/cryptopp/issues/831.
|
|
MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
|
|
ifeq ($(MACHINEX),armv8l-unknown-linux-gnueabihf)
|
|
MACHINEX := armv7l-unknown-linux-gnueabihf
|
|
endif
|
|
HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-')
|
|
ifeq ($(HOSTX),)
|
|
HOSTX := $(shell uname -m 2>/dev/null)
|
|
endif
|
|
|
|
IS_LINUX := $(shell echo $(MACHINEX) | $(GREP) -i -c "Linux")
|
|
|
|
# Can be used by Android and Embeeded cross-compiles. Disable by default because
|
|
# Android and embedded users typically don't run this configuration.
|
|
HAS_SOLIB_VERSION ?= 0
|
|
|
|
# Formely adhoc.cpp was created from adhoc.cpp.proto when needed.
|
|
# This is now needed because ISA tests are performed using adhoc.cpp.
|
|
ifeq ($(wildcard adhoc.cpp),)
|
|
$(shell cp adhoc.cpp.proto adhoc.cpp)
|
|
endif
|
|
|
|
###########################################################
|
|
##### General Variables #####
|
|
###########################################################
|
|
|
|
# Default prefix for make install
|
|
ifeq ($(PREFIX),)
|
|
PREFIX = /usr/local
|
|
endif
|
|
|
|
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
|
ifeq ($(DATADIR),)
|
|
DATADIR := $(PREFIX)/share
|
|
endif
|
|
ifeq ($(LIBDIR),)
|
|
LIBDIR := $(PREFIX)/lib
|
|
endif
|
|
ifeq ($(BINDIR),)
|
|
BINDIR := $(PREFIX)/bin
|
|
endif
|
|
ifeq ($(INCLUDEDIR),)
|
|
INCLUDEDIR := $(PREFIX)/include
|
|
endif
|
|
|
|
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
|
|
ifeq ($(ARFLAGS),rv)
|
|
ARFLAGS = r
|
|
endif
|
|
|
|
# Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
|
|
# Its a shame because GCC has so much to offer by the way of analysis.
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
|
|
ifneq ($(CLANG_COMPILER),0)
|
|
CXXFLAGS += -Wall
|
|
endif
|
|
|
|
###########################################################
|
|
##### iOS #####
|
|
###########################################################
|
|
|
|
# iOS cross-compile configuration.
|
|
# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
|
|
ifeq ($(IS_IOS),1)
|
|
CXXFLAGS += $(IOS_CXXFLAGS) -stdlib=libc++
|
|
CXXFLAGS += --sysroot "$(IOS_SYSROOT)"
|
|
|
|
AR = libtool
|
|
ARFLAGS = -static -o
|
|
endif
|
|
|
|
###########################################################
|
|
##### Android #####
|
|
###########################################################
|
|
|
|
# Android cross-compile configuration.
|
|
# See http://www.cryptopp.com/wiki/Android_(Command_Line).
|
|
ifeq ($(IS_ANDROID),1)
|
|
CXXFLAGS += $(ANDROID_CXXFLAGS) -D__ANDROID_API__=$(ANDROID_API)
|
|
CXXFLAGS += --sysroot=$(ANDROID_SYSROOT)
|
|
CXXFLAGS += -Wa,--noexecstack
|
|
|
|
# Source files copied into PWD for Android cpu-features
|
|
# setenv-android.sh does the copying. Its a dirty compile.
|
|
ANDROID_CPU_OBJ = cpu-features.o
|
|
endif
|
|
|
|
###########################################################
|
|
##### Embedded #####
|
|
###########################################################
|
|
|
|
# ARM embedded cross-compile configuration.
|
|
# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
|
|
# and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
|
|
ifeq ($(IS_ARM_EMBEDDED),1)
|
|
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-embedded.sh'
|
|
CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT)
|
|
endif
|
|
|
|
###########################################################
|
|
##### Compiler and Platform #####
|
|
###########################################################
|
|
|
|
# Wait until CXXFLAGS have been set by setenv scripts.
|
|
|
|
GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E 'llvm|clang' | $(GREP) -i -c -E '(gcc|g\+\+)')
|
|
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E 'llvm|clang')
|
|
|
|
HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-')
|
|
ifeq ($(HOSTX),)
|
|
HOSTX := $(shell uname -m 2>/dev/null)
|
|
endif
|
|
|
|
# This dance is because Clang reports the host architecture instead
|
|
# of the target architecture. Running Clang on an x86_64 machine with
|
|
# -arch arm64 yields x86_64 instead of aarch64 or arm64.
|
|
|
|
ifeq ($(CLANG_COMPILER),1)
|
|
IS_X86 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
|
|
IS_X64 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'x86_64|amd64')
|
|
IS_ARM32 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
|
|
IS_ARMV8 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
|
|
else
|
|
IS_X86 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
|
|
IS_X64 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'x86_64|amd64')
|
|
IS_ARM32 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
|
|
IS_ARMV8 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
|
|
endif
|
|
|
|
ifeq ($(IS_ARMV8),1)
|
|
IS_ARM32 = 0
|
|
endif
|
|
|
|
IS_X32 := 0
|
|
IS_PPC32 := 0
|
|
IS_PPC64 := 0
|
|
|
|
$(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8))
|
|
|
|
###########################################################
|
|
##### Test Program #####
|
|
###########################################################
|
|
|
|
# Hack to skip CPU feature tests for some recipes
|
|
DETECT_FEATURES ?= 1
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),-DCRYPTOPP_DISABLE_ASM)
|
|
DETECT_FEATURES := 0
|
|
else ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
|
|
DETECT_FEATURES := 0
|
|
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean)
|
|
DETECT_FEATURES := 0
|
|
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim)
|
|
DETECT_FEATURES := 0
|
|
else ifeq ($(IS_IOS),1)
|
|
DETECT_FEATURES := 0
|
|
endif
|
|
|
|
# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed
|
|
# because it requires -O1 or higher, but we use -O0 to tame the optimizer.
|
|
ifeq ($(DETECT_FEATURES),1)
|
|
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
|
|
ifneq ($(strip $(TCXXFLAGS)),)
|
|
$(info Using testing flags: $(TCXXFLAGS))
|
|
endif
|
|
#TPROG = TestPrograms/test_cxx.cxx
|
|
#$(info Testing compile... )
|
|
#$(info $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 1>/dev/null))
|
|
endif
|
|
|
|
# For the previous messages
|
|
$(info )
|
|
|
|
###########################################################
|
|
##### X86/X32/X64 Options #####
|
|
###########################################################
|
|
|
|
ifneq ($(IS_X86)$(IS_X64),00)
|
|
ifeq ($(DETECT_FEATURES),1)
|
|
|
|
SSE2_FLAG = -msse2
|
|
SSE3_FLAG = -msse3
|
|
SSSE3_FLAG = -mssse3
|
|
SSE41_FLAG = -msse4.1
|
|
SSE42_FLAG = -msse4.2
|
|
CLMUL_FLAG = -mpclmul
|
|
AESNI_FLAG = -maes
|
|
AVX_FLAG = -mavx
|
|
AVX2_FLAG = -mavx2
|
|
SHANI_FLAG = -msha
|
|
|
|
TPROG = TestPrograms/test_x86_sse2.cxx
|
|
TOPT = $(SSE2_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
CHACHA_FLAG = $(SSE2_FLAG)
|
|
else
|
|
SSE2_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_ssse3.cxx
|
|
TOPT = $(SSSE3_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
ARIA_FLAG = $(SSSE3_FLAG)
|
|
CHAM_FLAG = $(SSSE3_FLAG)
|
|
LEA_FLAG = $(SSSE3_FLAG)
|
|
SIMECK_FLAG = $(SSSE3_FLAG)
|
|
SIMON128_FLAG = $(SSSE3_FLAG)
|
|
SPECK128_FLAG = $(SSSE3_FLAG)
|
|
else
|
|
SSSE3_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_sse41.cxx
|
|
TOPT = $(SSE41_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
BLAKE2B_FLAG = $(SSE41_FLAG)
|
|
BLAKE2S_FLAG = $(SSE41_FLAG)
|
|
SIMON64_FLAG = $(SSE41_FLAG)
|
|
SPECK64_FLAG = $(SSE41_FLAG)
|
|
else
|
|
SSE41_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_sse42.cxx
|
|
TOPT = $(SSE42_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
CRC_FLAG = $(SSE42_FLAG)
|
|
else
|
|
SSE42_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_clmul.cxx
|
|
TOPT = $(CLMUL_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
|
|
else
|
|
CLMUL_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_aes.cxx
|
|
TOPT = $(AESNI_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
|
|
SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
|
|
else
|
|
AESNI_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_avx.cxx
|
|
TOPT = $(AVX_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
# XXX_FLAG = $(AVX_FLAG)
|
|
else
|
|
AVX_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_avx2.cxx
|
|
TOPT = $(AVX2_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
CHACHA_AVX2_FLAG = $(AVX2_FLAG)
|
|
else
|
|
AVX2_FLAG =
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_x86_sha.cxx
|
|
TOPT = $(SHANI_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
|
|
else
|
|
SHANI_FLAG =
|
|
endif
|
|
|
|
ifeq ($(SSE2_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|
else ifeq ($(SSE3_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
|
|
else ifeq ($(SSSE3_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
|
|
else ifeq ($(SSE41_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
|
|
else ifeq ($(SSE42_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
|
|
endif
|
|
|
|
ifneq ($(SSE42_FLAG),)
|
|
|
|
# Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
|
|
# test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
|
|
ifeq ($(CLMUL_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
|
|
endif
|
|
ifeq ($(AESNI_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
|
|
endif
|
|
|
|
ifeq ($(AVX_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
|
|
else ifeq ($(AVX2_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
|
|
else ifeq ($(SHANI_FLAG),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
|
|
endif
|
|
endif
|
|
|
|
# Drop to SSE2 if available
|
|
ifeq ($(GCM_FLAG),)
|
|
ifneq ($(SSE2_FLAG),)
|
|
GCM_FLAG = $(SSE2_FLAG)
|
|
endif
|
|
endif
|
|
|
|
# Most Clang cannot handle mixed asm with positional arguments, where the
|
|
# body is Intel style with no prefix and the templates are AT&T style.
|
|
# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
|
|
|
|
# CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
|
|
# Clang compilers. This test will need to be re-enabled if Clang fixes it.
|
|
#TPROG = TestPrograms/test_asm_mixed.cxx
|
|
#HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
#ifneq ($(strip $(HAVE_OPT)),0)
|
|
# CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
|
|
#endif
|
|
|
|
# DETECT_FEATURES
|
|
endif
|
|
|
|
# IS_X86, IS_X32 and IS_X64
|
|
endif
|
|
|
|
###########################################################
|
|
##### ARM A-32 and NEON #####
|
|
###########################################################
|
|
|
|
ifneq ($(IS_ARM32),0)
|
|
ifeq ($(DETECT_FEATURES),1)
|
|
|
|
# Android needs -c compile flag for NEON. Otherwise there's an odd linker message.
|
|
ifeq ($(IS_ANDROID),1)
|
|
NEON_FLAG = -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -mfpu=neon
|
|
else
|
|
NEON_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_neon.cxx
|
|
TOPT = $(NEON_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
ARIA_FLAG = $(NEON_FLAG)
|
|
AES_FLAG = $(NEON_FLAG)
|
|
CRC_FLAG = $(NEON_FLAG)
|
|
GCM_FLAG = $(NEON_FLAG)
|
|
BLAKE2B_FLAG = $(NEON_FLAG)
|
|
BLAKE2S_FLAG = $(NEON_FLAG)
|
|
CHACHA_FLAG = $(NEON_FLAG)
|
|
CHAM_FLAG = $(NEON_FLAG)
|
|
LEA_FLAG = $(NEON_FLAG)
|
|
SHA_FLAG = $(NEON_FLAG)
|
|
SIMECK_FLAG = $(NEON_FLAG)
|
|
SIMON64_FLAG = $(NEON_FLAG)
|
|
SIMON128_FLAG = $(NEON_FLAG)
|
|
SPECK64_FLAG = $(NEON_FLAG)
|
|
SPECK128_FLAG = $(NEON_FLAG)
|
|
SM4_FLAG = $(NEON_FLAG)
|
|
else
|
|
NEON_FLAG =
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|
endif
|
|
|
|
# DETECT_FEATURES
|
|
endif
|
|
# IS_ARM32
|
|
endif
|
|
|
|
###########################################################
|
|
##### Aach32 and Aarch64 #####
|
|
###########################################################
|
|
|
|
ifneq ($(IS_ARMV8),0)
|
|
ifeq ($(DETECT_FEATURES),1)
|
|
|
|
ifeq ($(IS_IOS),1)
|
|
ASIMD_FLAG =
|
|
CRC_FLAG =
|
|
AES_FLAG =
|
|
PMUL_FLAG =
|
|
SHA_FLAG =
|
|
else
|
|
ASIMD_FLAG = -march=armv8-a
|
|
CRC_FLAG = -march=armv8-a+crc
|
|
AES_FLAG = -march=armv8-a+crypto
|
|
PMULL_FLAG = -march=armv8-a+crypto
|
|
SHA_FLAG = -march=armv8-a+crypto
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_acle.cxx
|
|
TOPT = $(ASIMD_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
ACLE_FLAG += -DCRYPTOPP_ARM_ACLE_HEADER=1
|
|
else
|
|
CXXFLAGS += -DCRYPTOPP_ARM_ACLE_HEADER=0
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_asimd.cxx
|
|
TOPT = $(ASIMD_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
ARIA_FLAG = $(ASIMD_FLAG)
|
|
BLAKE2B_FLAG = $(ASIMD_FLAG)
|
|
BLAKE2S_FLAG = $(ASIMD_FLAG)
|
|
CHACHA_FLAG = $(ASIMD_FLAG)
|
|
CHAM_FLAG = $(ASIMD_FLAG)
|
|
LEA_FLAG = $(ASIMD_FLAG)
|
|
NEON_FLAG = $(ASIMD_FLAG)
|
|
SIMECK_FLAG = $(ASIMD_FLAG)
|
|
SIMON64_FLAG = $(ASIMD_FLAG)
|
|
SIMON128_FLAG = $(ASIMD_FLAG)
|
|
SPECK64_FLAG = $(ASIMD_FLAG)
|
|
SPECK128_FLAG = $(ASIMD_FLAG)
|
|
SM4_FLAG = $(ASIMD_FLAG)
|
|
else
|
|
ASIMD_FLAG =
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_crc.cxx
|
|
TOPT = $(CRC_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifneq ($(strip $(HAVE_OPT)),0)
|
|
CRC_FLAG =
|
|
CXXFLAGS += -DCRYPTOPP_ARM_CRC32_AVAILABLE=0
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_aes.cxx
|
|
TOPT = $(AES_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifneq ($(strip $(HAVE_OPT)),0)
|
|
AES_FLAG =
|
|
CXXFLAGS += -DCRYPTOPP_ARM_AES_AVAILABLE=0
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_pmull.cxx
|
|
TOPT = $(PMULL_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifneq ($(strip $(HAVE_OPT)),0)
|
|
PMULL_FLAG =
|
|
CXXFLAGS += -DCRYPTOPP_ARM_PMULL_AVAILABLE=0
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_sha1.cxx
|
|
TOPT = $(SHA_FLAG)
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifneq ($(strip $(HAVE_OPT)),0)
|
|
SHA_FLAG =
|
|
CXXFLAGS += -DCRYPTOPP_ARM_SHA_AVAILABLE=0
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_sm3.cxx
|
|
TOPT = -march=armv8.4-a+crypto
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
SM3_FLAG = -march=armv8.4-a+crypto
|
|
SM4_FLAG = -march=armv8.4-a+crypto
|
|
endif
|
|
|
|
TPROG = TestPrograms/test_arm_sha3.cxx
|
|
TOPT = -march=armv8.4-a+crypto
|
|
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
|
|
ifeq ($(strip $(HAVE_OPT)),0)
|
|
SHA3_FLAG = -march=armv8.4-a+crypto
|
|
SHA512_FLAG = -march=armv8.4-a+crypto
|
|
endif
|
|
|
|
# DETECT_FEATURES
|
|
endif
|
|
# IS_ARMV8
|
|
endif
|
|
|
|
###########################################################
|
|
##### Common #####
|
|
###########################################################
|
|
|
|
# No ASM for Travis testing
|
|
ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm)
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|
endif # CXXFLAGS
|
|
endif # No ASM
|
|
|
|
# Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
|
|
ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
|
|
ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
|
|
CXXFLAGS += -fsanitize=undefined
|
|
endif # CXXFLAGS
|
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
|
endif # CXXFLAGS
|
|
endif # UBsan
|
|
|
|
# Address Sanitizer (Asan) testing. Issue 'make asan'.
|
|
ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
|
|
ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
|
|
CXXFLAGS += -fsanitize=address
|
|
endif # CXXFLAGS
|
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
|
endif # CXXFLAGS
|
|
ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
|
|
CXXFLAGS += -fno-omit-frame-pointer
|
|
endif # CXXFLAGS
|
|
endif # Asan
|
|
|
|
# LD gold linker testing. Triggered by 'LD=ld.gold'.
|
|
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
|
|
ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
|
|
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf")
|
|
ifneq ($(ELF_FORMAT),0)
|
|
LDFLAGS += -fuse-ld=gold
|
|
endif # ELF/ELF64
|
|
endif # CXXFLAGS
|
|
endif # Gold
|
|
|
|
# Valgrind testing. Issue 'make valgrind'.
|
|
ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
|
|
# Tune flags; see http://valgrind.org/docs/manual/quick-start.html
|
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
|
endif # -DCRYPTOPP_COVERAGE
|
|
endif # Valgrind
|
|
|
|
# Debug testing on GNU systems. Triggered by -DDEBUG.
|
|
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
|
|
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
|
|
USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E pch.cpp 2>&1 | $(GREP) -i -c "__GLIBCXX__")
|
|
ifneq ($(USING_GLIBCXX),0)
|
|
ifeq ($(HAS_NEWLIB),0)
|
|
ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
|
|
CXXFLAGS += -D_GLIBCXX_DEBUG
|
|
endif # CXXFLAGS
|
|
endif # HAS_NEWLIB
|
|
endif # USING_GLIBCXX
|
|
endif # GNU Debug build
|
|
|
|
# Dead code stripping. Issue 'make lean'.
|
|
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
|
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
|
CXXFLAGS += -ffunction-sections
|
|
endif # CXXFLAGS
|
|
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
|
CXXFLAGS += -fdata-sections
|
|
endif # CXXFLAGS
|
|
ifneq ($(IS_IOS),0)
|
|
ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
|
|
LDFLAGS += -Wl,-dead_strip
|
|
endif # CXXFLAGS
|
|
else # BSD, Linux and Unix
|
|
ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
|
|
LDFLAGS += -Wl,--gc-sections
|
|
endif # LDFLAGS
|
|
endif # MAKECMDGOALS
|
|
endif # Dead code stripping
|
|
|
|
###########################################################
|
|
##### Source and object files #####
|
|
###########################################################
|
|
|
|
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
|
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp)))
|
|
# For Makefile.am; resource.h is Windows
|
|
INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
|
|
|
|
# Cryptogams source files. We couple to ARMv7.
|
|
# Limit to Linux. The source files target the GNU assembler.
|
|
# Also see https://www.cryptopp.com/wiki/Cryptogams.
|
|
ifeq ($(IS_ARM32)$(IS_LINUX),11)
|
|
ifeq ($(CLANG_COMPILER),1)
|
|
CRYPTOGAMS_ARMV7_FLAG = -march=armv7-a -Wa,--noexecstack
|
|
CRYPTOGAMS_ARMV7_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack
|
|
else
|
|
CRYPTOGAMS_ARMV7_FLAG = -march=armv7-a -Wa,--noexecstack
|
|
CRYPTOGAMS_ARMV7_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack
|
|
endif
|
|
SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S
|
|
endif
|
|
|
|
# Remove unneeded arch specific files to speed build time.
|
|
ifeq ($(IS_PPC32)$(IS_PPC64),00)
|
|
SRCS := $(filter-out ppc_%,$(SRCS))
|
|
endif
|
|
ifeq ($(IS_ARM32)$(IS_ARMV8),00)
|
|
SRCS := $(filter-out arm_%,$(SRCS))
|
|
SRCS := $(filter-out neon_%,$(SRCS))
|
|
endif
|
|
ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000)
|
|
SRCS := $(filter-out sse_%,$(SRCS))
|
|
endif
|
|
|
|
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
|
OBJS := $(SRCS:.cpp=.o)
|
|
OBJS := $(OBJS:.S=.o)
|
|
|
|
# List test.cpp first to tame C++ static initialization problems.
|
|
TESTSRCS := adhoc.cpp test.cpp bench1.cpp bench2.cpp bench3.cpp datatest.cpp dlltest.cpp fipsalgt.cpp validat0.cpp validat1.cpp validat2.cpp validat3.cpp validat4.cpp validat5.cpp validat6.cpp validat7.cpp validat8.cpp validat9.cpp validat10.cpp regtest1.cpp regtest2.cpp regtest3.cpp regtest4.cpp
|
|
TESTINCL := bench.h factory.h validate.h
|
|
|
|
# Test objects
|
|
TESTOBJS := $(TESTSRCS:.cpp=.o)
|
|
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
|
|
|
|
# For Shared Objects, Diff, Dist/Zip rules
|
|
LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3)
|
|
LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
|
|
LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
|
|
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
|
|
|
|
ifeq ($(strip $(LIB_PATCH)),)
|
|
LIB_PATCH := 0
|
|
endif
|
|
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
# Full version suffix for shared library
|
|
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
|
|
# Different patchlevels and minors are compatible since 6.1
|
|
SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR)
|
|
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
|
endif # HAS_SOLIB_VERSION
|
|
|
|
###########################################################
|
|
##### Targets and Recipes #####
|
|
###########################################################
|
|
|
|
# Default builds program with static library only
|
|
.PHONY: default
|
|
default: cryptest.exe
|
|
|
|
.PHONY: all static dynamic
|
|
all: static dynamic cryptest.exe
|
|
|
|
ifneq ($(IS_IOS),0)
|
|
static: libcryptopp.a
|
|
shared dynamic dylib: libcryptopp.dylib
|
|
else
|
|
static: libcryptopp.a
|
|
shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
|
endif
|
|
|
|
.PHONY: test check
|
|
test check: cryptest.exe
|
|
./cryptest.exe v
|
|
|
|
# CXXFLAGS are tuned earlier. Applications must use linker flags
|
|
# -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
|
|
.PHONY: lean
|
|
lean: static dynamic cryptest.exe
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(ANDROID_CPU_OBJ) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
|
|
@-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
|
|
@-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
|
@-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et
|
|
@-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
|
|
@-$(RM) /tmp/adhoc.exe
|
|
@-$(RM) -r /tmp/cryptopp_test/
|
|
@-$(RM) -r *.exe.dSYM/
|
|
@-$(RM) -r *.dylib.dSYM/
|
|
@-$(RM) -r cov-int/
|
|
|
|
.PHONY: autotools-clean
|
|
autotools-clean:
|
|
@-$(RM) -f configure.ac configure configure.in Makefile.am Makefile.in Makefile
|
|
@-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp
|
|
@-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing
|
|
@-$(RM) -f cryptest cryptestcwd libtool* libcryptopp.la libcryptopp.pc*
|
|
@-$(RM) -rf m4/ auto*.cache/ .deps/ .libs/
|
|
|
|
.PHONY: cmake-clean
|
|
cmake-clean:
|
|
@-$(RM) -f cryptopp-config.cmake CMakeLists.txt
|
|
@-$(RM) -rf cmake_build/
|
|
|
|
.PHONY: android-clean
|
|
android-clean:
|
|
@-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp))
|
|
@-$(RM) -rf obj/
|
|
|
|
.PHONY: distclean
|
|
distclean: clean autotools-clean cmake-clean android-clean
|
|
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
|
|
@-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
|
|
@-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
|
|
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
|
|
@-$(RM) -r $(LIBOBJS:.o=.lst) $(TESTOBJS:.o=.lst)
|
|
@-$(RM) -r TestCoverage/ ref*/
|
|
@-$(RM) cryptopp$(LIB_VER)\.* CryptoPPRef.zip
|
|
|
|
# Install cryptest.exe, libcryptopp.a and libcryptopp.so.
|
|
# The library install was broken-out into its own recipe at GH #653.
|
|
.PHONY: install
|
|
install: cryptest.exe install-lib
|
|
@-$(MKDIR) $(DESTDIR)$(BINDIR)
|
|
$(CP) cryptest.exe $(DESTDIR)$(BINDIR)
|
|
$(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe
|
|
@-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData
|
|
@-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
|
|
$(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData
|
|
$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
|
|
$(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
|
|
$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
|
|
|
|
# A recipe to install only the library, and not cryptest.exe. Also
|
|
# see https://github.com/weidai11/cryptopp/issues/653.
|
|
.PHONY: install-lib
|
|
install-lib:
|
|
@-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
|
$(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
|
$(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
|
|
ifneq ($(wildcard libcryptopp.a),)
|
|
@-$(MKDIR) $(DESTDIR)$(LIBDIR)
|
|
$(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
|
|
$(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
|
endif
|
|
ifneq ($(wildcard libcryptopp.dylib),)
|
|
@-$(MKDIR) $(DESTDIR)$(LIBDIR)
|
|
$(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
|
|
$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
|
-install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
|
endif
|
|
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
|
|
@-$(MKDIR) $(DESTDIR)$(LIBDIR)
|
|
$(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
|
|
$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
|
$(LDCONF) $(DESTDIR)$(LIBDIR)
|
|
endif
|
|
endif
|
|
ifneq ($(wildcard libcryptopp.pc),)
|
|
@-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig
|
|
$(CP) libcryptopp.pc $(DESTDIR)$(LIBDIR)/pkgconfig
|
|
$(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc
|
|
endif
|
|
|
|
.PHONY: remove uninstall
|
|
remove uninstall:
|
|
-$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
|
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
|
-$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
|
|
@-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
|
@-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
|
@-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
|
@-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
|
|
|
libcryptopp.a: $(LIBOBJS) $(ANDROID_CPU_OBJ)
|
|
$(AR) $(ARFLAGS) $@ $(LIBOBJS) $(ANDROID_CPU_OBJ)
|
|
$(RANLIB) $@
|
|
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
.PHONY: libcryptopp.so
|
|
libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
|
endif
|
|
|
|
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) $(ANDROID_CPU_OBJ)
|
|
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(ANDROID_CPU_OBJ) $(LDFLAGS) $(LDLIBS)
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
|
|
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
|
endif
|
|
|
|
libcryptopp.dylib: $(LIBOBJS)
|
|
$(CXX) -dynamiclib -o $@ $(strip $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
|
|
|
|
cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS)
|
|
$(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS)
|
|
|
|
# Used to generate list of source files for Autotools, CMakeList and Android.mk
|
|
.PHONY: sources
|
|
sources:
|
|
$(info ***** Library sources *****)
|
|
$(info $(filter-out $(TESTSRCS),$(SRCS)))
|
|
$(info )
|
|
$(info ***** Library headers *****)
|
|
$(info $(filter-out $(TESTINCL),$(INCL)))
|
|
$(info )
|
|
$(info ***** Test sources *****)
|
|
$(info $(TESTSRCS))
|
|
$(info )
|
|
$(info ***** Test headers *****)
|
|
$(info $(TESTINCL))
|
|
|
|
adhoc.cpp: adhoc.cpp.proto
|
|
ifeq ($(wildcard adhoc.cpp),)
|
|
cp adhoc.cpp.proto adhoc.cpp
|
|
else
|
|
touch adhoc.cpp
|
|
endif
|
|
|
|
# Include dependencies, if present. You must issue `make deps` to create them.
|
|
ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
|
|
-include GNUmakefile.deps
|
|
endif # Dependencies
|
|
|
|
# Cryptogams ARM asm implementation. AES needs -mthumb for Clang
|
|
aes_armv4.o : aes_armv4.S
|
|
$(CXX) $(strip $(CXXFLAGS) $(CRYPTOGAMS_ARMV7_THUMB_FLAG) -c) $<
|
|
|
|
# Use C++ compiler on C source after patching.
|
|
# https://github.com/weidai11/cryptopp/issues/926
|
|
cpu-features.o: cpu-features.h cpu-features.c
|
|
$(CXX) -x c $(strip $(CXXFLAGS) -c) cpu-features.c
|
|
|
|
# SSSE3 or NEON available
|
|
aria_simd.o : aria_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<
|
|
|
|
# SSE, NEON or POWER7 available
|
|
blake2s_simd.o : blake2s_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $<
|
|
|
|
# SSE, NEON or POWER8 available
|
|
blake2b_simd.o : blake2b_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $<
|
|
|
|
# SSE2 or NEON available
|
|
chacha_simd.o : chacha_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(CHACHA_FLAG) -c) $<
|
|
|
|
# AVX2 available
|
|
chacha_avx.o : chacha_avx.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $<
|
|
|
|
# SSSE3 available
|
|
cham_simd.o : cham_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(CHAM_FLAG) -c) $<
|
|
|
|
# Power9 available
|
|
darn.o : darn.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(DARN_FLAG) -c) $<
|
|
|
|
# SSE2 on i686
|
|
donna_sse.o : donna_sse.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $<
|
|
|
|
# SSE2 on i686
|
|
sse_simd.o : sse_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $<
|
|
|
|
# SSE4.2 or ARMv8a available
|
|
crc_simd.o : crc_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(CRC_FLAG) -c) $<
|
|
|
|
# PCLMUL or ARMv7a/ARMv8a available
|
|
gcm_simd.o : gcm_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(GCM_FLAG) -c) $<
|
|
|
|
# SSSE3 available
|
|
lea_simd.o : lea_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(LEA_FLAG) -c) $<
|
|
|
|
# NEON available
|
|
neon_simd.o : neon_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $<
|
|
|
|
# AESNI or ARMv7a/ARMv8a available
|
|
rijndael_simd.o : rijndael_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(AES_FLAG) -c) $<
|
|
|
|
# SSE4.2/SHA-NI or ARMv8a available
|
|
sha_simd.o : sha_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
|
|
|
|
# Cryptogams SHA1 asm implementation.
|
|
sha1_armv4.o : sha1_armv4.S
|
|
$(CXX) $(strip $(CXXFLAGS) $(CRYPTOGAMS_ARMV7_FLAG) -c) $<
|
|
|
|
# Cryptogams SHA256 asm implementation.
|
|
sha256_armv4.o : sha256_armv4.S
|
|
$(CXX) $(strip $(CXXFLAGS) $(CRYPTOGAMS_ARMV7_FLAG) -c) $<
|
|
|
|
# Cryptogams SHA512 asm implementation.
|
|
sha512_armv4.o : sha512_armv4.S
|
|
$(CXX) $(strip $(CXXFLAGS) $(CRYPTOGAMS_ARMV7_FLAG) -c) $<
|
|
|
|
# SSE4.2/SHA-NI or ARMv8a available
|
|
shacal2_simd.o : shacal2_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
|
|
|
|
# SSSE3 or NEON available
|
|
simeck_simd.o : simeck_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SIMECK_FLAG) -c) $<
|
|
|
|
# SSE4.1, NEON or POWER7 available
|
|
simon64_simd.o : simon64_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SIMON64_FLAG) -c) $<
|
|
|
|
# SSSE3, NEON or POWER8 available
|
|
simon128_simd.o : simon128_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SIMON128_FLAG) -c) $<
|
|
|
|
# SSE4.1, NEON or POWER7 available
|
|
speck64_simd.o : speck64_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SPECK64_FLAG) -c) $<
|
|
|
|
# SSSE3, NEON or POWER8 available
|
|
speck128_simd.o : speck128_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SPECK128_FLAG) -c) $<
|
|
|
|
# ARMv8.4 available
|
|
sm3_simd.o : sm3_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SM3_FLAG) -c) $<
|
|
|
|
# AESNI available
|
|
sm4_simd.o : sm4_simd.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) $(SM4_FLAG) -c) $<
|
|
|
|
%.o : %.cpp
|
|
$(CXX) $(strip $(CXXFLAGS) -c) $<
|
|
|
|
.PHONY: dep deps depend
|
|
dep deps depend GNUmakefile.deps:
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DISABLE_ASM) -MM *.cpp > GNUmakefile.deps
|
|
|