Crypto++  8.3
Free C++ class library of cryptographic schemes
GNUmakefile
1 
2 ###########################################################
3 ##### System Attributes and Programs #####
4 ###########################################################
5 
6 # https://www.gnu.org/software/make/manual/make.html#Makefile-Conventions
7 # and https://www.gnu.org/prep/standards/standards.html
8 
9 SHELL = /bin/sh
10 
11 # If needed
12 TMPDIR ?= /tmp
13 # Used for feature tests
14 TOUT ?= a.out
15 TOUT := $(strip $(TOUT))
16 
17 # Allow override for the cryptest recipe. Change to
18 # ./libcrypto++.so or ./libcrypto++.dylib to suit your
19 # taste. https://github.com/weidai11/crypto++/issues/866
20 LINK_LIBRARY ?= libcrypto++.a
21 LINK_LIBRARY_PATH ?= ./
22 
23 # Command and arguments
24 AR ?= ar
25 ARFLAGS ?= -cr # ar needs the dash on OpenBSD
26 RANLIB ?= ranlib
27 
28 CP ?= cp
29 MV ?= mv
30 RM ?= rm -f
31 GREP ?= grep
32 SED ?= sed
33 CHMOD ?= chmod
34 MKDIR ?= mkdir -p
35 
36 LN ?= ln -sf
37 LDCONF ?= /sbin/ldconfig -n
38 
39 # Solaris provides a non-Posix sed and grep at /usr/bin
40 # Solaris 10 is missing AR in /usr/bin
41 ifneq ($(wildcard /usr/xpg4/bin/grep),)
42  GREP := /usr/xpg4/bin/grep
43 endif
44 ifneq ($(wildcard /usr/xpg4/bin/sed),)
45  SED := /usr/xpg4/bin/sed
46 endif
47 ifneq ($(wildcard /usr/xpg4/bin/ar),)
48  AR := /usr/xpg4/bin/ar
49 endif
50 
51 # Clang is reporting armv8l-unknown-linux-gnueabihf
52 # for ARMv7 images on Aarch64 hardware.
53 MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
54 HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-')
55 ifeq ($(HOSTX),)
56  HOSTX := $(shell uname -m 2>/dev/null)
57 endif
58 
59 IS_X86 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'i.86|x86|i86')
60 IS_X64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E '_64|d64')
61 IS_PPC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'ppc|power')
62 IS_PPC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'ppc64|powerpc64|power64')
63 IS_SPARC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'sun|sparc')
64 IS_SPARC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'sun|sparc64')
65 IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'arm|armhf|armv7|eabihf|armv8')
66 IS_ARMV8 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'aarch32|aarch64|arm64')
67 
68 # Attempt to determine platform
69 SYSTEMX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
70 ifeq ($(SYSTEMX),)
71  SYSTEMX := $(shell uname -s 2>/dev/null)
72 endif
73 
74 IS_LINUX := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Linux")
75 IS_HURD := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c -E "GNU|Hurd")
76 IS_MINGW := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "MinGW")
77 IS_CYGWIN := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Cygwin")
78 IS_DARWIN := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Darwin")
79 IS_NETBSD := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "NetBSD")
80 IS_AIX := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "aix")
81 IS_SUN := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c -E "SunOS|Solaris")
82 
83 SUN_COMPILER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E 'CC: (Sun|Studio)')
84 GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E '(llvm|clang)' | $(GREP) -i -c -E '(gcc|g\+\+)')
85 XLC_COMPILER := $(shell $(CXX) -qversion 2>/dev/null |$(GREP) -i -c "IBM XL")
86 CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E '(llvm|clang)')
87 INTEL_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c '\‍(icc\‍)')
88 
89 # Various Port compilers on OS X
90 MACPORTS_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c "macports")
91 HOMEBREW_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c "homebrew")
92 ifeq ($(IS_DARWIN),1)
93  ifneq ($(MACPORTS_COMPILER)$(HOMEBREW_COMPILER),00)
94  OSXPORT_COMPILER := 1
95  endif
96 endif
97 
98 # Enable shared object versioning for Linux and Solaris
99 HAS_SOLIB_VERSION ?= 0
100 ifneq ($(IS_LINUX)$(IS_HURD)$(IS_SUN),000)
101  HAS_SOLIB_VERSION := 1
102 endif
103 
104 # Formely adhoc.cpp was created from adhoc.cpp.proto when needed.
105 ifeq ($(wildcard adhoc.cpp),)
106 $(shell cp adhoc.cpp.proto adhoc.cpp)
107 endif
108 
109 # Tell MacPorts and Homebrew GCC to use Clang integrated assembler (only on Intel-based Macs)
110 # http://github.com/weidai11/crypto++/issues/190
111 ifeq ($(GCC_COMPILER)$(OSXPORT_COMPILER)$(IS_PPC32)$(IS_PPC64),1100)
112  ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
113  CRYPTOPP_CXXFLAGS += -Wa,-q
114  endif
115 endif
116 
117 # Hack to skip CPU feature tests for some recipes
118 DETECT_FEATURES ?= 1
119 ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),-DCRYPTOPP_DISABLE_ASM)
120  DETECT_FEATURES := 0
121 else ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
122  DETECT_FEATURES := 0
123 else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean)
124  DETECT_FEATURES := 0
125 else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim)
126  DETECT_FEATURES := 0
127 endif
128 
129 # Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed
130 # because it requires -O1 or higher, but we use -O0 to tame the optimizer.
131 ifeq ($(DETECT_FEATURES),1)
132  TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
133  ifneq ($(strip $(TCXXFLAGS)),)
134  $(info Using testing flags: $(TCXXFLAGS))
135  endif
136  #TPROG = TestPrograms/test_cxx.cxx
137  #$(info Testing compile... )
138  #$(info $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 1>/dev/null))
139 endif
140 
141 # Fixup AIX
142 ifeq ($(IS_AIX),1)
143  TPROG = TestPrograms/test_64bit.cxx
144  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
145  ifeq ($(strip $(HAVE_OPT)),0)
146  IS_PPC64=1
147  else
148  IS_PPC32=1
149  endif
150 endif
151 
152 # libc++ is LLVM's standard C++ library. If we add libc++
153 # here then all user programs must use it too. The open
154 # question is, which choice is easier on users?
155 ifneq ($(IS_DARWIN),0)
156  CXX ?= c++
157  # CRYPTOPP_CXXFLAGS += -stdlib=libc++
158  AR = libtool
159  ARFLAGS = -static -o
160 endif
161 
162 ###########################################################
163 ##### General Variables #####
164 ###########################################################
165 
166 # Base CXXFLAGS used if the user did not specify them
167 ifeq ($(CXXFLAGS),)
168  ifeq ($(SUN_COMPILER),1)
169  CRYPTOPP_CXXFLAGS += -DNDEBUG -g -xO3
170  ZOPT = -xO0
171  else
172  CRYPTOPP_CXXFLAGS += -DNDEBUG -g2 -O3
173  ZOPT = -O0
174  endif
175 endif
176 
177 # Fix CXX on Cygwin 1.1.4
178 ifeq ($(CXX),gcc)
179 CXX := g++
180 endif
181 
182 # On ARM we may compile aes_armv4.S though the CC compiler
183 ifeq ($(GCC_COMPILER),1)
184  CC=gcc
185 else ifeq ($(CLANG_COMPILER),1)
186  CC=clang
187 endif
188 
189 # http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
190 ifeq ($(PREFIX),)
191 PREFIX = /usr/local
192 PC_PREFIX = /usr/local
193 else
194 PC_PREFIX = $(PREFIX)
195 endif
196 ifeq ($(LIBDIR),)
197 LIBDIR := $(PREFIX)/lib
198 PC_LIBDIR = $${prefix}/lib
199 else
200 PC_LIBDIR = $(LIBDIR)
201 endif
202 ifeq ($(DATADIR),)
203 DATADIR := $(PREFIX)/share
204 PC_DATADIR = $${prefix}/share
205 else
206 PC_DATADIR = $(DATADIR)
207 endif
208 ifeq ($(INCLUDEDIR),)
209 INCLUDEDIR := $(PREFIX)/include
210 PC_INCLUDEDIR = $${prefix}/include
211 else
212 PC_INCLUDEDIR = $(INCLUDEDIR)
213 endif
214 ifeq ($(BINDIR),)
215 BINDIR := $(PREFIX)/bin
216 endif
217 
218 # We honor ARFLAGS, but the "v" option used by default causes a noisy make
219 ifeq ($(ARFLAGS),rv)
220 ARFLAGS = r
221 endif
222 
223 # Original MinGW targets Win2k by default, but lacks proper Win2k support
224 # if target Windows version is not specified, use Windows XP instead
225 ifeq ($(IS_MINGW),1)
226 ifeq ($(findstring -D_WIN32_WINNT,$(CXXFLAGS)),)
227 ifeq ($(findstring -D_WIN32_WINDOWS,$(CXXFLAGS)),)
228 ifeq ($(findstring -DWINVER,$(CXXFLAGS)),)
229 ifeq ($(findstring -DNTDDI_VERSION,$(CXXFLAGS)),)
230  CRYPTOPP_CXXFLAGS += -D_WIN32_WINNT=0x0501
231 endif # NTDDI_VERSION
232 endif # WINVER
233 endif # _WIN32_WINDOWS
234 endif # _WIN32_WINNT
235 endif # IS_MINGW
236 
237 # Newlib needs _XOPEN_SOURCE=600 for signals
238 TPROG = TestPrograms/test_newlib.cxx
239 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
240 ifeq ($(strip $(HAVE_OPT)),0)
241  ifeq ($(findstring -D_XOPEN_SOURCE,$(CXXFLAGS)),)
242  CRYPTOPP_CXXFLAGS += -D_XOPEN_SOURCE=600
243  endif
244 endif
245 
246 ###########################################################
247 ##### X86/X32/X64 Options #####
248 ###########################################################
249 
250 ifneq ($(IS_X86)$(IS_X64)$(IS_MINGW),000)
251 ifeq ($(DETECT_FEATURES),1)
252 
253  ifeq ($(SUN_COMPILER),1)
254  SSE2_FLAG = -xarch=sse2
255  SSE3_FLAG = -xarch=sse3
256  SSSE3_FLAG = -xarch=ssse3
257  SSE41_FLAG = -xarch=sse4_1
258  SSE42_FLAG = -xarch=sse4_2
259  CLMUL_FLAG = -xarch=aes
260  AESNI_FLAG = -xarch=aes
261  AVX_FLAG = -xarch=avx
262  AVX2_FLAG = -xarch=avx2
263  SHANI_FLAG = -xarch=sha
264  else
265  SSE2_FLAG = -msse2
266  SSE3_FLAG = -msse3
267  SSSE3_FLAG = -mssse3
268  SSE41_FLAG = -msse4.1
269  SSE42_FLAG = -msse4.2
270  CLMUL_FLAG = -mpclmul
271  AESNI_FLAG = -maes
272  AVX_FLAG = -mavx
273  AVX2_FLAG = -mavx2
274  SHANI_FLAG = -msha
275  endif
276 
277  TPROG = TestPrograms/test_x86_sse2.cxx
278  TOPT = $(SSE2_FLAG)
279  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
280  ifeq ($(strip $(HAVE_OPT)),0)
281  CHACHA_FLAG = $(SSE2_FLAG)
282  SUN_LDFLAGS += $(SSE2_FLAG)
283  else
284  SSE2_FLAG =
285  endif
286 
287  TPROG = TestPrograms/test_x86_ssse3.cxx
288  TOPT = $(SSSE3_FLAG)
289  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
290  ifeq ($(strip $(HAVE_OPT)),0)
291  ARIA_FLAG = $(SSSE3_FLAG)
292  CHAM_FLAG = $(SSSE3_FLAG)
293  KECCAK_FLAG = $(SSSE3_FLAG)
294  LEA_FLAG = $(SSSE3_FLAG)
295  SIMON128_FLAG = $(SSSE3_FLAG)
296  SPECK128_FLAG = $(SSSE3_FLAG)
297  SUN_LDFLAGS += $(SSSE3_FLAG)
298  else
299  SSSE3_FLAG =
300  endif
301 
302  TPROG = TestPrograms/test_x86_sse41.cxx
303  TOPT = $(SSE41_FLAG)
304  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
305  ifeq ($(strip $(HAVE_OPT)),0)
306  BLAKE2B_FLAG = $(SSE41_FLAG)
307  BLAKE2S_FLAG = $(SSE41_FLAG)
308  SUN_LDFLAGS += $(SSE41_FLAG)
309  else
310  SSE41_FLAG =
311  endif
312 
313  TPROG = TestPrograms/test_x86_sse42.cxx
314  TOPT = $(SSE42_FLAG)
315  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
316  ifeq ($(strip $(HAVE_OPT)),0)
317  CRC_FLAG = $(SSE42_FLAG)
318  SUN_LDFLAGS += $(SSE42_FLAG)
319  else
320  SSE42_FLAG =
321  endif
322 
323  TPROG = TestPrograms/test_x86_clmul.cxx
324  TOPT = $(CLMUL_FLAG)
325  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
326  ifeq ($(strip $(HAVE_OPT)),0)
327  GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
328  GF2N_FLAG = $(CLMUL_FLAG)
329  SUN_LDFLAGS += $(CLMUL_FLAG)
330  else
331  CLMUL_FLAG =
332  endif
333 
334  TPROG = TestPrograms/test_x86_aes.cxx
335  TOPT = $(AESNI_FLAG)
336  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
337  ifeq ($(strip $(HAVE_OPT)),0)
338  AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
339  SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
340  SUN_LDFLAGS += $(AESNI_FLAG)
341  else
342  AESNI_FLAG =
343  endif
344 
345  TPROG = TestPrograms/test_x86_avx.cxx
346  TOPT = $(AVX_FLAG)
347  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
348  ifeq ($(strip $(HAVE_OPT)),0)
349  # XXX_FLAG = $(AVX_FLAG)
350  SUN_LDFLAGS += $(AVX_FLAG)
351  else
352  AVX_FLAG =
353  endif
354 
355  TPROG = TestPrograms/test_x86_avx2.cxx
356  TOPT = $(AVX2_FLAG)
357  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
358  ifeq ($(strip $(HAVE_OPT)),0)
359  CHACHA_AVX2_FLAG = $(AVX2_FLAG)
360  SUN_LDFLAGS += $(AVX2_FLAG)
361  else
362  AVX2_FLAG =
363  endif
364 
365  TPROG = TestPrograms/test_x86_sha.cxx
366  TOPT = $(SHANI_FLAG)
367  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
368  ifeq ($(strip $(HAVE_OPT)),0)
369  SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
370  SUN_LDFLAGS += $(SHANI_FLAG)
371  else
372  SHANI_FLAG =
373  endif
374 
375  ifeq ($(SUN_COMPILER),1)
376  CRYPTOPP_LDFLAGS += $(SUN_LDFLAGS)
377  endif
378 
379  ifeq ($(SSE2_FLAG),)
380  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
381  else ifeq ($(SSE3_FLAG),)
382  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
383  else ifeq ($(SSSE3_FLAG),)
384  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
385  else ifeq ($(SSE41_FLAG),)
386  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
387  else ifeq ($(SSE42_FLAG),)
388  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
389  endif
390 
391  ifneq ($(SSE42_FLAG),)
392 
393  # Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
394  # test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
395  ifeq ($(CLMUL_FLAG),)
396  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
397  endif
398  ifeq ($(AESNI_FLAG),)
399  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
400  endif
401 
402  ifeq ($(AVX_FLAG),)
403  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
404  else ifeq ($(AVX2_FLAG),)
405  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
406  else ifeq ($(SHANI_FLAG),)
407  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
408  endif
409  endif
410 
411  # Drop to SSE2 if available
412  ifeq ($(GCM_FLAG),)
413  ifneq ($(SSE2_FLAG),)
414  GCM_FLAG = $(SSE2_FLAG)
415  endif
416  endif
417 
418  # Most Clang cannot handle mixed asm with positional arguments, where the
419  # body is Intel style with no prefix and the templates are AT&T style.
420  # Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
421 
422  # CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
423  # Clang compilers. This test will need to be re-enabled if Clang fixes it.
424  #TPROG = TestPrograms/test_asm_mixed.cxx
425  #HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
426  #ifneq ($(strip $(HAVE_OPT)),0)
427  # CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
428  #endif
429 
430 # DETECT_FEATURES
431 endif
432 
433 ifneq ($(INTEL_COMPILER),0)
434  CRYPTOPP_CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
435 
436  ICC111_OR_LATER := $(shell $(CXX) --version 2>&1 | $(GREP) -c -E "\‍(ICC\‍) ([2-9][0-9]|1[2-9]|11\.[1-9])")
437  ifeq ($(ICC111_OR_LATER),0)
438  # "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and
439  # some x64 inline assembly with ICC 11.0. If you want to use Crypto++'s assembly code
440  # with ICC, try enabling it on individual files
441  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
442  endif
443 endif
444 
445 # Allow use of "/" operator for GNU Assembler.
446 # http://sourceware.org/bugzilla/show_bug.cgi?id=4572
447 ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
448  ifeq ($(IS_SUN)$(GCC_COMPILER),11)
449  CRYPTOPP_CXXFLAGS += -Wa,--divide
450  endif
451 endif
452 
453 # IS_X86, IS_X32 and IS_X64
454 endif
455 
456 ###########################################################
457 ##### ARM A-32 and NEON #####
458 ###########################################################
459 
460 ifneq ($(IS_ARM32),0)
461 ifeq ($(DETECT_FEATURES),1)
462 
463  # Clang needs an option to include <arm_neon.h>
464  TPROG = TestPrograms/test_arm_neon_header.cxx
465  TOPT = -march=armv7-a -mfpu=neon
466  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
467  ifeq ($(strip $(HAVE_OPT)),0)
468  THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
469  endif
470 
471  TPROG = TestPrograms/test_arm_neon.cxx
472  TOPT = -march=armv7-a -mfpu=neon
473  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
474  ifeq ($(strip $(HAVE_OPT)),0)
475  NEON_FLAG = -march=armv7-a -mfpu=neon
476  ARIA_FLAG = -march=armv7-a -mfpu=neon
477  AES_FLAG = -march=armv7-a -mfpu=neon
478  CRC_FLAG = -march=armv7-a -mfpu=neon
479  GCM_FLAG = -march=armv7-a -mfpu=neon
480  BLAKE2B_FLAG = -march=armv7-a -mfpu=neon
481  BLAKE2S_FLAG = -march=armv7-a -mfpu=neon
482  CHACHA_FLAG = -march=armv7-a -mfpu=neon
483  CHAM_FLAG = -march=armv7-a -mfpu=neon
484  LEA_FLAG = -march=armv7-a -mfpu=neon
485  SHA_FLAG = -march=armv7-a -mfpu=neon
486  SIMON128_FLAG = -march=armv7-a -mfpu=neon
487  SPECK128_FLAG = -march=armv7-a -mfpu=neon
488  SM4_FLAG = -march=armv7-a -mfpu=neon
489  else
490  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
491  endif
492 
493 # DETECT_FEATURES
494 endif
495 # IS_ARM32
496 endif
497 
498 ###########################################################
499 ##### Aach32 and Aarch64 #####
500 ###########################################################
501 
502 ifneq ($(IS_ARMV8),0)
503 ifeq ($(DETECT_FEATURES),1)
504 
505  TPROG = TestPrograms/test_arm_neon_header.cxx
506  TOPT =
507  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
508  ifeq ($(strip $(HAVE_OPT)),0)
509  THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
510  endif
511 
512  TPROG = TestPrograms/test_arm_acle_header.cxx
513  TOPT = -march=armv8-a
514  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
515  ifeq ($(strip $(HAVE_OPT)),0)
516  THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1
517  endif
518 
519  TPROG = TestPrograms/test_arm_asimd.cxx
520  TOPT = -march=armv8-a
521  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
522  ifeq ($(strip $(HAVE_OPT)),0)
523  ASIMD_FLAG = -march=armv8-a
524  ARIA_FLAG = -march=armv8-a
525  BLAKE2B_FLAG = -march=armv8-a
526  BLAKE2S_FLAG = -march=armv8-a
527  CHACHA_FLAG = -march=armv8-a
528  CHAM_FLAG = -march=armv8-a
529  LEA_FLAG = -march=armv8-a
530  NEON_FLAG = -march=armv8-a
531  SIMON128_FLAG = -march=armv8-a
532  SPECK128_FLAG = -march=armv8-a
533  SM4_FLAG = -march=armv8-a
534  else
535  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
536  endif
537 
538  ifneq ($(ASIMD_FLAG),)
539  TPROG = TestPrograms/test_arm_crc.cxx
540  TOPT = -march=armv8-a+crc
541  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
542  ifeq ($(strip $(HAVE_OPT)),0)
543  CRC_FLAG = -march=armv8-a+crc
544  else
545  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32
546  endif
547 
548  TPROG = TestPrograms/test_arm_aes.cxx
549  TOPT = -march=armv8-a+crypto
550  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
551  ifeq ($(strip $(HAVE_OPT)),0)
552  AES_FLAG = -march=armv8-a+crypto
553  else
554  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES
555  endif
556 
557  TPROG = TestPrograms/test_arm_pmull.cxx
558  TOPT = -march=armv8-a+crypto
559  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
560  ifeq ($(strip $(HAVE_OPT)),0)
561  GCM_FLAG = -march=armv8-a+crypto
562  GF2N_FLAG = -march=armv8-a+crypto
563  else
564  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL
565  endif
566 
567  TPROG = TestPrograms/test_arm_sha1.cxx
568  TOPT = -march=armv8-a+crypto
569  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
570  ifeq ($(strip $(HAVE_OPT)),0)
571  SHA_FLAG = -march=armv8-a+crypto
572  else
573  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1
574  endif
575 
576  TPROG = TestPrograms/test_arm_sha256.cxx
577  TOPT = -march=armv8-a+crypto
578  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
579  ifeq ($(strip $(HAVE_OPT)),0)
580  SHA_FLAG = -march=armv8-a+crypto
581  else
582  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2
583  endif
584 
585  TPROG = TestPrograms/test_arm_sm3.cxx
586  TOPT = -march=armv8.4-a+crypto
587  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
588  ifeq ($(strip $(HAVE_OPT)),0)
589  SM3_FLAG = -march=armv8.4-a+crypto
590  SM4_FLAG = -march=armv8.4-a+crypto
591  else
592  #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3
593  #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
594  endif
595 
596  TPROG = TestPrograms/test_arm_sha3.cxx
597  TOPT = -march=armv8.4-a+crypto
598  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
599  ifeq ($(strip $(HAVE_OPT)),0)
600  SHA3_FLAG = -march=armv8.4-a+crypto
601  else
602  #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3
603  endif
604 
605  TPROG = TestPrograms/test_arm_sha512.cxx
606  TOPT = -march=armv8.4-a+crypto
607  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
608  ifeq ($(strip $(HAVE_OPT)),0)
609  SHA512_FLAG = -march=armv8.4-a+crypto
610  else
611  #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA512
612  endif
613 
614  # ASIMD_FLAG
615  endif
616 
617 # DETECT_FEATURES
618 endif
619 # IS_ARMV8
620 endif
621 
622 ###########################################################
623 ##### PowerPC #####
624 ###########################################################
625 
626 # PowerPC and PowerPC64. Altivec is available with POWER4 with GCC and
627 # POWER6 with XLC. The tests below are crafted for IBM XLC and the LLVM
628 # front-end. XLC/LLVM only supplies POWER8 so we have to set the flags for
629 # XLC/LLVM to POWER8. I've got a feeling LLVM is going to cause trouble.
630 
631 ifneq ($(IS_PPC32)$(IS_PPC64),00)
632 ifeq ($(DETECT_FEATURES),1)
633 
634  # XLC requires -qaltivec in addition to Arch or CPU option
635  ifeq ($(XLC_COMPILER),1)
636  # POWER9_FLAG = -qarch=pwr9 -qaltivec
637  POWER8_FLAG = -qarch=pwr8 -qaltivec
638  POWER7_VSX_FLAG = -qarch=pwr7 -qvsx -qaltivec
639  POWER7_PWR_FLAG = -qarch=pwr7 -qaltivec
640  POWER6_FLAG = -qarch=pwr6 -qaltivec
641  POWER5_FLAG = -qarch=pwr5 -qaltivec
642  POWER4_FLAG = -qarch=pwr4 -qaltivec
643  ALTIVEC_FLAG = -qaltivec
644  else
645  # POWER9_FLAG = -mcpu=power9
646  POWER8_FLAG = -mcpu=power8
647  POWER7_VSX_FLAG = -mcpu=power7 -mvsx
648  POWER7_PWR_FLAG = -mcpu=power7
649  ALTIVEC_FLAG = -maltivec
650  endif
651 
652  # GCC 10 is giving us trouble in CPU_ProbePower9() and
653  # CPU_ProbeDARN(). GCC is generating POWER9 instructions
654  # on POWER8 for ppc_power9.cpp. The compiler idiots did
655  # not think through the consequences of requiring us to
656  # use -mcpu=power9 to unlock the ISA. Epic fail.
657  # https:#github.com/weidai11/cryptopp/issues/986
658  POWER9_FLAG =
659 
660  # XLC with LLVM front-ends failed to define XLC defines.
661  #ifeq ($(findstring -qxlcompatmacros,$(CXXFLAGS)),)
662  # TPROG = TestPrograms/test_ppc_altivec.cxx
663  # TOPT = -qxlcompatmacros
664  # HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
665  # ifeq ($(strip $(HAVE_OPT)),0)
666  # CRYPTOPP_CXXFLAGS += -qxlcompatmacros
667  # endif
668  #endif
669 
670  #####################################################################
671  # Looking for a POWER9 option
672 
673  #TPROG = TestPrograms/test_ppc_power9.cxx
674  #TOPT = $(POWER9_FLAG)
675  #HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
676  #ifeq ($(strip $(HAVE_OPT)),0)
677  # DARN_FLAG = $(POWER9_FLAG)
678  #else
679  # POWER9_FLAG =
680  #endif
681 
682  #####################################################################
683  # Looking for a POWER8 option
684 
685  TPROG = TestPrograms/test_ppc_power8.cxx
686  TOPT = $(POWER8_FLAG)
687  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
688  ifeq ($(strip $(HAVE_OPT)),0)
689  AES_FLAG = $(POWER8_FLAG)
690  BLAKE2B_FLAG = $(POWER8_FLAG)
691  CRC_FLAG = $(POWER8_FLAG)
692  GCM_FLAG = $(POWER8_FLAG)
693  GF2N_FLAG = $(POWER8_FLAG)
694  LEA_FLAG = $(POWER8_FLAG)
695  SHA_FLAG = $(POWER8_FLAG)
696  SHACAL2_FLAG = $(POWER8_FLAG)
697  else
698  POWER8_FLAG =
699  endif
700 
701  #####################################################################
702  # Looking for a POWER7 option
703 
704  # GCC needs -mvsx for Power7 to enable 64-bit vector elements.
705  # XLC provides 64-bit vector elements without an option.
706 
707  TPROG = TestPrograms/test_ppc_power7.cxx
708  TOPT = $(POWER7_VSX_FLAG)
709  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
710  ifeq ($(strip $(HAVE_OPT)),0)
711  POWER7_FLAG = $(POWER7_VSX_FLAG)
712  else
713  TPROG = TestPrograms/test_ppc_power7.cxx
714  TOPT = $(POWER7_PWR_FLAG)
715  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
716  ifeq ($(strip $(HAVE_OPT)),0)
717  POWER7_FLAG = $(POWER7_PWR_FLAG)
718  else
719  POWER7_FLAG =
720  endif
721  endif
722 
723  #####################################################################
724  # Looking for an Altivec option
725 
726  TPROG = TestPrograms/test_ppc_altivec.cxx
727  TOPT = $(ALTIVEC_FLAG)
728  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
729  ifneq ($(strip $(HAVE_OPT)),0)
730  ALTIVEC_FLAG =
731  endif
732 
733  # XLC fixup
734  ifeq ($(XLC_COMPILER)$(ALTIVEC_FLAG),1)
735  TPROG = TestPrograms/test_ppc_altivec.cxx
736  TOPT = $(POWER4_FLAG)
737  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
738  ifeq ($(strip $(HAVE_OPT)),0)
739  ALTIVEC_FLAG = $(POWER4_FLAG)
740  else
741  TPROG = TestPrograms/test_ppc_altivec.cxx
742  TOPT = $(POWER5_FLAG)
743  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
744  ifeq ($(strip $(HAVE_OPT)),0)
745  ALTIVEC_FLAG = $(POWER5_FLAG)
746  else
747  TPROG = TestPrograms/test_ppc_altivec.cxx
748  TOPT = $(POWER6_FLAG)
749  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
750  ifeq ($(strip $(HAVE_OPT)),0)
751  ALTIVEC_FLAG = $(POWER6_FLAG)
752  else
753  ALTIVEC_FLAG =
754  endif
755  endif
756  endif
757  endif
758 
759  ifneq ($(ALTIVEC_FLAG),)
760  BLAKE2S_FLAG = $(ALTIVEC_FLAG)
761  CHACHA_FLAG = $(ALTIVEC_FLAG)
762  SPECK128_FLAG = $(ALTIVEC_FLAG)
763  SIMON128_FLAG = $(ALTIVEC_FLAG)
764  endif
765 
766  #####################################################################
767  # Fixups for algorithms that can drop to a lower ISA, if needed
768 
769  # Drop to Altivec if higher Power is not available
770  ifneq ($(ALTIVEC_FLAG),)
771  ifeq ($(GCM_FLAG),)
772  GCM_FLAG = $(ALTIVEC_FLAG)
773  endif
774  endif
775 
776  #####################################################################
777  # Fixups for missing ISAs
778 
779  ifeq ($(ALTIVEC_FLAG),)
780  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ALTIVEC
781  else ifeq ($(POWER7_FLAG),)
782  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER7
783  else ifeq ($(POWER8_FLAG),)
784  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8
785  #else ifeq ($(POWER9_FLAG),)
786  # CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER9
787  endif
788 
789 # DETECT_FEATURES
790 endif
791 
792 # IBM XL C++ compiler
793 ifeq ($(XLC_COMPILER),1)
794  ifeq ($(findstring -qmaxmem,$(CXXFLAGS)),)
795  CRYPTOPP_CXXFLAGS += -qmaxmem=-1
796  endif
797  # http://www-01.ibm.com/support/docview.wss?uid=swg21007500
798  ifeq ($(findstring -qrtti,$(CXXFLAGS)),)
799  CRYPTOPP_CXXFLAGS += -qrtti
800  endif
801 endif
802 
803 # IS_PPC32, IS_PPC64
804 endif
805 
806 ###########################################################
807 ##### Common #####
808 ###########################################################
809 
810 # Add -fPIC for targets *except* X86, X32, Cygwin or MinGW
811 ifeq ($(IS_X86)$(IS_CYGWIN)$(IS_MINGW),000)
812  ifeq ($(findstring -fpic,$(CXXFLAGS))$(findstring -fPIC,$(CXXFLAGS)),)
813  CRYPTOPP_CXXFLAGS += -fPIC
814  endif
815 endif
816 
817 # Use -pthread whenever it is available. See http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf
818 # http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling
819 ifeq ($(DETECT_FEATURES),1)
820  ifeq ($(XLC_COMPILER),1)
821  ifeq ($(findstring -qthreaded,$(CXXFLAGS)),)
822  TPROG = TestPrograms/test_pthreads.cxx
823  TOPT = -qthreaded
824  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
825  ifeq ($(strip $(HAVE_OPT)),0)
826  CRYPTOPP_CXXFLAGS += -qthreaded
827  endif # CRYPTOPP_CXXFLAGS
828  endif # qthreaded
829  else
830  ifeq ($(findstring -pthread,$(CXXFLAGS)),)
831  TPROG = TestPrograms/test_pthreads.cxx
832  TOPT = -pthread
833  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
834  ifeq ($(strip $(HAVE_OPT)),0)
835  CRYPTOPP_CXXFLAGS += -pthread
836  endif # CRYPTOPP_CXXFLAGS
837  endif # pthread
838  endif # XLC/GCC and friends
839 endif # DETECT_FEATURES
840 
841 # Remove -fPIC if present. SunCC use -KPIC, and needs the larger GOT table
842 # https://docs.oracle.com/cd/E19205-01/819-5267/bkbaq/index.html
843 ifeq ($(SUN_COMPILER),1)
844  CRYPTOPP_CXXFLAGS := $(subst -fPIC,-KPIC,$(CRYPTOPP_CXXFLAGS))
845  CRYPTOPP_CXXFLAGS := $(subst -fpic,-KPIC,$(CRYPTOPP_CXXFLAGS))
846 endif
847 
848 # Remove -fPIC if present. IBM XL C++ uses -qpic
849 ifeq ($(XLC_COMPILER),1)
850  CRYPTOPP_CXXFLAGS := $(subst -fPIC,-qpic,$(CRYPTOPP_CXXFLAGS))
851  CRYPTOPP_CXXFLAGS := $(subst -fpic,-qpic,$(CRYPTOPP_CXXFLAGS))
852 endif
853 
854 # Disable IBM XL C++ "1500-036: (I) The NOSTRICT option (default at OPT(3))
855 # has the potential to alter the semantics of a program."
856 ifeq ($(XLC_COMPILER),1)
857  TPROG = TestPrograms/test_cxx.cxx
858  TOPT = -qsuppress=1500-036
859  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
860  ifeq ($(strip $(HAVE_OPT)),0)
861  CRYPTOPP_CXXFLAGS += -qsuppress=1500-036
862  endif # -qsuppress
863 endif # IBM XL C++ compiler
864 
865 # Add -xregs=no%appl SPARC. SunCC should not use certain registers in library code.
866 # https://docs.oracle.com/cd/E18659_01/html/821-1383/bkamt.html
867 ifneq ($(IS_SPARC32)$(IS_SPARC64),00)
868  ifeq ($(SUN_COMPILER),1)
869  ifeq ($(findstring -xregs=no%appl,$(CXXFLAGS)),)
870  CRYPTOPP_CXXFLAGS += -xregs=no%appl
871  endif # -xregs
872  endif # SunCC
873  ifeq ($(GCC_COMPILER),1)
874  ifeq ($(findstring -mno-app-regs,$(CXXFLAGS)),)
875  CRYPTOPP_CXXFLAGS += -mno-app-regs
876  endif # no-app-regs
877  endif # GCC
878 endif # Sparc
879 
880 # Add -pipe for everything except IBM XL C++, SunCC and ARM.
881 # Allow ARM-64 because they seems to have >1 GB of memory
882 ifeq ($(XLC_COMPILER)$(SUN_COMPILER)$(IS_ARM32),000)
883  ifeq ($(findstring -save-temps,$(CXXFLAGS)),)
884  CRYPTOPP_CXXFLAGS += -pipe
885  endif
886 endif
887 
888 # For SunOS, create a Mapfile that allows our object files
889 # to contain additional bits (like SSE4 and AES on old Xeon)
890 # http://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html
891 ifeq ($(IS_SUN)$(SUN_COMPILER),11)
892  ifneq ($(IS_X86)$(IS_X64),00)
893  ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)),)
894  CRYPTOPP_LDFLAGS += -M crypto++.mapfile
895  endif # No CRYPTOPP_DISABLE_ASM
896  endif # X86/X32/X64
897 endif # SunOS
898 
899 ifneq ($(IS_LINUX)$(IS_HURD),00)
900  ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp)
901  ifeq ($(findstring -lgomp,$(LDLIBS)),)
902  LDLIBS += -lgomp
903  endif # LDLIBS
904  endif # OpenMP
905 endif # IS_LINUX or IS_HURD
906 
907 # Add -errtags=yes to get the name for a warning suppression
908 ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler
909 # Add to all Solaris
910 CRYPTOPP_CXXFLAGS += -template=no%extdef
911 SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(GREP) -c -E "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])")
912 ifneq ($(SUN_CC10_BUGGY),0)
913 # -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21
914 # and was fixed in May 2010. Remove it if you get "already had a body defined" errors in vector.cc
915 CRYPTOPP_CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
916 endif
917 AR = $(CXX)
918 ARFLAGS = -xar -o
919 RANLIB = true
920 endif
921 
922 # No ASM for Travis testing
923 ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm)
924  ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)),)
925  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
926  endif # CRYPTOPP_CXXFLAGS
927 endif # No ASM
928 
929 # Native build testing. Issue 'make native'.
930 ifeq ($(findstring native,$(MAKECMDGOALS)),native)
931  NATIVE_OPT =
932 
933  # Try GCC and compatibles first
934  TPROG = TestPrograms/test_cxx.cxx
935  TOPT = -march=native
936  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
937  ifeq ($(strip $(HAVE_OPT)),0)
938  NATIVE_OPT = -march=native
939  endif # NATIVE_OPT
940 
941  # And tune
942  ifeq ($(NATIVE_OPT),)
943  TOPT = -mtune=native
944  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
945  ifeq ($(strip $(HAVE_OPT)),0)
946  NATIVE_OPT = -mtune=native
947  endif # NATIVE_OPT
948  endif
949 
950  # Try SunCC next
951  ifeq ($(NATIVE_OPT),)
952  TOPT = -native
953  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
954  ifeq ($(strip $(HAVE_OPT)),0)
955  NATIVE_OPT = -native
956  endif # NATIVE_OPT
957  endif
958 
959  ifneq ($(NATIVE_OPT),)
960  CRYPTOPP_CXXFLAGS += $(NATIVE_OPT)
961  endif
962 
963 endif # Native
964 
965 # Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
966 ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
967  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
968  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
969  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
970  ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
971  CRYPTOPP_CXXFLAGS += -fsanitize=undefined
972  endif # CRYPTOPP_CXXFLAGS
973  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
974  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
975  endif # CRYPTOPP_CXXFLAGS
976 endif # UBsan
977 
978 # Address Sanitizer (Asan) testing. Issue 'make asan'.
979 ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
980  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
981  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
982  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
983  ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
984  CRYPTOPP_CXXFLAGS += -fsanitize=address
985  endif # CRYPTOPP_CXXFLAGS
986  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
987  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
988  endif # CRYPTOPP_CXXFLAGS
989  ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
990  CRYPTOPP_CXXFLAGS += -fno-omit-frame-pointer
991  endif # CRYPTOPP_CXXFLAGS
992 endif # Asan
993 
994 # LD gold linker testing. Triggered by 'LD=ld.gold'.
995 ifeq ($(findstring ld.gold,$(LD)),ld.gold)
996  ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
997  LD_GOLD = $(shell command -v ld.gold)
998  ELF_FORMAT := $(shell file $(LD_GOLD) 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf")
999  ifneq ($(ELF_FORMAT),0)
1000  CRYPTOPP_LDFLAGS += -fuse-ld=gold
1001  endif # ELF/ELF64
1002  endif # CXXFLAGS
1003 endif # Gold
1004 
1005 # lcov code coverage. Issue 'make coverage'.
1006 ifneq ($(filter lcov coverage,$(MAKECMDGOALS)),)
1007  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
1008  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
1009  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
1010  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
1011  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
1012  endif # CRYPTOPP_COVERAGE
1013  ifeq ($(findstring -coverage,$(CXXFLAGS)),)
1014  CRYPTOPP_CXXFLAGS += -coverage
1015  endif # -coverage
1016 endif # GCC code coverage
1017 
1018 # gcov code coverage for Travis. Issue 'make codecov'.
1019 ifneq ($(filter gcov codecov,$(MAKECMDGOALS)),)
1020  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
1021  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
1022  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
1023  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
1024  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
1025  endif # CRYPTOPP_COVERAGE
1026  ifeq ($(findstring -coverage,$(CXXFLAGS)),)
1027  CRYPTOPP_CXXFLAGS += -coverage
1028  endif # -coverage
1029 endif # GCC code coverage
1030 
1031 # Valgrind testing. Issue 'make valgrind'.
1032 ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
1033  # Tune flags; see http://valgrind.org/docs/manual/quick-start.html
1034  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
1035  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
1036  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
1037  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
1038  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
1039  endif # -DCRYPTOPP_COVERAGE
1040 endif # Valgrind
1041 
1042 # Debug testing on GNU systems. Triggered by -DDEBUG.
1043 # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
1044 ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
1045  TPROG = TestPrograms/test_cxx.cxx
1046  USING_GLIBCXX := $(shell $(CXX)$(CXXFLAGS) -E $(TPROG) -o $(TOUT) 2>&1 | $(GREP) -i -c "__GLIBCXX__")
1047  ifneq ($(USING_GLIBCXX),0)
1048  ifeq ($(HAS_NEWLIB),0)
1049  ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
1050  CRYPTOPP_CXXFLAGS += -D_GLIBCXX_DEBUG
1051  endif # CRYPTOPP_CXXFLAGS
1052  endif # HAS_NEWLIB
1053  endif # USING_GLIBCXX
1054 
1055  ifeq ($(XLC_COMPILER),1)
1056  TPROG = TestPrograms/test_cxx.cxx
1057  TOPT = -qheapdebug -qro
1058  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
1059  ifeq ($(strip $(HAVE_OPT)),0)
1060  CRYPTOPP_CXXFLAGS += -qheapdebug -qro
1061  endif # CRYPTOPP_CXXFLAGS
1062  endif # XLC_COMPILER
1063 endif # Debug build
1064 
1065 # Dead code stripping. Issue 'make lean'.
1066 ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
1067  ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
1068  CRYPTOPP_CXXFLAGS += -ffunction-sections
1069  endif # CRYPTOPP_CXXFLAGS
1070  ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
1071  CRYPTOPP_CXXFLAGS += -fdata-sections
1072  endif # CRYPTOPP_CXXFLAGS
1073  ifneq ($(IS_DARWIN),0)
1074  ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
1075  CRYPTOPP_LDFLAGS += -Wl,-dead_strip
1076  endif # CRYPTOPP_CXXFLAGS
1077  else # BSD, Linux and Unix
1078  ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
1079  CRYPTOPP_LDFLAGS += -Wl,--gc-sections
1080  endif # LDFLAGS
1081  endif # MAKECMDGOALS
1082 endif # Dead code stripping
1083 
1084 # For Shared Objects, Diff, Dist/Zip rules
1085 LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3)
1086 LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
1087 LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
1088 LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
1089 
1090 ifeq ($(strip $(LIB_PATCH)),)
1091  LIB_PATCH := 0
1092 endif
1093 
1094 ifeq ($(HAS_SOLIB_VERSION),1)
1095 # Different patchlevels and minors are compatible since 6.1
1096 SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR)
1097 # Linux uses -Wl,-soname
1098 ifneq ($(IS_LINUX)$(IS_HURD),00)
1099 # Linux uses full version suffix for shared library
1100 SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
1101 SOLIB_FLAGS=-Wl,-soname,libcrypto++.so$(SOLIB_COMPAT_SUFFIX)
1102 endif
1103 # Solaris uses -Wl,-h
1104 ifeq ($(IS_SUN),1)
1105 # Solaris uses major version suffix for shared library, but we use major.minor
1106 # The minor version allows previous version to remain and not overwritten.
1107 # https://blogs.oracle.com/solaris/how-to-name-a-solaris-shared-object-v2
1108 SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
1109 SOLIB_FLAGS=-Wl,-h,libcrypto++.so$(SOLIB_COMPAT_SUFFIX)
1110 endif
1111 endif # HAS_SOLIB_VERSION
1112 
1113 ###########################################################
1114 ##### Temp file cleanup #####
1115 ###########################################################
1116 
1117 # After this point no more test programs should be run.
1118 # https://github.com/weidai11/crypto++/issues/738
1119 ifeq ($(findstring /dev/null,$(TOUT)),)
1120  # $(info TOUT is not /dev/null, cleaning $(TOUT))
1121  ifeq ($(wildcard $(TOUT)),$(TOUT))
1122  UNUSED := $(shell $(RM) $(TOUT) 2>/dev/null)
1123  endif
1124  ifeq ($(wildcard $(TOUT).dSYM/),$(TOUT).dSYM/)
1125  UNUSED := $(shell $(RM) -r $(TOUT).dSYM/ 2>/dev/null)
1126  endif
1127 endif
1128 
1129 ###########################################################
1130 ##### Source and object files #####
1131 ###########################################################
1132 
1133 # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
1134 SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp)))
1135 # For Makefile.am; resource.h is Windows
1136 INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
1137 
1138 ifneq ($(IS_MINGW),0)
1139 INCL += resource.h
1140 endif
1141 
1142 # Cryptogams source files. We couple to ARMv7.
1143 # Limit to Linux. The source files target the GNU assembler.
1144 # Also see https://www.crypto++.com/wiki/Cryptogams.
1145 ifeq ($(IS_ARM32)$(IS_LINUX),11)
1146  ifeq ($(CLANG_COMPILER),1)
1147  CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
1148  CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack
1149  else
1150  CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
1151  CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack
1152  endif
1153  SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S
1154 endif
1155 
1156 # Remove unneeded arch specific files to speed build time.
1157 ifeq ($(IS_PPC32)$(IS_PPC64),00)
1158  SRCS := $(filter-out ppc_%,$(SRCS))
1159 endif
1160 ifeq ($(IS_ARM32)$(IS_ARMV8),00)
1161  SRCS := $(filter-out arm_%,$(SRCS))
1162  SRCS := $(filter-out neon_%,$(SRCS))
1163 endif
1164 ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000)
1165  SRCS := $(filter-out sse_%,$(SRCS))
1166 endif
1167 
1168 # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
1169 OBJS := $(SRCS:.cpp=.o)
1170 OBJS := $(OBJS:.S=.o)
1171 
1172 # List test.cpp first to tame C++ static initialization problems.
1173 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
1174 TESTINCL := bench.h factory.h validate.h
1175 
1176 # Test objects
1177 TESTOBJS := $(TESTSRCS:.cpp=.o)
1178 LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
1179 
1180 # In Crypto++ 5.6.2 these were the source and object files for the FIPS DLL.
1181 # Since the library is on the Historical Validation List we add all files.
1182 # The 5.6.2 list is at https://github.com/weidai11/crypto++/blob/789f81f048c9.
1183 DLLSRCS := $(SRCS)
1184 DLLOBJS := $(DLLSRCS:.cpp=.export.o)
1185 DLLOBJS := $(DLLOBJS:.S=.export.o)
1186 
1187 # Import lib testing
1188 LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
1189 TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
1190 DLLTESTOBJS := dlltest.dllonly.o
1191 
1192 ###########################################################
1193 ##### Add our flags to user flags #####
1194 ###########################################################
1195 
1196 # This ensures we don't add flags when the user forbids
1197 # use of customary library flags, like -fPIC. Make will
1198 # ignore this assignment when CXXFLAGS is passed as an
1199 # argument to the make program: make CXXFLAGS="..."
1200 CPPFLAGS := $(strip $(CRYPTOPP_CPPFLAGS) $(CPPFLAGS))
1201 CXXFLAGS := $(strip $(CRYPTOPP_CXXFLAGS) $(CXXFLAGS))
1202 LDFLAGS := $(strip $(CRYPTOPP_LDFLAGS) $(LDFLAGS))
1203 
1204 ###########################################################
1205 ##### Targets and Recipes #####
1206 ###########################################################
1207 
1208 # Default builds program with static library only
1209 .PHONY: default
1210 default: cryptest
1211 
1212 .PHONY: all static dynamic
1213 all: static dynamic cryptest
1214 
1215 ifneq ($(IS_DARWIN),0)
1216 static: libcrypto++.a
1217 shared dynamic dylib: libcrypto++.dylib
1218 else
1219 static: libcrypto++.a
1220 shared dynamic: libcrypto++.so$(SOLIB_VERSION_SUFFIX)
1221 endif
1222 
1223 # CXXFLAGS are tuned earlier.
1224 .PHONY: native no-asm asan ubsan
1225 native no-asm asan ubsan: cryptest
1226 
1227 # CXXFLAGS are tuned earlier. Applications must use linker flags
1228 # -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
1229 .PHONY: lean
1230 lean: static dynamic cryptest
1231 
1232 # May want to export CXXFLAGS="-g3 -O1"
1233 .PHONY: lcov coverage
1234 lcov coverage: cryptest
1235  @-$(RM) -r ./TestCoverage/
1236  lcov --base-directory . --directory . --zerocounters -q
1237  ./cryptest v
1238  ./cryptest tv all
1239  ./cryptest b 0.25
1240  lcov --base-directory . --directory . -c -o cryptest.info
1241  lcov --remove cryptest.info "adhoc.*" -o cryptest.info
1242  lcov --remove cryptest.info "fips140.*" -o cryptest.info
1243  lcov --remove cryptest.info "*test.*" -o cryptest.info
1244  lcov --remove cryptest.info "/usr/*" -o cryptest.info
1245  genhtml -o ./TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info
1246 
1247 # Travis CI and CodeCov rule
1248 .PHONY: gcov codecov
1249 gcov codecov: cryptest
1250  @-$(RM) -r ./TestCoverage/
1251  ./cryptest v
1252  ./cryptest tv all
1253  gcov -r $(SRCS)
1254 
1255 # Should use CXXFLAGS="-g3 -O1"
1256 .PHONY: valgrind
1257 valgrind: cryptest
1258  valgrind --track-origins=yes --suppressions=crypto++.supp ./cryptest v
1259 
1260 .PHONY: test check
1261 test check: cryptest
1262  ./cryptest v
1263 
1264 # Used to generate list of source files for Autotools, CMakeList, Android.mk, etc
1265 .PHONY: sources
1266 sources: adhoc.cpp
1267  $(info ***** Library sources *****)
1268  $(info $(filter-out $(TESTSRCS),$(SRCS)))
1269  $(info )
1270  $(info ***** Library headers *****)
1271  $(info $(filter-out $(TESTINCL),$(INCL)))
1272  $(info )
1273  $(info ***** Test sources *****)
1274  $(info $(TESTSRCS))
1275  $(info )
1276  $(info ***** Test headers *****)
1277  $(info $(TESTINCL))
1278 
1279 # Directory we want (can't specify on Doygen command line)
1280 DOCUMENT_DIRECTORY := ref$(LIB_VER)
1281 # Directory Doxygen uses (specified in Doygen config file)
1282 ifeq ($(wildcard Doxyfile),Doxyfile)
1283 DOXYGEN_DIRECTORY := $(strip $(shell $(GREP) "OUTPUT_DIRECTORY" Doxyfile | $(GREP) -v "\#" | cut -d "=" -f 2))
1284 endif
1285 # Default directory (in case its missing in the config file)
1286 ifeq ($(strip $(DOXYGEN_DIRECTORY)),)
1287 DOXYGEN_DIRECTORY := html-docs
1288 endif
1289 
1290 # Builds the documentation. Directory name is ref563, ref570, etc.
1291 .PHONY: docs html
1292 docs html:
1293  @-$(RM) -r $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/ html-docs/
1294  @-$(RM) CryptoPPRef.zip
1295  doxygen Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
1296  $(MV) $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/
1297  zip -9 CryptoPPRef.zip -x ".*" -x "*/.*" -r $(DOCUMENT_DIRECTORY)/
1298 
1299 .PHONY: clean
1300 clean:
1301  -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
1302  @-$(RM) libcrypto++.a libcrypto++.dylib crypto++.dll libcrypto++.dll.a libcrypto++.import.a
1303  @-$(RM) libcrypto++.so libcrypto++.so$(SOLIB_COMPAT_SUFFIX) libcrypto++.so$(SOLIB_VERSION_SUFFIX)
1304  @-$(RM) cryptest dlltest.exe cryptest.import.exe cryptest.info ct et
1305  @-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
1306  @-$(RM) /tmp/adhoc.exe
1307  @-$(RM) -r /tmp/crypto++_test/
1308  @-$(RM) -r *.exe.dSYM/ *.dylib.dSYM/
1309  @-$(RM) -r cov-int/
1310 
1311 .PHONY: autotools-clean
1312 autotools-clean:
1313  @-$(RM) -f configure.ac configure configure.in Makefile.am Makefile.in Makefile
1314  @-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp
1315  @-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing
1316  @-$(RM) -f cryptest cryptestcwd libtool* libcrypto++.la libcrypto++.pc*
1317  @-$(RM) -rf build-aux/ m4/ auto*.cache/ .deps/ .libs/
1318 
1319 .PHONY: cmake-clean
1320 cmake-clean:
1321  @-$(RM) -f crypto++-config.cmake CMakeLists.txt
1322  @-$(RM) -rf cmake_build/
1323 
1324 .PHONY: android-clean
1325 android-clean:
1326  @-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp))
1327  @-$(RM) -rf obj/
1328 
1329 .PHONY: distclean
1330 distclean: clean autotools-clean cmake-clean android-clean
1331  -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
1332  @-$(RM) cryptest-*.txt crypto++.tgz libcrypto++.pc *.o *.bc *.ii *~
1333  @-$(RM) -r cryptlib.lib cryptest *.suo *.sdf *.pdb Win32/ x64/ ipch/
1334  @-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
1335  @-$(RM) -r $(LIBOBJS:.o=.lst) $(TESTOBJS:.o=.lst)
1336  @-$(RM) -r TestCoverage/ ref*/
1337  @-$(RM) crypto++$(LIB_VER)\.* CryptoPPRef.zip
1338 
1339 # Install cryptest, libcrypto++.a, libcrypto++.so and libcrypto++.pc.
1340 # The library install was broken-out into its own recipe at GH #653.
1341 .PHONY: install
1342 install: cryptest install-lib
1343  @-$(MKDIR) $(DESTDIR)$(BINDIR)
1344  $(CP) cryptest $(DESTDIR)$(BINDIR)
1345  $(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest
1346  @-$(MKDIR) $(DESTDIR)$(DATADIR)/crypto++/TestData
1347  @-$(MKDIR) $(DESTDIR)$(DATADIR)/crypto++/TestVectors
1348  $(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/crypto++/TestData
1349  $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/crypto++/TestData/*.dat
1350  $(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/crypto++/TestVectors
1351  $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/crypto++/TestVectors/*.txt
1352 
1353 # A recipe to install only the library, and not cryptest. Also
1354 # see https://github.com/weidai11/crypto++/issues/653. Some users
1355 # already have a libcrypto++.pc. Install the *.pc file if the file
1356 # is present. If you want one, then issue 'make libcrypto++.pc'.
1357 .PHONY: install-lib
1358 install-lib:
1359  @-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/crypto++
1360  $(CP) *.h $(DESTDIR)$(INCLUDEDIR)/crypto++
1361  $(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/crypto++/*.h
1362 ifneq ($(wildcard libcrypto++.a),)
1363  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
1364  $(CP) libcrypto++.a $(DESTDIR)$(LIBDIR)
1365  $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcrypto++.a
1366 endif
1367 ifneq ($(wildcard libcrypto++.dylib),)
1368  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
1369  $(CP) libcrypto++.dylib $(DESTDIR)$(LIBDIR)
1370  $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcrypto++.dylib
1371  -install_name_tool -id $(DESTDIR)$(LIBDIR)/libcrypto++.dylib $(DESTDIR)$(LIBDIR)/libcrypto++.dylib
1372 endif
1373 ifneq ($(wildcard libcrypto++.so$(SOLIB_VERSION_SUFFIX)),)
1374  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
1375  $(CP) libcrypto++.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
1376  $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcrypto++.so$(SOLIB_VERSION_SUFFIX)
1377 ifeq ($(HAS_SOLIB_VERSION),1)
1378  -$(LN) libcrypto++.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcrypto++.so
1379  $(LDCONF) $(DESTDIR)$(LIBDIR)
1380 endif
1381 endif
1382 ifneq ($(wildcard libcrypto++.pc),)
1383  @-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig
1384  $(CP) libcrypto++.pc $(DESTDIR)$(LIBDIR)/pkgconfig
1385  $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/pkgconfig/libcrypto++.pc
1386 endif
1387 
1388 .PHONY: remove uninstall
1389 remove uninstall:
1390  -$(RM) -r $(DESTDIR)$(INCLUDEDIR)/crypto++
1391  -$(RM) $(DESTDIR)$(LIBDIR)/libcrypto++.a
1392  -$(RM) $(DESTDIR)$(BINDIR)/cryptest
1393 ifneq ($(wildcard $(DESTDIR)$(LIBDIR)/libcrypto++.dylib),)
1394  -$(RM) $(DESTDIR)$(LIBDIR)/libcrypto++.dylib
1395 endif
1396 ifneq ($(wildcard $(DESTDIR)$(LIBDIR)/libcrypto++.so),)
1397  -$(RM) $(DESTDIR)$(LIBDIR)/libcrypto++.so
1398 endif
1399  @-$(RM) $(DESTDIR)$(LIBDIR)/libcrypto++.so$(SOLIB_VERSION_SUFFIX)
1400  @-$(RM) $(DESTDIR)$(LIBDIR)/libcrypto++.so$(SOLIB_COMPAT_SUFFIX)
1401  @-$(RM) $(DESTDIR)$(LIBDIR)/pkgconfig/libcrypto++.pc
1402  @-$(RM) -r $(DESTDIR)$(DATADIR)/crypto++
1403 
1404 libcrypto++.a: $(LIBOBJS)
1405  $(AR) $(ARFLAGS) $@ $(LIBOBJS)
1406 ifeq ($(IS_SUN),0)
1407  $(RANLIB) $@
1408 endif
1409 
1410 ifeq ($(HAS_SOLIB_VERSION),1)
1411 .PHONY: libcrypto++.so
1412 libcrypto++.so: libcrypto++.so$(SOLIB_VERSION_SUFFIX) | so_warning
1413 endif
1414 
1415 libcrypto++.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
1416 ifeq ($(XLC_COMPILER),1)
1417  $(CXX) -qmkshrobj $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
1418 else
1419  $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
1420 endif
1421 ifeq ($(HAS_SOLIB_VERSION),1)
1422  -$(LN) libcrypto++.so$(SOLIB_VERSION_SUFFIX) libcrypto++.so
1423  -$(LN) libcrypto++.so$(SOLIB_VERSION_SUFFIX) libcrypto++.so$(SOLIB_COMPAT_SUFFIX)
1424 endif
1425 
1426 libcrypto++.dylib: $(LIBOBJS)
1427  $(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
1428 
1429 cryptest: $(LINK_LIBRARY) $(TESTOBJS)
1430  $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS)
1431 
1432 # Makes it faster to test changes
1433 nolib: $(OBJS)
1434  $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
1435 
1436 dll: cryptest.import.exe dlltest.exe
1437 
1438 crypto++.dll: $(DLLOBJS)
1439  $(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcrypto++.dll.a
1440 
1441 libcrypto++.import.a: $(LIBIMPORTOBJS)
1442  $(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
1443 ifeq ($(IS_SUN),0)
1444  $(RANLIB) $@
1445 endif
1446 
1447 cryptest.import.exe: crypto++.dll libcrypto++.import.a $(TESTIMPORTOBJS)
1448  $(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcrypto++.dll -lcrypto++.import $(LDFLAGS) $(LDLIBS)
1449 
1450 dlltest.exe: crypto++.dll $(DLLTESTOBJS)
1451  $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcrypto++.dll $(LDFLAGS) $(LDLIBS)
1452 
1453 # Some users already have a libcrypto++.pc. We install it if the file
1454 # is present. If you want one, then issue 'make libcrypto++.pc'. Be sure
1455 # to use/verify PREFIX and LIBDIR below after writing the file.
1456 libcrypto++.pc:
1457  @echo '# Crypto++ package configuration file' > libcrypto++.pc
1458  @echo '' >> libcrypto++.pc
1459  @echo 'prefix=$(PC_PREFIX)' >> libcrypto++.pc
1460  @echo 'libdir=$(PC_LIBDIR)' >> libcrypto++.pc
1461  @echo 'includedir=$(PC_INCLUDEDIR)' >> libcrypto++.pc
1462  @echo 'datadir=$(PC_DATADIR)' >> libcrypto++.pc
1463  @echo '' >> libcrypto++.pc
1464  @echo 'Name: Crypto++' >> libcrypto++.pc
1465  @echo 'Description: Crypto++ cryptographic library' >> libcrypto++.pc
1466  @echo 'Version: 8.3' >> libcrypto++.pc
1467  @echo 'URL: https://crypto++.com/' >> libcrypto++.pc
1468  @echo '' >> libcrypto++.pc
1469  @echo 'Cflags: -I$${includedir}' >> libcrypto++.pc
1470  @echo 'Libs: -L$${libdir} -lcrypto++' >> libcrypto++.pc
1471 
1472 # This recipe prepares the distro files
1473 TEXT_FILES := *.h *.cpp License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters crypto++.rc TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx TestScripts/*.sh TestScripts/*.cmd
1474 EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/ TestPrograms/
1475 
1476 ifeq ($(wildcard Filelist.txt),Filelist.txt)
1477 DIST_FILES := $(shell cat Filelist.txt)
1478 endif
1479 
1480 .PHONY: trim
1481 trim:
1482 ifneq ($(IS_DARWIN),0)
1483  $(SED) -i '' -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S
1484  $(SED) -i '' -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
1485  $(SED) -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.*
1486  make convert
1487 else
1488  $(SED) -i -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S
1489  $(SED) -i -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
1490  $(SED) -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.*
1491  make convert
1492 endif
1493 
1494 .PHONY: convert
1495 convert:
1496  @-$(CHMOD) 0700 TestVectors/ TestData/ TestPrograms/ TestScripts/
1497  @-$(CHMOD) 0600 $(TEXT_FILES) *.supp .*.yml *.asm *.zip TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx TestScripts/*.*
1498  @-$(CHMOD) 0700 $(EXEC_FILES) TestScripts/*.sh TestScripts/*.cmd
1499  @-$(CHMOD) 0700 GNUmakefile GNUmakefile-cross TestScripts/*.sh
1500  -unix2dos --keepdate --quiet $(TEXT_FILES) .*.yml *.asm TestScripts/*.*
1501  -dos2unix --keepdate --quiet GNUmakefile* *.supp *.mapfile TestScripts/*.sh
1502 ifneq ($(IS_DARWIN),0)
1503  @-xattr -c *
1504 endif
1505 
1506 # Build the ZIP file with source files. No documentation.
1507 .PHONY: zip dist
1508 zip dist: | distclean convert
1509  zip -q -9 crypto++$(LIB_VER).zip $(DIST_FILES)
1510 
1511 # Build the ISO to transfer the ZIP to old distros via CDROM
1512 .PHONY: iso
1513 iso: | zip
1514 ifneq ($(IS_DARWIN),0)
1515  $(MKDIR) $(PWD)/crypto++$(LIB_VER)
1516  $(CP) crypto++$(LIB_VER).zip $(PWD)/crypto++$(LIB_VER)
1517  hdiutil makehybrid -iso -joliet -o crypto++$(LIB_VER).iso $(PWD)/crypto++$(LIB_VER)
1518  @-$(RM) -r $(PWD)/crypto++$(LIB_VER)
1519 else ifneq ($(IS_LINUX)$(IS_HURD),00)
1520  $(MKDIR) $(PWD)/crypto++$(LIB_VER)
1521  $(CP) crypto++$(LIB_VER).zip $(PWD)/crypto++$(LIB_VER)
1522  genisoimage -q -o crypto++$(LIB_VER).iso $(PWD)/crypto++$(LIB_VER)
1523  @-$(RM) -r $(PWD)/crypto++$(LIB_VER)
1524 endif
1525 
1526 # CRYPTOPP_CPU_FREQ in GHz
1527 CRYPTOPP_CPU_FREQ ?= 0.0
1528 .PHONY: bench benchmark benchmarks
1529 bench benchmark benchmarks: cryptest
1530  @-$(RM) -f benchmarks.html
1531  ./cryptest b 2 $(CRYPTOPP_CPU_FREQ)
1532 
1533 adhoc.cpp: adhoc.cpp.proto
1534 ifeq ($(wildcard adhoc.cpp),)
1535  cp adhoc.cpp.proto adhoc.cpp
1536 else
1537  touch adhoc.cpp
1538 endif
1539 
1540 # Include dependencies, if present. You must issue `make deps` to create them.
1541 ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
1542 -include GNUmakefile.deps
1543 endif # Dependencies
1544 
1545 # Cryptogams ARM asm implementation. AES needs -mthumb for Clang
1546 aes_armv4.o : aes_armv4.S
1547  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $<
1548 
1549 # SSSE3 or NEON available
1550 aria_simd.o : aria_simd.cpp
1551  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ARIA_FLAG) -c) $<
1552 
1553 # SSE, NEON or POWER7 available
1554 blake2s_simd.o : blake2s_simd.cpp
1555  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $<
1556 
1557 # SSE, NEON or POWER8 available
1558 blake2b_simd.o : blake2b_simd.cpp
1559  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $<
1560 
1561 # SSE2 or NEON available
1562 chacha_simd.o : chacha_simd.cpp
1563  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_FLAG) -c) $<
1564 
1565 # AVX2 available
1566 chacha_avx.o : chacha_avx.cpp
1567  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $<
1568 
1569 # SSSE3 available
1570 cham_simd.o : cham_simd.cpp
1571  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHAM_FLAG) -c) $<
1572 
1573 # SSE4.2 or ARMv8a available
1574 crc_simd.o : crc_simd.cpp
1575  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRC_FLAG) -c) $<
1576 
1577 # Power9 available
1578 darn.o : darn.cpp
1579  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(DARN_FLAG) -c) $<
1580 
1581 # SSE2 on i686
1582 donna_sse.o : donna_sse.cpp
1583  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
1584 
1585 # Carryless multiply
1586 gcm_simd.o : gcm_simd.cpp
1587  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GCM_FLAG) -c) $<
1588 
1589 # Carryless multiply
1590 gf2n_simd.o : gf2n_simd.cpp
1591  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GF2N_FLAG) -c) $<
1592 
1593 # SSSE3 available
1594 keccak_simd.o : keccak_simd.cpp
1595  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(KECCAK_FLAG) -c) $<
1596 
1597 # SSSE3 available
1598 lea_simd.o : lea_simd.cpp
1599  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $<
1600 
1601 # NEON available
1602 neon_simd.o : neon_simd.cpp
1603  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $<
1604 
1605 # AltiVec available
1606 ppc_simd.o : ppc_simd.cpp
1607  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $<
1608 
1609 # Power7 available
1610 ppc_power7.o : ppc_power7.cpp
1611  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER7_FLAG) -c) $<
1612 
1613 # Power8 available
1614 ppc_power8.o : ppc_power8.cpp
1615  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER8_FLAG) -c) $<
1616 
1617 # Power9 available
1618 ppc_power9.o : ppc_power9.cpp
1619  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER9_FLAG) -c) $<
1620 
1621 # AESNI or ARMv7a/ARMv8a available
1622 rijndael_simd.o : rijndael_simd.cpp
1623  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(AES_FLAG) -c) $<
1624 
1625 # SSE4.2/SHA-NI or ARMv8a available
1626 sha_simd.o : sha_simd.cpp
1627  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
1628 
1629 # Cryptogams SHA1 asm implementation.
1630 sha1_armv4.o : sha1_armv4.S
1631  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
1632 
1633 # Cryptogams SHA256 asm implementation.
1634 sha256_armv4.o : sha256_armv4.S
1635  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
1636 
1637 # Cryptogams SHA512 asm implementation.
1638 sha512_armv4.o : sha512_armv4.S
1639  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
1640 
1641 sha3_simd.o : sha3_simd.cpp
1642  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA3_FLAG) -c) $<
1643 
1644 # SSE4.2/SHA-NI or ARMv8a available
1645 shacal2_simd.o : shacal2_simd.cpp
1646  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
1647 
1648 # SSSE3, NEON or POWER8 available
1649 simon128_simd.o : simon128_simd.cpp
1650  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SIMON128_FLAG) -c) $<
1651 
1652 # SSSE3, NEON or POWER8 available
1653 speck128_simd.o : speck128_simd.cpp
1654  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SPECK128_FLAG) -c) $<
1655 
1656 # ARMv8.4 available
1657 sm3_simd.o : sm3_simd.cpp
1658  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM3_FLAG) -c) $<
1659 
1660 # AESNI available
1661 sm4_simd.o : sm4_simd.cpp
1662  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM4_FLAG) -c) $<
1663 
1664 # IBM XLC -O3 optimization bug
1665 ifeq ($(XLC_COMPILER),1)
1666 sm3.o : sm3.cpp
1667  $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $<
1668 donna_32.o : donna_32.cpp
1669  $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $<
1670 donna_64.o : donna_64.cpp
1671  $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $<
1672 endif
1673 
1674 # SSE2 on i686
1675 sse_simd.o : sse_simd.cpp
1676  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
1677 
1678 # Don't build Rijndael with UBsan. Too much noise due to unaligned data accesses.
1679 ifneq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
1680 rijndael.o : rijndael.cpp
1681  $(CXX) $(strip $(subst -fsanitize=undefined,,$(CXXFLAGS)) -c) $<
1682 endif
1683 
1684 # Only use CRYPTOPP_DATA_DIR if its not set in CXXFLAGS
1685 ifeq ($(findstring -DCRYPTOPP_DATA_DIR, $(CXXFLAGS)),)
1686 ifneq ($(strip $(CRYPTOPP_DATA_DIR)),)
1687 validat%.o : validat%.cpp
1688  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1689 bench%.o : bench%.cpp
1690  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1691 datatest.o : datatest.cpp
1692  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1693 test.o : test.cpp
1694  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1695 endif
1696 endif
1697 
1698 validat1.o : validat1.cpp
1699  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $<
1700 
1701 %.dllonly.o : %.cpp
1702  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c) $< -o $@
1703 
1704 %.import.o : %.cpp
1705  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c) $< -o $@
1706 
1707 %.export.o : %.cpp
1708  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c) $< -o $@
1709 
1710 %.bc : %.cpp
1711  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $<
1712 
1713 %.o : %.cpp
1714  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $<
1715 
1716 .PHONY: so_warning
1717 so_warning:
1718 ifeq ($(HAS_SOLIB_VERSION),1)
1719  $(info WARNING: Only the symlinks to the shared-object library have been updated.)
1720  $(info WARNING: If the library is installed in a system directory you will need)
1721  $(info WARNING: to run 'ldconfig' to update the shared-object library cache.)
1722  $(info )
1723 endif
1724 
1725 .PHONY: dep deps depend
1726 dep deps depend GNUmakefile.deps:
1727  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps