2016-01-24 22:02:16 +00:00
|
|
|
###########################################################
|
2016-06-09 03:30:39 +00:00
|
|
|
##### System Attributes and Programs #####
|
2016-01-24 22:02:16 +00:00
|
|
|
###########################################################
|
|
|
|
|
2017-08-17 20:35:56 +00:00
|
|
|
# Must use Bash
|
|
|
|
SHELL = bash
|
2017-08-17 16:33:43 +00:00
|
|
|
# If needed
|
|
|
|
TMPDIR ?= /tmp
|
|
|
|
# Used for ARMv7 and NEON.
|
|
|
|
FP_ABI ?= hard
|
|
|
|
|
|
|
|
# Command ard arguments
|
2015-07-31 12:09:59 +00:00
|
|
|
AR ?= ar
|
2015-12-25 21:06:43 +00:00
|
|
|
ARFLAGS ?= -cr # ar needs the dash on OpenBSD
|
2015-07-31 12:09:59 +00:00
|
|
|
RANLIB ?= ranlib
|
2015-12-25 21:06:43 +00:00
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
CP ?= cp
|
2015-12-26 11:45:59 +00:00
|
|
|
MV ?= mv
|
2017-03-10 06:53:51 +00:00
|
|
|
RM ?= rm -f
|
2015-11-05 06:59:46 +00:00
|
|
|
CHMOD ?= chmod
|
2015-07-31 12:09:59 +00:00
|
|
|
MKDIR ?= mkdir
|
2015-11-08 20:29:56 +00:00
|
|
|
LN ?= ln -sf
|
2015-11-25 04:14:53 +00:00
|
|
|
LDCONF ?= /sbin/ldconfig -n
|
2015-11-05 06:59:46 +00:00
|
|
|
UNAME := $(shell uname)
|
2016-06-09 03:30:39 +00:00
|
|
|
|
2017-08-29 12:57:04 +00:00
|
|
|
# Solaris provides a non-Posix shell at /usr/bin
|
|
|
|
ifneq ($(wildcard /usr/xpg4/bin),)
|
|
|
|
GREP ?= /usr/xpg4/bin/grep
|
|
|
|
else
|
|
|
|
GREP ?= grep
|
|
|
|
endif
|
|
|
|
|
2017-09-10 00:33:06 +00:00
|
|
|
IS_X86 := $(shell uname -m | $(GREP) -v "64" | $(GREP) -i -c -E "i.86|x86|i86")
|
2017-08-29 12:57:04 +00:00
|
|
|
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")
|
2017-09-10 00:33:06 +00:00
|
|
|
IS_PPC32 := $(shell uname -m | $(GREP) -i -v "64" | $(GREP) -i -c -E "ppc|power")
|
|
|
|
IS_PPC64 := $(shell uname -m | $(GREP) -i -c -E "ppc64|power64")
|
|
|
|
IS_ARM32 := $(shell uname -m | $(GREP) -i -v "64" | $(GREP) -i -c -E 'armhf|arm7l|eabihf')
|
2017-08-29 12:57:04 +00:00
|
|
|
IS_ARM64 := $(shell uname -m | $(GREP) -i -c 'aarch64')
|
2017-08-30 14:00:46 +00:00
|
|
|
IS_ARMV8 ?= $(shell uname -m | $(GREP) -i -c -E 'aarch32|aarch64')
|
2017-08-29 12:57:04 +00:00
|
|
|
IS_NEON ?= $(shell uname -m | $(GREP) -i -c -E 'armv7|armv8|aarch32|aarch64')
|
|
|
|
IS_SPARC := $(shell uname -m | $(GREP) -i -c "sparc")
|
|
|
|
IS_SPARC64 := $(shell uname -m | $(GREP) -i -c "sparc64")
|
|
|
|
|
2017-08-31 14:08:18 +00:00
|
|
|
IS_AIX := $(shell uname -s | $(GREP) -i -c 'aix')
|
|
|
|
IS_SUN := $(shell uname -s | $(GREP) -i -c "SunOS")
|
|
|
|
|
2017-10-13 05:27:09 +00:00
|
|
|
IS_LINUX := $(shell $(CXX) -dumpmachine 2>/dev/null | $(GREP) -i -c "Linux")
|
|
|
|
IS_MINGW := $(shell $(CXX) -dumpmachine 2>/dev/null | $(GREP) -i -c "MinGW")
|
|
|
|
IS_CYGWIN := $(shell $(CXX) -dumpmachine 2>/dev/null | $(GREP) -i -c "Cygwin")
|
|
|
|
IS_DARWIN := $(shell $(CXX) -dumpmachine 2>/dev/null | $(GREP) -i -c "Darwin")
|
|
|
|
IS_NETBSD := $(shell $(CXX) -dumpmachine 2>/dev/null | $(GREP) -i -c "NetBSD")
|
|
|
|
|
2017-10-27 22:09:40 +00:00
|
|
|
SUN_COMPILER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E 'CC: (Sun|Studio)')
|
2017-10-13 05:27:09 +00:00
|
|
|
GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E '(llvm|clang)' | $(GREP) -i -c -E '(gcc|g\+\+)')
|
|
|
|
XLC_COMPILER := $(shell $(CXX) $(CXX) -qversion 2>/dev/null |$(GREP) -i -c "IBM XL")
|
|
|
|
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E '(llvm|clang)')
|
|
|
|
INTEL_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c '\(icc\)')
|
|
|
|
MACPORTS_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c "macports")
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-08-24 10:19:42 +00:00
|
|
|
# Sun Studio 12.0 provides SunCC 0x0510; and Sun Studio 12.3 provides SunCC 0x0512
|
2017-08-29 12:57:04 +00:00
|
|
|
SUNCC_510_OR_LATER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|6\.)")
|
|
|
|
SUNCC_511_OR_LATER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[1-9]|5\.[2-9]|6\.)")
|
|
|
|
SUNCC_512_OR_LATER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[2-9]|5\.[2-9]|6\.)")
|
|
|
|
SUNCC_513_OR_LATER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[3-9]|5\.[2-9]|6\.)")
|
2016-06-15 09:02:28 +00:00
|
|
|
|
2017-03-13 19:57:47 +00:00
|
|
|
# Enable shared object versioning for Linux
|
2015-11-08 20:29:56 +00:00
|
|
|
HAS_SOLIB_VERSION := $(IS_LINUX)
|
|
|
|
|
2017-03-13 19:57:47 +00:00
|
|
|
# Set to 1 if you want to use X32 on X64
|
|
|
|
IS_X32 ?= 0
|
|
|
|
|
|
|
|
# Set to 1 if you used NASM to build rdrand-{x86|x32|x64}
|
2017-03-14 22:38:37 +00:00
|
|
|
USE_NASM ?= 0
|
2017-03-13 19:57:47 +00:00
|
|
|
|
|
|
|
# Fixup for X32
|
|
|
|
ifeq ($(IS_X32),1)
|
|
|
|
IS_X86 = 0
|
|
|
|
IS_X64 = 0
|
|
|
|
endif
|
|
|
|
|
2016-06-09 03:30:39 +00:00
|
|
|
# Fixup SunOS
|
|
|
|
ifeq ($(IS_SUN),1)
|
2017-08-29 12:57:04 +00:00
|
|
|
IS_X86 := $(shell isainfo -k 2>/dev/null | $(GREP) -i -c "i386")
|
|
|
|
IS_X64 := $(shell isainfo -k 2>/dev/null | $(GREP) -i -c "amd64")
|
2016-06-09 03:30:39 +00:00
|
|
|
endif
|
|
|
|
|
2017-10-18 08:49:26 +00:00
|
|
|
# Fixup AIX
|
|
|
|
ifeq ($(IS_AIX),1)
|
|
|
|
# https://www-01.ibm.com/support/docview.wss?uid=swg21256116
|
|
|
|
IS_64BIT := $(shell getconf KERNEL_BITMODE | $(GREP) -i -c "64")
|
|
|
|
ifeq ($(IS_64BIT),1)
|
|
|
|
IS_PPC32 := 0
|
|
|
|
IS_PPC64 := 1
|
|
|
|
else
|
|
|
|
IS_PPC32 := 1
|
|
|
|
IS_PPC64 := 0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-03-13 19:57:47 +00:00
|
|
|
# Newlib needs _XOPEN_SOURCE=700 for signals
|
2017-08-29 12:57:04 +00:00
|
|
|
HAS_NEWLIB := $(shell $(CXX) -x c++ $(CXXFLAGS) -dM -E adhoc.cpp.proto 2>&1 | $(GREP) -i -c "__NEWLIB__")
|
2016-10-21 20:49:04 +00:00
|
|
|
|
2016-06-09 03:30:39 +00:00
|
|
|
###########################################################
|
|
|
|
##### General Variables #####
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
# Base CXXFLAGS used if the user did not specify them
|
2016-06-09 04:54:53 +00:00
|
|
|
ifeq ($(SUN_COMPILER),1)
|
2016-08-24 03:43:50 +00:00
|
|
|
ifeq ($(SUNCC_512_OR_LATER),1)
|
2017-08-04 22:31:52 +00:00
|
|
|
CXXFLAGS ?= -DNDEBUG -g3 -xO3
|
2016-06-15 09:02:28 +00:00
|
|
|
else
|
2017-08-04 22:31:52 +00:00
|
|
|
CXXFLAGS ?= -DNDEBUG -g -xO3
|
2016-06-15 09:02:28 +00:00
|
|
|
endif
|
2016-06-09 03:30:39 +00:00
|
|
|
else
|
2017-08-04 22:31:52 +00:00
|
|
|
CXXFLAGS ?= -DNDEBUG -g2 -O3
|
2016-06-09 03:30:39 +00:00
|
|
|
endif
|
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
# Default prefix for make install
|
|
|
|
ifeq ($(PREFIX),)
|
2015-12-25 21:06:43 +00:00
|
|
|
PREFIX = /usr/local
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2015-12-29 11:32:45 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
# Fix CXX on Cygwin 1.1.4
|
|
|
|
ifeq ($(CXX),gcc)
|
2015-11-05 06:59:46 +00:00
|
|
|
CXX := g++
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2015-12-31 06:43:42 +00:00
|
|
|
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
|
2015-11-05 06:59:46 +00:00
|
|
|
ifeq ($(ARFLAGS),rv)
|
|
|
|
ARFLAGS = r
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-13 19:57:47 +00:00
|
|
|
ifneq ($(HAS_NEWLIB),0)
|
|
|
|
ifeq ($(findstring -D_XOPEN_SOURCE,$(CXXFLAGS)),)
|
2017-08-23 20:13:20 +00:00
|
|
|
CXXFLAGS += -D_XOPEN_SOURCE=600
|
2017-03-13 19:57:47 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-03-20 12:51:10 +00:00
|
|
|
# Clang integrated assembler will be used with -Wa,-q
|
|
|
|
CLANG_INTEGRATED_ASSEMBLER ?= 0
|
|
|
|
|
2016-01-24 22:02:16 +00:00
|
|
|
###########################################################
|
|
|
|
##### X86/X32/X64 Options #####
|
|
|
|
###########################################################
|
|
|
|
|
2016-06-09 03:30:39 +00:00
|
|
|
ifneq ($(IS_X86)$(IS_X32)$(IS_X64),000)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2017-03-20 12:51:10 +00:00
|
|
|
# Fixup. Clang reports an error rather than "LLVM assembler" or similar.
|
2016-06-16 09:17:16 +00:00
|
|
|
ifneq ($(MACPORTS_COMPILER),1)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_GAS := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(GREP) -c "GNU assembler")
|
2016-06-16 09:17:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(GCC_COMPILER),0)
|
2017-08-29 12:57:04 +00:00
|
|
|
IS_GCC_29 := $(shell $(CXX) -v 2>&1 | $(GREP) -i -c -E gcc-9[0-9][0-9])
|
|
|
|
GCC42_OR_LATER := $(shell $(CXX) -v 2>&1 | $(GREP) -i -c -E "gcc version (4\.[2-9]|[5-9]\.)")
|
|
|
|
GCC46_OR_LATER := $(shell $(CXX) -v 2>&1 | $(GREP) -i -c -E "gcc version (4\.[6-9]|[5-9]\.)")
|
2016-06-16 09:17:16 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-20 12:51:10 +00:00
|
|
|
ifneq ($(HAVE_GAS),0)
|
2017-08-29 12:57:04 +00:00
|
|
|
GAS210_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(GREP) -c -E "GNU assembler version (2\.[1-9][0-9]|[3-9])")
|
|
|
|
GAS217_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(GREP) -c -E "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
|
|
|
|
GAS218_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(GREP) -c -E "GNU assembler version (2\.1[8-9]|2\.[2-9]|[3-9])")
|
|
|
|
GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(GREP) -c -E "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
|
|
|
|
GAS223_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(GREP) -c -E "GNU assembler version (2\.2[3-9]|2\.[3-9]|[3-9])")
|
2016-06-16 09:17:16 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2017-08-29 12:57:04 +00:00
|
|
|
ICC111_OR_LATER := $(shell $(CXX) --version 2>&1 | $(GREP) -c -E "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-01-24 22:02:16 +00:00
|
|
|
# Add -fPIC for targets *except* X86, X32, Cygwin or MinGW
|
2016-06-09 05:02:56 +00:00
|
|
|
ifeq ($(IS_X86)$(IS_X32)$(IS_CYGWIN)$(IS_MINGW)$(SUN_COMPILER),00000)
|
2015-11-05 06:59:46 +00:00
|
|
|
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -fPIC
|
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-22 21:26:25 +00:00
|
|
|
# .intel_syntax wasn't supported until GNU assembler 2.10
|
2017-04-23 10:37:03 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
2017-03-22 21:26:25 +00:00
|
|
|
ifeq ($(HAVE_GAS)$(GAS210_OR_LATER),10)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|
|
|
else
|
|
|
|
ifeq ($(HAVE_GAS)$(GAS217_OR_LATER),10)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
|
|
|
|
else
|
2017-04-23 10:37:03 +00:00
|
|
|
ifeq ($(HAVE_GAS)$(GAS218_OR_LATER),10)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
|
|
|
|
else
|
2017-03-22 21:26:25 +00:00
|
|
|
ifeq ($(HAVE_GAS)$(GAS219_OR_LATER),10)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
|
2017-04-22 23:46:13 +00:00
|
|
|
else
|
|
|
|
ifeq ($(HAVE_GAS)$(GAS223_OR_LATER),10)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SHA
|
2017-08-24 23:17:21 +00:00
|
|
|
|
2017-04-23 10:37:03 +00:00
|
|
|
endif # -DCRYPTOPP_DISABLE_SHA
|
|
|
|
endif # -DCRYPTOPP_DISABLE_AESNI
|
|
|
|
endif # -DCRYPTOPP_DISABLE_SSE4
|
|
|
|
endif # -DCRYPTOPP_DISABLE_SSSE3
|
|
|
|
endif # -DCRYPTOPP_DISABLE_ASM
|
|
|
|
endif # CXXFLAGS
|
|
|
|
|
2017-09-13 01:23:23 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
|
|
|
ifeq ($(IS_X86),1)
|
|
|
|
CPU_FLAG = -msse2
|
|
|
|
endif
|
|
|
|
endif
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_SSSE3,$(CXXFLAGS)),)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_SSSE3 = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -mssse3 -dM -E - 2>/dev/null | $(GREP) -i -c __SSSE3__)
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_SSSE3),1)
|
2017-08-17 23:04:00 +00:00
|
|
|
ARIA_FLAG = -mssse3
|
2017-08-17 20:35:56 +00:00
|
|
|
SSSE3_FLAG = -mssse3
|
|
|
|
endif
|
2017-08-17 16:33:43 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_SSE4,$(CXXFLAGS)),)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_SSE4 = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.2 -dM -E - 2>/dev/null | $(GREP) -i -c __SSE4_2__)
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_SSE4),1)
|
|
|
|
BLAKE2_FLAG = -msse4.2
|
|
|
|
CRC_FLAG = -msse4.2
|
|
|
|
endif
|
2017-08-17 16:33:43 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_AESNI,$(CXXFLAGS)),)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_CLMUL = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -mssse3 -mpclmul -dM -E - 2>/dev/null | $(GREP) -i -c __PCLMUL__ )
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_CLMUL),1)
|
|
|
|
GCM_FLAG = -mssse3 -mpclmul
|
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_AES = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.1 -maes -dM -E - 2>/dev/null | $(GREP) -i -c __AES__)
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_AES),1)
|
|
|
|
AES_FLAG = -msse4.1 -maes
|
|
|
|
endif
|
2017-08-17 16:33:43 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_SHA,$(CXXFLAGS)),)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_SHA = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.2 -msha -dM -E - 2>/dev/null | $(GREP) -i -c __SHA__)
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_SHA),1)
|
|
|
|
SHA_FLAG = -msse4.2 -msha
|
|
|
|
endif
|
|
|
|
endif # -DCRYPTOPP_DISABLE_SHA
|
|
|
|
endif # -DCRYPTOPP_DISABLE_AESNI
|
|
|
|
endif # -DCRYPTOPP_DISABLE_SSE4
|
|
|
|
endif # -DCRYPTOPP_DISABLE_SSSE3
|
2017-08-17 16:33:43 +00:00
|
|
|
|
2017-08-24 23:17:21 +00:00
|
|
|
# Begin SunCC
|
|
|
|
ifeq ($(SUN_COMPILER),1)
|
2017-08-29 12:57:04 +00:00
|
|
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=ssse3 -xdumpmacros /dev/null 2>&1 | $(GREP) -i -c "illegal value ignored")
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(COUNT),0)
|
|
|
|
SSSE3_FLAG = -xarch=ssse3 -D__SSSE3__=1
|
|
|
|
ARIA_FLAG = -xarch=ssse3 -D__SSSE3__=1
|
2017-08-28 21:51:59 +00:00
|
|
|
LDFLAGS += -xarch=ssse3
|
2017-08-24 23:17:21 +00:00
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=sse4_2 -xdumpmacros /dev/null 2>&1 | $(GREP) -i -c "illegal value ignored")
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(COUNT),0)
|
|
|
|
BLAKE2_FLAG = -xarch=sse4_2 -D__SSE4_2__=1
|
|
|
|
CRC_FLAG = -xarch=sse4_2 -D__SSE4_2__=1
|
2017-08-28 21:51:59 +00:00
|
|
|
LDFLAGS += -xarch=sse4_2
|
2017-08-24 23:17:21 +00:00
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=aes -xdumpmacros /dev/null 2>&1 | $(GREP) -i -c "illegal value ignored")
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(COUNT),0)
|
|
|
|
GCM_FLAG = -xarch=aes -D__PCLMUL__=1
|
|
|
|
AES_FLAG = -xarch=aes -D__AES__=1
|
2017-08-28 21:51:59 +00:00
|
|
|
LDFLAGS += -xarch=aes
|
2017-08-24 23:17:21 +00:00
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=sha -xdumpmacros /dev/null 2>&1 | $(GREP) -i -c "illegal value ignored")
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(COUNT),0)
|
|
|
|
SHA_FLAG = -xarch=sha -D__SHA__=1
|
2017-08-28 21:51:59 +00:00
|
|
|
LDFLAGS += -xarch=sha
|
2017-08-24 23:17:21 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
2017-08-24 23:17:21 +00:00
|
|
|
# End SunCC
|
|
|
|
|
|
|
|
ifneq ($(INTEL_COMPILER),0)
|
|
|
|
CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
|
|
|
|
ifeq ($(ICC111_OR_LATER),0)
|
|
|
|
# "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and some x64 inline assembly with ICC 11.0
|
|
|
|
# if you want to use Crypto++'s assembly code with ICC, try enabling it on individual files
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2016-06-15 22:58:02 +00:00
|
|
|
# Tell MacPorts GCC to use Clang integrated assembler
|
2016-07-20 05:17:55 +00:00
|
|
|
# http://github.com/weidai11/cryptopp/issues/190
|
2016-06-16 09:17:16 +00:00
|
|
|
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER),11)
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -Wa,-q
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER,$(CXXFLAGS)),)
|
|
|
|
CLANG_INTEGRATED_ASSEMBLER := 1
|
|
|
|
CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1
|
|
|
|
endif
|
2016-06-15 22:58:02 +00:00
|
|
|
endif
|
|
|
|
|
2016-07-20 05:17:55 +00:00
|
|
|
# GCC on Solaris needs -m64. Otherwise, i386 is default
|
|
|
|
# http://github.com/weidai11/cryptopp/issues/230
|
2017-08-31 14:08:18 +00:00
|
|
|
HAVE_BITS=$(shell echo $(CXXFLAGS) | $(GREP) -i -c -E '\-m32|\-m64')
|
|
|
|
ifeq ($(IS_SUN)$(GCC_COMPILER)$(IS_X64)$(HAVE_BITS),1110)
|
|
|
|
CXXFLAGS += -m64
|
2016-10-26 02:42:04 +00:00
|
|
|
endif
|
2016-07-20 05:17:55 +00:00
|
|
|
|
2016-06-15 13:55:10 +00:00
|
|
|
# Allow use of "/" operator for GNU Assembler.
|
|
|
|
# http://sourceware.org/bugzilla/show_bug.cgi?id=4572
|
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
|
|
|
ifeq ($(IS_SUN)$(GCC_COMPILER),11)
|
|
|
|
CXXFLAGS += -Wa,--divide
|
|
|
|
endif
|
|
|
|
endif
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2016-01-24 22:02:16 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
##### Not X86/X32/X64 #####
|
|
|
|
###########################################################
|
2015-12-25 21:06:43 +00:00
|
|
|
|
|
|
|
# Add PIC
|
|
|
|
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -fPIC
|
|
|
|
endif
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2017-08-17 16:33:43 +00:00
|
|
|
ifeq ($(IS_NEON),1)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_NEON = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon -dM -E - 2>/dev/null | $(GREP) -i -c -E '\<__ARM_NEON\>')
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_NEON),1)
|
|
|
|
NEON_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon
|
2017-08-17 23:04:00 +00:00
|
|
|
GCM_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon
|
|
|
|
ARIA_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon
|
|
|
|
BLAKE2_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon
|
2017-08-17 20:35:56 +00:00
|
|
|
endif
|
2017-08-17 16:33:43 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(IS_ARMV8),1)
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_NEON = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a -dM -E - 2>/dev/null | $(GREP) -i -c __ARM_NEON)
|
2017-08-17 20:35:56 +00:00
|
|
|
ifeq ($(HAVE_NEON),1)
|
|
|
|
ARIA_FLAG = -march=armv8-a
|
|
|
|
BLAKE2_FLAG = -march=armv8-a
|
|
|
|
NEON_FLAG = -march=armv8-a
|
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_CRC = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a+crc -dM -E - 2>/dev/null | $(GREP) -i -c __ARM_FEATURE_CRC32)
|
2017-09-10 00:33:06 +00:00
|
|
|
ifeq ($(HAVE_CRC),1)
|
2017-08-17 20:35:56 +00:00
|
|
|
CRC_FLAG = -march=armv8-a+crc
|
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
HAVE_CRYPTO = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a+crypto -dM -E - 2>/dev/null | $(GREP) -i -c __ARM_FEATURE_CRYPTO)
|
2017-09-10 00:33:06 +00:00
|
|
|
ifeq ($(HAVE_CRYPTO),1)
|
2017-08-17 20:35:56 +00:00
|
|
|
AES_FLAG = -march=armv8-a+crypto
|
|
|
|
GCM_FLAG = -march=armv8-a+crypto
|
|
|
|
SHA_FLAG = -march=armv8-a+crypto
|
|
|
|
endif
|
2017-08-17 16:33:43 +00:00
|
|
|
endif
|
|
|
|
|
2017-09-09 21:22:42 +00:00
|
|
|
# PowerPC and PowerPC-64
|
2017-10-18 00:47:14 +00:00
|
|
|
# Altivec is available with Power4, but the library is tied to Power7 and unaligned loads/stores.
|
2017-09-11 07:05:04 +00:00
|
|
|
ifneq ($(IS_PPC32)$(IS_PPC64)$(IS_AIX),000)
|
2017-09-10 00:33:06 +00:00
|
|
|
# GCC and some compatibles
|
2017-10-18 00:47:14 +00:00
|
|
|
HAVE_ALTIVEC = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -mcpu=power7 -maltivec -dM -E - 2>/dev/null | $(GREP) -i -c '__ALTIVEC__')
|
2017-09-11 07:05:04 +00:00
|
|
|
ifneq ($(HAVE_ALTIVEC),0)
|
2017-10-18 00:47:14 +00:00
|
|
|
ALTIVEC_FLAG = -mcpu=power7 -maltivec
|
2017-09-11 07:05:04 +00:00
|
|
|
endif
|
|
|
|
# GCC and some compatibles
|
2017-09-12 22:10:07 +00:00
|
|
|
HAVE_CRYPTO = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -mcpu=power8 -maltivec -dM -E - 2>/dev/null | $(GREP) -i -c -E '_ARCH_PWR8|_ARCH_PWR9|__CRYPTO')
|
2017-09-11 07:05:04 +00:00
|
|
|
ifneq ($(HAVE_CRYPTO),0)
|
2017-09-12 22:10:07 +00:00
|
|
|
AES_FLAG = -mcpu=power8 -maltivec
|
|
|
|
GCM_FLAG = -mcpu=power8 -maltivec
|
|
|
|
SHA_FLAG = -mcpu=power8 -maltivec
|
|
|
|
ALTIVEC_FLAG = -mcpu=power8 -maltivec
|
2017-09-10 00:33:06 +00:00
|
|
|
endif
|
|
|
|
# IBM XL C/C++
|
2017-10-18 00:47:14 +00:00
|
|
|
HAVE_ALTIVEC = $(shell $(CXX) $(CXXFLAGS) -qshowmacros -qarch=pwr7 -qaltivec -E adhoc.cpp.proto 2>/dev/null | $(GREP) -i -c '__ALTIVEC__')
|
2017-09-11 07:05:04 +00:00
|
|
|
ifneq ($(HAVE_ALTIVEC),0)
|
2017-10-18 00:47:14 +00:00
|
|
|
ALTIVEC_FLAG = -qarch=pwr7 -qaltivec
|
2017-09-11 07:05:04 +00:00
|
|
|
endif
|
|
|
|
# IBM XL C/C++
|
|
|
|
HAVE_CRYPTO = $(shell $(CXX) $(CXXFLAGS) -qshowmacros -qarch=pwr8 -qaltivec -E adhoc.cpp.proto 2>/dev/null | $(GREP) -i -c -E '_ARCH_PWR8|_ARCH_PWR9|__CRYPTO')
|
|
|
|
ifneq ($(HAVE_CRYPTO),0)
|
2017-09-10 00:33:06 +00:00
|
|
|
AES_FLAG = -qarch=pwr8 -qaltivec
|
|
|
|
GCM_FLAG = -qarch=pwr8 -qaltivec
|
|
|
|
SHA_FLAG = -qarch=pwr8 -qaltivec
|
2017-09-11 07:05:04 +00:00
|
|
|
ALTIVEC_FLAG = -qarch=pwr8 -qaltivec
|
2017-09-10 00:33:06 +00:00
|
|
|
endif
|
2017-10-18 00:47:14 +00:00
|
|
|
# Fail safe to disable intrinsics on down level machines, like PowerMac G5
|
|
|
|
ifeq ($(ALTIVEC_FLAG),)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ALTIVEC
|
|
|
|
endif
|
2017-09-10 00:33:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# IBM XL C/C++ compiler
|
2017-09-09 21:22:42 +00:00
|
|
|
ifeq ($(XLC_COMPILER),1)
|
|
|
|
# http://www-01.ibm.com/support/docview.wss?uid=swg21007500
|
|
|
|
ifeq ($(findstring -qrtti,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -qrtti
|
|
|
|
endif
|
|
|
|
# -fPIC causes link errors dues to unknown option
|
|
|
|
ifneq ($(findstring -fPIC,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-fPIC=-qpic)
|
|
|
|
endif
|
2017-10-18 08:49:26 +00:00
|
|
|
HAVE_BITS=$(shell echo $(CXXFLAGS) | $(GREP) -i -c -E '\-q32|\-q64')
|
2017-10-18 09:55:12 +00:00
|
|
|
ifeq ($(IS_PPC64)$(XLC_COMPILER)$(HAVE_BITS),110)
|
2017-10-18 08:49:26 +00:00
|
|
|
CXXFLAGS += -q64
|
|
|
|
else
|
2017-10-18 09:55:12 +00:00
|
|
|
ifeq ($(IS_PPC32)$(XLC_COMPILER)$(HAVE_BITS),110)
|
2017-10-18 08:49:26 +00:00
|
|
|
CXXFLAGS += -q32
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring -q64,$(CXXFLAGS)),-q64)
|
2017-10-18 09:55:12 +00:00
|
|
|
ifeq ($(findstring -X64,$(ARFLAGS)),)
|
2017-10-18 08:49:26 +00:00
|
|
|
ARFLAGS := -r -X64
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifeq ($(findstring -q32,$(CXXFLAGS)),-q32)
|
2017-10-18 09:55:12 +00:00
|
|
|
ifeq ($(findstring -X32,$(ARFLAGS)),)
|
2017-10-18 08:49:26 +00:00
|
|
|
ARFLAGS := -r -X32
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2017-09-09 21:22:42 +00:00
|
|
|
endif
|
|
|
|
|
2017-10-18 08:49:26 +00:00
|
|
|
endif # X86, X64, ARM32, ARM64, PPC32, PPC64, etc
|
2016-01-24 22:02:16 +00:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
##### Common #####
|
|
|
|
###########################################################
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2017-08-31 14:08:18 +00:00
|
|
|
# Use -pthread whenever it is available. See http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf
|
|
|
|
# http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling
|
|
|
|
ifneq ($(IS_LINUX)$(GCC_COMPILER)$(CLANG_COMPILER)$(INTEL_COMPILER),0000)
|
|
|
|
CXXFLAGS += -pthread
|
|
|
|
endif # CXXFLAGS
|
|
|
|
|
2017-09-17 02:09:50 +00:00
|
|
|
# Add -pipe for everything except IBM XL C/C++, SunCC and ARM.
|
2017-09-09 19:10:32 +00:00
|
|
|
# Allow ARM-64 because they seems to have >1 GB of memory
|
2017-09-17 02:09:50 +00:00
|
|
|
ifeq ($(XLC_COMPILER)$(SUN_COMPILER)$(IS_ARM32),000)
|
2017-08-31 14:08:18 +00:00
|
|
|
ifeq ($(findstring -save-temps,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -pipe
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-04-23 16:11:08 +00:00
|
|
|
# For SunOS, create a Mapfile that allows our object files
|
2017-08-17 16:33:43 +00:00
|
|
|
# to contain additional bits (like SSE4 and AES on old Xeon)
|
2017-04-23 16:11:08 +00:00
|
|
|
# http://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html
|
|
|
|
ifeq ($(IS_SUN)$(SUN_COMPILER),11)
|
2017-08-31 14:08:18 +00:00
|
|
|
ifneq ($(IS_X86)$(IS_X32)$(IS_X64),000)
|
|
|
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
|
|
|
LDFLAGS += -M cryptest.mapfile
|
|
|
|
endif # No CRYPTOPP_DISABLE_ASM
|
|
|
|
endif # X86/X32/X64
|
2017-04-23 16:11:08 +00:00
|
|
|
endif # SunOS
|
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
ifneq ($(IS_MINGW),0)
|
2017-08-31 14:08:18 +00:00
|
|
|
LDLIBS += -lws2_32
|
2015-11-05 06:59:46 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-06-09 01:41:45 +00:00
|
|
|
ifneq ($(IS_SUN),0)
|
2017-08-31 14:08:18 +00:00
|
|
|
LDLIBS += -lnsl -lsocket
|
2016-06-09 01:41:45 +00:00
|
|
|
endif
|
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
ifeq ($(IS_LINUX),1)
|
2017-08-31 14:08:18 +00:00
|
|
|
ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp)
|
|
|
|
ifeq ($(findstring -lgomp,$(LDLIBS)),)
|
|
|
|
LDLIBS += -lgomp
|
|
|
|
endif # LDLIBS
|
|
|
|
endif # OpenMP
|
2015-11-05 06:59:46 +00:00
|
|
|
endif # IS_LINUX
|
|
|
|
|
|
|
|
ifneq ($(IS_DARWIN),0)
|
2017-08-17 20:35:56 +00:00
|
|
|
AR = libtool
|
|
|
|
ARFLAGS = -static -o
|
|
|
|
CXX ?= c++
|
2015-11-05 06:59:46 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-06-09 04:51:23 +00:00
|
|
|
# Add -errtags=yes to get the name for a warning suppression
|
2015-07-31 12:09:59 +00:00
|
|
|
ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler
|
2017-08-29 12:57:04 +00:00
|
|
|
IS_64 := $(shell isainfo -b 2>/dev/null | $(GREP) -i -c "64")
|
2017-08-31 14:08:18 +00:00
|
|
|
HAVE_BITS=$(shell echo $(CXXFLAGS) | $(GREP) -i -c -E '\-m32|\-m64')
|
|
|
|
ifeq ($(IS_64)$(HAVE_BITS),10)
|
2016-08-22 12:53:01 +00:00
|
|
|
CXXFLAGS += -m64
|
2017-08-31 14:08:18 +00:00
|
|
|
else ifeq ($(IS_64)$(HAVE_BITS),00)
|
2016-08-22 12:53:01 +00:00
|
|
|
CXXFLAGS += -m32
|
|
|
|
endif
|
2016-06-15 09:02:28 +00:00
|
|
|
# Add for non-i386
|
2016-06-09 05:02:56 +00:00
|
|
|
ifneq ($(IS_X86),1)
|
2016-06-09 07:47:57 +00:00
|
|
|
CXXFLAGS += -KPIC
|
2016-06-09 05:02:56 +00:00
|
|
|
endif
|
2016-06-15 09:02:28 +00:00
|
|
|
# Add to all Solaris
|
2016-07-08 22:32:12 +00:00
|
|
|
CXXFLAGS += -template=no%extdef
|
2017-04-22 05:15:17 +00:00
|
|
|
# http://github.com/weidai11/cryptopp/issues/403
|
|
|
|
ifneq ($(IS_SPARC)$(IS_SPARC64),00)
|
|
|
|
CXXFLAGS += -xmemalign=4i
|
|
|
|
endif
|
2017-08-29 12:57:04 +00:00
|
|
|
SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(GREP) -c -E "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])")
|
2015-07-31 12:09:59 +00:00
|
|
|
ifneq ($(SUN_CC10_BUGGY),0)
|
|
|
|
# -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 and was fixed in May 2010
|
|
|
|
# remove it if you get "already had a body defined" errors in vector.cc
|
|
|
|
CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
|
2015-11-05 06:59:46 +00:00
|
|
|
endif
|
2016-06-09 01:41:45 +00:00
|
|
|
AR = $(CXX)
|
|
|
|
ARFLAGS = -xar -o
|
|
|
|
RANLIB = true
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2017-04-17 04:20:22 +00:00
|
|
|
# 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
|
|
|
|
|
2017-08-23 20:13:20 +00:00
|
|
|
# Native build testing. Issue 'make native'.
|
|
|
|
ifeq ($(findstring native,$(MAKECMDGOALS)),native)
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(findstring -march=native,$(CXXFLAGS)),)
|
|
|
|
ifeq ($(IS_SUN)$(SUN_COMPILER),11)
|
|
|
|
CXXFLAGS += -native
|
|
|
|
else
|
|
|
|
CXXFLAGS += -march=native
|
|
|
|
endif # CXXFLAGS
|
|
|
|
endif # Sun
|
2017-08-23 20:13:20 +00:00
|
|
|
endif # Native
|
|
|
|
|
2017-05-22 00:45:08 +00:00
|
|
|
# Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
|
2015-11-05 06:59:46 +00:00
|
|
|
ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
|
2017-08-24 23:17:21 +00:00
|
|
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
|
|
|
ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -fsanitize=undefined
|
|
|
|
endif # CXXFLAGS
|
|
|
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
|
|
|
endif # CXXFLAGS
|
2015-11-05 06:59:46 +00:00
|
|
|
endif # UBsan
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# Address Sanitizer (Asan) testing. Issue 'make asan'.
|
2015-11-05 06:59:46 +00:00
|
|
|
ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
|
2017-08-24 23:17:21 +00:00
|
|
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
|
|
|
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
|
2015-11-05 06:59:46 +00:00
|
|
|
endif # Asan
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# LD gold linker testing. Triggered by 'LD=ld.gold'.
|
2015-11-05 06:59:46 +00:00
|
|
|
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
|
2017-08-29 12:57:04 +00:00
|
|
|
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf")
|
2017-08-24 23:17:21 +00:00
|
|
|
ifneq ($(ELF_FORMAT),0)
|
|
|
|
LDFLAGS += -fuse-ld=gold
|
|
|
|
endif # ELF/ELF64
|
|
|
|
endif # CXXFLAGS
|
2015-11-05 06:59:46 +00:00
|
|
|
endif # Gold
|
|
|
|
|
2017-05-27 07:42:50 +00:00
|
|
|
# lcov code coverage. Issue 'make coverage'.
|
2017-05-27 11:02:44 +00:00
|
|
|
ifneq ($(filter lcov coverage,$(MAKECMDGOALS)),)
|
2017-08-24 23:17:21 +00:00
|
|
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
|
|
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
|
|
|
endif # CRYPTOPP_COVERAGE
|
|
|
|
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -coverage
|
|
|
|
endif # -coverage
|
2017-05-27 07:42:50 +00:00
|
|
|
endif # GCC code coverage
|
|
|
|
|
|
|
|
# gcov code coverage for Travis. Issue 'make codecov'.
|
2017-05-27 11:02:44 +00:00
|
|
|
ifneq ($(filter gcov codecov,$(MAKECMDGOALS)),)
|
2017-08-24 23:17:21 +00:00
|
|
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
|
|
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
|
|
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
|
|
|
endif # CRYPTOPP_COVERAGE
|
|
|
|
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -coverage
|
|
|
|
endif # -coverage
|
2015-12-29 09:50:15 +00:00
|
|
|
endif # GCC code coverage
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2017-05-07 02:54:49 +00:00
|
|
|
# Valgrind testing. Issue 'make valgrind'.
|
|
|
|
ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
|
2017-08-24 23:17:21 +00:00
|
|
|
# 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_VALGRIND,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -DCRYPTOPP_VALGRIND
|
|
|
|
endif # -DCRYPTOPP_VALGRIND
|
2017-05-07 02:54:49 +00:00
|
|
|
endif # Valgrind
|
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# Debug testing on GNU systems. Triggered by -DDEBUG.
|
2016-06-17 10:36:22 +00:00
|
|
|
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
|
2015-11-05 06:59:46 +00:00
|
|
|
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
|
2017-08-29 12:57:04 +00:00
|
|
|
USING_GLIBCXX := $(shell $(CXX) -x c++ $(CXXFLAGS) -E adhoc.cpp.proto 2>&1 | $(GREP) -i -c "__GLIBCXX__")
|
2017-08-24 23:17:21 +00:00
|
|
|
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
|
2015-11-05 06:59:46 +00:00
|
|
|
endif # GNU Debug build
|
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# Dead code stripping. Issue 'make lean'.
|
|
|
|
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
2017-08-24 23:17:21 +00:00
|
|
|
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -ffunction-sections
|
|
|
|
endif # CXXFLAGS
|
|
|
|
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
|
|
|
CXXFLAGS += -fdata-sections
|
|
|
|
endif # CXXFLAGS
|
|
|
|
ifneq ($(IS_DARWIN),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
|
2016-01-04 23:24:18 +00:00
|
|
|
endif # Dead code stripping
|
|
|
|
|
2016-01-24 22:02:16 +00:00
|
|
|
# For Shared Objects, Diff, Dist/Zip rules
|
2017-08-29 12:57:04 +00:00
|
|
|
LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
|
2016-01-24 22:02:16 +00:00
|
|
|
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)),)
|
2017-08-24 23:17:21 +00:00
|
|
|
LIB_PATCH := 0
|
2016-01-24 22:02:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
|
|
# Full version suffix for shared library
|
|
|
|
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
|
|
|
|
# Different patchlevels are compatible, minor versions are not
|
|
|
|
SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
|
|
|
|
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
|
|
|
endif # HAS_SOLIB_VERSION
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
##### Source and object files #####
|
|
|
|
###########################################################
|
|
|
|
|
2016-09-15 01:31:10 +00:00
|
|
|
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
2017-05-19 22:34:08 +00:00
|
|
|
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp)))
|
2017-11-01 22:25:44 +00:00
|
|
|
# For Makefile.am; resource.h is Windows
|
|
|
|
INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
ifneq ($(IS_MINGW),0)
|
|
|
|
SRCS += winpipes.cpp
|
2017-11-01 22:25:44 +00:00
|
|
|
INCL += resource.h
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2016-09-15 01:31:10 +00:00
|
|
|
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
2015-11-05 06:59:46 +00:00
|
|
|
OBJS := $(SRCS:.cpp=.o)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2017-03-14 22:38:37 +00:00
|
|
|
ifeq ($(USE_NASM),1)
|
2017-03-13 19:57:47 +00:00
|
|
|
ifeq ($(IS_X64),1)
|
|
|
|
OBJS += rdrand-x64.o
|
|
|
|
else ifeq ($(IS_X32),1)
|
|
|
|
OBJS += rdrand-x32.o
|
|
|
|
else ifeq ($(IS_X86),1)
|
|
|
|
OBJS += rdrand-x86.o
|
|
|
|
endif
|
|
|
|
endif # Nasm
|
|
|
|
|
2016-09-15 01:31:10 +00:00
|
|
|
# List test.cpp first to tame C++ static initialization problems.
|
2017-08-17 16:33:43 +00:00
|
|
|
TESTSRCS := adhoc.cpp test.cpp bench1.cpp bench2.cpp validat0.cpp validat1.cpp validat2.cpp validat3.cpp datatest.cpp regtest1.cpp regtest2.cpp regtest3.cpp dlltest.cpp fipsalgt.cpp
|
2017-11-01 22:25:44 +00:00
|
|
|
TESTINCL := bench.h factory.h validate.h
|
|
|
|
# Test objects
|
2015-12-25 21:06:43 +00:00
|
|
|
TESTOBJS := $(TESTSRCS:.cpp=.o)
|
2015-11-05 06:59:46 +00:00
|
|
|
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-09-15 01:31:10 +00:00
|
|
|
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
2017-08-23 20:13:20 +00:00
|
|
|
DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp 3way.cpp adler32.cpp algebra.cpp algparam.cpp arc4.cpp aria-simd.cpp aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp basecode.cpp bfinit.cpp blake2-simd.cpp blake2.cpp blowfish.cpp blumshub.cpp camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp channels.cpp cmac.cpp crc-simd.cpp crc.cpp default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gcm-simd.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp gost.cpp gzip.cpp hex.cpp hmac.cpp hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp keccak.cpp luc.cpp mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp neon-simd.cpp network.cpp oaep.cpp ospstore.cpp osrng.cpp panama.cpp pkcspad.cpp poly1305.cpp polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp seal.cpp seed.cpp serpent.cpp sha-simd.cpp sha.cpp sha3.cpp shacal2-simd.cpp shacal2.cpp shark.cpp sharkbox.cpp skipjack.cpp socketft.cpp sosemanuk.cpp square.cpp squaretb.cpp strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp trdlocal.cpp ttmac.cpp twofish.cpp vmac.cpp wait.cpp wake.cpp whrlpool.cpp xtr.cpp xtrcrypt.cpp zdeflate.cpp zinflate.cpp zlib.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
DLLOBJS := $(DLLSRCS:.cpp=.export.o)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
# Import lib testing
|
|
|
|
LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
|
|
|
|
TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
|
|
|
|
DLLTESTOBJS := dlltest.dllonly.o
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-01-24 22:02:16 +00:00
|
|
|
###########################################################
|
|
|
|
##### Targets and Recipes #####
|
|
|
|
###########################################################
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-12-29 00:30:01 +00:00
|
|
|
.PHONY: all
|
2015-11-05 06:59:46 +00:00
|
|
|
all: cryptest.exe
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
ifneq ($(IS_DARWIN),0)
|
|
|
|
static: libcryptopp.a
|
|
|
|
shared dynamic dylib: libcryptopp.dylib
|
2015-07-31 12:09:59 +00:00
|
|
|
else
|
2015-11-05 06:59:46 +00:00
|
|
|
static: libcryptopp.a
|
2015-11-08 20:29:56 +00:00
|
|
|
shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2017-08-17 16:33:43 +00:00
|
|
|
.PHONY: dep deps depend
|
|
|
|
dep deps depend GNUmakefile.deps:
|
2016-10-26 07:53:28 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# CXXFLAGS are tuned earlier.
|
2017-08-23 20:13:20 +00:00
|
|
|
.PHONY: native no-asm asan ubsan
|
|
|
|
native no-asm asan ubsan: libcryptopp.a cryptest.exe
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
# May want to export CXXFLAGS="-g3 -O1"
|
2017-05-27 11:02:44 +00:00
|
|
|
.PHONY: lcov coverage
|
|
|
|
lcov coverage: libcryptopp.a cryptest.exe
|
2017-03-10 06:53:51 +00:00
|
|
|
@-$(RM) -r ./TestCoverage/
|
2015-12-28 12:06:50 +00:00
|
|
|
lcov --base-directory . --directory . --zerocounters -q
|
|
|
|
./cryptest.exe v
|
2015-12-29 09:50:15 +00:00
|
|
|
./cryptest.exe tv all
|
2015-12-28 12:06:50 +00:00
|
|
|
lcov --base-directory . --directory . -c -o cryptest.info
|
2017-05-05 21:21:08 +00:00
|
|
|
lcov --remove cryptest.info "adhoc.cpp" "wait.*" "network.*" "socketft.*" "fips140.*" "*test.*" "bench*.cpp" "validat*.*" "/usr/*" -o cryptest.info
|
2015-12-28 12:06:50 +00:00
|
|
|
genhtml -o ./TestCoverage/ -t "cryptest.exe test coverage" --num-spaces 4 cryptest.info
|
|
|
|
|
2017-05-27 07:42:50 +00:00
|
|
|
# Travis CI and CodeCov rule
|
2017-05-27 11:02:44 +00:00
|
|
|
.PHONY: gcov codecov
|
|
|
|
gcov codecov: libcryptopp.a cryptest.exe
|
2017-05-27 07:42:50 +00:00
|
|
|
@-$(RM) -r ./TestCoverage/
|
|
|
|
./cryptest.exe v
|
|
|
|
./cryptest.exe tv all
|
2017-05-27 11:18:48 +00:00
|
|
|
gcov -r $(SRCS)
|
2017-05-27 07:42:50 +00:00
|
|
|
|
|
|
|
# Should use CXXFLAGS="-g3 -O1"
|
2017-05-07 02:54:49 +00:00
|
|
|
.PHONY: valgrind
|
|
|
|
valgrind: libcryptopp.a cryptest.exe
|
|
|
|
valgrind ./cryptest.exe v
|
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
.PHONY: test check
|
|
|
|
test check: cryptest.exe
|
|
|
|
./cryptest.exe v
|
|
|
|
|
2016-01-04 23:24:18 +00:00
|
|
|
# Used to generate list of source files for Autotools, CMakeList, Android.mk, etc
|
2015-12-25 21:06:43 +00:00
|
|
|
.PHONY: sources
|
2016-11-01 09:07:57 +00:00
|
|
|
sources: adhoc.cpp
|
|
|
|
$(info Library sources: $(filter-out $(TESTSRCS),$(SRCS)))
|
2015-12-25 21:06:43 +00:00
|
|
|
$(info )
|
2017-11-01 22:25:44 +00:00
|
|
|
$(info Library headers: $(filter-out $(TESTINCL),$(INCL)))
|
|
|
|
$(info )
|
2015-12-25 21:06:43 +00:00
|
|
|
$(info Test sources: $(TESTSRCS))
|
2017-11-01 22:25:44 +00:00
|
|
|
$(info )
|
|
|
|
$(info Test headers: $(TESTINCL))
|
2015-12-25 21:06:43 +00:00
|
|
|
|
2015-11-18 20:35:35 +00:00
|
|
|
# Directory we want (can't specify on Doygen command line)
|
|
|
|
DOCUMENT_DIRECTORY := ref$(LIB_VER)
|
|
|
|
# Directory Doxygen uses (specified in Doygen config file)
|
|
|
|
ifeq ($(wildcard Doxyfile),Doxyfile)
|
2017-08-29 12:57:04 +00:00
|
|
|
DOXYGEN_DIRECTORY := $(strip $(shell $(GREP) "OUTPUT_DIRECTORY" Doxyfile | $(GREP) -v "\#" | cut -d "=" -f 2))
|
2015-11-05 06:59:46 +00:00
|
|
|
endif
|
2015-11-25 20:20:37 +00:00
|
|
|
# Default directory (in case its missing in the config file)
|
2015-11-23 00:17:15 +00:00
|
|
|
ifeq ($(strip $(DOXYGEN_DIRECTORY)),)
|
|
|
|
DOXYGEN_DIRECTORY := html-docs
|
2015-11-05 06:59:46 +00:00
|
|
|
endif
|
|
|
|
|
2015-12-25 21:06:43 +00:00
|
|
|
# Builds the documentation. Directory name is ref563, ref570, etc.
|
2015-11-05 06:59:46 +00:00
|
|
|
.PHONY: docs html
|
|
|
|
docs html:
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) -r $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/ html-docs/
|
|
|
|
@-$(RM) CryptoPPRef.zip
|
2015-11-05 06:59:46 +00:00
|
|
|
doxygen Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
|
2015-12-26 11:45:59 +00:00
|
|
|
$(MV) $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/
|
2015-11-18 20:35:35 +00:00
|
|
|
zip -9 CryptoPPRef.zip -x ".*" -x "*/.*" -r $(DOCUMENT_DIRECTORY)/
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2017-03-10 06:53:51 +00:00
|
|
|
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(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)
|
2017-08-31 16:15:39 +00:00
|
|
|
@-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et
|
2017-11-05 08:42:39 +00:00
|
|
|
@-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) /tmp/adhoc.exe
|
|
|
|
@-$(RM) -r /tmp/cryptopp_test/
|
|
|
|
@-$(RM) -r *.exe.dSYM/
|
|
|
|
@-$(RM) -r *.dylib.dSYM/
|
|
|
|
@-$(RM) -r cov-int/
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
.PHONY: distclean
|
2015-11-05 06:59:46 +00:00
|
|
|
distclean: clean
|
2017-11-01 22:30:49 +00:00
|
|
|
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt cryptest-*.txt
|
2017-03-25 05:42:23 +00:00
|
|
|
@-$(RM) cryptopp.tgz *.o *.bc *.ii *~
|
2017-11-01 16:11:04 +00:00
|
|
|
@-$(RM) -r $(SRCS:.cpp=.obj) cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) -r $(DOCUMENT_DIRECTORY)/
|
2017-11-05 08:38:19 +00:00
|
|
|
@-$(RM) -f configure.ac configure configure.in Makefile.am Makefile.in Makefile
|
|
|
|
@-$(RM) -f config.guess config.status config.sub depcomp install-sh compile
|
|
|
|
@-$(RM) -f stamp-h1 ar-lib *.m4 local.* lt*.sh missing libtool
|
2017-11-05 08:42:39 +00:00
|
|
|
@-$(RM) -rf m4/ auto*.cache/ .deps/ .libs/
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) -r TestCoverage/
|
|
|
|
@-$(RM) cryptopp$(LIB_VER)\.*
|
|
|
|
@-$(RM) CryptoPPRef.zip
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install:
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(MKDIR) -p $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
2016-01-03 20:30:59 +00:00
|
|
|
$(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
|
|
|
-$(CHMOD) 0755 $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
|
|
|
-$(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
|
2015-12-25 21:06:43 +00:00
|
|
|
ifneq ($(wildcard libcryptopp.a),)
|
2017-03-10 06:53:51 +00:00
|
|
|
@-$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
2016-01-03 20:30:59 +00:00
|
|
|
$(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
|
|
|
|
-$(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
2015-12-25 21:06:43 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(wildcard cryptest.exe),)
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(MKDIR) -p $(DESTDIR)$(BINDIR)
|
2016-01-03 20:30:59 +00:00
|
|
|
$(CP) cryptest.exe $(DESTDIR)$(BINDIR)
|
|
|
|
-$(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe
|
|
|
|
$(MKDIR) -p $(DESTDIR)$(DATADIR)/cryptopp
|
|
|
|
$(CP) -r TestData $(DESTDIR)$(DATADIR)/cryptopp
|
|
|
|
$(CP) -r TestVectors $(DESTDIR)$(DATADIR)/cryptopp
|
|
|
|
-$(CHMOD) 0755 $(DESTDIR)$(DATADIR)/cryptopp
|
|
|
|
-$(CHMOD) 0755 $(DESTDIR)$(DATADIR)/cryptopp/TestData
|
|
|
|
-$(CHMOD) 0755 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
|
|
|
|
-$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
|
|
|
|
-$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
|
2015-12-25 21:06:43 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(wildcard libcryptopp.dylib),)
|
2017-03-10 06:53:51 +00:00
|
|
|
@-$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
2016-01-03 20:30:59 +00:00
|
|
|
$(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
|
2015-12-29 11:32:45 +00:00
|
|
|
-install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
2016-01-03 20:30:59 +00:00
|
|
|
-$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
2015-12-25 21:06:43 +00:00
|
|
|
endif
|
2015-11-08 20:29:56 +00:00
|
|
|
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
|
2017-03-10 06:53:51 +00:00
|
|
|
@-$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
2016-01-03 20:30:59 +00:00
|
|
|
$(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
2015-11-08 20:29:56 +00:00
|
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
2015-12-29 11:32:45 +00:00
|
|
|
-$(LN) -sf libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
|
|
|
$(LDCONF) $(DESTDIR)$(LIBDIR)
|
2015-11-08 20:29:56 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
endif
|
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
.PHONY: remove uninstall
|
|
|
|
remove uninstall:
|
2015-12-29 11:32:45 +00:00
|
|
|
-$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
|
|
|
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
|
|
|
-$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(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
|
|
|
|
@-$(RM) -r $(DESTDIR)$(DATADIR)/cryptopp
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-09-18 16:36:50 +00:00
|
|
|
libcryptopp.a: $(LIBOBJS)
|
2015-07-31 12:09:59 +00:00
|
|
|
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
2016-06-15 09:02:28 +00:00
|
|
|
ifeq ($(IS_SUN),0)
|
2015-07-31 12:09:59 +00:00
|
|
|
$(RANLIB) $@
|
2016-06-15 09:02:28 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-12-31 21:05:14 +00:00
|
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
2015-12-26 11:00:31 +00:00
|
|
|
.PHONY: libcryptopp.so
|
2016-05-09 06:59:16 +00:00
|
|
|
libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX) | so_warning
|
2015-12-31 21:05:14 +00:00
|
|
|
endif
|
2015-12-26 11:00:31 +00:00
|
|
|
|
2016-05-09 06:59:16 +00:00
|
|
|
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
|
2017-09-09 20:24:01 +00:00
|
|
|
ifeq ($(XLC_COMPILER),1)
|
|
|
|
$(CXX) -qmkshrobj $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
|
|
|
|
else
|
|
|
|
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) $(PIC_FLAG) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
|
|
|
|
endif
|
2015-11-08 20:29:56 +00:00
|
|
|
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
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
libcryptopp.dylib: $(LIBOBJS)
|
2016-10-26 22:24:32 +00:00
|
|
|
$(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)
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2016-09-18 16:36:50 +00:00
|
|
|
cryptest.exe: libcryptopp.a $(TESTOBJS)
|
2016-10-26 22:24:32 +00:00
|
|
|
$(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-12-28 12:06:50 +00:00
|
|
|
# Makes it faster to test changes
|
|
|
|
nolib: $(OBJS)
|
2017-03-13 19:57:47 +00:00
|
|
|
$(CXX) -o ct $(strip $(CXXFLAGS)) $(OBJS) $(LDFLAGS) $(LDLIBS)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
dll: cryptest.import.exe dlltest.exe
|
|
|
|
|
|
|
|
cryptopp.dll: $(DLLOBJS)
|
2016-10-26 22:24:32 +00:00
|
|
|
$(CXX) -shared -o $@ $(strip $(CXXFLAGS)) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
libcryptopp.import.a: $(LIBIMPORTOBJS)
|
|
|
|
$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
|
2016-06-15 09:02:28 +00:00
|
|
|
ifeq ($(IS_SUN),0)
|
2015-07-31 12:09:59 +00:00
|
|
|
$(RANLIB) $@
|
2016-06-15 09:02:28 +00:00
|
|
|
endif
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
|
2016-10-26 22:24:32 +00:00
|
|
|
$(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
|
2016-10-26 22:24:32 +00:00
|
|
|
$(CXX) -o $@ $(strip $(CXXFLAGS)) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
# This recipe prepares the distro files
|
2017-11-05 12:21:09 +00:00
|
|
|
TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestScripts/*.sh TestScripts/*.cmd
|
2016-09-24 03:30:44 +00:00
|
|
|
EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/
|
2015-11-18 20:35:35 +00:00
|
|
|
|
|
|
|
ifeq ($(wildcard Filelist.txt),Filelist.txt)
|
|
|
|
DIST_FILES := $(shell cat Filelist.txt)
|
|
|
|
endif
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2016-09-24 03:30:44 +00:00
|
|
|
.PHONY: trim
|
2017-08-17 16:33:43 +00:00
|
|
|
trim:
|
2016-09-24 03:30:44 +00:00
|
|
|
ifneq ($(IS_DARWIN),0)
|
2017-08-24 11:26:14 +00:00
|
|
|
sed -i '' -e's/[[:space:]]*$$//' *.txt *.sh .*.yml *.h *.cpp *.asm *.s *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
|
2017-05-26 14:08:44 +00:00
|
|
|
sed -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestScripts/*.*
|
2016-09-24 03:30:44 +00:00
|
|
|
make convert
|
|
|
|
else
|
2017-08-24 11:26:14 +00:00
|
|
|
sed -i -e's/[[:space:]]*$$//' *.txt *.sh .*.yml *.h *.cpp *.asm *.s *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
|
2017-05-26 14:08:44 +00:00
|
|
|
sed -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestScripts/*.*
|
2016-09-24 03:30:44 +00:00
|
|
|
make convert
|
|
|
|
endif
|
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
.PHONY: convert
|
|
|
|
convert:
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(CHMOD) 0700 TestVectors/ TestData/ TestScripts/
|
2017-09-17 01:09:40 +00:00
|
|
|
@-$(CHMOD) 0600 $(TEXT_FILES) .*.yml *.asm *.s *.zip TestVectors/*.txt TestData/*.dat TestScripts/*.*
|
2017-11-05 12:21:09 +00:00
|
|
|
@-$(CHMOD) 0700 $(EXEC_FILES) *.sh *.cmd TestScripts/*.sh TestScripts/*.cmd
|
|
|
|
@-$(CHMOD) 0700 *.cmd *.sh GNUmakefile GNUmakefile-cross TestScripts/*.sh
|
2017-09-17 01:09:40 +00:00
|
|
|
-unix2dos --keepdate --quiet $(TEXT_FILES) .*.yml *.asm *.cmd TestScripts/*.*
|
2017-08-27 23:01:00 +00:00
|
|
|
-dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.s *.sh *.mapfile TestScripts/*.sh
|
2015-11-23 00:17:15 +00:00
|
|
|
ifneq ($(IS_DARWIN),0)
|
2017-03-09 09:01:36 +00:00
|
|
|
@-xattr -c *
|
2015-11-23 00:17:15 +00:00
|
|
|
endif
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2015-12-29 11:32:45 +00:00
|
|
|
# Build the ZIP file with source files. No documentation.
|
2015-11-05 06:59:46 +00:00
|
|
|
.PHONY: zip dist
|
2015-12-25 21:06:43 +00:00
|
|
|
zip dist: | distclean convert
|
2015-11-05 06:59:46 +00:00
|
|
|
zip -q -9 cryptopp$(LIB_VER).zip $(DIST_FILES)
|
2015-11-18 20:35:35 +00:00
|
|
|
|
2015-12-29 11:32:45 +00:00
|
|
|
# Build the ISO to transfer the ZIP to old distros via CDROM
|
2015-12-25 21:06:43 +00:00
|
|
|
.PHONY: iso
|
|
|
|
iso: | zip
|
|
|
|
ifneq ($(IS_DARWIN),0)
|
2015-12-26 11:45:59 +00:00
|
|
|
$(MKDIR) -p $(PWD)/cryptopp$(LIB_VER)
|
|
|
|
$(CP) cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
|
2015-12-25 21:06:43 +00:00
|
|
|
hdiutil makehybrid -iso -joliet -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) -r $(PWD)/cryptopp$(LIB_VER)
|
2015-12-25 21:06:43 +00:00
|
|
|
else ifneq ($(IS_LINUX),0)
|
2015-12-26 11:45:59 +00:00
|
|
|
$(MKDIR) -p $(PWD)/cryptopp$(LIB_VER)
|
|
|
|
$(CP) cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
|
2015-12-25 21:06:43 +00:00
|
|
|
genisoimage -q -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) -r $(PWD)/cryptopp$(LIB_VER)
|
2015-12-25 21:06:43 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-08 20:45:38 +00:00
|
|
|
# CRYPTOPP_CPU_FREQ in GHz
|
|
|
|
CRYPTOPP_CPU_FREQ ?= 0.0
|
2015-11-18 20:35:35 +00:00
|
|
|
.PHONY: bench benchmark benchmarks
|
|
|
|
bench benchmark benchmarks: cryptest.exe
|
2017-03-09 09:01:36 +00:00
|
|
|
@-$(RM) -f benchmarks.html
|
2017-03-08 20:45:38 +00:00
|
|
|
./cryptest.exe b 2 $(CRYPTOPP_CPU_FREQ)
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
adhoc.cpp: adhoc.cpp.proto
|
|
|
|
ifeq ($(wildcard adhoc.cpp),)
|
|
|
|
cp adhoc.cpp.proto adhoc.cpp
|
|
|
|
else
|
|
|
|
touch adhoc.cpp
|
|
|
|
endif
|
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
# Include dependencies, if present. You must issue `make deps` to create them.
|
|
|
|
ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
|
|
|
|
-include GNUmakefile.deps
|
|
|
|
endif # Dependencies
|
|
|
|
|
2017-03-13 19:57:47 +00:00
|
|
|
# Run rdrand-nasm.sh to create the object files
|
2017-03-14 22:38:37 +00:00
|
|
|
ifeq ($(USE_NASM),1)
|
2017-03-23 20:05:30 +00:00
|
|
|
rdrand.o: rdrand.h rdrand.cpp rdrand.s
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DNASM_RDRAND_ASM_AVAILABLE=1 -DNASM_RDSEED_ASM_AVAILABLE=1 -c rdrand.cpp)
|
2017-03-22 21:26:25 +00:00
|
|
|
rdrand-%.o:
|
|
|
|
./rdrand-nasm.sh
|
2017-03-13 19:57:47 +00:00
|
|
|
endif
|
|
|
|
|
2017-11-05 08:38:19 +00:00
|
|
|
# SSSE3 or NEON available
|
2017-08-17 16:33:43 +00:00
|
|
|
aria-simd.o : aria-simd.cpp
|
|
|
|
$(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<
|
|
|
|
|
|
|
|
# SSE4.2 or ARMv8a available
|
|
|
|
blake2-simd.o : blake2-simd.cpp
|
|
|
|
$(CXX) $(strip $(CXXFLAGS) $(BLAKE2_FLAG) -c) $<
|
|
|
|
|
2017-09-13 01:23:23 +00:00
|
|
|
# SSE2 on i586
|
|
|
|
cpu.o : cpu.cpp
|
|
|
|
$(CXX) $(strip $(CXXFLAGS) $(CPU_FLAG) -c) $<
|
|
|
|
|
2017-08-17 16:33:43 +00:00
|
|
|
# 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) $<
|
|
|
|
|
2017-09-11 07:05:04 +00:00
|
|
|
# NEON available
|
|
|
|
neon-simd.o : neon-simd.cpp
|
|
|
|
$(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $<
|
|
|
|
|
|
|
|
# AltiVec, Power7, Power8 available
|
|
|
|
ppc-simd.o : ppc-simd.cpp
|
|
|
|
$(CXX) $(strip $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $<
|
|
|
|
|
2017-08-17 16:33:43 +00:00
|
|
|
# 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) $<
|
|
|
|
|
|
|
|
# SSE4.2/SHA-NI or ARMv8a available
|
|
|
|
shacal2-simd.o : shacal2-simd.cpp
|
|
|
|
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
|
|
|
|
|
2017-05-28 21:00:09 +00:00
|
|
|
# Don't build Threefish with UBsan on Travis CI. Timeouts cause the build to fail.
|
2017-08-31 14:08:18 +00:00
|
|
|
# Also see http://stackoverflow.com/q/12983137/608639.
|
2017-05-28 21:00:09 +00:00
|
|
|
ifeq ($(findstring true,$(CI)),true)
|
|
|
|
threefish.o : threefish.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(subst -fsanitize=undefined,,$(CXXFLAGS)) -c) $<
|
2017-05-28 21:00:09 +00:00
|
|
|
endif
|
|
|
|
|
2017-05-22 00:45:08 +00:00
|
|
|
# Don't build Rijndael with UBsan. Too much noise due to unaligned data accesses.
|
|
|
|
ifneq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
|
|
|
|
rijndael.o : rijndael.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(subst -fsanitize=undefined,,$(CXXFLAGS)) -c) $<
|
2017-05-22 00:45:08 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Don't build VMAC and friends with Asan. Too many false positives.
|
|
|
|
ifneq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
|
|
|
|
vmac.o : vmac.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(subst -fsanitize=address,,$(CXXFLAGS)) -c) $<
|
2017-05-22 00:45:08 +00:00
|
|
|
endif
|
|
|
|
|
2016-01-03 20:30:59 +00:00
|
|
|
# Only use CRYPTOPP_DATA_DIR if its not set in CXXFLAGS
|
2016-10-26 22:24:32 +00:00
|
|
|
ifeq ($(findstring -DCRYPTOPP_DATA_DIR, $(strip $(CXXFLAGS))),)
|
2016-01-03 20:30:59 +00:00
|
|
|
ifneq ($(strip $(CRYPTOPP_DATA_DIR)),)
|
|
|
|
validat%.o : validat%.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
|
2016-01-03 20:30:59 +00:00
|
|
|
bench%.o : bench%.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
|
2016-01-03 20:30:59 +00:00
|
|
|
datatest.o : datatest.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
|
2016-01-03 20:30:59 +00:00
|
|
|
test.o : test.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
|
2016-01-03 20:30:59 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
%.dllonly.o : %.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c) $< -o $@
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
%.import.o : %.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c) $< -o $@
|
2015-07-31 12:09:59 +00:00
|
|
|
|
|
|
|
%.export.o : %.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c) $< -o $@
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-07-20 07:03:01 +00:00
|
|
|
%.bc : %.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -c) $<
|
2016-07-20 07:03:01 +00:00
|
|
|
|
2015-07-31 12:09:59 +00:00
|
|
|
%.o : %.cpp
|
2017-08-17 16:33:43 +00:00
|
|
|
$(CXX) $(strip $(CXXFLAGS) -c) $<
|
2015-07-31 12:09:59 +00:00
|
|
|
|
2016-05-09 06:59:16 +00:00
|
|
|
.PHONY: so_warning
|
|
|
|
so_warning:
|
2015-11-25 04:14:53 +00:00
|
|
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
|
|
$(info WARNING: Only the symlinks to the shared-object library have been updated.)
|
|
|
|
$(info WARNING: If the library is installed in a system directory you will need)
|
|
|
|
$(info WARNING: to run 'ldconfig' to update the shared-object library cache.)
|
|
|
|
$(info )
|
|
|
|
endif
|