Crypto++  6.1
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 
4 SHELL = /bin/sh
5 
6 # Default CXXFLAGS if none were provided
7 CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe
8 
9 AR ?= ar
10 ARFLAGS ?= cr
11 RANLIB ?= ranlib
12 CP ?= cp
13 MV ?= mv
14 CHMOD ?= chmod
15 MKDIR ?= mkdir -p
16 EGREP ?= egrep
17 
18 LN ?= ln -sf
19 LDCONF ?= /sbin/ldconfig -n
20 
21 INSTALL = install
22 INSTALL_PROGRAM = $(INSTALL)
23 INSTALL_DATA = $(INSTALL) -m 644
24 
25 # Attempt to determine host machine, fallback to "this" machine.
26 # The host machine is the one the package runs on. Most people
27 # call this the "target", but not Autotools.
28 HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-')
29 ifeq ($(HOSTX),)
30  HOSTX := $(shell uname -m 2>/dev/null)
31 endif
32 
33 IS_i686 := $(shell echo "$HOSTX" | $(EGREP) -v 64 | $(EGREP) -i -c 'i.86')
34 IS_x86_64 := $(shell echo "$HOSTX" | $(EGREP) -i -c 'x86_64|amd64')
35 IS_ARM := $(shell echo "$HOSTX" | $(EGREP) -i -c 'arm')
36 IS_ARMv8 := $(shell echo "$HOSTX" | $(EGREP) -i -c 'aarch32|aarch64')
37 
38 CLANG_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
39 
40 IS_IOS ?= 0
41 IS_ANDROID ?= 0
42 IS_ARM_EMBEDDED ?= 0
43 IS_NEON ?= 0
44 
45 # Fixup ARM
46 ifeq ($(IS_ARMv8),1)
47  IS_ARM := 0
48 endif
49 
50 # Can be used by Android and Embeeded cross-compiles. Disable by default because
51 # Android and embedded users typically don't run this configuration.
52 HAS_SOLIB_VERSION ?= 0
53 
54 # Default prefix for make install
55 ifeq ($(PREFIX),)
56 PREFIX = /usr/local
57 endif
58 
59 # http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
60 ifeq ($(DATADIR),)
61 DATADIR := $(PREFIX)/share
62 endif
63 ifeq ($(LIBDIR),)
64 LIBDIR := $(PREFIX)/lib
65 endif
66 ifeq ($(BINDIR),)
67 BINDIR := $(PREFIX)/bin
68 endif
69 ifeq ($(INCLUDEDIR),)
70 INCLUDEDIR := $(PREFIX)/include
71 endif
72 
73 # We honor ARFLAGS, but the "v" option used by default causes a noisy make
74 ifeq ($(ARFLAGS),rv)
75 ARFLAGS = r
76 endif
77 
78 # Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
79 # Its a shame because GCC has so much to offer by the way of analysis.
80 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
81 ifneq ($(CLANG_COMPILER),0)
82 CXXFLAGS += -Wall
83 endif
84 
85 # iOS cross-compile configuration.
86 # See http://www.cryptopp.com/wiki/iOS_(Command_Line).
87 ifeq ($(IS_IOS),1)
88  CXX = clang++
89 
90  CXXFLAGS += $(IOS_FLAGS) -arch $(IOS_ARCH)
91  CXXFLAGS += -isysroot $(IOS_SYSROOT) -stdlib=libc++
92 
93  AR = libtool
94  ARFLAGS = -static -o
95  RANLIB = ranlib
96 endif
97 
98 # Android cross-compile configuration.
99 # See http://www.cryptopp.com/wiki/Android_(Command_Line).
100 ifeq ($(IS_ANDROID),1)
101  # CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-android.sh'
102  CXXFLAGS += $(AOSP_FLAGS) -DANDROID --sysroot=$(AOSP_SYSROOT)
103  CXXFLAGS += -Wa,--noexecstack -I$(AOSP_STL_INC) -I$(AOSP_SYS_ARCH_INC)
104  LDFLAGS += --sysroot=$(AOSP_LD_SYSROOT)
105 
106  # c++config.h shows up in odd places at times.
107  ifneq ($(AOSP_BITS_INC),)
108  CXXFLAGS += -I$(AOSP_BITS_INC)
109  endif
110 
111  # STL headers
112  LDLIBS += $(AOSP_STL_LIB)
113 
114  # Source files copied into PWD for Android cpu-features
115  # setenv-android.sh does the copying. Its a dirty compile.
116  AOSP_CPU_OBJ = cpu-features.o
117 endif
118 
119 # ARM embedded cross-compile configuration.
120 # See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
121 # and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
122 ifeq ($(IS_ARM_EMBEDDED),1)
123  # CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-embedded.sh'
124  CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT)
125 endif
126 
127 # No ASM for Travis testing
128 ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm)
129  ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
130  CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
131  endif # CXXFLAGS
132 endif # No ASM
133 
134 # Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
135 ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
136  ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
137  CXXFLAGS += -fsanitize=undefined
138  endif # CXXFLAGS
139  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
140  CXXFLAGS += -DCRYPTOPP_COVERAGE
141  endif # CXXFLAGS
142 endif # UBsan
143 
144 # Address Sanitizer (Asan) testing. Issue 'make asan'.
145 ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
146  ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
147  CXXFLAGS += -fsanitize=address
148  endif # CXXFLAGS
149  ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
150  CXXFLAGS += -DCRYPTOPP_COVERAGE
151  endif # CXXFLAGS
152  ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
153  CXXFLAGS += -fno-omit-frame-pointer
154  endif # CXXFLAGS
155 endif # Asan
156 
157 # LD gold linker testing. Triggered by 'LD=ld.gold'.
158 ifeq ($(findstring ld.gold,$(LD)),ld.gold)
159  ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
160  ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(EGREP) -i -c "elf")
161  ifneq ($(ELF_FORMAT),0)
162  LDFLAGS += -fuse-ld=gold
163  endif # ELF/ELF64
164  endif # CXXFLAGS
165 endif # Gold
166 
167 # Valgrind testing. Issue 'make valgrind'.
168 ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
169  # Tune flags; see http://valgrind.org/docs/manual/quick-start.html
170  CXXFLAGS := $(CXXFLAGS:-g%=-g3)
171  CXXFLAGS := $(CXXFLAGS:-O%=-O1)
172  CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
173  ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),)
174  CXXFLAGS += -DCRYPTOPP_VALGRIND
175  endif # -DCRYPTOPP_VALGRIND
176 endif # Valgrind
177 
178 # Debug testing on GNU systems. Triggered by -DDEBUG.
179 # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
180 ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
181  USING_GLIBCXX := $(shell $(CXX) -x c++ $(CXXFLAGS) -E adhoc.cpp.proto 2>&1 | $(EGREP) -i -c "__GLIBCXX__")
182  ifneq ($(USING_GLIBCXX),0)
183  ifeq ($(HAS_NEWLIB),0)
184  ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
185  CXXFLAGS += -D_GLIBCXX_DEBUG
186  endif # CXXFLAGS
187  endif # HAS_NEWLIB
188  endif # USING_GLIBCXX
189 endif # GNU Debug build
190 
191 # Dead code stripping. Issue 'make lean'.
192 ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
193  ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
194  CXXFLAGS += -ffunction-sections
195  endif # CXXFLAGS
196  ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
197  CXXFLAGS += -fdata-sections
198  endif # CXXFLAGS
199  ifneq ($(IS_IOS),0)
200  ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
201  LDFLAGS += -Wl,-dead_strip
202  endif # CXXFLAGS
203  else # BSD, Linux and Unix
204  ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
205  LDFLAGS += -Wl,--gc-sections
206  endif # LDFLAGS
207  endif # MAKECMDGOALS
208 endif # Dead code stripping
209 
210 # Pickup ARMv7 and NEON. Do it after Android, iOS and Embedded flags have been set.
211 ifeq ($(IS_ARM),1)
212  IS_ARMv7 := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -dM -E - 2>/dev/null | $(EGREP) -i -c '__ARM_ARCH 7')
213  ifeq ($(IS_ARMv7),1)
214  IS_NEON := 1
215  else
216  IS_NEON := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -dM -E - 2>/dev/null | $(EGREP) -i -c -E '<__ARM_NEON>')
217  endif
218 endif
219 
220 # ARMv7-a
221 ifeq ($(IS_ARMv7),1)
222  ifeq ($(findstring -march=armv7-a,$(CXXFLAGS)),)
223  NEON_FLAG = -march=armv7-a
224  GCM_FLAG = -march=armv7-a
225  ARIA_FLAG = -march=armv7-a
226  BLAKE2_FLAG = -march=armv7-a
227  endif
228 endif
229 
230 # NEON
231 ifeq ($(IS_NEON),1)
232  ifeq ($(findstring -mfpu=neon,$(CXXFLAGS)),)
233  NEON_FLAG += -mfpu=neon
234  GCM_FLAG += -mfpu=neon
235  ARIA_FLAG += -mfpu=neon
236  BLAKE2_FLAG += -mfpu=neon
237  SIMON_FLAG += -mfpu=neon
238  SPECK_FLAG += -mfpu=neon
239  ifeq ($(IS_ANDROID),1)
240  ifeq ($(findstring -mfloat-abi=softfp,$(CXXFLAGS)),)
241  NEON_FLAG += -mfloat-abi=softfp
242  GCM_FLAG += -mfloat-abi=softfp
243  ARIA_FLAG += -mfloat-abi=softfp
244  BLAKE2_FLAG += -mfloat-abi=softfp
245  SIMON_FLAG += -mfloat-abi=softfp
246  SPECK_FLAG += -mfloat-abi=softfp
247  endif
248  endif
249  endif
250 endif
251 
252 # ARMv8-a
253 ifneq ($(IS_ARMv8),0)
254  IS_NEON := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a -dM -E - 2>/dev/null | $(EGREP) -i -c __ARM_NEON)
255  ifeq ($(IS_NEON),1)
256  ARIA_FLAG = -march=armv8-a
257  BLAKE2_FLAG = -march=armv8-a
258  NEON_FLAG = -march=armv8-a
259  SIMON_FLAG = -march=armv8-a
260  SPECK_FLAG = -march=armv8-a
261  endif
262  HAVE_CRC := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a+crc -dM -E - 2>/dev/null | $(EGREP) -i -c __ARM_FEATURE_CRC32)
263  ifeq ($(HAVE_CRC),1)
264  CRC_FLAG = -march=armv8-a+crc
265  endif
266  HAVE_CRYPTO := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a+crypto -dM -E - 2>/dev/null | $(EGREP) -i -c __ARM_FEATURE_CRYPTO)
267  ifeq ($(HAVE_CRYPTO),1)
268  AES_FLAG = -march=armv8-a+crypto
269  GCM_FLAG = -march=armv8-a+crypto
270  SHA_FLAG = -march=armv8-a+crypto
271  endif
272 endif
273 
274 # i686 and x86_64
275 ifneq ($(IS_i686)$(IS_x86_64),00)
276  HAVE_SSSE3 = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -mssse3 -dM -E - 2>/dev/null | $(EGREP) -i -c __SSSE3__)
277  ifeq ($(HAVE_SSSE3),1)
278  ARIA_FLAG = -mssse3
279  SSSE3_FLAG = -mssse3
280  SIMON_FLAG = -mssse3
281  SPECK_FLAG = -mssse3
282  endif
283  HAVE_SSE4 = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.1 -dM -E - 2>/dev/null | $(EGREP) -i -c __SSE4_1__)
284  ifeq ($(HAVE_SSE4),1)
285  SIMON_FLAG = -msse4.1
286  SPECK_FLAG = -msse4.1
287  endif
288  HAVE_SSE4 = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.2 -dM -E - 2>/dev/null | $(EGREP) -i -c __SSE4_2__)
289  ifeq ($(HAVE_SSE4),1)
290  BLAKE2_FLAG = -msse4.2
291  CRC_FLAG = -msse4.2
292  endif
293  HAVE_CLMUL = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -mssse3 -mpclmul -dM -E - 2>/dev/null | $(EGREP) -i -c __PCLMUL__ )
294  ifeq ($(HAVE_CLMUL),1)
295  GCM_FLAG = -mssse3 -mpclmul
296  endif
297  HAVE_AES = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.1 -maes -dM -E - 2>/dev/null | $(EGREP) -i -c __AES__)
298  ifeq ($(HAVE_AES),1)
299  AES_FLAG = -msse4.1 -maes
300  endif
301  HAVE_SHA = $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -msse4.2 -msha -dM -E - 2>/dev/null | $(EGREP) -i -c __SHA__)
302  ifeq ($(HAVE_SHA),1)
303  SHA_FLAG = -msse4.2 -msha
304  endif
305 endif
306 
307 # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
308 SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp)))
309 
310 # For Makefile.am; resource.h is Windows
311 INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
312 
313 # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
314 OBJS := $(SRCS:.cpp=.o)
315 
316 # List test.cpp first to tame C++ static initialization problems.
317 TESTSRCS := adhoc.cpp test.cpp bench1.cpp bench2.cpp validat0.cpp validat1.cpp validat2.cpp validat3.cpp validat4.cpp datatest.cpp regtest1.cpp regtest2.cpp regtest3.cpp fipsalgt.cpp dlltest.cpp
318 TESTINCL := bench.h factory.h validate.h
319 TESTOBJS := $(TESTSRCS:.cpp=.o)
320 LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
321 
322 # For Shared Objects, Diff, Dist/Zip rules
323 LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
324 LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
325 LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
326 LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
327 
328 ifeq ($(strip $(LIB_PATCH)),)
329 LIB_PATCH := 0
330 endif
331 
332 ifeq ($(HAS_SOLIB_VERSION),1)
333 # Full version suffix for shared library
334 SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
335 # Different patchlevels and minors are compatible since 6.1
336 SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR)
337 SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
338 endif # HAS_SOLIB_VERSION
339 
340 # Default builds program with static library only
341 .PHONY: default
342 default: cryptest.exe
343 
344 .PHONY: all
345 all: static dynamic cryptest.exe
346 
347 ifneq ($(IS_IOS),0)
348 static: libcryptopp.a
349 shared dynamic dylib: libcryptopp.dylib
350 else
351 static: libcryptopp.a
352 shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
353 endif
354 
355 .PHONY: test check
356 test check: cryptest.exe
357  ./cryptest.exe v
358 
359 # CXXFLAGS are tuned earlier. Applications must use linker flags
360 # -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
361 .PHONY: lean
362 lean: static dynamic cryptest.exe
363 
364 .PHONY: clean
365 clean:
366  -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(AOSP_CPU_OBJ) $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
367  @-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
368  @-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX)
369  @-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct rdrand-???.o
370  @-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
371  @-$(RM) /tmp/adhoc.exe
372  @-$(RM) -r /tmp/cryptopp_test/
373  @-$(RM) -r *.exe.dSYM/
374  @-$(RM) -r *.dylib.dSYM/
375  @-$(RM) -r cov-int/
376 
377 .PHONY: distclean
378 distclean: clean
379  -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt cryptest-*.txt
380  @-$(RM) cryptopp.tgz *.o *.bc *.ii *~
381  @-$(RM) -r $(SRCS:.cpp=.obj) cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
382  @-$(RM) -f configure.ac configure configure.in Makefile.am Makefile.in Makefile
383  @-$(RM) -f config.guess config.status config.sub depcomp install-sh compile
384  @-$(RM) -f stamp-h1 ar-lib *.m4 local.* lt*.sh missing libtool* libcryptopp.pc*
385  @-$(RM) -rf m4/ auto*.cache/ .deps/ .libs/
386  @-$(RM) -r TestCoverage/
387  @-$(RM) cryptopp$(LIB_VER)\.*
388  @-$(RM) CryptoPPRef.zip
389 
390 .PHONY: install
391 install:
392  @-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp
393  $(INSTALL_DATA) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
394 ifneq ($(wildcard cryptest.exe),)
395  @-$(MKDIR) $(DESTDIR)$(BINDIR)
396  $(INSTALL_PROGRAM) cryptest.exe $(DESTDIR)$(BINDIR)
397  @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData
398  @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
399  $(INSTALL_DATA) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData
400  $(INSTALL_DATA) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
401 endif
402 ifneq ($(wildcard libcryptopp.a),)
403  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
404  $(INSTALL_DATA) libcryptopp.a $(DESTDIR)$(LIBDIR)
405 endif
406 ifneq ($(wildcard libcryptopp.dylib),)
407  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
408  $(INSTALL_PROGRAM) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
409 endif
410 ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
411  @-$(MKDIR) $(DESTDIR)$(LIBDIR)
412  $(INSTALL_PROGRAM) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
413 ifeq ($(HAS_SOLIB_VERSION),1)
414  -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
415  $(LDCONF) $(DESTDIR)$(LIBDIR)
416 endif
417 endif
418 
419 .PHONY: remove uninstall
420 remove uninstall:
421  -$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
422  -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
423  -$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
424  @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
425  @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
426  @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
427  @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
428 
429 libcryptopp.a: $(LIBOBJS) $(AOSP_CPU_OBJ)
430  $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(AOSP_CPU_OBJ)
431  $(RANLIB) $@
432 
433 ifeq ($(HAS_SOLIB_VERSION),1)
434 .PHONY: libcryptopp.so
435 libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
436 endif
437 
438 libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
439  $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(LDFLAGS) $(LDLIBS)
440 ifeq ($(HAS_SOLIB_VERSION),1)
441  -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
442  -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
443 endif
444 
445 libcryptopp.dylib: $(LIBOBJS)
446  $(CXX) -dynamiclib -o $@ $(strip $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
447 
448 cryptest.exe: libcryptopp.a $(TESTOBJS)
449  $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
450 
451 # Used to generate list of source files for Autotools, CMakeList and Android.mk
452 .PHONY: sources
453 sources:
454  $(info Library sources: $(filter-out $(TESTSRCS),$(SRCS)))
455  $(info )
456  $(info Library headers: $(filter-out $(TESTINCL),$(INCL)))
457  $(info )
458  $(info Test sources: $(TESTSRCS))
459  $(info )
460  $(info Test headers: $(TESTINCL))
461 
462 adhoc.cpp: adhoc.cpp.proto
463 ifeq ($(wildcard adhoc.cpp),)
464  cp adhoc.cpp.proto adhoc.cpp
465 else
466  touch adhoc.cpp
467 endif
468 
469 # Include dependencies, if present. You must issue `make deps` to create them.
470 ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
471 -include GNUmakefile.deps
472 endif # Dependencies
473 
474 cpu-features.o: cpu-features.h cpu-features.c
475  $(CXX) $(strip $(CXXFLAGS) -fpermissive -c) cpu-features.c
476 
477 # SSE4.2 or NEON available
478 aria-simd.o : aria-simd.cpp
479  $(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<
480 
481 # SSE4.2 or ARMv8a available
482 blake2-simd.o : blake2-simd.cpp
483  $(CXX) $(strip $(CXXFLAGS) $(BLAKE2_FLAG) -c) $<
484 
485 # SSE2 on i586
486 cpu.o : cpu.cpp
487  $(CXX) $(strip $(CXXFLAGS) $(CPU_FLAG) -c) $<
488 
489 # SSE4.2 or ARMv8a available
490 crc-simd.o : crc-simd.cpp
491  $(CXX) $(strip $(CXXFLAGS) $(CRC_FLAG) -c) $<
492 
493 # PCLMUL or ARMv7a/ARMv8a available
494 gcm-simd.o : gcm-simd.cpp
495  $(CXX) $(strip $(CXXFLAGS) $(GCM_FLAG) -c) $<
496 
497 # NEON available
498 neon-simd.o : neon-simd.cpp
499  $(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $<
500 
501 # AESNI or ARMv7a/ARMv8a available
502 rijndael-simd.o : rijndael-simd.cpp
503  $(CXX) $(strip $(CXXFLAGS) $(AES_FLAG) -c) $<
504 
505 # SSE4.2/SHA-NI or ARMv8a available
506 sha-simd.o : sha-simd.cpp
507  $(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
508 
509 # SSE4.2/SHA-NI or ARMv8a available
510 shacal2-simd.o : shacal2-simd.cpp
511  $(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
512 
513 # SSSE3 or NEON available
514 simon-simd.o : simon-simd.cpp
515  $(CXX) $(strip $(CXXFLAGS) $(SIMON_FLAG) -c) $<
516 
517 # SSSE3 or NEON available
518 speck-simd.o : speck-simd.cpp
519  $(CXX) $(strip $(CXXFLAGS) $(SPECK_FLAG) -c) $<
520 
521 %.o : %.cpp
522  $(CXX) $(strip $(CXXFLAGS) -c) $<
523 
524 GNUmakefile.deps:
525  $(CXX) $(strip $(CXXFLAGS) -MM) *.cpp > GNUmakefile.deps