summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-07-16 04:38:08 +0000
committernoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-07-16 04:38:08 +0000
commitc6083fd33279252a081d8f0e5b4ad7d19ed2e253 (patch)
treef569a8c09d496a8aac9794936ddfa7a590d20a88
parent738c7f720674ceeb5ca641a039e6c83ab5e078d8 (diff)
downloadcryptopp-c6083fd33279252a081d8f0e5b4ad7d19ed2e253.tar.gz
Added targets for UBsan and Asan
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@590 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--GNUmakefile20
1 files changed, 16 insertions, 4 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 1f7185a..82327c5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -4,7 +4,7 @@ CXXFLAGS ?= -DNDEBUG -g2 -O3
# CXXFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += -Wl,--gc-sections
ARFLAGS = -cr # ar needs the dash on OpenBSD
-RANLIB = ranlib
+RANLIB ?= ranlib
CP = cp
MKDIR = mkdir
EGREP = egrep
@@ -27,7 +27,7 @@ endif
ifeq ($(IS_X86),1)
-GCC42_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -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])")
ICC111_OR_LATER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
GAS210_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-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])")
@@ -38,6 +38,16 @@ ifneq ($(IS_X86_64),0)
CXXFLAGS += -fPIC
endif # PIC for x86_64 targets
+# Undefined Behavior Sanitzier (Clang and G++)
+ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
+CXXFLAGS += -fsanitize=undefined
+endif # UBsan
+
+# Address Sanitzier (Clang and G++)
+ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
+CXXFLAGS += -fsanitize=address
+endif # Asan
+
# Cygwin work arounds
ifneq ($(IS_CYGWIN),0)
@@ -49,10 +59,10 @@ endif # CXX
# -fPIC causes spurious output during compile
ifeq ($(findstring -fPIC,$(CXXFLAGS)),-fPIC)
CXXFLAGS := $(subst -fPIC,,$(CXXFLAGS))
-endif # --fPIC
+endif # -fPIC
# -O3 fails to link with GCC 4.5.3
-IS_GCC45 = = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "^gcc version 4\.5\.")
+IS_GCC45 = $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "^gcc version 4\.5\.")
ifneq ($(IS_GCC45),0)
ifeq ($(findstring -O3,$(CXXFLAGS)),-O3)
CXXFLAGS := $(subst -O3,-O2,$(CXXFLAGS))
@@ -168,6 +178,8 @@ all: cryptest.exe
static: libcryptopp.a
dynamic: libcryptopp.so
+asan ubsan: libcryptopp.a cryptest.exe
+
test: cryptest.exe
./cryptest.exe v