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