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