2015-07-20 10:55:42 +00:00
|
|
|
CXXFLAGS ?= -DNDEBUG -g2 -Os -fPIC -pipe
|
2015-06-08 11:50:22 +00:00
|
|
|
|
|
|
|
# The following options reduce code size, but breaks link or makes link very slow on some systems
|
|
|
|
# CXXFLAGS += -ffunction-sections -fdata-sections
|
|
|
|
# LDFLAGS += -Wl,--gc-sections
|
|
|
|
CXXFLAGS += -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable
|
2015-07-20 10:55:42 +00:00
|
|
|
|
2015-06-08 11:50:22 +00:00
|
|
|
ARFLAGS = -cr # ar needs the dash on OpenBSD
|
|
|
|
RANLIB ?= ranlib
|
|
|
|
CP = cp
|
|
|
|
MKDIR = mkdir
|
|
|
|
EGREP = egrep
|
|
|
|
CHMOD = chmod
|
|
|
|
|
|
|
|
CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
|
|
|
|
|
|
|
|
IS_X86=0
|
|
|
|
IS_LINUX=0
|
|
|
|
IS_MINGW=0
|
|
|
|
IS_DARWIN=0
|
|
|
|
UNAME=CrossCompile
|
|
|
|
|
|
|
|
# Default prefix for make install
|
|
|
|
ifeq ($(PREFIX),)
|
|
|
|
PREFIX = /usr/local
|
|
|
|
endif
|
|
|
|
|
2015-07-20 10:55:42 +00:00
|
|
|
# Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
|
|
|
|
# Its a shame because GCC has so much to offer by the way of analysis.
|
|
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
|
|
|
|
ifneq ($(CLANG_COMPILER),0)
|
|
|
|
CXXFLAGS += -Wall
|
|
|
|
endif
|
|
|
|
|
2015-06-08 11:50:22 +00:00
|
|
|
# iOS cross-compile configuration. Works in conjunction with IS_CROSS_COMPILE.
|
|
|
|
# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
|
|
|
|
ifeq ($(IS_IOS),1)
|
|
|
|
CXX = clang++
|
|
|
|
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(IOS_FLAGS)
|
|
|
|
CXXFLAGS += -arch $(IOS_ARCH) -isysroot $(IOS_SYSROOT)
|
|
|
|
CXXFLAGS += -stdlib=libc++
|
|
|
|
|
|
|
|
AR = libtool
|
|
|
|
ARFLAGS = -static -o
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Android cross-compile configuration. Works in conjunction with IS_CROSS_COMPILE.
|
|
|
|
# See http://www.cryptopp.com/wiki/Android_(Command_Line).
|
|
|
|
ifeq ($(IS_ANDROID),1)
|
|
|
|
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-android.sh'
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(ANDROID_FLAGS)
|
|
|
|
CXXFLAGS += --sysroot=$(ANDROID_SYSROOT) -I$(ANDROID_STL_INC)
|
|
|
|
LDLIBS += $(ANDROID_STL_LIB)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# ARM embedded cross-compile configuration. Works in conjunction with IS_CROSS_COMPILE.
|
|
|
|
# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
|
|
|
|
# and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
|
|
|
|
ifeq ($(IS_ARM_EMBEDDED),1)
|
|
|
|
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-embedded.sh'
|
|
|
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(ARM_EMBEDDED_FLAGS)
|
|
|
|
CXXFLAGS += --sysroot=$(ARM_EMBEDDED_SYSROOT)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(CLANG_COMPILER),0)
|
|
|
|
CXXFLAGS += -Wno-tautological-compare -Wno-unused-value
|
|
|
|
endif
|
|
|
|
|
2015-07-20 10:55:42 +00:00
|
|
|
SRCS = $(filter-out pch.cpp cryptlib_bds.cpp winpipes.cpp, $(wildcard *.cpp))
|
2015-06-08 11:50:22 +00:00
|
|
|
OBJS = $(SRCS:.cpp=.o)
|
2015-07-20 10:55:42 +00:00
|
|
|
|
2015-06-08 11:50:22 +00:00
|
|
|
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
|
|
|
|
TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
|
|
|
|
LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
|
|
|
|
|
|
|
|
DLLSRCS = algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp cryptlib.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
|
|
|
|
DLLOBJS = $(DLLSRCS:.cpp=.export.o)
|
|
|
|
LIBIMPORTOBJS = $(LIBOBJS:.o=.import.o)
|
|
|
|
TESTIMPORTOBJS = $(TESTOBJS:.o=.import.o)
|
|
|
|
DLLTESTOBJS = dlltest.dllonly.o
|
|
|
|
|
|
|
|
all: cryptest.exe
|
|
|
|
static: libcryptopp.a
|
|
|
|
dynamic: libcryptopp.so
|
|
|
|
|
|
|
|
test: cryptest.exe
|
|
|
|
./cryptest.exe v
|
|
|
|
|
|
|
|
clean:
|
2015-07-20 10:55:42 +00:00
|
|
|
-$(RM) cryptest.exe libcryptopp.a libcryptopp.so GNUmakefile.deps $(LIBOBJS) $(DLLOBJS) $(TESTOBJS)
|
2015-06-08 11:50:22 +00:00
|
|
|
-$(RM) -r *.dSYM
|
|
|
|
|
|
|
|
install:
|
|
|
|
$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
|
|
|
|
-$(CP) *.h $(PREFIX)/include/cryptopp
|
|
|
|
-$(CP) *.a $(PREFIX)/lib
|
|
|
|
-$(CP) *.so $(PREFIX)/lib
|
|
|
|
-$(CP) *.exe $(PREFIX)/bin
|
|
|
|
|
|
|
|
remove:
|
|
|
|
-$(RM) -rf $(PREFIX)/include/cryptopp
|
|
|
|
-$(RM) $(PREFIX)/lib/libcryptopp.a
|
|
|
|
-$(RM) $(PREFIX)/lib/libcryptopp.so
|
|
|
|
-$(RM) $(PREFIX)/bin/cryptest.exe
|
|
|
|
|
|
|
|
libcryptopp.a: $(LIBOBJS)
|
|
|
|
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
|
|
|
libcryptopp.so: $(LIBOBJS)
|
|
|
|
$(CXX) $(CXXFLAGS) -shared -o $@ $(LIBOBJS) $(LDFLAGS) $(LDLIBS)
|
|
|
|
|
|
|
|
cryptest.exe: libcryptopp.a $(TESTOBJS)
|
|
|
|
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
|
|
|
|
|
|
|
|
adhoc.cpp: adhoc.cpp.proto
|
|
|
|
ifeq ($(wildcard adhoc.cpp),)
|
|
|
|
cp adhoc.cpp.proto adhoc.cpp
|
|
|
|
else
|
|
|
|
touch adhoc.cpp
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.o : %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c $<
|
2015-07-20 10:55:42 +00:00
|
|
|
|
|
|
|
# Do not build dependencies when cleaning
|
|
|
|
ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
|
|
|
|
-include GNUmakefile.deps
|
|
|
|
endif
|
|
|
|
|
|
|
|
GNUmakefile.deps:
|
|
|
|
$(CXX) $(CXXFLAGS) -MM *.cpp > GNUmakefile.deps
|