Resolve conflicts between master and version_shlib

pull/65/head
Todd Knarr 2015-12-25 13:06:43 -08:00
parent 10c5b2e0f1
commit a3ac556e37
1 changed files with 81 additions and 48 deletions

View File

@ -14,6 +14,7 @@ CXXFLAGS ?= -DNDEBUG -g2 -O2
AR ?= ar AR ?= ar
ARFLAGS ?= -cr # ar needs the dash on OpenBSD ARFLAGS ?= -cr # ar needs the dash on OpenBSD
RANLIB ?= ranlib RANLIB ?= ranlib
CP ?= cp CP ?= cp
CHMOD ?= chmod CHMOD ?= chmod
MKDIR ?= mkdir MKDIR ?= mkdir
@ -42,7 +43,7 @@ HAS_SOLIB_VERSION := $(IS_LINUX)
# Default prefix for make install # Default prefix for make install
ifeq ($(PREFIX),) ifeq ($(PREFIX),)
PREFIX = /usr PREFIX = /usr/local
endif endif
ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4 ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4
@ -129,6 +130,13 @@ CXXFLAGS += -Wa,--divide # allow use of "/" operator
endif endif
endif endif
else # Not IS_X86
# Add PIC
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
CXXFLAGS += -fPIC
endif
endif # IS_X86 endif # IS_X86
ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist
@ -256,7 +264,8 @@ endif
OBJS := $(SRCS:.cpp=.o) OBJS := $(SRCS:.cpp=.o)
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?) # 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 TESTSRCS := bench.cpp bench2.cpp test.cpp validat1.cpp validat2.cpp validat3.cpp adhoc.cpp datatest.cpp regtest.cpp fipsalgt.cpp dlltest.cpp
TESTOBJS := $(TESTSRCS:.cpp=.o)
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS)) LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
# List cryptlib.cpp first in an attempt to tame C++ static initialization problems # List cryptlib.cpp first in an attempt to tame C++ static initialization problems
@ -273,6 +282,11 @@ LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1) LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2) LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3) LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
ifeq ($(strip $(LIB_PATCH)),)
LIB_PATCH := 0
endif
ifeq ($(HAS_SOLIB_VERSION),1) ifeq ($(HAS_SOLIB_VERSION),1)
# Full version suffix for shared library # Full version suffix for shared library
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH) SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
@ -281,10 +295,6 @@ SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX) SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
endif # HAS_SOLIB_VERSION endif # HAS_SOLIB_VERSION
ifeq ($(strip $(LIB_PATCH)),)
LIB_PATCH := 0
endif
all: cryptest.exe all: cryptest.exe
ifneq ($(IS_DARWIN),0) ifneq ($(IS_DARWIN),0)
@ -306,6 +316,13 @@ asan ubsan align aligned: libcryptopp.a cryptest.exe
test check: cryptest.exe test check: cryptest.exe
./cryptest.exe v ./cryptest.exe v
# Used to generate list of source files for Autotools, CMakeList and Android.mk
.PHONY: sources
sources:
$(info Library sources: $(filter-out fipstest.cpp $(TESTSRCS),$(SRCS)))
$(info )
$(info Test sources: $(TESTSRCS))
# Directory we want (can't specify on Doygen command line) # Directory we want (can't specify on Doygen command line)
DOCUMENT_DIRECTORY := ref$(LIB_VER) DOCUMENT_DIRECTORY := ref$(LIB_VER)
# Directory Doxygen uses (specified in Doygen config file) # Directory Doxygen uses (specified in Doygen config file)
@ -317,6 +334,7 @@ ifeq ($(strip $(DOXYGEN_DIRECTORY)),)
DOXYGEN_DIRECTORY := html-docs DOXYGEN_DIRECTORY := html-docs
endif endif
# Builds the documentation. Directory name is ref563, ref570, etc.
.PHONY: docs html .PHONY: docs html
docs html: docs html:
-$(RM) -r $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/ html-docs/ -$(RM) -r $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/ html-docs/
@ -358,41 +376,48 @@ endif
.PHONY: install .PHONY: install
install: install:
-$(RM) -r $(PREFIX)/include/cryptopp $(MKDIR) -p $(DESTDIR)$(PREFIX)/include/cryptopp
$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin -$(CP) *.h $(DESTDIR)$(PREFIX)/include/cryptopp
-$(CP) *.h $(PREFIX)/include/cryptopp -$(CHMOD) 755 $(DESTDIR)$(PREFIX)/include/cryptopp
-$(CHMOD) 755 $(PREFIX)/include/cryptopp -$(CHMOD) 644 $(DESTDIR)$(PREFIX)/include/cryptopp/*.h
-$(CHMOD) 644 $(PREFIX)/include/cryptopp/*.h ifneq ($(wildcard libcryptopp.a),)
-$(CP) libcryptopp.a $(PREFIX)/lib $(MKDIR) -p $(DESTDIR)$(PREFIX)/lib
-$(CHMOD) 644 $(PREFIX)/lib/libcryptopp.a -$(CP) libcryptopp.a $(DESTDIR)$(PREFIX)/lib
-$(CP) cryptest.exe $(PREFIX)/bin -$(CHMOD) 644 $(DESTDIR)$(PREFIX)/lib/libcryptopp.a
-$(CHMOD) 755 $(PREFIX)/bin/cryptest.exe
ifneq ($(IS_DARWIN),0)
-$(CP) libcryptopp.dylib $(PREFIX)/lib
-$(CHMOD) 755 $(PREFIX)/lib/libcryptopp.dylib
else
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
-$(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(PREFIX)/lib
-$(CHMOD) 755 $(PREFIX)/lib/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
ifeq ($(HAS_SOLIB_VERSION),1)
-$(LN) -sf libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(PREFIX)/lib/libcryptopp.so
$(LDCONF) $(PREFIX)/lib
endif endif
ifneq ($(wildcard cryptest.exe),)
$(MKDIR) -p $(DESTDIR)$(PREFIX)/bin
-$(CP) cryptest.exe $(DESTDIR)$(PREFIX)/bin
-$(CHMOD) 755 $(DESTDIR)$(PREFIX)/bin/cryptest.exe
endif
ifneq ($(wildcard libcryptopp.dylib),)
$(MKDIR) -p $(DESTDIR)$(PREFIX)/lib
-$(CP) libcryptopp.dylib $(DESTDIR)$(PREFIX)/lib
-install_name_tool -id $(DESTDIR)$(PREFIX)/lib/libcryptopp.dylib $(DESTDIR)$(PREFIX)/lib/libcryptopp.dylib
-$(CHMOD) 755 $(DESTDIR)$(PREFIX)/lib/libcryptopp.dylib
endif
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
$(MKDIR) -p $(DESTDIR)$(PREFIX)/lib
-$(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(PREFIX)/lib
-$(CHMOD) 755 $(DESTDIR)$(PREFIX)/lib/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
ifeq ($(HAS_SOLIB_VERSION),1)
-$(LN) -sf libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(PREFIX)/lib/libcryptopp.so
$(LDCONF) $(DESTDIR)$(PREFIX)/lib
endif endif
endif endif
.PHONY: remove uninstall .PHONY: remove uninstall
remove uninstall: remove uninstall:
-$(RM) -r $(PREFIX)/include/cryptopp -$(RM) -r $(DESTDIR)$(PREFIX)/include/cryptopp
-$(RM) $(PREFIX)/lib/libcryptopp.a -$(RM) $(DESTDIR)$(PREFIX)/lib/libcryptopp.a
-$(RM) $(PREFIX)/bin/cryptest.exe -$(RM) $(DESTDIR)$(PREFIX)/bin/cryptest.exe
ifneq ($(IS_DARWIN),0) ifneq ($(IS_DARWIN),0)
-$(RM) $(PREFIX)/lib/libcryptopp.dylib -$(RM) $(DESTDIR)$(PREFIX)/lib/libcryptopp.dylib
else else
-$(RM) $(PREFIX)/lib/libcryptopp.so$(SOLIB_VERSION_SUFFIX) -$(RM) $(DESTDIR)$(PREFIX)/lib/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
ifeq ($(HAS_SOLIB_VERSION),1) ifeq ($(HAS_SOLIB_VERSION),1)
-$(RM) $(PREFIX)/lib/libcryptopp.so$(SOLIB_COMPAT_SUFFIX) -$(RM) $(DESTDIR)$(PREFIX)/lib/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
-$(RM) $(PREFIX)/lib/libcryptopp.so -$(RM) $(DESTDIR)$(PREFIX)/lib/libcryptopp.so
$(LDCONF) $(PREFIX)/lib $(LDCONF) $(PREFIX)/lib
endif endif
endif endif
@ -432,15 +457,9 @@ cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
dlltest.exe: cryptopp.dll $(DLLTESTOBJS) dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
# This recipe requires a previous "svn co -r 541 http://svn.code.sf.net/p/cryptopp/code/trunk/c5"
.PHONY: diff
diff:
-$(RM) cryptopp$(LIB_VER).diff
-svn diff -r 541 > cryptopp$(LIB_VER).diff
# This recipe prepares the distro files # This recipe prepares the distro files
TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt config.recommend Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcproj *.dsw *.dsp cryptopp.rc TestVectors/*.txt TestData/*.dat TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt config.recommend Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcproj *.dsw *.dsp cryptopp.rc TestVectors/*.txt TestData/*.dat
EXEC_FILES := GNUmakefile GNUmakefile-cross cryptest.sh rdrand-nasm.sh TestData/ TestVectors/ EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/
ifeq ($(wildcard Filelist.txt),Filelist.txt) ifeq ($(wildcard Filelist.txt),Filelist.txt)
DIST_FILES := $(shell cat Filelist.txt) DIST_FILES := $(shell cat Filelist.txt)
@ -448,20 +467,34 @@ endif
.PHONY: convert .PHONY: convert
convert: convert:
chmod 0700 TestVectors/ TestData/ -chmod 0700 TestVectors/ TestData/
chmod 0600 $(TEXT_FILES) *.zip -chmod 0600 $(TEXT_FILES) *.asm *.S *.zip
chmod 0700 $(EXEC_FILES) -chmod 0700 $(EXEC_FILES) *.sh *.cmd
chmod u+x *.cmd *.sh -chmod 0700 *.cmd *.sh GNUmakefile GNUmakefile-cross
unix2dos --keepdate --quiet $(TEXT_FILES) *.asm *.cmd -unix2dos --keepdate --quiet $(TEXT_FILES) *.asm *.cmd
dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.S *.sh -dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.S *.sh
ifneq ($(IS_DARWIN),0) ifneq ($(IS_DARWIN),0)
xattr -c * -xattr -c *
endif endif
.PHONY: zip dist .PHONY: zip dist
zip dist: | distclean convert diff zip dist: | distclean convert
zip -q -9 cryptopp$(LIB_VER).zip $(DIST_FILES) zip -q -9 cryptopp$(LIB_VER).zip $(DIST_FILES)
.PHONY: iso
iso: | zip
ifneq ($(IS_DARWIN),0)
mkdir -p $(PWD)/cryptopp$(LIB_VER)
cp cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
hdiutil makehybrid -iso -joliet -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
-rm -rf $(PWD)/cryptopp$(LIB_VER)
else ifneq ($(IS_LINUX),0)
mkdir -p $(PWD)/cryptopp$(LIB_VER)
cp cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
genisoimage -q -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
-rm -rf $(PWD)/cryptopp$(LIB_VER)
endif
.PHONY: bench benchmark benchmarks .PHONY: bench benchmark benchmarks
bench benchmark benchmarks: cryptest.exe bench benchmark benchmarks: cryptest.exe
rm -f benchmarks.html rm -f benchmarks.html