Crypto++  8.2
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.exe recipe. Change to
18 # ./libcryptopp.so or ./libcryptopp.dylib to suit your
19 # taste. https://github.com/weidai11/cryptopp/issues/866
20 LINK_LIBRARY ?= libcryptopp.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/cryptopp/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 PowerPC-64. 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 ifneq ($(IS_PPC32)$(IS_PPC64),00)
631 ifeq ($(DETECT_FEATURES),1)
632 
633  # XLC requires -qaltivec in addition to Arch or CPU option
634  ifeq ($(XLC_COMPILER),1)
635  POWER9_FLAG = -qarch=pwr9 -qaltivec
636  POWER8_FLAG = -qarch=pwr8 -qaltivec
637  POWER7_VSX_FLAG = -qarch=pwr7 -qvsx -qaltivec
638  POWER7_PWR_FLAG = -qarch=pwr7 -qaltivec
639  POWER6_FLAG = -qarch=pwr6 -qaltivec
640  POWER5_FLAG = -qarch=pwr5 -qaltivec
641  POWER4_FLAG = -qarch=pwr4 -qaltivec
642  ALTIVEC_FLAG = -qaltivec
643  else
644  POWER9_FLAG = -mcpu=power9
645  POWER8_FLAG = -mcpu=power8
646  POWER7_VSX_FLAG = -mcpu=power7 -mvsx
647  POWER7_PWR_FLAG = -mcpu=power7
648  ALTIVEC_FLAG = -maltivec
649  endif
650 
651  # XLC with LLVM front-ends failed to define XLC defines.
652  #ifeq ($(findstring -qxlcompatmacros,$(CXXFLAGS)),)
653  # TPROG = TestPrograms/test_ppc_altivec.cxx
654  # TOPT = -qxlcompatmacros
655  # HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
656  # ifeq ($(strip $(HAVE_OPT)),0)
657  # CRYPTOPP_CXXFLAGS += -qxlcompatmacros
658  # endif
659  #endif
660 
661  #####################################################################
662  # Looking for a POWER9 option
663 
664  TPROG = TestPrograms/test_ppc_power9.cxx
665  TOPT = $(POWER9_FLAG)
666  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
667  ifeq ($(strip $(HAVE_OPT)),0)
668  # DARN_FLAG = $(POWER9_FLAG)
669  else
670  POWER9_FLAG =
671  endif
672 
673  #####################################################################
674  # Looking for a POWER8 option
675 
676  TPROG = TestPrograms/test_ppc_power8.cxx
677  TOPT = $(POWER8_FLAG)
678  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
679  ifeq ($(strip $(HAVE_OPT)),0)
680  AES_FLAG = $(POWER8_FLAG)
681  BLAKE2B_FLAG = $(POWER8_FLAG)
682  CRC_FLAG = $(POWER8_FLAG)
683  GCM_FLAG = $(POWER8_FLAG)
684  GF2N_FLAG = $(POWER8_FLAG)
685  LEA_FLAG = $(POWER8_FLAG)
686  SHA_FLAG = $(POWER8_FLAG)
687  SHACAL2_FLAG = $(POWER8_FLAG)
688  else
689  POWER8_FLAG =
690  endif
691 
692  #####################################################################
693  # Looking for a POWER7 option
694 
695  # GCC needs -mvsx for Power7 to enable 64-bit vector elements.
696  # XLC provides 64-bit vector elements without an option.
697 
698  TPROG = TestPrograms/test_ppc_power7.cxx
699  TOPT = $(POWER7_VSX_FLAG)
700  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
701  ifeq ($(strip $(HAVE_OPT)),0)
702  POWER7_FLAG = $(POWER7_VSX_FLAG)
703  else
704  TPROG = TestPrograms/test_ppc_power7.cxx
705  TOPT = $(POWER7_PWR_FLAG)
706  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
707  ifeq ($(strip $(HAVE_OPT)),0)
708  POWER7_FLAG = $(POWER7_PWR_FLAG)
709  else
710  POWER7_FLAG =
711  endif
712  endif
713 
714  #####################################################################
715  # Looking for an Altivec option
716 
717  TPROG = TestPrograms/test_ppc_altivec.cxx
718  TOPT = $(ALTIVEC_FLAG)
719  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
720  ifneq ($(strip $(HAVE_OPT)),0)
721  ALTIVEC_FLAG =
722  endif
723 
724  # XLC fixup
725  ifeq ($(XLC_COMPILER)$(ALTIVEC_FLAG),1)
726  TPROG = TestPrograms/test_ppc_altivec.cxx
727  TOPT = $(POWER4_FLAG)
728  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
729  ifeq ($(strip $(HAVE_OPT)),0)
730  ALTIVEC_FLAG = $(POWER4_FLAG)
731  else
732  TPROG = TestPrograms/test_ppc_altivec.cxx
733  TOPT = $(POWER5_FLAG)
734  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
735  ifeq ($(strip $(HAVE_OPT)),0)
736  ALTIVEC_FLAG = $(POWER5_FLAG)
737  else
738  TPROG = TestPrograms/test_ppc_altivec.cxx
739  TOPT = $(POWER6_FLAG)
740  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
741  ifeq ($(strip $(HAVE_OPT)),0)
742  ALTIVEC_FLAG = $(POWER6_FLAG)
743  else
744  ALTIVEC_FLAG =
745  endif
746  endif
747  endif
748  endif
749 
750  ifneq ($(ALTIVEC_FLAG),)
751  BLAKE2S_FLAG = $(ALTIVEC_FLAG)
752  CHACHA_FLAG = $(ALTIVEC_FLAG)
753  SPECK128_FLAG = $(ALTIVEC_FLAG)
754  SIMON128_FLAG = $(ALTIVEC_FLAG)
755  endif
756 
757  #####################################################################
758  # Fixups for algorithms that can drop to a lower ISA, if needed
759 
760  # Drop to Altivec if higher Power is not available
761  ifneq ($(ALTIVEC_FLAG),)
762  ifeq ($(GCM_FLAG),)
763  GCM_FLAG = $(ALTIVEC_FLAG)
764  endif
765  endif
766 
767  #####################################################################
768  # Fixups for missing ISAs
769 
770  ifeq ($(ALTIVEC_FLAG),)
771  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ALTIVEC
772  else ifeq ($(POWER7_FLAG),)
773  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER7
774  else ifeq ($(POWER8_FLAG),)
775  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8
776  else ifeq ($(POWER9_FLAG),)
777  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER9
778  endif
779 
780 # DETECT_FEATURES
781 endif
782 
783 # IBM XL C++ compiler
784 ifeq ($(XLC_COMPILER),1)
785  ifeq ($(findstring -qmaxmem,$(CXXFLAGS)),)
786  CRYPTOPP_CXXFLAGS += -qmaxmem=-1
787  endif
788  # http://www-01.ibm.com/support/docview.wss?uid=swg21007500
789  ifeq ($(findstring -qrtti,$(CXXFLAGS)),)
790  CRYPTOPP_CXXFLAGS += -qrtti
791  endif
792 endif
793 
794 # IS_PPC32, IS_PPC64
795 endif
796 
797 ###########################################################
798 ##### Common #####
799 ###########################################################
800 
801 # Add -fPIC for targets *except* X86, X32, Cygwin or MinGW
802 ifeq ($(IS_X86)$(IS_CYGWIN)$(IS_MINGW),000)
803  ifeq ($(findstring -fpic,$(CXXFLAGS))$(findstring -fPIC,$(CXXFLAGS)),)
804  CRYPTOPP_CXXFLAGS += -fPIC
805  endif
806 endif
807 
808 # Use -pthread whenever it is available. See http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf
809 # http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling
810 ifeq ($(DETECT_FEATURES),1)
811  ifeq ($(XLC_COMPILER),1)
812  ifeq ($(findstring -qthreaded,$(CXXFLAGS)),)
813  TPROG = TestPrograms/test_pthreads.cxx
814  TOPT = -qthreaded
815  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
816  ifeq ($(strip $(HAVE_OPT)),0)
817  CRYPTOPP_CXXFLAGS += -qthreaded
818  endif # CRYPTOPP_CXXFLAGS
819  endif # qthreaded
820  else
821  ifeq ($(findstring -pthread,$(CXXFLAGS)),)
822  TPROG = TestPrograms/test_pthreads.cxx
823  TOPT = -pthread
824  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
825  ifeq ($(strip $(HAVE_OPT)),0)
826  CRYPTOPP_CXXFLAGS += -pthread
827  endif # CRYPTOPP_CXXFLAGS
828  endif # pthread
829  endif # XLC/GCC and friends
830 endif # DETECT_FEATURES
831 
832 # Remove -fPIC if present. SunCC use -KPIC, and needs the larger GOT table
833 # https://docs.oracle.com/cd/E19205-01/819-5267/bkbaq/index.html
834 ifeq ($(SUN_COMPILER),1)
835  CRYPTOPP_CXXFLAGS := $(subst -fPIC,-KPIC,$(CRYPTOPP_CXXFLAGS))
836  CRYPTOPP_CXXFLAGS := $(subst -fpic,-KPIC,$(CRYPTOPP_CXXFLAGS))
837 endif
838 
839 # Remove -fPIC if present. IBM XL C++ uses -qpic
840 ifeq ($(XLC_COMPILER),1)
841  CRYPTOPP_CXXFLAGS := $(subst -fPIC,-qpic,$(CRYPTOPP_CXXFLAGS))
842  CRYPTOPP_CXXFLAGS := $(subst -fpic,-qpic,$(CRYPTOPP_CXXFLAGS))
843 endif
844 
845 # Disable IBM XL C++ "1500-036: (I) The NOSTRICT option (default at OPT(3))
846 # has the potential to alter the semantics of a program."
847 ifeq ($(XLC_COMPILER),1)
848  TPROG = TestPrograms/test_cxx.cxx
849  TOPT = -qsuppress=1500-036
850  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
851  ifeq ($(strip $(HAVE_OPT)),0)
852  CRYPTOPP_CXXFLAGS += -qsuppress=1500-036
853  endif # -qsuppress
854 endif # IBM XL C++ compiler
855 
856 # Add -xregs=no%appl SPARC. SunCC should not use certain registers in library code.
857 # https://docs.oracle.com/cd/E18659_01/html/821-1383/bkamt.html
858 ifneq ($(IS_SPARC32)$(IS_SPARC64),00)
859  ifeq ($(SUN_COMPILER),1)
860  ifeq ($(findstring -xregs=no%appl,$(CXXFLAGS)),)
861  CRYPTOPP_CXXFLAGS += -xregs=no%appl
862  endif # -xregs
863  endif # SunCC
864  ifeq ($(GCC_COMPILER),1)
865  ifeq ($(findstring -mno-app-regs,$(CXXFLAGS)),)
866  CRYPTOPP_CXXFLAGS += -mno-app-regs
867  endif # no-app-regs
868  endif # GCC
869 endif # Sparc
870 
871 # Add -pipe for everything except IBM XL C++, SunCC and ARM.
872 # Allow ARM-64 because they seems to have >1 GB of memory
873 ifeq ($(XLC_COMPILER)$(SUN_COMPILER)$(IS_ARM32),000)
874  ifeq ($(findstring -save-temps,$(CXXFLAGS)),)
875  CRYPTOPP_CXXFLAGS += -pipe
876  endif
877 endif
878 
879 # For SunOS, create a Mapfile that allows our object files
880 # to contain additional bits (like SSE4 and AES on old Xeon)
881 # http://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html
882 ifeq ($(IS_SUN)$(SUN_COMPILER),11)
883  ifneq ($(IS_X86)$(IS_X64),00)
884  ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)),)
885  CRYPTOPP_LDFLAGS += -M cryptopp.mapfile
886  endif # No CRYPTOPP_DISABLE_ASM
887  endif # X86/X32/X64
888 endif # SunOS
889 
890 ifneq ($(IS_LINUX)$(IS_HURD),00)
891  ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp)
892  ifeq ($(findstring -lgomp,$(LDLIBS)),)
893  LDLIBS += -lgomp
894  endif # LDLIBS
895  endif # OpenMP
896 endif # IS_LINUX or IS_HURD
897 
898 # Add -errtags=yes to get the name for a warning suppression
899 ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler
900 # Add to all Solaris
901 CRYPTOPP_CXXFLAGS += -template=no%extdef
902 SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(GREP) -c -E "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])")
903 ifneq ($(SUN_CC10_BUGGY),0)
904 # -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21
905 # and was fixed in May 2010. Remove it if you get "already had a body defined" errors in vector.cc
906 CRYPTOPP_CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
907 endif
908 AR = $(CXX)
909 ARFLAGS = -xar -o
910 RANLIB = true
911 endif
912 
913 # No ASM for Travis testing
914 ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm)
915  ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)),)
916  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
917  endif # CRYPTOPP_CXXFLAGS
918 endif # No ASM
919 
920 # Native build testing. Issue 'make native'.
921 ifeq ($(findstring native,$(MAKECMDGOALS)),native)
922  NATIVE_OPT =
923 
924  # Try GCC and compatibles first
925  TPROG = TestPrograms/test_cxx.cxx
926  TOPT = -march=native
927  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
928  ifeq ($(strip $(HAVE_OPT)),0)
929  NATIVE_OPT = -march=native
930  endif # NATIVE_OPT
931 
932  # And tune
933  ifeq ($(NATIVE_OPT),)
934  TOPT = -mtune=native
935  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
936  ifeq ($(strip $(HAVE_OPT)),0)
937  NATIVE_OPT = -mtune=native
938  endif # NATIVE_OPT
939  endif
940 
941  # Try SunCC next
942  ifeq ($(NATIVE_OPT),)
943  TOPT = -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 = -native
947  endif # NATIVE_OPT
948  endif
949 
950  ifneq ($(NATIVE_OPT),)
951  CRYPTOPP_CXXFLAGS += $(NATIVE_OPT)
952  endif
953 
954 endif # Native
955 
956 # Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
957 ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
958  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
959  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
960  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
961  ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
962  CRYPTOPP_CXXFLAGS += -fsanitize=undefined
963  endif # CRYPTOPP_CXXFLAGS
964  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
965  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
966  endif # CRYPTOPP_CXXFLAGS
967 endif # UBsan
968 
969 # Address Sanitizer (Asan) testing. Issue 'make asan'.
970 ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
971  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
972  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
973  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
974  ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
975  CRYPTOPP_CXXFLAGS += -fsanitize=address
976  endif # CRYPTOPP_CXXFLAGS
977  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
978  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
979  endif # CRYPTOPP_CXXFLAGS
980  ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
981  CRYPTOPP_CXXFLAGS += -fno-omit-frame-pointer
982  endif # CRYPTOPP_CXXFLAGS
983 endif # Asan
984 
985 # LD gold linker testing. Triggered by 'LD=ld.gold'.
986 ifeq ($(findstring ld.gold,$(LD)),ld.gold)
987  ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
988  LD_GOLD = $(shell command -v ld.gold)
989  ELF_FORMAT := $(shell file $(LD_GOLD) 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf")
990  ifneq ($(ELF_FORMAT),0)
991  CRYPTOPP_LDFLAGS += -fuse-ld=gold
992  endif # ELF/ELF64
993  endif # CXXFLAGS
994 endif # Gold
995 
996 # lcov code coverage. Issue 'make coverage'.
997 ifneq ($(filter lcov coverage,$(MAKECMDGOALS)),)
998  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
999  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
1000  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
1001  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
1002  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
1003  endif # CRYPTOPP_COVERAGE
1004  ifeq ($(findstring -coverage,$(CXXFLAGS)),)
1005  CRYPTOPP_CXXFLAGS += -coverage
1006  endif # -coverage
1007 endif # GCC code coverage
1008 
1009 # gcov code coverage for Travis. Issue 'make codecov'.
1010 ifneq ($(filter gcov codecov,$(MAKECMDGOALS)),)
1011  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
1012  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
1013  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
1014  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
1015  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
1016  endif # CRYPTOPP_COVERAGE
1017  ifeq ($(findstring -coverage,$(CXXFLAGS)),)
1018  CRYPTOPP_CXXFLAGS += -coverage
1019  endif # -coverage
1020 endif # GCC code coverage
1021 
1022 # Valgrind testing. Issue 'make valgrind'.
1023 ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
1024  # Tune flags; see http://valgrind.org/docs/manual/quick-start.html
1025  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3)
1026  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1)
1027  CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1)
1028  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
1029  CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE
1030  endif # -DCRYPTOPP_COVERAGE
1031 endif # Valgrind
1032 
1033 # Debug testing on GNU systems. Triggered by -DDEBUG.
1034 # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
1035 ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
1036  TPROG = TestPrograms/test_cxx.cxx
1037  USING_GLIBCXX := $(shell $(CXX)$(CXXFLAGS) -E $(TPROG) -o $(TOUT) 2>&1 | $(GREP) -i -c "__GLIBCXX__")
1038  ifneq ($(USING_GLIBCXX),0)
1039  ifeq ($(HAS_NEWLIB),0)
1040  ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
1041  CRYPTOPP_CXXFLAGS += -D_GLIBCXX_DEBUG
1042  endif # CRYPTOPP_CXXFLAGS
1043  endif # HAS_NEWLIB
1044  endif # USING_GLIBCXX
1045 
1046  ifeq ($(XLC_COMPILER),1)
1047  TPROG = TestPrograms/test_cxx.cxx
1048  TOPT = -qheapdebug -qro
1049  HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
1050  ifeq ($(strip $(HAVE_OPT)),0)
1051  CRYPTOPP_CXXFLAGS += -qheapdebug -qro
1052  endif # CRYPTOPP_CXXFLAGS
1053  endif # XLC_COMPILER
1054 endif # Debug build
1055 
1056 # Dead code stripping. Issue 'make lean'.
1057 ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
1058  ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
1059  CRYPTOPP_CXXFLAGS += -ffunction-sections
1060  endif # CRYPTOPP_CXXFLAGS
1061  ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
1062  CRYPTOPP_CXXFLAGS += -fdata-sections
1063  endif # CRYPTOPP_CXXFLAGS
1064  ifneq ($(IS_DARWIN),0)
1065  ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
1066  CRYPTOPP_LDFLAGS += -Wl,-dead_strip
1067  endif # CRYPTOPP_CXXFLAGS
1068  else # BSD, Linux and Unix
1069  ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
1070  CRYPTOPP_LDFLAGS += -Wl,--gc-sections
1071  endif # LDFLAGS
1072  endif # MAKECMDGOALS
1073 endif # Dead code stripping
1074 
1075 # For Shared Objects, Diff, Dist/Zip rules
1076 LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3)
1077 LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
1078 LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
1079 LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
1080 
1081 ifeq ($(strip $(LIB_PATCH)),)
1082  LIB_PATCH := 0
1083 endif
1084 
1085 ifeq ($(HAS_SOLIB_VERSION),1)
1086 # Different patchlevels and minors are compatible since 6.1
1087 SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR)
1088 # Linux uses -Wl,-soname
1089 ifneq ($(IS_LINUX)$(IS_HURD),00)
1090 # Linux uses full version suffix for shared library
1091 SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
1092 SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
1093 endif
1094 # Solaris uses -Wl,-h
1095 ifeq ($(IS_SUN),1)
1096 # Solaris uses major version suffix for shared library, but we use major.minor
1097 # The minor version allows previous version to remain and not overwritten.
1098 # https://blogs.oracle.com/solaris/how-to-name-a-solaris-shared-object-v2
1099 SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
1100 SOLIB_FLAGS=-Wl,-h,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
1101 endif
1102 endif # HAS_SOLIB_VERSION
1103 
1104 ###########################################################
1105 ##### Temp file cleanup #####
1106 ###########################################################
1107 
1108 # After this point no more test programs should be run.
1109 # https://github.com/weidai11/cryptopp/issues/738
1110 ifeq ($(findstring /dev/null,$(TOUT)),)
1111  # $(info TOUT is not /dev/null, cleaning $(TOUT))
1112  ifeq ($(wildcard $(TOUT)),$(TOUT))
1113  UNUSED := $(shell $(RM) $(TOUT) 2>/dev/null)
1114  endif
1115  ifeq ($(wildcard $(TOUT).dSYM/),$(TOUT).dSYM/)
1116  UNUSED := $(shell $(RM) -r $(TOUT).dSYM/ 2>/dev/null)
1117  endif
1118 endif
1119 
1120 ###########################################################
1121 ##### Source and object files #####
1122 ###########################################################
1123 
1124 # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
1125 SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp)))
1126 # For Makefile.am; resource.h is Windows
1127 INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
1128 
1129 ifneq ($(IS_MINGW),0)
1130 INCL += resource.h
1131 endif
1132 
1133 # Cryptogams source files. We couple to ARMv7.
1134 # Limit to Linux. The source files target the GNU assembler.
1135 # Also see https://www.cryptopp.com/wiki/Cryptogams.
1136 ifeq ($(IS_ARM32)$(IS_LINUX),11)
1137  ifeq ($(CLANG_COMPILER),1)
1138  CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
1139  CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack
1140  else
1141  CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
1142  CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack
1143  endif
1144  SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S
1145 endif
1146 
1147 # Remove unneeded arch specific files to speed build time.
1148 ifeq ($(IS_PPC32)$(IS_PPC64),00)
1149  SRCS := $(filter-out ppc_%,$(SRCS))
1150 endif
1151 ifeq ($(IS_ARM32)$(IS_ARMV8),00)
1152  SRCS := $(filter-out arm_%,$(SRCS))
1153  SRCS := $(filter-out neon_%,$(SRCS))
1154 endif
1155 ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000)
1156  SRCS := $(filter-out sse_%,$(SRCS))
1157 endif
1158 
1159 # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
1160 OBJS := $(SRCS:.cpp=.o)
1161 OBJS := $(OBJS:.S=.o)
1162 
1163 # List test.cpp first to tame C++ static initialization problems.
1164 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
1165 TESTINCL := bench.h factory.h validate.h
1166 
1167 # Test objects
1168 TESTOBJS := $(TESTSRCS:.cpp=.o)
1169 LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
1170 
1171 # In Crypto++ 5.6.2 these were the source and object files for the FIPS DLL.
1172 # Since the library is on the Historical Validation List we add all files.
1173 # The 5.6.2 list is at https://github.com/weidai11/cryptopp/blob/789f81f048c9.
1174 DLLSRCS := $(SRCS)
1175 DLLOBJS := $(DLLSRCS:.cpp=.export.o)
1176 DLLOBJS := $(DLLOBJS:.S=.export.o)
1177 
1178 # Import lib testing
1179 LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
1180 TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
1181 DLLTESTOBJS := dlltest.dllonly.o
1182 
1183 ###########################################################
1184 ##### Add our flags to user flags #####
1185 ###########################################################
1186 
1187 # This ensures we don't add flags when the user forbids
1188 # use of customary library flags, like -fPIC. Make will
1189 # ignore this assignment when CXXFLAGS is passed as an
1190 # argument to the make program: make CXXFLAGS="..."
1191 CPPFLAGS := $(strip $(CRYPTOPP_CPPFLAGS) $(CPPFLAGS))
1192 CXXFLAGS := $(strip $(CRYPTOPP_CXXFLAGS) $(CXXFLAGS))
1193 LDFLAGS := $(strip $(CRYPTOPP_LDFLAGS) $(LDFLAGS))
1194 
1195 ###########################################################
1196 ##### Targets and Recipes #####
1197 ###########################################################
1198 
1199 # Default builds program with static library only
1200 .PHONY: default
1201 default: cryptest.exe
1202 
1203 .PHONY: all static dynamic
1204 all: static dynamic cryptest.exe
1205 
1206 ifneq ($(IS_DARWIN),0)
1207 static: libcryptopp.a
1208 shared dynamic dylib: libcryptopp.dylib
1209 else
1210 static: libcryptopp.a
1211 shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
1212 endif
1213 
1214 # CXXFLAGS are tuned earlier.
1215 .PHONY: native no-asm asan ubsan
1216 native no-asm asan ubsan: cryptest.exe
1217 
1218 # CXXFLAGS are tuned earlier. Applications must use linker flags
1219 # -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
1220 .PHONY: lean
1221 lean: static dynamic cryptest.exe
1222 
1223 # May want to export CXXFLAGS="-g3 -O1"
1224 .PHONY: lcov coverage
1225 lcov coverage: cryptest.exe
1226  @-$(RM) -r ./TestCoverage/
1227  lcov --base-directory . --directory . --zerocounters -q
1228  ./cryptest.exe v
1229  ./cryptest.exe tv all
1230  ./cryptest.exe b 0.25
1231  lcov --base-directory . --directory . -c -o cryptest.info
1232  lcov --remove cryptest.info "adhoc.*" -o cryptest.info
1233  lcov --remove cryptest.info "fips140.*" -o cryptest.info
1234  lcov --remove cryptest.info "*test.*" -o cryptest.info
1235  lcov --remove cryptest.info "/usr/*" -o cryptest.info
1236  genhtml -o ./TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info
1237 
1238 # Travis CI and CodeCov rule
1239 .PHONY: gcov codecov
1240 gcov codecov: cryptest.exe
1241  @-$(RM) -r ./TestCoverage/
1242  ./cryptest.exe v
1243  ./cryptest.exe tv all
1244  gcov -r $(SRCS)
1245 
1246 # Should use CXXFLAGS="-g3 -O1"
1247 .PHONY: valgrind
1248 valgrind: cryptest.exe
1249  valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v
1250 
1251 .PHONY: test check
1252 test check: cryptest.exe
1253  ./cryptest.exe v
1254 
1255 # Used to generate list of source files for Autotools, CMakeList, Android.mk, etc
1256 .PHONY: sources
1257 sources: adhoc.cpp
1258  $(info ***** Library sources *****)
1259  $(info $(filter-out $(TESTSRCS),$(SRCS)))
1260  $(info )
1261  $(info ***** Library headers *****)
1262  $(info $(filter-out $(TESTINCL),$(INCL)))
1263  $(info )
1264  $(info ***** Test sources *****)
1265  $(info $(TESTSRCS))
1266  $(info )
1267  $(info ***** Test headers *****)
1268  $(info $(TESTINCL))
1269 
1270 # Directory we want (can't specify on Doygen command line)
1271 DOCUMENT_DIRECTORY := ref$(LIB_VER)
1272 # Directory Doxygen uses (specified in Doygen config file)
1273 ifeq ($(wildcard Doxyfile),Doxyfile)
1274 DOXYGEN_DIRECTORY := $(strip $(shell $(GREP) "OUTPUT_DIRECTORY" Doxyfile | $(GREP) -v "\#" | cut -d "=" -f 2))
1275 endif
1276 # Default directory (in case its missing in the config file)
1277 ifeq ($(strip $(DOXYGEN_DIRECTORY)),)
1278 DOXYGEN_DIRECTORY := html-docs
1279 endif
1280 
1281 # Builds the documentation. Directory name is ref563, ref570, etc.
1282 .PHONY: docs html
1283 docs html:
1284  @-$(RM) -r $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/ html-docs/
1285  @-$(RM) CryptoPPRef.zip
1286  doxygen Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
1287  $(MV) $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/
1288  zip -9 CryptoPPRef.zip -x ".*" -x "*/.*" -r $(DOCUMENT_DIRECTORY)/
1289 
1290 .PHONY: clean
1291 clean:
1292  -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
1293  @-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
1294  @-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX)
1295  @-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et
1296  @-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
1297  @-$(RM) /tmp/adhoc.exe
1298  @-$(RM) -r /tmp/cryptopp_test/
1299  @-$(RM) -r *.exe.dSYM/ *.dylib.dSYM/
1300  @-$(RM) -r cov-int/
1301 
1302 .PHONY: autotools-clean
1303 autotools-clean:
1304  @-$(RM) -f configure.ac configure configure.in Makefile.am Makefile.in Makefile
1305  @-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp
1306  @-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing
1307  @-$(RM) -f cryptest cryptestcwd libtool* libcryptopp.la libcryptopp.pc*
1308  @-$(RM) -rf build-aux/ m4/ auto*.cache/ .deps/ .libs/
1309 
1310 .PHONY: cmake-clean
1311 cmake-clean:
1312  @-$(RM) -f cryptopp-config.cmake CMakeLists.txt
1313  @-$(RM) -rf cmake_build/
1314 
1315 .PHONY: android-clean
1316 android-clean:
1317  @-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp))
1318  @-$(RM) -rf obj/
1319 
1320 .PHONY: distclean
1321 distclean: clean autotools-clean cmake-clean android-clean
1322  -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
1323  @-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
1324  @-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
1325  @-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
1326  @-$(RM) -r $(LIBOBJS:.o=.lst) $(TESTOBJS:.o=.lst)
1327  @-$(RM) -r TestCoverage/ ref*/
1328  @-$(RM) cryptopp$(LIB_VER)\.* CryptoPPRef.zip
1329 
1330 # Install cryptest.exe, libcryptopp.a, libcryptopp.so and libcryptopp.pc.
1331 # The library install was broken-out into its own recipe at GH #653.
1332 .PHONY: install
1333 install: cryptest.exe install-lib
1334  @-$(MKDIR) $(DESTDIR)$(BINDIR)
1335  $(CP) cryptest.exe $(DESTDIR)$(BINDIR)
1336  $(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe
1337  @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData
1338  @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
1339  $(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData
1340  $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
1341  $(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
1342  $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
1343 
1344 # A recipe to install only the library, and not cryptest.exe. Also
1345 # see https://github.com/weidai11/cryptopp/issues/653. Some users
1346 # already have a libcryptopp.pc. Install the *.pc file if the file
1347 # is present. If you want one, then issue 'make libcryptopp.pc'.
1348 .PHONY: install-lib
1349 install-lib:
1350  @-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp
1351  $(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
1352  $(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
1353 ifneq ($(wildcard libcryptopp.a),)
1354  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
1355  $(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
1356  $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a
1357 endif
1358 ifneq ($(wildcard libcryptopp.dylib),)
1359  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
1360  $(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
1361  $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
1362  -install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
1363 endif
1364 ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
1365  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
1366  $(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
1367  $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
1368 ifeq ($(HAS_SOLIB_VERSION),1)
1369  -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
1370  $(LDCONF) $(DESTDIR)$(LIBDIR)
1371 endif
1372 endif
1373 ifneq ($(wildcard libcryptopp.pc),)
1374  @-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig
1375  $(CP) libcryptopp.pc $(DESTDIR)$(LIBDIR)/pkgconfig
1376  $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc
1377 endif
1378 
1379 .PHONY: remove uninstall
1380 remove uninstall:
1381  -$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
1382  -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
1383  -$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
1384 ifneq ($(wildcard $(DESTDIR)$(LIBDIR)/libcryptopp.dylib),)
1385  -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
1386 endif
1387 ifneq ($(wildcard $(DESTDIR)$(LIBDIR)/libcryptopp.so),)
1388  -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
1389 endif
1390  @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
1391  @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
1392  @-$(RM) $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc
1393  @-$(RM) -r $(DESTDIR)$(DATADIR)/cryptopp
1394 
1395 libcryptopp.a: $(LIBOBJS)
1396  $(AR) $(ARFLAGS) $@ $(LIBOBJS)
1397 ifeq ($(IS_SUN),0)
1398  $(RANLIB) $@
1399 endif
1400 
1401 ifeq ($(HAS_SOLIB_VERSION),1)
1402 .PHONY: libcryptopp.so
1403 libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX) | so_warning
1404 endif
1405 
1406 libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
1407 ifeq ($(XLC_COMPILER),1)
1408  $(CXX) -qmkshrobj $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
1409 else
1410  $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
1411 endif
1412 ifeq ($(HAS_SOLIB_VERSION),1)
1413  -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
1414  -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
1415 endif
1416 
1417 libcryptopp.dylib: $(LIBOBJS)
1418  $(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)
1419 
1420 cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS)
1421  $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS)
1422 
1423 # Makes it faster to test changes
1424 nolib: $(OBJS)
1425  $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
1426 
1427 dll: cryptest.import.exe dlltest.exe
1428 
1429 cryptopp.dll: $(DLLOBJS)
1430  $(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
1431 
1432 libcryptopp.import.a: $(LIBIMPORTOBJS)
1433  $(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
1434 ifeq ($(IS_SUN),0)
1435  $(RANLIB) $@
1436 endif
1437 
1438 cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
1439  $(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
1440 
1441 dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
1442  $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
1443 
1444 # Some users already have a libcryptopp.pc. We install it if the file
1445 # is present. If you want one, then issue 'make libcryptopp.pc'. Be sure
1446 # to use/verify PREFIX and LIBDIR below after writing the file.
1447 libcryptopp.pc:
1448  @echo '# Crypto++ package configuration file' > libcryptopp.pc
1449  @echo '' >> libcryptopp.pc
1450  @echo 'prefix=$(PC_PREFIX)' >> libcryptopp.pc
1451  @echo 'libdir=$(PC_LIBDIR)' >> libcryptopp.pc
1452  @echo 'includedir=$(PC_INCLUDEDIR)' >> libcryptopp.pc
1453  @echo 'datadir=$(PC_DATADIR)' >> libcryptopp.pc
1454  @echo '' >> libcryptopp.pc
1455  @echo 'Name: Crypto++' >> libcryptopp.pc
1456  @echo 'Description: Crypto++ cryptographic library' >> libcryptopp.pc
1457  @echo 'Version: 8.3' >> libcryptopp.pc
1458  @echo 'URL: https://cryptopp.com/' >> libcryptopp.pc
1459  @echo '' >> libcryptopp.pc
1460  @echo 'Cflags: -I$${includedir}' >> libcryptopp.pc
1461  @echo 'Libs: -L$${libdir} -lcryptopp' >> libcryptopp.pc
1462 
1463 # This recipe prepares the distro files
1464 TEXT_FILES := *.h *.cpp License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx TestScripts/*.sh TestScripts/*.cmd
1465 EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/ TestPrograms/
1466 
1467 ifeq ($(wildcard Filelist.txt),Filelist.txt)
1468 DIST_FILES := $(shell cat Filelist.txt)
1469 endif
1470 
1471 .PHONY: trim
1472 trim:
1473 ifneq ($(IS_DARWIN),0)
1474  $(SED) -i '' -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S
1475  $(SED) -i '' -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
1476  $(SED) -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.*
1477  make convert
1478 else
1479  $(SED) -i -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S
1480  $(SED) -i -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
1481  $(SED) -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.*
1482  make convert
1483 endif
1484 
1485 .PHONY: convert
1486 convert:
1487  @-$(CHMOD) 0700 TestVectors/ TestData/ TestPrograms/ TestScripts/
1488  @-$(CHMOD) 0600 $(TEXT_FILES) *.supp .*.yml *.asm *.zip TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx TestScripts/*.*
1489  @-$(CHMOD) 0700 $(EXEC_FILES) TestScripts/*.sh TestScripts/*.cmd
1490  @-$(CHMOD) 0700 GNUmakefile GNUmakefile-cross TestScripts/*.sh
1491  -unix2dos --keepdate --quiet $(TEXT_FILES) .*.yml *.asm TestScripts/*.*
1492  -dos2unix --keepdate --quiet GNUmakefile* *.supp *.mapfile TestScripts/*.sh
1493 ifneq ($(IS_DARWIN),0)
1494  @-xattr -c *
1495 endif
1496 
1497 # Build the ZIP file with source files. No documentation.
1498 .PHONY: zip dist
1499 zip dist: | distclean convert
1500  zip -q -9 cryptopp$(LIB_VER).zip $(DIST_FILES)
1501 
1502 # Build the ISO to transfer the ZIP to old distros via CDROM
1503 .PHONY: iso
1504 iso: | zip
1505 ifneq ($(IS_DARWIN),0)
1506  $(MKDIR) $(PWD)/cryptopp$(LIB_VER)
1507  $(CP) cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
1508  hdiutil makehybrid -iso -joliet -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
1509  @-$(RM) -r $(PWD)/cryptopp$(LIB_VER)
1510 else ifneq ($(IS_LINUX)$(IS_HURD),00)
1511  $(MKDIR) $(PWD)/cryptopp$(LIB_VER)
1512  $(CP) cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
1513  genisoimage -q -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
1514  @-$(RM) -r $(PWD)/cryptopp$(LIB_VER)
1515 endif
1516 
1517 # CRYPTOPP_CPU_FREQ in GHz
1518 CRYPTOPP_CPU_FREQ ?= 0.0
1519 .PHONY: bench benchmark benchmarks
1520 bench benchmark benchmarks: cryptest.exe
1521  @-$(RM) -f benchmarks.html
1522  ./cryptest.exe b 2 $(CRYPTOPP_CPU_FREQ)
1523 
1524 adhoc.cpp: adhoc.cpp.proto
1525 ifeq ($(wildcard adhoc.cpp),)
1526  cp adhoc.cpp.proto adhoc.cpp
1527 else
1528  touch adhoc.cpp
1529 endif
1530 
1531 # Include dependencies, if present. You must issue `make deps` to create them.
1532 ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
1533 -include GNUmakefile.deps
1534 endif # Dependencies
1535 
1536 # Cryptogams ARM asm implementation. AES needs -mthumb for Clang
1537 aes_armv4.o : aes_armv4.S
1538  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $<
1539 
1540 # SSSE3 or NEON available
1541 aria_simd.o : aria_simd.cpp
1542  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ARIA_FLAG) -c) $<
1543 
1544 # SSE, NEON or POWER7 available
1545 blake2s_simd.o : blake2s_simd.cpp
1546  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $<
1547 
1548 # SSE, NEON or POWER8 available
1549 blake2b_simd.o : blake2b_simd.cpp
1550  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $<
1551 
1552 # SSE2 or NEON available
1553 chacha_simd.o : chacha_simd.cpp
1554  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_FLAG) -c) $<
1555 
1556 # AVX2 available
1557 chacha_avx.o : chacha_avx.cpp
1558  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $<
1559 
1560 # SSSE3 available
1561 cham_simd.o : cham_simd.cpp
1562  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHAM_FLAG) -c) $<
1563 
1564 # SSE4.2 or ARMv8a available
1565 crc_simd.o : crc_simd.cpp
1566  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRC_FLAG) -c) $<
1567 
1568 # Power9 available
1569 darn.o : darn.cpp
1570  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(DARN_FLAG) -c) $<
1571 
1572 # SSE2 on i686
1573 donna_sse.o : donna_sse.cpp
1574  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
1575 
1576 # Carryless multiply
1577 gcm_simd.o : gcm_simd.cpp
1578  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GCM_FLAG) -c) $<
1579 
1580 # Carryless multiply
1581 gf2n_simd.o : gf2n_simd.cpp
1582  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GF2N_FLAG) -c) $<
1583 
1584 # SSSE3 available
1585 keccak_simd.o : keccak_simd.cpp
1586  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(KECCAK_FLAG) -c) $<
1587 
1588 # SSSE3 available
1589 lea_simd.o : lea_simd.cpp
1590  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $<
1591 
1592 # NEON available
1593 neon_simd.o : neon_simd.cpp
1594  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $<
1595 
1596 # AltiVec available
1597 ppc_simd.o : ppc_simd.cpp
1598  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $<
1599 
1600 # Power7 available
1601 ppc_power7.o : ppc_power7.cpp
1602  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER7_FLAG) -c) $<
1603 
1604 # Power8 available
1605 ppc_power8.o : ppc_power8.cpp
1606  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER8_FLAG) -c) $<
1607 
1608 # Power9 available
1609 ppc_power9.o : ppc_power9.cpp
1610  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER9_FLAG) -c) $<
1611 
1612 # AESNI or ARMv7a/ARMv8a available
1613 rijndael_simd.o : rijndael_simd.cpp
1614  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(AES_FLAG) -c) $<
1615 
1616 # SSE4.2/SHA-NI or ARMv8a available
1617 sha_simd.o : sha_simd.cpp
1618  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
1619 
1620 # Cryptogams SHA1 asm implementation.
1621 sha1_armv4.o : sha1_armv4.S
1622  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
1623 
1624 # Cryptogams SHA256 asm implementation.
1625 sha256_armv4.o : sha256_armv4.S
1626  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
1627 
1628 # Cryptogams SHA512 asm implementation.
1629 sha512_armv4.o : sha512_armv4.S
1630  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
1631 
1632 sha3_simd.o : sha3_simd.cpp
1633  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA3_FLAG) -c) $<
1634 
1635 # SSE4.2/SHA-NI or ARMv8a available
1636 shacal2_simd.o : shacal2_simd.cpp
1637  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
1638 
1639 # SSSE3, NEON or POWER8 available
1640 simon128_simd.o : simon128_simd.cpp
1641  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SIMON128_FLAG) -c) $<
1642 
1643 # SSSE3, NEON or POWER8 available
1644 speck128_simd.o : speck128_simd.cpp
1645  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SPECK128_FLAG) -c) $<
1646 
1647 # ARMv8.4 available
1648 sm3_simd.o : sm3_simd.cpp
1649  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM3_FLAG) -c) $<
1650 
1651 # AESNI available
1652 sm4_simd.o : sm4_simd.cpp
1653  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM4_FLAG) -c) $<
1654 
1655 # IBM XLC -O3 optimization bug
1656 ifeq ($(XLC_COMPILER),1)
1657 sm3.o : sm3.cpp
1658  $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $<
1659 donna_32.o : donna_32.cpp
1660  $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $<
1661 donna_64.o : donna_64.cpp
1662  $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $<
1663 endif
1664 
1665 # SSE2 on i686
1666 sse_simd.o : sse_simd.cpp
1667  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
1668 
1669 # Don't build Rijndael with UBsan. Too much noise due to unaligned data accesses.
1670 ifneq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
1671 rijndael.o : rijndael.cpp
1672  $(CXX) $(strip $(subst -fsanitize=undefined,,$(CXXFLAGS)) -c) $<
1673 endif
1674 
1675 # Only use CRYPTOPP_DATA_DIR if its not set in CXXFLAGS
1676 ifeq ($(findstring -DCRYPTOPP_DATA_DIR, $(CXXFLAGS)),)
1677 ifneq ($(strip $(CRYPTOPP_DATA_DIR)),)
1678 validat%.o : validat%.cpp
1679  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1680 bench%.o : bench%.cpp
1681  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1682 datatest.o : datatest.cpp
1683  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1684 test.o : test.cpp
1685  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $<
1686 endif
1687 endif
1688 
1689 validat1.o : validat1.cpp
1690  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $<
1691 
1692 %.dllonly.o : %.cpp
1693  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c) $< -o $@
1694 
1695 %.import.o : %.cpp
1696  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c) $< -o $@
1697 
1698 %.export.o : %.cpp
1699  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c) $< -o $@
1700 
1701 %.bc : %.cpp
1702  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $<
1703 
1704 %.o : %.cpp
1705  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $<
1706 
1707 .PHONY: so_warning
1708 so_warning:
1709 ifeq ($(HAS_SOLIB_VERSION),1)
1710  $(info WARNING: Only the symlinks to the shared-object library have been updated.)
1711  $(info WARNING: If the library is installed in a system directory you will need)
1712  $(info WARNING: to run 'ldconfig' to update the shared-object library cache.)
1713  $(info )
1714 endif
1715 
1716 .PHONY: dep deps depend
1717 dep deps depend GNUmakefile.deps:
1718  $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps