-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
GNUmakefile
1821 lines (1591 loc) · 60.9 KB
/
GNUmakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###########################################################
##### System Attributes and Programs #####
###########################################################
# https://www.gnu.org/software/make/manual/make.html#Makefile-Conventions
# and https://www.gnu.org/prep/standards/standards.html
SHELL = /bin/sh
# If needed
TMPDIR ?= /tmp
# Used for feature tests
TOUT ?= a.out
TOUT := $(strip $(TOUT))
# Allow override for the cryptest.exe recipe. Change to
# ./libcryptopp.so or ./libcryptopp.dylib to suit your
# taste. https://github.com/weidai11/cryptopp/issues/866
LINK_LIBRARY ?= libcryptopp.a
LINK_LIBRARY_PATH ?= ./
# Command and arguments
AR ?= ar
ARFLAGS ?= -cr # ar needs the dash on OpenBSD
RANLIB ?= ranlib
CP ?= cp
MV ?= mv
RM ?= rm -f
GREP ?= grep
SED ?= sed
CHMOD ?= chmod
MKDIR ?= mkdir -p
LN ?= ln -sf
LDCONF ?= /sbin/ldconfig -n
# Solaris provides a non-Posix sed and grep at /usr/bin
# Solaris 10 is missing AR in /usr/bin
ifneq ($(wildcard /usr/xpg4/bin/grep),)
GREP := /usr/xpg4/bin/grep
endif
ifneq ($(wildcard /usr/xpg4/bin/sed),)
SED := /usr/xpg4/bin/sed
endif
ifneq ($(wildcard /usr/xpg4/bin/ar),)
AR := /usr/xpg4/bin/ar
endif
# Clang is reporting armv8l-unknown-linux-gnueabihf
# for ARMv7 images on Aarch64 hardware.
MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-')
ifeq ($(HOSTX),)
HOSTX := $(shell uname -m 2>/dev/null)
endif
IS_X86 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'i.86|x86|i86')
IS_X64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E '_64|d64')
IS_PPC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'ppc|power')
IS_PPC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'ppc64|powerpc64|power64')
IS_SPARC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'sun|sparc')
IS_SPARC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'sun|sparc64')
IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'arm|armhf|armv7|eabihf|armv8')
IS_ARMV8 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'aarch32|aarch64|arm64')
# Attempt to determine platform
SYSTEMX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
ifeq ($(SYSTEMX),)
SYSTEMX := $(shell uname -s 2>/dev/null)
endif
IS_LINUX := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Linux")
IS_HURD := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c -E "GNU|Hurd")
IS_MINGW := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "MinGW")
IS_CYGWIN := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Cygwin")
IS_DARWIN := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Darwin")
IS_NETBSD := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "NetBSD")
IS_AIX := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "aix")
IS_SUN := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c -E "SunOS|Solaris")
SUN_COMPILER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E 'CC: (Sun|Studio)')
GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E '(llvm|clang)' | $(GREP) -i -c -E '(gcc|g\+\+)')
XLC_COMPILER := $(shell $(CXX) -qversion 2>/dev/null |$(GREP) -i -c "IBM XL")
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E '(llvm|clang)')
INTEL_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c '\(icc\)')
# Enable shared object versioning for Linux and Solaris
HAS_SOLIB_VERSION ?= 0
ifneq ($(IS_LINUX)$(IS_HURD)$(IS_SUN),000)
HAS_SOLIB_VERSION := 1
endif
# Formerly adhoc.cpp was created from adhoc.cpp.proto when needed.
ifeq ($(wildcard adhoc.cpp),)
$(shell cp adhoc.cpp.proto adhoc.cpp)
endif
# Hack to skip CPU feature tests for some recipes
DETECT_FEATURES ?= 1
ifneq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
DETECT_FEATURES := 0
else
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
DETECT_FEATURES := 0
else
ifneq ($(findstring distclean,$(MAKECMDGOALS)),)
DETECT_FEATURES := 0
else
ifneq ($(findstring trim,$(MAKECMDGOALS)),)
DETECT_FEATURES := 0
else
ifneq ($(findstring zip,$(MAKECMDGOALS)),)
DETECT_FEATURES := 0
endif # zip
endif # trim
endif # distclean
endif # clean
endif # CRYPTOPP_DISABLE_ASM
# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed
# because it requires -O1 or higher, but we use -O0 to tame the optimizer.
# Always print testing flags since some tests always happen, like 64-bit.
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CPPFLAGS) $(CXXFLAGS))
ifneq ($(strip $(TCXXFLAGS)),)
$(info Using testing flags: $(TCXXFLAGS))
endif
# TCOMMAND is used for just about all tests. Make will lazy-evaluate
# the variables when executed by $(shell $(TCOMMAND) ...).
TCOMMAND = $(CXX) -I. $(TCXXFLAGS) $(TEXTRA) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT)
# Fixup AIX
ifeq ($(IS_AIX),1)
TPROG = TestPrograms/test_64bit.cpp
TOPT =
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
IS_PPC64=1
else
IS_PPC32=1
endif
endif
# Uncomment for debugging
# $(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8))
###########################################################
##### General Variables #####
###########################################################
# Base CPPFLAGS and CXXFLAGS used if the user did not specify them
ifeq ($(filter -DDEBUG -DNDEBUG,$(CPPFLAGS)$(CXXFLAGS)),)
CRYPTOPP_CPPFLAGS += -DNDEBUG
endif
ifeq ($(filter -g%,$(CPPFLAGS)$(CXXFLAGS)),)
ifeq ($(SUN_COMPILER),1)
CRYPTOPP_CXXFLAGS += -g
else
CRYPTOPP_CXXFLAGS += -g2
endif
endif
ifeq ($(filter -O% -xO%,$(CPPFLAGS)$(CXXFLAGS)),)
ifeq ($(SUN_COMPILER),1)
CRYPTOPP_CXXFLAGS += -xO3
ZOPT = -xO0
else
CRYPTOPP_CXXFLAGS += -O3
ZOPT = -O0
endif
endif
# Needed when the assembler is invoked
ifeq ($(findstring -Wa,--noexecstack,$(ASFLAGS)$(CXXFLAGS)),)
CRYPTOPP_ASFLAGS += -Wa,--noexecstack
endif
# Fix CXX on Cygwin 1.1.4
ifeq ($(CXX),gcc)
CXX := g++
endif
# On ARM we may compile aes_armv4.S, sha1_armv4.S, sha256_armv4.S, and
# sha512_armv4.S through the CC compiler
ifeq ($(GCC_COMPILER),1)
CC=gcc
else
ifeq ($(CLANG_COMPILER),1)
CC=clang
endif
endif
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
ifeq ($(PREFIX),)
PREFIX = /usr/local
PC_PREFIX = /usr/local
else
PC_PREFIX = $(PREFIX)
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib
PC_LIBDIR = $${prefix}/lib
else
PC_LIBDIR = $(LIBDIR)
endif
ifeq ($(DATADIR),)
DATADIR := $(PREFIX)/share
PC_DATADIR = $${prefix}/share
else
PC_DATADIR = $(DATADIR)
endif
ifeq ($(INCLUDEDIR),)
INCLUDEDIR := $(PREFIX)/include
PC_INCLUDEDIR = $${prefix}/include
else
PC_INCLUDEDIR = $(INCLUDEDIR)
endif
ifeq ($(BINDIR),)
BINDIR := $(PREFIX)/bin
endif
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
ifeq ($(ARFLAGS),rv)
ARFLAGS = r
else
ifeq ($(ARFLAGS),-rv)
ARFLAGS = -r
endif
endif
# Original MinGW targets Win2k by default, but lacks proper Win2k support
# if target Windows version is not specified, use Windows XP instead
ifeq ($(IS_MINGW),1)
ifeq ($(findstring -D_WIN32_WINNT,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
ifeq ($(findstring -D_WIN32_WINDOWS,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
ifeq ($(findstring -DWINVER,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
ifeq ($(findstring -DNTDDI_VERSION,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
CRYPTOPP_CPPFLAGS += -D_WIN32_WINNT=0x0501
endif # NTDDI_VERSION
endif # WINVER
endif # _WIN32_WINDOWS
endif # _WIN32_WINNT
endif # IS_MINGW
# Newlib needs _XOPEN_SOURCE=600 for signals
TPROG = TestPrograms/test_newlib.cpp
TOPT =
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ifeq ($(findstring -D_XOPEN_SOURCE,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
CRYPTOPP_CPPFLAGS += -D_XOPEN_SOURCE=600
endif
endif
###########################################################
##### X86/X32/X64 Options #####
###########################################################
ifneq ($(IS_X86)$(IS_X64)$(IS_MINGW),000)
ifeq ($(DETECT_FEATURES),1)
ifeq ($(SUN_COMPILER),1)
SSE2_FLAG = -xarch=sse2
SSE3_FLAG = -xarch=sse3
SSSE3_FLAG = -xarch=ssse3
SSE41_FLAG = -xarch=sse4_1
SSE42_FLAG = -xarch=sse4_2
CLMUL_FLAG = -xarch=aes
AESNI_FLAG = -xarch=aes
AVX_FLAG = -xarch=avx
AVX2_FLAG = -xarch=avx2
SHANI_FLAG = -xarch=sha
else
SSE2_FLAG = -msse2
SSE3_FLAG = -msse3
SSSE3_FLAG = -mssse3
SSE41_FLAG = -msse4.1
SSE42_FLAG = -msse4.2
CLMUL_FLAG = -mpclmul
AESNI_FLAG = -maes
AVX_FLAG = -mavx
AVX2_FLAG = -mavx2
SHANI_FLAG = -msha
endif
# Tell MacPorts and Homebrew GCC to use Clang integrated assembler
# Intel-based Macs. http://github.com/weidai11/cryptopp/issues/190
ifneq ($(IS_DARWIN),0)
ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
TPROG = TestPrograms/test_cxx.cpp
TOPT = -Wa,-q
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
TEXTRA += -Wa,-q
CRYPTOPP_CXXFLAGS += -Wa,-q
endif
endif
endif
TPROG = TestPrograms/test_x86_sse2.cpp
TOPT = $(SSE2_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_FLAG = $(SSE2_FLAG)
SUN_LDFLAGS += $(SSE2_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
SSE2_FLAG =
endif
ifeq ($(SSE2_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
# Need SSE2 or higher for these tests
ifneq ($(SSE2_FLAG),)
TPROG = TestPrograms/test_x86_sse3.cpp
TOPT = $(SSE3_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
SSE3_FLAG =
endif
TPROG = TestPrograms/test_x86_ssse3.cpp
TOPT = $(SSSE3_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(SSSE3_FLAG)
CHAM_FLAG = $(SSSE3_FLAG)
KECCAK_FLAG = $(SSSE3_FLAG)
LEA_FLAG = $(SSSE3_FLAG)
LSH256_FLAG = $(SSSE3_FLAG)
LSH512_FLAG = $(SSSE3_FLAG)
SIMON128_FLAG = $(SSSE3_FLAG)
SPECK128_FLAG = $(SSSE3_FLAG)
SUN_LDFLAGS += $(SSSE3_FLAG)
else
SSSE3_FLAG =
endif
# The first Apple MacBooks were Core2's with SSE4.1
ifneq ($(IS_DARWIN),0)
# Add SSE2 algo's here as required
# They get a free upgrade
endif
TPROG = TestPrograms/test_x86_sse41.cpp
TOPT = $(SSE41_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
BLAKE2B_FLAG = $(SSE41_FLAG)
BLAKE2S_FLAG = $(SSE41_FLAG)
SUN_LDFLAGS += $(SSE41_FLAG)
else
SSE41_FLAG =
endif
TPROG = TestPrograms/test_x86_sse42.cpp
TOPT = $(SSE42_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = $(SSE42_FLAG)
SUN_LDFLAGS += $(SSE42_FLAG)
else
SSE42_FLAG =
endif
TPROG = TestPrograms/test_x86_clmul.cpp
TOPT = $(CLMUL_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
GF2N_FLAG = $(CLMUL_FLAG)
SUN_LDFLAGS += $(CLMUL_FLAG)
else
CLMUL_FLAG =
endif
TPROG = TestPrograms/test_x86_aes.cpp
TOPT = $(AESNI_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
SUN_LDFLAGS += $(AESNI_FLAG)
else
AESNI_FLAG =
endif
TPROG = TestPrograms/test_x86_avx.cpp
TOPT = $(AVX_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
# XXX_FLAG = $(AVX_FLAG)
SUN_LDFLAGS += $(AVX_FLAG)
else
AVX_FLAG =
endif
TPROG = TestPrograms/test_x86_avx2.cpp
TOPT = $(AVX2_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_AVX2_FLAG = $(AVX2_FLAG)
LSH256_AVX2_FLAG = $(AVX2_FLAG)
LSH512_AVX2_FLAG = $(AVX2_FLAG)
SUN_LDFLAGS += $(AVX2_FLAG)
else
AVX2_FLAG =
endif
TPROG = TestPrograms/test_x86_sha.cpp
TOPT = $(SHANI_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
SUN_LDFLAGS += $(SHANI_FLAG)
else
SHANI_FLAG =
endif
ifeq ($(SUN_COMPILER),1)
CRYPTOPP_LDFLAGS += $(SUN_LDFLAGS)
endif
ifeq ($(SSE3_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE3
else
ifeq ($(SSSE3_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSSE3
else
ifeq ($(SSE41_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE4
else
ifeq ($(SSE42_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE4
endif # SSE4.2
endif # SSE4.1
endif # SSSE3
endif # SSE3
ifneq ($(SSE42_FLAG),)
# Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
# test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
ifeq ($(CLMUL_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_CLMUL
endif
ifeq ($(AESNI_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_AESNI
endif
ifeq ($(AVX_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_AVX
else
ifeq ($(AVX2_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_AVX2
endif # AVX2
endif # AVX
# SHANI independent of AVX per GH #1045
ifeq ($(SHANI_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SHANI
endif
endif
# Drop to SSE2 if available
ifeq ($(GCM_FLAG),)
GCM_FLAG = $(SSE2_FLAG)
endif
# Most Clang cannot handle mixed asm with positional arguments, where the
# body is Intel style with no prefix and the templates are AT&T style.
# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
# CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
# Clang compilers. This test will need to be re-enabled if Clang fixes it.
#TPROG = TestPrograms/test_asm_mixed.cpp
#TOPT =
#HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
#ifneq ($(strip $(HAVE_OPT)),0)
# CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
#endif
# SSE2_FLAGS
endif
# DETECT_FEATURES
endif
ifneq ($(INTEL_COMPILER),0)
CRYPTOPP_CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
ICC111_OR_LATER := $(shell $(CXX) --version 2>&1 | $(GREP) -c -E "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
ifeq ($(ICC111_OR_LATER),0)
# "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and
# some x64 inline assembly with ICC 11.0. If you want to use Crypto++'s assembly code
# with ICC, try enabling it on individual files
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
endif
# Allow use of "/" operator for GNU Assembler.
# http://sourceware.org/bugzilla/show_bug.cgi?id=4572
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
ifeq ($(IS_SUN)$(GCC_COMPILER),11)
CRYPTOPP_CXXFLAGS += -Wa,--divide
endif
endif
# IS_X86 and IS_X64
endif
###########################################################
##### ARM A-32 and NEON #####
###########################################################
ifneq ($(IS_ARM32),0)
# No need for feature detection on this platform if NEON is disabled
ifneq ($(findstring -DCRYPTOPP_DISABLE_ARM_NEON,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
DETECT_FEATURES := 0
endif
ifeq ($(DETECT_FEATURES),1)
# Clang needs an option to include <arm_neon.h>
TPROG = TestPrograms/test_arm_neon_header.cpp
TOPT = -DCRYPTOPP_ARM_NEON_HEADER=1 -march=armv7-a -mfpu=neon
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
TEXTRA += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_neon.cpp
TOPT = -march=armv7-a -mfpu=neon
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
NEON_FLAG = -march=armv7-a -mfpu=neon
ARIA_FLAG = -march=armv7-a -mfpu=neon
GCM_FLAG = -march=armv7-a -mfpu=neon
BLAKE2B_FLAG = -march=armv7-a -mfpu=neon
BLAKE2S_FLAG = -march=armv7-a -mfpu=neon
CHACHA_FLAG = -march=armv7-a -mfpu=neon
CHAM_FLAG = -march=armv7-a -mfpu=neon
LEA_FLAG = -march=armv7-a -mfpu=neon
SIMON128_FLAG = -march=armv7-a -mfpu=neon
SPECK128_FLAG = -march=armv7-a -mfpu=neon
SM4_FLAG = -march=armv7-a -mfpu=neon
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
# $(info Running make again to see what failed)
# $(info $(shell $(TCOMMAND)))
NEON_FLAG =
endif
ifeq ($(NEON_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_NEON
endif
# DETECT_FEATURES
endif
# IS_ARM32
endif
###########################################################
##### Aach32 and Aarch64 #####
###########################################################
ifneq ($(IS_ARMV8),0)
ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_arm_neon_header.cpp
TOPT = -DCRYPTOPP_ARM_NEON_HEADER=1
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
TEXTRA += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_acle_header.cpp
TOPT = -DCRYPTOPP_ARM_ACLE_HEADER=1 -march=armv8-a
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
TEXTRA += -DCRYPTOPP_ARM_ACLE_HEADER=1
endif
TPROG = TestPrograms/test_arm_asimd.cpp
TOPT = -march=armv8-a
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ASIMD_FLAG = -march=armv8-a
ARIA_FLAG = -march=armv8-a
BLAKE2B_FLAG = -march=armv8-a
BLAKE2S_FLAG = -march=armv8-a
CHACHA_FLAG = -march=armv8-a
CHAM_FLAG = -march=armv8-a
LEA_FLAG = -march=armv8-a
NEON_FLAG = -march=armv8-a
SIMON128_FLAG = -march=armv8-a
SPECK128_FLAG = -march=armv8-a
SM4_FLAG = -march=armv8-a
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
ASIMD_FLAG =
endif
ifeq ($(ASIMD_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
ifneq ($(ASIMD_FLAG),)
TPROG = TestPrograms/test_arm_crc.cpp
TOPT = -march=armv8-a+crc
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = -march=armv8-a+crc
else
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32
endif
TPROG = TestPrograms/test_arm_aes.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_AES
endif
TPROG = TestPrograms/test_arm_pmull.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = -march=armv8-a+crypto
GF2N_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL
endif
TPROG = TestPrograms/test_arm_sha1.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1
endif
TPROG = TestPrograms/test_arm_sha256.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2
endif
TPROG = TestPrograms/test_arm_sm3.cpp
TOPT = -march=armv8.4-a+sm3
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SM3_FLAG = -march=armv8.4-a+sm3
SM4_FLAG = -march=armv8.4-a+sm3
else
#CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3
#CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
endif
TPROG = TestPrograms/test_arm_sha3.cpp
TOPT = -march=armv8.4-a+sha3
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA3_FLAG = -march=armv8.4-a+sha3
else
#CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3
endif
TPROG = TestPrograms/test_arm_sha512.cpp
TOPT = -march=armv8.4-a+sha512
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA512_FLAG = -march=armv8.4-a+sha512
else
#CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA512
endif
# ASIMD_FLAG
endif
# DETECT_FEATURES
endif
# IS_ARMV8
endif
###########################################################
##### PowerPC #####
###########################################################
# PowerPC and PowerPC64. Altivec is available with POWER4 with GCC and
# POWER6 with XLC. The tests below are crafted for IBM XLC and the LLVM
# front-end. XLC/LLVM only supplies POWER8 so we have to set the flags for
# XLC/LLVM to POWER8. I've got a feeling LLVM is going to cause trouble.
ifneq ($(IS_PPC32)$(IS_PPC64),00)
ifeq ($(DETECT_FEATURES),1)
# IBM XL C/C++ has the -qaltivec flag really screwed up. We can't seem
# to get it enabled without an -qarch= option. And -qarch= produces an
# error on later versions of the compiler. The only thing that seems
# to work consistently is -qarch=auto. -qarch=auto is equivalent to
# GCC's -march=native, which we don't really want.
# XLC requires -qaltivec in addition to Arch or CPU option
ifeq ($(XLC_COMPILER),1)
# POWER9_FLAG = -qarch=pwr9 -qaltivec
POWER8_FLAG = -qarch=pwr8 -qaltivec
POWER7_VSX_FLAG = -qarch=pwr7 -qvsx -qaltivec
POWER7_PWR_FLAG = -qarch=pwr7 -qaltivec
ALTIVEC_FLAG = -qarch=auto -qaltivec
else
# POWER9_FLAG = -mcpu=power9
POWER8_FLAG = -mcpu=power8
POWER7_VSX_FLAG = -mcpu=power7 -mvsx
POWER7_PWR_FLAG = -mcpu=power7
ALTIVEC_FLAG = -maltivec
endif
# GCC 10 is giving us trouble in CPU_ProbePower9() and
# CPU_ProbeDARN(). GCC is generating POWER9 instructions
# on POWER8 for ppc_power9.cpp. The compiler folks did
# not think through the consequences of requiring us to
# use -mcpu=power9 to unlock the ISA. Epic fail.
# https:#github.com/weidai11/cryptopp/issues/986
POWER9_FLAG =
# XLC with LLVM front-ends failed to define XLC defines.
#ifeq ($(findstring -qxlcompatmacros,$(CXXFLAGS)),)
# TPROG = TestPrograms/test_ppc_altivec.cpp
# TOPT = -qxlcompatmacros
# HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
# ifeq ($(strip $(HAVE_OPT)),0)
# CRYPTOPP_CXXFLAGS += -qxlcompatmacros
# endif
#endif
#####################################################################
# Looking for a POWER9 option
#TPROG = TestPrograms/test_ppc_power9.cpp
#TOPT = $(POWER9_FLAG)
#HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
#ifeq ($(strip $(HAVE_OPT)),0)
# DARN_FLAG = $(POWER9_FLAG)
#else
# POWER9_FLAG =
#endif
#####################################################################
# Looking for a POWER8 option
TPROG = TestPrograms/test_ppc_power8.cpp
TOPT = $(POWER8_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(POWER8_FLAG)
BLAKE2B_FLAG = $(POWER8_FLAG)
CRC_FLAG = $(POWER8_FLAG)
GCM_FLAG = $(POWER8_FLAG)
GF2N_FLAG = $(POWER8_FLAG)
LEA_FLAG = $(POWER8_FLAG)
SHA_FLAG = $(POWER8_FLAG)
SHACAL2_FLAG = $(POWER8_FLAG)
else
POWER8_FLAG =
endif
#####################################################################
# Looking for a POWER7 option
# GCC needs -mvsx for Power7 to enable 64-bit vector elements.
# XLC provides 64-bit vector elements without an option.
TPROG = TestPrograms/test_ppc_power7.cpp
TOPT = $(POWER7_VSX_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
POWER7_FLAG = $(POWER7_VSX_FLAG)
else
TPROG = TestPrograms/test_ppc_power7.cpp
TOPT = $(POWER7_PWR_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
POWER7_FLAG = $(POWER7_PWR_FLAG)
else
POWER7_FLAG =
endif
endif
#####################################################################
# Looking for an Altivec option
TPROG = TestPrograms/test_ppc_altivec.cpp
TOPT = $(ALTIVEC_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ALTIVEC_FLAG := $(ALTIVEC_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
ALTIVEC_FLAG =
endif
ifneq ($(ALTIVEC_FLAG),)
BLAKE2S_FLAG = $(ALTIVEC_FLAG)
CHACHA_FLAG = $(ALTIVEC_FLAG)
SPECK128_FLAG = $(ALTIVEC_FLAG)
SIMON128_FLAG = $(ALTIVEC_FLAG)
endif
#####################################################################
# Fixups for algorithms that can drop to a lower ISA, if needed
# Drop to Altivec if higher Power is not available
ifneq ($(ALTIVEC_FLAG),)
ifeq ($(GCM_FLAG),)
GCM_FLAG = $(ALTIVEC_FLAG)
endif
endif
#####################################################################
# Fixups for missing ISAs
ifeq ($(ALTIVEC_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_ALTIVEC
else
ifeq ($(POWER7_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_POWER7
else
ifeq ($(POWER8_FLAG),)
CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_POWER8
#else ifeq ($(POWER9_FLAG),)
# CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_POWER9
endif # POWER8
endif # POWER7
endif # Altivec
# DETECT_FEATURES
endif
# IBM XL C++ compiler
ifeq ($(XLC_COMPILER),1)
ifeq ($(findstring -qmaxmem,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -qmaxmem=-1
endif
# http://www-01.ibm.com/support/docview.wss?uid=swg21007500
ifeq ($(findstring -qrtti,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -qrtti
endif
endif
# IS_PPC32, IS_PPC64
endif
###########################################################
##### Common #####
###########################################################
# Add -fPIC for targets *except* X86, X32, Cygwin or MinGW
ifeq ($(IS_X86)$(IS_CYGWIN)$(IS_MINGW),000)
ifeq ($(findstring -fpic,$(CXXFLAGS))$(findstring -fPIC,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -fPIC
endif
endif
# Fix for GH #1134 and GH #1141. We need to add -fno-devirtualize because GCC is removing
# code we are using. https://github.com/weidai11/cryptopp/issues/1134 and
# https://github.com/weidai11/cryptopp/issues/1141
ifeq ($(findstring -fno-devirtualize,$(CXXFLAGS)),)
TPROG = TestPrograms/test_nodevirtualize.cpp
TOPT = -fno-devirtualize
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -fno-devirtualize
endif # CRYPTOPP_CXXFLAGS
endif # -fno-devirtualize
# Use -pthread whenever it is available. See http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf
# http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling
ifeq ($(DETECT_FEATURES),1)
ifeq ($(XLC_COMPILER),1)
ifeq ($(findstring -qthreaded,$(CXXFLAGS)),)
TPROG = TestPrograms/test_pthreads.cpp
TOPT = -qthreaded
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -qthreaded
endif # CRYPTOPP_CXXFLAGS
endif # -qthreaded
else
ifeq ($(findstring -pthread,$(CXXFLAGS)),)
TPROG = TestPrograms/test_pthreads.cpp
TOPT = -pthread
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -pthread
endif # CRYPTOPP_CXXFLAGS
endif # -pthread
endif # XLC/GCC and friends
endif # DETECT_FEATURES
# Remove -fPIC if present. SunCC use -KPIC, and needs the larger GOT table
# https://docs.oracle.com/cd/E19205-01/819-5267/bkbaq/index.html
ifeq ($(SUN_COMPILER),1)
CRYPTOPP_CXXFLAGS := $(subst -fPIC,-KPIC,$(CRYPTOPP_CXXFLAGS))
CRYPTOPP_CXXFLAGS := $(subst -fpic,-KPIC,$(CRYPTOPP_CXXFLAGS))
endif
# Remove -fPIC if present. IBM XL C++ uses -qpic
ifeq ($(XLC_COMPILER),1)
CRYPTOPP_CXXFLAGS := $(subst -fPIC,-qpic,$(CRYPTOPP_CXXFLAGS))
CRYPTOPP_CXXFLAGS := $(subst -fpic,-qpic,$(CRYPTOPP_CXXFLAGS))
endif
# Disable IBM XL C++ "1500-036: (I) The NOSTRICT option (default at OPT(3))
# has the potential to alter the semantics of a program."
ifeq ($(XLC_COMPILER),1)
TPROG = TestPrograms/test_cxx.cpp
TOPT = -qsuppress=1500-036
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -qsuppress=1500-036
endif # -qsuppress
endif # IBM XL C++ compiler
# libc++ is LLVM's standard C++ library. If we add libc++
# here then all user programs must use it too. The open
# question is, which choice is easier on users?
ifneq ($(IS_DARWIN),0)
CXX ?= c++
# CRYPTOPP_CXXFLAGS += -stdlib=libc++
ifeq ($(findstring -fno-common,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -fno-common
endif
IS_APPLE_LIBTOOL=$(shell libtool -V 2>&1 | $(GREP) -i -c 'Apple')
ifeq ($(IS_APPLE_LIBTOOL),1)
AR = libtool
else
AR = /usr/bin/libtool
endif
ARFLAGS = -static -o
endif
# Add -xregs=no%appl SPARC. SunCC should not use certain registers in library code.
# https://docs.oracle.com/cd/E18659_01/html/821-1383/bkamt.html
ifneq ($(IS_SPARC32)$(IS_SPARC64),00)
ifeq ($(SUN_COMPILER),1)
ifeq ($(findstring -xregs=no%appl,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -xregs=no%appl
endif # -xregs
endif # SunCC
ifeq ($(GCC_COMPILER),1)
ifeq ($(findstring -mno-app-regs,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -mno-app-regs
endif # no-app-regs
endif # GCC
endif # Sparc
# Add -pipe for everything except IBM XL C++, SunCC and ARM.
# Allow ARM-64 because they seems to have >1 GB of memory
ifeq ($(XLC_COMPILER)$(SUN_COMPILER)$(IS_ARM32),000)
ifeq ($(findstring -save-temps,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -pipe
endif
endif
# For SunOS, create a Mapfile that allows our object files
# to contain additional bits (like SSE4 and AES on old Xeon)
# http://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html
ifeq ($(IS_SUN)$(SUN_COMPILER),11)
ifneq ($(IS_X86)$(IS_X64),00)
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CPPFLAGS)$(CPPFLAGS)$(CXXFLAGS)),)
CRYPTOPP_LDFLAGS += -M cryptopp.mapfile
endif # No CRYPTOPP_DISABLE_ASM
endif # X86/X32/X64
endif # SunOS
ifneq ($(IS_LINUX)$(IS_HURD),00)
ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp)
ifeq ($(findstring -lgomp,$(LDLIBS)),)
LDLIBS += -lgomp
endif # LDLIBS
endif # OpenMP
endif # IS_LINUX or IS_HURD