(1) Remove -pipe from ARM builds (Issue 120); (2) Added section labels for wiki article; (3) Moved LIB_MAJOR, LIB_MINOR and LIB_PATCH into Common Section
parent
80134f2ef4
commit
f20585ccb8
100
GNUmakefile
100
GNUmakefile
|
|
@ -1,3 +1,7 @@
|
||||||
|
###########################################################
|
||||||
|
##### General Variables #####
|
||||||
|
###########################################################
|
||||||
|
|
||||||
# Base CXXFLAGS used if the user did not specify them
|
# Base CXXFLAGS used if the user did not specify them
|
||||||
CXXFLAGS ?= -DNDEBUG -g2 -O2
|
CXXFLAGS ?= -DNDEBUG -g2 -O2
|
||||||
|
|
||||||
|
|
@ -14,8 +18,10 @@ LN ?= ln -sf
|
||||||
LDCONF ?= /sbin/ldconfig -n
|
LDCONF ?= /sbin/ldconfig -n
|
||||||
|
|
||||||
UNAME := $(shell uname)
|
UNAME := $(shell uname)
|
||||||
IS_X86 := $(shell uname -m | $(EGREP) -i -c "i.86|x86|i86|amd64")
|
IS_X86 := $(shell uname -m | $(EGREP) -v "x86_64" | $(EGREP) -i -c "i.86|x86|i86")
|
||||||
|
IS_X32 ?= 0
|
||||||
IS_X86_64 := $(shell uname -m | $(EGREP) -i -c "(_64|d64)")
|
IS_X86_64 := $(shell uname -m | $(EGREP) -i -c "(_64|d64)")
|
||||||
|
IS_PPC := $(shell uname -m | $(EGREP) -i -c "ppc")
|
||||||
IS_AARCH64 := $(shell uname -m | $(EGREP) -i -c "aarch64")
|
IS_AARCH64 := $(shell uname -m | $(EGREP) -i -c "aarch64")
|
||||||
|
|
||||||
IS_SUN := $(shell uname | $(EGREP) -i -c "SunOS")
|
IS_SUN := $(shell uname | $(EGREP) -i -c "SunOS")
|
||||||
|
|
@ -61,7 +67,11 @@ ifeq ($(ARFLAGS),rv)
|
||||||
ARFLAGS = r
|
ARFLAGS = r
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(IS_X86),1)
|
###########################################################
|
||||||
|
##### X86/X32/X64 Options #####
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
ifneq ($(IS_X86)$(IS_X32)$(IS_X86_64),000)
|
||||||
|
|
||||||
IS_GCC_29 := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c gcc-9[0-9][0-9])
|
IS_GCC_29 := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c gcc-9[0-9][0-9])
|
||||||
GCC42_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[2-9]|[5-9]\.)")
|
GCC42_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[2-9]|[5-9]\.)")
|
||||||
|
|
@ -74,15 +84,12 @@ GAS210_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(E
|
||||||
GAS217_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
|
GAS217_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
|
||||||
GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
|
GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
|
||||||
|
|
||||||
# Add -fPIC for x86_64, but not X32, Cygwin or MinGW
|
# Add -fPIC for targets *except* X86, X32, Cygwin or MinGW
|
||||||
ifneq ($(IS_X86_64),0)
|
ifeq ($(IS_X86)$(IS_X32)$(IS_CYGWIN)$(IS_MINGW),0000)
|
||||||
IS_X32 := $(shell $(CXX) -dM -E - < /dev/null 2>&1 | $(EGREP) -c "ILP32")
|
|
||||||
ifeq ($(IS_X32)$(IS_CYGWIN)$(IS_MINGW),000)
|
|
||||||
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -fPIC
|
CXXFLAGS += -fPIC
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# Guard use of -march=native
|
# Guard use of -march=native
|
||||||
ifeq ($(GCC_COMPILER),0)
|
ifeq ($(GCC_COMPILER),0)
|
||||||
|
|
@ -136,20 +143,35 @@ CXXFLAGS += -Wa,--divide # allow use of "/" operator
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else # Not IS_X86
|
ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist
|
||||||
|
CXXFLAGS += -mbnu210
|
||||||
|
else ifneq ($(findstring -save-temps,$(CXXFLAGS)),-save-temps)
|
||||||
|
CXXFLAGS += -pipe
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
##### Not X86/X32/X64 #####
|
||||||
|
###########################################################
|
||||||
|
|
||||||
# Add PIC
|
# Add PIC
|
||||||
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -fPIC
|
CXXFLAGS += -fPIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif # IS_X86
|
# Add -pipe for everything except ARM
|
||||||
|
ifneq ($(IS_PPC),0)
|
||||||
ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist
|
ifeq ($(findstring -save-temps,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -mbnu210
|
|
||||||
else ifneq ($(findstring -save-temps,$(CXXFLAGS)),-save-temps)
|
|
||||||
CXXFLAGS += -pipe
|
CXXFLAGS += -pipe
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif # IS_X86
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
##### Common #####
|
||||||
|
###########################################################
|
||||||
|
|
||||||
ifneq ($(IS_MINGW),0)
|
ifneq ($(IS_MINGW),0)
|
||||||
LDLIBS += -lws2_32
|
LDLIBS += -lws2_32
|
||||||
|
|
@ -162,18 +184,8 @@ ifeq ($(findstring -lgomp,$(LDLIBS)),)
|
||||||
LDLIBS += -lgomp
|
LDLIBS += -lgomp
|
||||||
endif # LDLIBS
|
endif # LDLIBS
|
||||||
endif # OpenMP
|
endif # OpenMP
|
||||||
ifneq ($(IS_X86_64),0)
|
|
||||||
M32OR64 = -m64
|
|
||||||
endif
|
|
||||||
endif # IS_LINUX
|
endif # IS_LINUX
|
||||||
|
|
||||||
# And add it for ARM64, too
|
|
||||||
ifneq ($(IS_AARCH64),0)
|
|
||||||
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
|
||||||
CXXFLAGS += -fPIC
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(IS_DARWIN),0)
|
ifneq ($(IS_DARWIN),0)
|
||||||
AR = libtool
|
AR = libtool
|
||||||
ARFLAGS = -static -o
|
ARFLAGS = -static -o
|
||||||
|
|
@ -281,6 +293,28 @@ endif # LDFLAGS
|
||||||
endif # MAKECMDGOALS
|
endif # MAKECMDGOALS
|
||||||
endif # Dead code stripping
|
endif # Dead code stripping
|
||||||
|
|
||||||
|
# For Shared Objects, Diff, Dist/Zip rules
|
||||||
|
LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
|
||||||
|
LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
|
||||||
|
LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
|
||||||
|
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
|
||||||
|
|
||||||
|
ifeq ($(strip $(LIB_PATCH)),)
|
||||||
|
LIB_PATCH := 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||||
|
# Full version suffix for shared library
|
||||||
|
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
|
||||||
|
# Different patchlevels are compatible, minor versions are not
|
||||||
|
SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
|
||||||
|
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||||
|
endif # HAS_SOLIB_VERSION
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
##### Source and object files #####
|
||||||
|
###########################################################
|
||||||
|
|
||||||
# List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems.
|
# List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems.
|
||||||
# The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp
|
# The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp
|
||||||
# is the second candidate for explicit initialization order.
|
# is the second candidate for explicit initialization order.
|
||||||
|
|
@ -312,23 +346,9 @@ LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
|
||||||
TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
|
TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
|
||||||
DLLTESTOBJS := dlltest.dllonly.o
|
DLLTESTOBJS := dlltest.dllonly.o
|
||||||
|
|
||||||
# For Shared Objects, Diff, Dist/Zip rules
|
###########################################################
|
||||||
LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
|
##### Targets and Recipes #####
|
||||||
LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
|
###########################################################
|
||||||
LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
|
|
||||||
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
|
|
||||||
|
|
||||||
ifeq ($(strip $(LIB_PATCH)),)
|
|
||||||
LIB_PATCH := 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
|
||||||
# Full version suffix for shared library
|
|
||||||
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
|
|
||||||
# Different patchlevels are compatible, minor versions are not
|
|
||||||
SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
|
|
||||||
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
|
||||||
endif # HAS_SOLIB_VERSION
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: cryptest.exe
|
all: cryptest.exe
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue