@@ -35,10 +35,11 @@ CLANG_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
35
35
INTEL_COMPILER := $(shell $(CXX ) --version 2>&1 | $(EGREP ) -i -c "\(icc\) ")
36
36
MACPORTS_COMPILER := $(shell $(CXX ) --version 2>&1 | $(EGREP ) -i -c "macports")
37
37
38
- # Sun Studio 12.0 (0x0510) and 12.3 (0x0512)
39
- SUNCC_120_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|6\.)")
40
- SUNCC_122_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[1-9]|5\.[2-9]|6\.)")
41
- SUNCC_123_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[2-9]|5\.[2-9]|6\.)")
38
+ # Sun Studio 12.0 provides SunCC 0x0510; and Sun Studio 12.3 provides SunCC 0x0512
39
+ SUNCC_510_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|6\.)")
40
+ SUNCC_511_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[1-9]|5\.[2-9]|6\.)")
41
+ SUNCC_512_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[2-9]|5\.[2-9]|6\.)")
42
+ SUNCC_513_OR_LATER := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: (Sun|Studio) .* (5\.1[3-9]|5\.[2-9]|6\.)")
42
43
43
44
HAS_SOLIB_VERSION := $(IS_LINUX )
44
45
54
55
55
56
# Base CXXFLAGS used if the user did not specify them
56
57
ifeq ($(SUN_COMPILER ) ,1)
57
- ifeq ($(SUNCC_123_OR_LATER ),1)
58
+ ifeq ($(SUNCC_512_OR_LATER ),1)
58
59
CXXFLAGS ?= -DNDEBUG -g3 -xO2
59
60
else
60
61
CXXFLAGS ?= -DNDEBUG -g -xO2
@@ -141,17 +142,21 @@ else
141
142
endif # X86/X32/X64
142
143
endif
143
144
144
- # Aligned access required at -O3 for GCC due to vectorization (circa 08/2008). Expect other compilers to do the same.
145
+ # Aligned access required for -O3 and above due to vectorization
145
146
UNALIGNED_ACCESS := $(shell $(EGREP ) -c "^[[:space:]]* //[[:space:]]* \#[[:space:]]* define[[:space:]]* CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
146
- ifeq ($(findstring -O3,$(CXXFLAGS ) ) ,-O3)
147
147
ifneq ($(UNALIGNED_ACCESS ) ,0)
148
- ifeq ($(GCC46_OR_LATER ) ,1)
149
148
ifeq ($(findstring -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS,$(CXXFLAGS ) ) ,)
149
+ ifeq ($(findstring -O3,$(CXXFLAGS ) ) ,-O3)
150
+ CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
151
+ endif # -O3
152
+ ifeq ($(findstring -O5,$(CXXFLAGS ) ) ,-O5)
150
153
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
154
+ endif # -O5
155
+ ifeq ($(findstring -Ofast,$(CXXFLAGS ) ) ,-Ofast)
156
+ CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
157
+ endif # -Ofast
151
158
endif # CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
152
- endif # GCC 4.6
153
159
endif # UNALIGNED_ACCESS
154
- endif # Vectorization
155
160
156
161
ifneq ($(INTEL_COMPILER ) ,0)
157
162
CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
@@ -176,6 +181,7 @@ endif
176
181
endif
177
182
178
183
# Tell MacPorts GCC to use Clang integrated assembler
184
+ # http://github.com/weidai11/cryptopp/issues/190
179
185
ifeq ($(GCC_COMPILER )$(MACPORTS_COMPILER ) ,11)
180
186
ifneq ($(findstring -Wa,-q,$(CXXFLAGS ) ) ,-Wa,-q)
181
187
CXXFLAGS += -Wa,-q
@@ -185,6 +191,12 @@ CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1
185
191
endif
186
192
endif
187
193
194
+ # GCC on Solaris needs -m64. Otherwise, i386 is default
195
+ # http://github.com/weidai11/cryptopp/issues/230
196
+ ifeq ($(IS_SUN )$(GCC_COMPILER )$(IS_X64 ) ,111)
197
+ CXXFLAGS += -m64
198
+ endif
199
+
188
200
# Allow use of "/" operator for GNU Assembler.
189
201
# http://sourceware.org/bugzilla/show_bug.cgi?id=4572
190
202
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS ) ) ,)
@@ -219,6 +231,22 @@ CXXFLAGS += -pipe
219
231
endif
220
232
endif
221
233
234
+ # Aligned access required for -O3 and above due to vectorization
235
+ UNALIGNED_ACCESS := $(shell $(EGREP ) -c "^[[:space:]]* //[[:space:]]* \#[[:space:]]* define[[:space:]]* CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
236
+ ifneq ($(UNALIGNED_ACCESS ) ,0)
237
+ ifeq ($(findstring -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS,$(CXXFLAGS ) ) ,)
238
+ ifeq ($(findstring -O3,$(CXXFLAGS ) ) ,-O3)
239
+ CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
240
+ endif # -O3
241
+ ifeq ($(findstring -O5,$(CXXFLAGS ) ) ,-O5)
242
+ CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
243
+ endif # -O5
244
+ ifeq ($(findstring -Ofast,$(CXXFLAGS ) ) ,-Ofast)
245
+ CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
246
+ endif # -Ofast
247
+ endif # CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
248
+ endif # UNALIGNED_ACCESS
249
+
222
250
endif # IS_X86
223
251
224
252
# ##########################################################
@@ -257,9 +285,12 @@ endif
257
285
ifneq ($(SUN_COMPILER ) ,0) # override flags for CC Sun C++ compiler
258
286
IS_64 := $(shell isainfo -b 2>/dev/null | grep -i -c "64")
259
287
ifeq ($(IS_64 ) ,1)
260
- CXXFLAGS += -native - m64
288
+ CXXFLAGS += -m64
261
289
else ifeq ($(IS_64),0)
262
- CXXFLAGS += -native -m32
290
+ CXXFLAGS += -m32
291
+ endif
292
+ ifneq ($(SUNCC_513_OR_LATER ) ,0)
293
+ CXXFLAGS += -native
263
294
endif
264
295
# Add for non-i386
265
296
ifneq ($(IS_X86 ) ,1)
@@ -268,7 +299,7 @@ endif
268
299
# Add to all Solaris
269
300
CXXFLAGS += -template=no%extdef
270
301
# Add to Sun Studio 12.2 and above
271
- ifneq ($(SUNCC_122_OR_LATER ) ,0)
302
+ ifneq ($(SUNCC_511_OR_LATER ) ,0)
272
303
CXXFLAGS += -w -erroff=wvarhidemem -erroff=voidretw
273
304
endif
274
305
SUN_CC10_BUGGY := $(shell $(CXX ) -V 2>&1 | $(EGREP ) -c "CC: Sun .* 5\.10 .* (2009|2010/0[1-4]) ")
@@ -277,7 +308,7 @@ ifneq ($(SUN_CC10_BUGGY),0)
277
308
# remove it if you get "already had a body defined" errors in vector.cc
278
309
CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
279
310
endif
280
- # ifneq ($SUNCC_123_OR_LATER ),0)
311
+ # ifneq ($SUNCC_512_OR_LATER ),0)
281
312
# CXXFLAGS += -xarch=aes -D__AES__=1 -xarch=no%sse4_1 -xarch=no%sse4_2
282
313
# endif
283
314
AR = $(CXX )
@@ -388,7 +419,7 @@ endif # HAS_SOLIB_VERSION
388
419
# List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems.
389
420
# The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp
390
421
# is the second candidate for explicit initialization order.
391
- SRCS := cryptlib.cpp cpu.cpp $(filter-out cryptlib.cpp cpu.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard * .cpp) )
422
+ SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer .cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard * .cpp) )
392
423
393
424
# Need CPU for X86/X64/X32 and ARM
394
425
ifeq ($(IS_X86 )$(IS_X64 )$(IS_ARM32 )$(IS_ARM64 ) ,0000)
@@ -412,7 +443,7 @@ TESTOBJS := $(TESTSRCS:.cpp=.o)
412
443
LIBOBJS := $(filter-out $(TESTOBJS ) ,$(OBJS ) )
413
444
414
445
# List cryptlib.cpp first in an attempt to tame C++ static initialization problems
415
- DLLSRCS := cryptlib.cpp cpu.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp polynomi.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp elgamal.cpp marss.cpp blowfish.cpp ecp.cpp filters.cpp strciphr.cpp camellia.cpp ida.cpp zlib.cpp des.cpp crc.cpp algparam.cpp dessp.cpp tea.cpp eax.cpp network.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp zdeflate.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp blake2.cpp hrtimer.cpp eprecomp.cpp hex.cpp dsa.cpp sha.cpp fips140.cpp gzip.cpp seal.cpp files.cpp base32.cpp vmac.cpp tigertab.cpp sharkbox.cpp safer.cpp randpool.cpp esign.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp integer.cpp sha3.cpp sosemanuk.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdrand.cpp rsa.cpp rdtables.cpp gost.cpp socketft.cpp tftables.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp chacha.cpp gfpcrypt.cpp poly1305.cpp dll.cpp ec2n.cpp blumshub.cpp algebra.cpp basecode.cpp base64.cpp cbcmac.cpp rc6.cpp dh2.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp tiger.cpp cast.cpp rng.cpp square.cpp asn.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp md2.cpp mqv.cpp gf2_32.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp eccrypto.cpp serpent.cpp cmac.cpp
446
+ DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp polynomi.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp elgamal.cpp marss.cpp blowfish.cpp ecp.cpp filters.cpp strciphr.cpp camellia.cpp ida.cpp zlib.cpp des.cpp crc.cpp algparam.cpp dessp.cpp tea.cpp eax.cpp network.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp zdeflate.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp blake2.cpp hrtimer.cpp eprecomp.cpp hex.cpp dsa.cpp sha.cpp fips140.cpp gzip.cpp seal.cpp files.cpp base32.cpp vmac.cpp tigertab.cpp sharkbox.cpp safer.cpp randpool.cpp esign.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp sha3.cpp sosemanuk.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdrand.cpp rsa.cpp rdtables.cpp gost.cpp socketft.cpp tftables.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp chacha.cpp gfpcrypt.cpp poly1305.cpp dll.cpp ec2n.cpp blumshub.cpp algebra.cpp basecode.cpp base64.cpp cbcmac.cpp rc6.cpp dh2.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp tiger.cpp cast.cpp rng.cpp square.cpp asn.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp md2.cpp mqv.cpp gf2_32.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp eccrypto.cpp serpent.cpp cmac.cpp
416
447
DLLOBJS := $(DLLSRCS:.cpp=.export.o )
417
448
418
449
# Import lib testing
@@ -506,6 +537,9 @@ endif
506
537
ifneq ($(wildcard * .exe.dSYM) ,)
507
538
-$(RM) -r *.exe.dSYM/
508
539
endif
540
+ ifneq ($(wildcard * .dylib.dSYM) ,)
541
+ -$(RM) -r *.dylib.dSYM/
542
+ endif
509
543
ifneq ($(wildcard cov-int/) ,)
510
544
-$(RM) -r cov-int/
511
545
endif
@@ -514,7 +548,7 @@ endif
514
548
distclean : clean
515
549
-$(RM ) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt cryptest-* .txt
516
550
-$(RM ) CMakeCache.txt Makefile CTestTestfile.cmake cmake_install.cmake cryptopp-config-version.cmake
517
- -$(RM ) cryptopp.tgz * .o * .ii * .s * ~
551
+ -$(RM ) cryptopp.tgz * .o * .bc * . ii * .s * ~
518
552
ifneq ($(wildcard CMakeFiles/) ,)
519
553
-$(RM) -r CMakeFiles/
520
554
endif
@@ -637,7 +671,7 @@ dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
637
671
$(CXX ) -o $@ $(CXXFLAGS ) $(DLLTESTOBJS ) -L. -lcryptopp.dll $(LDFLAGS ) $(LDLIBS )
638
672
639
673
# This recipe prepares the distro files
640
- TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt CMakeLists.txt config.recommend Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcproj *.dsw *.dsp cryptopp.rc TestVectors/*.txt TestData/*.dat
674
+ TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt CMakeLists.txt config.recommend Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj cryptopp.rc TestVectors/*.txt TestData/*.dat
641
675
EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/
642
676
643
677
ifeq ($(wildcard Filelist.txt) ,Filelist.txt)
@@ -739,10 +773,13 @@ endif
739
773
% .export.o : % .cpp
740
774
$(CXX ) $(CXXFLAGS ) -DCRYPTOPP_EXPORTS -c $< -o $@
741
775
776
+ % .bc : % .cpp
777
+ $(CXX ) $(CXXFLAGS ) -c $<
778
+
742
779
% .o : % .cpp
743
780
$(CXX ) $(CXXFLAGS ) -c $<
744
781
745
- # Warn of potential configuration issues. They will go away after 5.6.3 .
782
+ # Warn of potential configuration issues. They will go away after 5.6.4 .
746
783
UNALIGNED_ACCESS := $(shell $(EGREP ) -c "^[[:space:]]* //[[:space:]]* \#[[:space:]]* define[[:space:]]* CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
747
784
NO_INIT_PRIORITY := $(shell $(EGREP ) -c "^[[:space:]]* //[[:space:]]* \#[[:space:]]* define[[:space:]]* CRYPTOPP_INIT_PRIORITY" config.h)
748
785
COMPATIBILITY_562 := $(shell $(EGREP ) -c "^[[:space:]]* \#[[:space:]]* define[[:space:]]* CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562" config.h)
0 commit comments