Crypto++ 8.5
Free C++ class library of cryptographic schemes
GNUmakefile-cross
1# https://www.gnu.org/software/make/manual/make.html#Makefile-Conventions
2# and https://www.gnu.org/prep/standards/standards.html
3
4SHELL = /bin/sh
5
6# If needed
7TMPDIR ?= /tmp
8# Used for feature tests
9TOUT ?= a.out
10TOUT := $(strip $(TOUT))
11
12# Allow override for the cryptest.exe recipe. Change to
13# ./libcryptopp.so or ./libcryptopp.dylib to suit your
14# taste. https://github.com/weidai11/cryptopp/issues/866
15LINK_LIBRARY ?= libcryptopp.a
16LINK_LIBRARY_PATH ?= ./
17
18# Default CXXFLAGS if none were provided
19CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe
20
21AR ?= ar
22ARFLAGS ?= cr
23RANLIB ?= ranlib
24CP ?= cp
25MV ?= mv
26CHMOD ?= chmod
27MKDIR ?= mkdir -p
28GREP ?= grep
29SED ?= sed
30
31LN ?= ln -sf
32LDCONF ?= /sbin/ldconfig -n
33
34IS_IOS ?= 0
35IS_ANDROID ?= 0
36IS_ARM_EMBEDDED ?= 0
37
38# Clang is reporting armv8l-unknown-linux-gnueabihf
39# for ARMv7 images on Aarch64 hardware.
40MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
41HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-')
42ifeq ($(HOSTX),)
43 HOSTX := $(shell uname -m 2>/dev/null)
44endif
45
46IS_LINUX := $(shell echo $(MACHINEX) | $(GREP) -i -c "Linux")
47
48# Can be used by Android and Embeeded cross-compiles. Disable by default because
49# Android and embedded users typically don't run this configuration.
50HAS_SOLIB_VERSION ?= 0
51
52# Formely adhoc.cpp was created from adhoc.cpp.proto when needed.
53# This is now needed because ISA tests are performed using adhoc.cpp.
54ifeq ($(wildcard adhoc.cpp),)
55$(shell cp adhoc.cpp.proto adhoc.cpp)
56endif
57
58###########################################################
59##### General Variables #####
60###########################################################
61
62# Default prefix for make install
63ifeq ($(PREFIX),)
64PREFIX = /usr/local
65endif
66
67# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
68ifeq ($(DATADIR),)
69DATADIR := $(PREFIX)/share
70endif
71ifeq ($(LIBDIR),)
72LIBDIR := $(PREFIX)/lib
73endif
74ifeq ($(BINDIR),)
75BINDIR := $(PREFIX)/bin
76endif
77ifeq ($(INCLUDEDIR),)
78INCLUDEDIR := $(PREFIX)/include
79endif
80
81# We honor ARFLAGS, but the "v" option used by default causes a noisy make
82ifeq ($(ARFLAGS),rv)
83 ARFLAGS = r
84endif
85
86# Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
87# Its a shame because GCC has so much to offer by the way of analysis.
88# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
89ifneq ($(CLANG_COMPILER),0)
90 CXXFLAGS += -Wall
91endif
92
93###########################################################
94##### iOS #####
95###########################################################
96
97# iOS cross-compile configuration.
98# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
99ifeq ($(IS_IOS),1)
100 CXXFLAGS += $(IOS_CXXFLAGS) -stdlib=libc++
101 CXXFLAGS += --sysroot "$(IOS_SYSROOT)"
102
103 AR = libtool
104 ARFLAGS = -static -o
105endif
106
107###########################################################
108##### Android #####
109###########################################################
110
111# Android cross-compile configuration.
112# See http://www.cryptopp.com/wiki/Android_(Command_Line).
113ifeq ($(IS_ANDROID),1)
114 CPPFLAGS += $(ANDROID_CPPFLAGS)
115 CPPFLAGS += -DANDROID
116 CXXFLAGS += $(ANDROID_CXXFLAGS)
117 CXXFLAGS += --sysroot=$(ANDROID_SYSROOT)
118 CXXFLAGS += -Wa,--noexecstack
119
120 # Aarch64 ld does not understand --warn-execstack
121 LDFLAGS += $(ANDROID_LDFLAGS)
122 LDFLAGS += -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
123 LDFLAGS += -Wl,--warn-shared-textrel -Wl,--warn-common
124 LDFLAGS += -Wl,--warn-unresolved-symbols
125 LDFLAGS += -Wl,--gc-sections -Wl,--fatal-warnings
126
127 # Source files copied into PWD for Android cpu-features
128 # setenv-android.sh does the copying. Its a dirty compile.
129 ANDROID_CPU_OBJ = cpu-features.o
130endif
131
132###########################################################
133##### Embedded #####
134###########################################################
135
136# ARM embedded cross-compile configuration.
137# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
138# and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
139ifeq ($(IS_ARM_EMBEDDED),1)
140 # CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-embedded.sh'
141 CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT)
142endif
143
144###########################################################
145##### Compiler and Platform #####
146###########################################################
147
148# Wait until CXXFLAGS have been set by setenv scripts.
149
150GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E 'llvm|clang' | $(GREP) -i -c -E '(gcc|g\+\+)')
151CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E 'llvm|clang')
152
153HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-')
154ifeq ($(HOSTX),)
155 HOSTX := $(shell uname -m 2>/dev/null)
156endif
157
158# This dance is because Clang reports the host architecture instead
159# of the target architecture. Running Clang on an x86_64 machine with
160# -arch arm64 yields x86_64 instead of aarch64 or arm64.
161
162ifeq ($(CLANG_COMPILER),1)
163 IS_X86 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
164 IS_X64 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'x86_64|amd64')
165 IS_ARM32 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
166 IS_ARMV8 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
167else
168 IS_X86 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
169 IS_X64 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'x86_64|amd64')
170 IS_ARM32 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
171 IS_ARMV8 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
172endif
173
174ifeq ($(IS_ARMV8),1)
175 IS_ARM32 = 0
176endif
177
178IS_X32 := 0
179IS_PPC32 := 0
180IS_PPC64 := 0
181
182$(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8))
183
184###########################################################
185##### Test Program #####
186###########################################################
187
188# Hack to skip CPU feature tests for some recipes
189DETECT_FEATURES ?= 1
190ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),-DCRYPTOPP_DISABLE_ASM)
191 DETECT_FEATURES := 0
192else ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
193 DETECT_FEATURES := 0
194else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean)
195 DETECT_FEATURES := 0
196else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim)
197 DETECT_FEATURES := 0
198else ifeq ($(IS_IOS),1)
199 DETECT_FEATURES := 0
200endif
201
202# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed
203# because it requires -O1 or higher, but we use -O0 to tame the optimizer.
204ifeq ($(DETECT_FEATURES),1)
205 TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
206 ifneq ($(strip $(TCXXFLAGS)),)
207 $(info Using testing flags: $(TCXXFLAGS))
208 endif
209 #TPROG = TestPrograms/test_cxx.cxx
210 #$(info Testing compile... )
211 #$(info $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 1>/dev/null))
212endif
213
214# For the previous messages
215$(info )
216
217###########################################################
218##### X86/X32/X64 Options #####
219###########################################################
220
221ifneq ($(IS_X86)$(IS_X64),00)
222ifeq ($(DETECT_FEATURES),1)
223
224 SSE2_FLAG = -msse2
225 SSE3_FLAG = -msse3
226 SSSE3_FLAG = -mssse3
227 SSE41_FLAG = -msse4.1
228 SSE42_FLAG = -msse4.2
229 CLMUL_FLAG = -mpclmul
230 AESNI_FLAG = -maes
231 AVX_FLAG = -mavx
232 AVX2_FLAG = -mavx2
233 SHANI_FLAG = -msha
234
235 TPROG = TestPrograms/test_x86_sse2.cxx
236 TOPT = $(SSE2_FLAG)
237 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
238 ifeq ($(strip $(HAVE_OPT)),0)
239 CHACHA_FLAG = $(SSE2_FLAG)
240 else
241 SSE2_FLAG =
242 endif
243
244 TPROG = TestPrograms/test_x86_ssse3.cxx
245 TOPT = $(SSSE3_FLAG)
246 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
247 ifeq ($(strip $(HAVE_OPT)),0)
248 ARIA_FLAG = $(SSSE3_FLAG)
249 CHAM_FLAG = $(SSSE3_FLAG)
250 KECCAK_FLAG = $(SSSE3_FLAG)
251 LEA_FLAG = $(SSSE3_FLAG)
252 SIMON128_FLAG = $(SSSE3_FLAG)
253 SPECK128_FLAG = $(SSSE3_FLAG)
254 else
255 SSSE3_FLAG =
256 endif
257
258 TPROG = TestPrograms/test_x86_sse41.cxx
259 TOPT = $(SSE41_FLAG)
260 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
261 ifeq ($(strip $(HAVE_OPT)),0)
262 BLAKE2B_FLAG = $(SSE41_FLAG)
263 BLAKE2S_FLAG = $(SSE41_FLAG)
264 else
265 SSE41_FLAG =
266 endif
267
268 TPROG = TestPrograms/test_x86_sse42.cxx
269 TOPT = $(SSE42_FLAG)
270 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
271 ifeq ($(strip $(HAVE_OPT)),0)
272 CRC_FLAG = $(SSE42_FLAG)
273 else
274 SSE42_FLAG =
275 endif
276
277 TPROG = TestPrograms/test_x86_clmul.cxx
278 TOPT = $(CLMUL_FLAG)
279 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
280 ifeq ($(strip $(HAVE_OPT)),0)
281 GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
282 GF2N_FLAG = $(CLMUL_FLAG)
283 else
284 CLMUL_FLAG =
285 endif
286
287 TPROG = TestPrograms/test_x86_aes.cxx
288 TOPT = $(AESNI_FLAG)
289 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
290 ifeq ($(strip $(HAVE_OPT)),0)
291 AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
292 SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
293 else
294 AESNI_FLAG =
295 endif
296
297 TPROG = TestPrograms/test_x86_avx.cxx
298 TOPT = $(AVX_FLAG)
299 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
300 ifeq ($(strip $(HAVE_OPT)),0)
301 # XXX_FLAG = $(AVX_FLAG)
302 else
303 AVX_FLAG =
304 endif
305
306 TPROG = TestPrograms/test_x86_avx2.cxx
307 TOPT = $(AVX2_FLAG)
308 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
309 ifeq ($(strip $(HAVE_OPT)),0)
310 CHACHA_AVX2_FLAG = $(AVX2_FLAG)
311 else
312 AVX2_FLAG =
313 endif
314
315 TPROG = TestPrograms/test_x86_sha.cxx
316 TOPT = $(SHANI_FLAG)
317 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
318 ifeq ($(strip $(HAVE_OPT)),0)
319 SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
320 else
321 SHANI_FLAG =
322 endif
323
324 ifeq ($(SSE2_FLAG),)
325 CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
326 else ifeq ($(SSE3_FLAG),)
327 CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
328 else ifeq ($(SSSE3_FLAG),)
329 CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
330 else ifeq ($(SSE41_FLAG),)
331 CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
332 else ifeq ($(SSE42_FLAG),)
333 CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
334 endif
335
336 ifneq ($(SSE42_FLAG),)
337
338 # Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
339 # test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
340 ifeq ($(CLMUL_FLAG),)
341 CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
342 endif
343 ifeq ($(AESNI_FLAG),)
344 CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
345 endif
346
347 ifeq ($(AVX_FLAG),)
348 CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
349 else ifeq ($(AVX2_FLAG),)
350 CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
351 else ifeq ($(SHANI_FLAG),)
352 CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
353 endif
354 endif
355
356 # Drop to SSE2 if available
357 ifeq ($(GCM_FLAG),)
358 ifneq ($(SSE2_FLAG),)
359 GCM_FLAG = $(SSE2_FLAG)
360 endif
361 endif
362
363 # Most Clang cannot handle mixed asm with positional arguments, where the
364 # body is Intel style with no prefix and the templates are AT&T style.
365 # Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
366
367 # CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
368 # Clang compilers. This test will need to be re-enabled if Clang fixes it.
369 #TPROG = TestPrograms/test_asm_mixed.cxx
370 #HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
371 #ifneq ($(strip $(HAVE_OPT)),0)
372 # CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
373 #endif
374
375# DETECT_FEATURES
376endif
377
378# IS_X86, IS_X32 and IS_X64
379endif
380
381###########################################################
382##### ARM A-32 and NEON #####
383###########################################################
384
385ifneq ($(IS_ARM32),0)
386ifeq ($(DETECT_FEATURES),1)
387
388 # Android needs -c compile flag for NEON. Otherwise there's an odd linker message.
389 ifeq ($(IS_ANDROID),1)
390 NEON_FLAG = -march=armv7-a -mfpu=vfpv3-d16 -mfpu=neon
391 else
392 NEON_FLAG = -march=armv7-a -mfpu=neon
393 endif
394
395 # Clang needs an option to include <arm_neon.h>
396 TPROG = TestPrograms/test_arm_neon_header.cxx
397 TOPT = $(NEON_FLAG)
398 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
399 ifeq ($(strip $(HAVE_OPT)),0)
400 THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
401 endif
402
403 TPROG = TestPrograms/test_arm_neon.cxx
404 TOPT = $(NEON_FLAG)
405 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
406 ifeq ($(strip $(HAVE_OPT)),0)
407 ARIA_FLAG = $(NEON_FLAG)
408 AES_FLAG = $(NEON_FLAG)
409 CRC_FLAG = $(NEON_FLAG)
410 GCM_FLAG = $(NEON_FLAG)
411 BLAKE2B_FLAG = $(NEON_FLAG)
412 BLAKE2S_FLAG = $(NEON_FLAG)
413 CHACHA_FLAG = $(NEON_FLAG)
414 CHAM_FLAG = $(NEON_FLAG)
415 LEA_FLAG = $(NEON_FLAG)
416 SHA_FLAG = $(NEON_FLAG)
417 SIMON128_FLAG = $(NEON_FLAG)
418 SPECK128_FLAG = $(NEON_FLAG)
419 SM4_FLAG = $(NEON_FLAG)
420 else
421 NEON_FLAG =
422 CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
423 endif
424
425# DETECT_FEATURES
426endif
427# IS_ARM32
428endif
429
430###########################################################
431##### Aach32 and Aarch64 #####
432###########################################################
433
434ifneq ($(IS_ARMV8),0)
435ifeq ($(DETECT_FEATURES),1)
436
437 ifeq ($(IS_IOS),1)
438 ASIMD_FLAG =
439 CRC_FLAG =
440 AES_FLAG =
441 PMUL_FLAG =
442 SHA_FLAG =
443 else
444 ASIMD_FLAG = -march=armv8-a
445 CRC_FLAG = -march=armv8-a+crc
446 AES_FLAG = -march=armv8-a+crypto
447 GCM_FLAG = -march=armv8-a+crypto
448 GF2N_FLAG = -march=armv8-a+crypto
449 SHA_FLAG = -march=armv8-a+crypto
450 endif
451
452 TPROG = TestPrograms/test_arm_neon_header.cxx
453 TOPT =
454 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
455 ifeq ($(strip $(HAVE_OPT)),0)
456 THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
457 endif
458
459 TPROG = TestPrograms/test_arm_acle_header.cxx
460 TOPT = $(ASIMD_FLAG)
461 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
462 ifeq ($(strip $(HAVE_OPT)),0)
463 THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1
464 endif
465
466 TPROG = TestPrograms/test_arm_asimd.cxx
467 TOPT = $(ASIMD_FLAG)
468 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
469 ifeq ($(strip $(HAVE_OPT)),0)
470 ARIA_FLAG = $(ASIMD_FLAG)
471 BLAKE2B_FLAG = $(ASIMD_FLAG)
472 BLAKE2S_FLAG = $(ASIMD_FLAG)
473 CHACHA_FLAG = $(ASIMD_FLAG)
474 CHAM_FLAG = $(ASIMD_FLAG)
475 LEA_FLAG = $(ASIMD_FLAG)
476 NEON_FLAG = $(ASIMD_FLAG)
477 SIMON128_FLAG = $(ASIMD_FLAG)
478 SPECK128_FLAG = $(ASIMD_FLAG)
479 SM4_FLAG = $(ASIMD_FLAG)
480 else
481 ASIMD_FLAG =
482 CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
483 endif
484
485 TPROG = TestPrograms/test_arm_crc.cxx
486 TOPT = $(CRC_FLAG)
487 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
488 ifneq ($(strip $(HAVE_OPT)),0)
489 CRC_FLAG =
490 CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32
491 endif
492
493 TPROG = TestPrograms/test_arm_aes.cxx
494 TOPT = $(AES_FLAG)
495 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
496 ifneq ($(strip $(HAVE_OPT)),0)
497 AES_FLAG =
498 CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES
499 endif
500
501 TPROG = TestPrograms/test_arm_pmull.cxx
502 TOPT = $(PMULL_FLAG)
503 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
504 ifneq ($(strip $(HAVE_OPT)),0)
505 GCM_FLAG =
506 GF2N_FLAG =
507 CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL
508 endif
509
510 TPROG = TestPrograms/test_arm_sha1.cxx
511 TOPT = $(SHA_FLAG)
512 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
513 ifneq ($(strip $(HAVE_OPT)),0)
514 SHA_FLAG =
515 CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1
516 endif
517
518 TPROG = TestPrograms/test_arm_sha256.cxx
519 TOPT = $(SHA_FLAG)
520 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
521 ifneq ($(strip $(HAVE_OPT)),0)
522 SHA_FLAG =
523 CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2
524 endif
525
526 TPROG = TestPrograms/test_arm_sm3.cxx
527 TOPT = -march=armv8.4-a+crypto
528 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
529 ifeq ($(strip $(HAVE_OPT)),0)
530 SM3_FLAG = -march=armv8.4-a+crypto
531 SM4_FLAG = -march=armv8.4-a+crypto
532 else
533 #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3
534 #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
535 endif
536
537 TPROG = TestPrograms/test_arm_sha3.cxx
538 TOPT = -march=armv8.4-a+crypto
539 HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
540 ifeq ($(strip $(HAVE_OPT)),0)
541 SHA3_FLAG = -march=armv8.4-a+crypto
542 SHA512_FLAG = -march=armv8.4-a+crypto
543 else
544 #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3
545 #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
546 endif
547
548# DETECT_FEATURES
549endif
550# IS_ARMV8
551endif
552
553###########################################################
554##### Common #####
555###########################################################
556
557# No ASM for Travis testing
558ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm)
559 ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
560 CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
561 endif # CXXFLAGS
562endif # No ASM
563
564# Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
565ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
566 ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
567 CXXFLAGS += -fsanitize=undefined
568 endif # CXXFLAGS
569 ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
570 CXXFLAGS += -DCRYPTOPP_COVERAGE
571 endif # CXXFLAGS
572endif # UBsan
573
574# Address Sanitizer (Asan) testing. Issue 'make asan'.
575ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
576 ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
577 CXXFLAGS += -fsanitize=address
578 endif # CXXFLAGS
579 ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
580 CXXFLAGS += -DCRYPTOPP_COVERAGE
581 endif # CXXFLAGS
582 ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
583 CXXFLAGS += -fno-omit-frame-pointer
584 endif # CXXFLAGS
585endif # Asan
586
587# LD gold linker testing. Triggered by 'LD=ld.gold'.
588ifeq ($(findstring ld.gold,$(LD)),ld.gold)
589 ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
590 ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf")
591 ifneq ($(ELF_FORMAT),0)
592 LDFLAGS += -fuse-ld=gold
593 endif # ELF/ELF64
594 endif # CXXFLAGS
595endif # Gold
596
597# Valgrind testing. Issue 'make valgrind'.
598ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
599 # Tune flags; see http://valgrind.org/docs/manual/quick-start.html
600 CXXFLAGS := $(CXXFLAGS:-g%=-g3)
601 CXXFLAGS := $(CXXFLAGS:-O%=-O1)
602 CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
603 ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
604 CXXFLAGS += -DCRYPTOPP_COVERAGE
605 endif # -DCRYPTOPP_COVERAGE
606endif # Valgrind
607
608# Debug testing on GNU systems. Triggered by -DDEBUG.
609# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
610ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
611 USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E pch.cpp 2>&1 | $(GREP) -i -c "__GLIBCXX__")
612 ifneq ($(USING_GLIBCXX),0)
613 ifeq ($(HAS_NEWLIB),0)
614 ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
615 CXXFLAGS += -D_GLIBCXX_DEBUG
616 endif # CXXFLAGS
617 endif # HAS_NEWLIB
618 endif # USING_GLIBCXX
619endif # GNU Debug build
620
621# Dead code stripping. Issue 'make lean'.
622ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
623 ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
624 CXXFLAGS += -ffunction-sections
625 endif # CXXFLAGS
626 ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
627 CXXFLAGS += -fdata-sections
628 endif # CXXFLAGS
629 ifneq ($(IS_IOS),0)
630 ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
631 LDFLAGS += -Wl,-dead_strip
632 endif # CXXFLAGS
633 else # BSD, Linux and Unix
634 ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
635 LDFLAGS += -Wl,--gc-sections
636 endif # LDFLAGS
637 endif # MAKECMDGOALS
638endif # Dead code stripping
639
640###########################################################
641##### Source and object files #####
642###########################################################
643
644# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
645SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp)))
646# For Makefile.am; resource.h is Windows
647INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
648
649# Cryptogams source files. We couple to ARMv7.
650# Limit to Linux. The source files target the GNU assembler.
651# Also see https://www.cryptopp.com/wiki/Cryptogams.
652ifeq ($(IS_ARM32)$(IS_LINUX),11)
653 ifeq ($(CLANG_COMPILER),1)
654 CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
655 CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack
656 else
657 CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
658 CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack
659 endif
660 SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S
661endif
662
663# Remove unneeded arch specific files to speed build time.
664ifeq ($(IS_PPC32)$(IS_PPC64),00)
665 SRCS := $(filter-out ppc_%,$(SRCS))
666endif
667ifeq ($(IS_ARM32)$(IS_ARMV8),00)
668 SRCS := $(filter-out arm_%,$(SRCS))
669 SRCS := $(filter-out neon_%,$(SRCS))
670endif
671ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000)
672 SRCS := $(filter-out sse_%,$(SRCS))
673endif
674
675# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
676OBJS := $(SRCS:.cpp=.o)
677OBJS := $(OBJS:.S=.o)
678
679# List test.cpp first to tame C++ static initialization problems.
680TESTSRCS := 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
681TESTINCL := bench.h factory.h validate.h
682
683# Test objects
684TESTOBJS := $(TESTSRCS:.cpp=.o)
685LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
686
687# Clean recipe, Issue 998. Don't filter-out some artifacts from the list of objects
688# The *.S is a hack. It makes the ASM appear like C++ so the object files make the CLEAN_OBJS list
689CLEAN_SRCS := $(wildcard *.cpp) $(patsubst %.S,%.cpp,$(wildcard *.S))
690CLEAN_OBJS := $(CLEAN_SRCS:.cpp=.o) $(CLEAN_SRCS:.cpp=.import.o) $(CLEAN_SRCS:.cpp=.export.o)
691
692# For Shared Objects, Diff, Dist/Zip rules
693LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3)
694LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
695LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
696LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
697
698ifeq ($(strip $(LIB_PATCH)),)
699LIB_PATCH := 0
700endif
701
702ifeq ($(HAS_SOLIB_VERSION),1)
703# Full version suffix for shared library
704SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
705# Different patchlevels and minors are compatible since 6.1
706SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR)
707SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
708endif # HAS_SOLIB_VERSION
709
710###########################################################
711##### Targets and Recipes #####
712###########################################################
713
714# Default builds program with static library only
715.PHONY: default
716default: cryptest.exe
717
718.PHONY: all static dynamic
719all: static dynamic cryptest.exe
720
721ifneq ($(IS_IOS),0)
722static: libcryptopp.a
723shared dynamic dylib: libcryptopp.dylib
724else
725static: libcryptopp.a
726shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
727endif
728
729.PHONY: test check
730test check: cryptest.exe
731 ./cryptest.exe v
732
733# CXXFLAGS are tuned earlier. Applications must use linker flags
734# -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
735.PHONY: lean
736lean: static dynamic cryptest.exe
737
738.PHONY: clean
739clean:
740 -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(CLEAN_OBJS) $(ANDROID_CPU_OBJ) rdrand-*.o
741 @-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
742 @-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX)
743 @-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et
744 @-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
745 @-$(RM) /tmp/adhoc.exe
746 @-$(RM) -r /tmp/cryptopp_test/
747 @-$(RM) -r *.exe.dSYM/
748 @-$(RM) -r *.dylib.dSYM/
749 @-$(RM) -r cov-int/
750
751.PHONY: autotools-clean
752autotools-clean:
753 @-$(RM) -f configure.ac configure configure.in Makefile.am Makefile.in Makefile
754 @-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp
755 @-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing
756 @-$(RM) -f cryptest cryptestcwd libtool* libcryptopp.la libcryptopp.pc*
757 @-$(RM) -rf build-aux/ m4/ auto*.cache/ .deps/ .libs/
758
759.PHONY: cmake-clean
760cmake-clean:
761 @-$(RM) -f cryptopp-config.cmake CMakeLists.txt
762 @-$(RM) -rf cmake_build/
763
764.PHONY: android-clean
765android-clean:
766 @-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp))
767 @-$(RM) -rf obj/
768
769.PHONY: distclean
770distclean: clean autotools-clean cmake-clean android-clean
771 -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
772 @-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
773 @-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
774 @-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
775 @-$(RM) -r $(LIBOBJS:.o=.lst) $(TESTOBJS:.o=.lst)
776 @-$(RM) -r TestCoverage/ ref*/
777 @-$(RM) cryptopp$(LIB_VER)\.* CryptoPPRef.zip
778
779# Install cryptest.exe, libcryptopp.a and libcryptopp.so.
780# The library install was broken-out into its own recipe at GH #653.
781.PHONY: install
782install: cryptest.exe install-lib
783 @-$(MKDIR) $(DESTDIR)$(BINDIR)
784 $(CP) cryptest.exe $(DESTDIR)$(BINDIR)
785 $(CHMOD) u=rwx,go=rx $(DESTDIR)$(BINDIR)/cryptest.exe
786 @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData
787 @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
788 $(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData
789 $(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
790 $(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
791 $(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
792
793# A recipe to install only the library, and not cryptest.exe. Also
794# see https://github.com/weidai11/cryptopp/issues/653.
795.PHONY: install-lib
796install-lib:
797 @-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp
798 $(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
799 $(CHMOD) u=rw,go=r $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
800ifneq ($(wildcard libcryptopp.a),)
801 @-$(MKDIR) $(DESTDIR)$(LIBDIR)
802 $(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
803 $(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/libcryptopp.a
804endif
805ifneq ($(wildcard libcryptopp.dylib),)
806 @-$(MKDIR) $(DESTDIR)$(LIBDIR)
807 $(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
808 $(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
809 -install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
810endif
811ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
812 @-$(MKDIR) $(DESTDIR)$(LIBDIR)
813 $(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
814 $(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
815ifeq ($(HAS_SOLIB_VERSION),1)
816 -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
817 $(LDCONF) $(DESTDIR)$(LIBDIR)
818endif
819endif
820ifneq ($(wildcard libcryptopp.pc),)
821 @-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig
822 $(CP) libcryptopp.pc $(DESTDIR)$(LIBDIR)/pkgconfig
823 $(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc
824endif
825
826.PHONY: remove uninstall
827remove uninstall:
828 -$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
829 -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
830 -$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
831 @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
832 @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
833 @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
834 @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
835
836libcryptopp.a: $(LIBOBJS) $(ANDROID_CPU_OBJ)
837 $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(ANDROID_CPU_OBJ)
838 $(RANLIB) $@
839
840ifeq ($(HAS_SOLIB_VERSION),1)
841.PHONY: libcryptopp.so
842libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
843endif
844
845libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) $(ANDROID_CPU_OBJ)
846 $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(ANDROID_CPU_OBJ) $(LDFLAGS) $(LDLIBS)
847ifeq ($(HAS_SOLIB_VERSION),1)
848 -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
849 -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
850endif
851
852libcryptopp.dylib: $(LIBOBJS)
853 $(CXX) -dynamiclib -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
854
855cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS)
856 $(CXX) -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS)
857
858# Used to generate list of source files for Autotools, CMakeList and Android.mk
859.PHONY: sources
860sources:
861 $(info ***** Library sources *****)
862 $(info $(filter-out $(TESTSRCS),$(SRCS)))
863 $(info )
864 $(info ***** Library headers *****)
865 $(info $(filter-out $(TESTINCL),$(INCL)))
866 $(info )
867 $(info ***** Test sources *****)
868 $(info $(TESTSRCS))
869 $(info )
870 $(info ***** Test headers *****)
871 $(info $(TESTINCL))
872
873adhoc.cpp: adhoc.cpp.proto
874ifeq ($(wildcard adhoc.cpp),)
875 cp adhoc.cpp.proto adhoc.cpp
876else
877 touch adhoc.cpp
878endif
879
880# Include dependencies, if present. You must issue `make deps` to create them.
881ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
882-include GNUmakefile.deps
883endif # Dependencies
884
885# A few recipes trigger warnings for -std=c++11 and -stdlib=c++
886NOSTD_CXXFLAGS=$(filter-out -stdlib=%,$(filter-out -std=%,$(CXXFLAGS)))
887
888# Cryptogams ARM asm implementation. AES needs -mthumb for Clang
889aes_armv4.o : aes_armv4.S
890 $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $<
891
892# Use C++ compiler on C source after patching.
893# https://github.com/weidai11/cryptopp/issues/926
894cpu-features.o: cpu-features.h cpu-features.c
895 $(CXX) -x c $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) -c) cpu-features.c
896
897# SSSE3 or NEON available
898aria_simd.o : aria_simd.cpp
899 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ARIA_FLAG) -c) $<
900
901# SSE, NEON or POWER7 available
902blake2s_simd.o : blake2s_simd.cpp
903 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $<
904
905# SSE, NEON or POWER8 available
906blake2b_simd.o : blake2b_simd.cpp
907 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $<
908
909# SSE2 or NEON available
910chacha_simd.o : chacha_simd.cpp
911 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_FLAG) -c) $<
912
913# AVX2 available
914chacha_avx.o : chacha_avx.cpp
915 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $<
916
917# SSSE3 available
918cham_simd.o : cham_simd.cpp
919 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHAM_FLAG) -c) $<
920
921# Power9 available
922darn.o : darn.cpp
923 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(DARN_FLAG) -c) $<
924
925# SSE2 on i686
926donna_sse.o : donna_sse.cpp
927 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
928
929# SSE2 on i686
930sse_simd.o : sse_simd.cpp
931 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
932
933# SSE4.2 or ARMv8a available
934crc_simd.o : crc_simd.cpp
935 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRC_FLAG) -c) $<
936
937# PCLMUL or ARMv7a/ARMv8a available
938gcm_simd.o : gcm_simd.cpp
939 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GCM_FLAG) -c) $<
940
941# Carryless multiply
942gf2n_simd.o : gf2n_simd.cpp
943 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GF2N_FLAG) -c) $<
944
945# SSSE3 available
946keccak_simd.o : keccak_simd.cpp
947 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(KECCAK_FLAG) -c) $<
948
949# SSSE3 available
950lea_simd.o : lea_simd.cpp
951 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $<
952
953# NEON available
954neon_simd.o : neon_simd.cpp
955 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $<
956
957# AESNI or ARMv7a/ARMv8a available
958rijndael_simd.o : rijndael_simd.cpp
959 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(AES_FLAG) -c) $<
960
961# SSE4.2/SHA-NI or ARMv8a available
962sha_simd.o : sha_simd.cpp
963 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
964
965# Cryptogams SHA1 asm implementation.
966sha1_armv4.o : sha1_armv4.S
967 $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
968
969# Cryptogams SHA256 asm implementation.
970sha256_armv4.o : sha256_armv4.S
971 $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
972
973# Cryptogams SHA512 asm implementation.
974sha512_armv4.o : sha512_armv4.S
975 $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
976
977# SSE4.2/SHA-NI or ARMv8a available
978shacal2_simd.o : shacal2_simd.cpp
979 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
980
981# SSSE3, NEON or POWER8 available
982simon128_simd.o : simon128_simd.cpp
983 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SIMON128_FLAG) -c) $<
984
985# SSSE3, NEON or POWER8 available
986speck128_simd.o : speck128_simd.cpp
987 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SPECK128_FLAG) -c) $<
988
989# ARMv8.4 available
990sm3_simd.o : sm3_simd.cpp
991 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM3_FLAG) -c) $<
992
993# AESNI available
994sm4_simd.o : sm4_simd.cpp
995 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM4_FLAG) -c) $<
996
997%.o : %.cpp
998 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $<
999
1000.PHONY: dep deps depend
1001dep deps depend GNUmakefile.deps:
1002 $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps