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