From d46c8971fdc342e17520589324c7e8db6765300a Mon Sep 17 00:00:00 2001 From: weidai Date: Sun, 15 Apr 2007 22:59:29 +0000 Subject: enabled optimization flags by default in GNUmakefile git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@285 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- GNUmakefile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'GNUmakefile') diff --git a/GNUmakefile b/GNUmakefile index 3dff775..c1dbaef 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,12 +1,5 @@ -# can't use -fno-rtti yet because it causes problems with exception handling in GCC 2.95.2 -CXXFLAGS = -g -# Uncomment the following two lines to do a release build. -# Note that you must define NDEBUG for your own application if you define it for Crypto++. -# Make sure you run the validation tests and test your own program thoroughly -# after turning on -O3. The GCC optimizer may have bugs that cause it to generate incorrect code. -# Try removing -fdata-sections if you get "undefined external reference" errors. -# CXXFLAGS = -O3 -DNDEBUG -ffunction-sections -fdata-sections -# LDFLAGS += -Wl,--gc-sections +CXXFLAGS = -DNDEBUG -ffunction-sections -fdata-sections -g +LDFLAGS += -Wl,--gc-sections ARFLAGS = -cr # ar needs the dash on OpenBSD RANLIB = ranlib CP = cp @@ -15,6 +8,13 @@ EGREP = egrep UNAME = $(shell uname) ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86") ISMINGW = $(shell uname | $(EGREP) -c "MINGW32") +GCC4_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "gcc version 4") + +ifeq ($(GCC4_OR_LATER),1) +CXXFLAGS += -Os # -O3 causes Salsa20 validation to fail on GCC 4.1.2 +else +CXXFLAGS += -O1 # -Os, -O2, -O3 all cause Salsa20 validation to fail on GCC 3.4.4 +endif # Default prefix for make install ifeq ($(PREFIX),) @@ -27,15 +27,15 @@ endif ifeq ($(ISX86),1) -GCC33ORLATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "gcc version (3.[3-9]|[4-9])") -GAS210ORLATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2.[1-9][0-9]|[3-9])") +GCC33_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "gcc version (3.[3-9]|[4-9])") +GAS210_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2.[1-9][0-9]|[3-9])") -ifeq ($(GCC33ORLATER) $(ISMINGW),1 0) # MINGW32 is missing the memalign function +ifeq ($(GCC33_OR_LATER),1) CXXFLAGS += -msse2 endif -ifeq ($(GAS210ORLATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10 -CXXFLAGS += -DCRYPTOPP_DISABLE_X86ASM +ifeq ($(GAS210_OR_LATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10 +CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif endif -- cgit v1.2.1