From 71bb258543e2a50555397336a0d1ad8f1fccfc4c Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sun, 4 Oct 2015 10:52:07 -0700 Subject: [PATCH] Various Makefile fixes: Handle USE_O3 parameter correctly while building headless client; Use -O2 optimization level by default in BSD makefile; Fix OS X headless client compilation issues. --- src/makefile.bsd | 7 ++++++- src/makefile.linux-mingw | 7 ++++++- src/makefile.mingw | 7 ++++++- src/makefile.osx | 12 ++++++------ src/makefile.unix | 6 +++++- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/makefile.bsd b/src/makefile.bsd index 29c497e..8be6835 100644 --- a/src/makefile.bsd +++ b/src/makefile.bsd @@ -88,9 +88,14 @@ LIBS+= \ DEBUGFLAGS=-g +xOPT_LEVEL=-O2 +ifeq (${USE_O3}, 1) + xOPT_LEVEL=-O3 +endif + # CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only # adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. -xCXXFLAGS=-O0 -msse2 -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter \ +xCXXFLAGS=$(xOPT_LEVEL) -msse2 -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter \ $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) # LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index c34e197..3c65af9 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -50,9 +50,14 @@ LIBS= \ -l crypto \ -Wl,-Bstatic -lpthread -Wl,-Bdynamic +xOPT_LEVEL=-O2 +ifeq (${USE_O3}, 1) + xOPT_LEVEL=-O3 +endif + DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS DEBUGFLAGS=-g -CFLAGS=-O2 -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) +CFLAGS=$(xOPT_LEVEL) -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static-libgcc -static-libstdc++ ifndef USE_UPNP diff --git a/src/makefile.mingw b/src/makefile.mingw index 2f1dd90..c09ed6b 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -38,9 +38,14 @@ LIBS= \ -l ssl \ -l crypto +xOPT_LEVEL=-O2 +ifeq (${USE_O3}, 1) + xOPT_LEVEL=-O3 +endif + DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS DEBUGFLAGS=-g -CFLAGS=-mthreads -O2 -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) +CFLAGS=-mthreads $(xOPT_LEVEL) -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static ifndef USE_UPNP diff --git a/src/makefile.osx b/src/makefile.osx index 5aa9e9c..cd13d12 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -134,16 +134,16 @@ ifeq (${USE_ASM}, 1) OBJS += crypto/scrypt/asm/obj/scrypt-arm.o crypto/scrypt/asm/obj/scrypt-x86.o crypto/scrypt/asm/obj/scrypt-x86_64.o crypto/scrypt/asm/obj/asm-wrapper.o crypto/scrypt/asm/obj/scrypt-x86.o: crypto/scrypt/asm/scrypt-x86.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< crypto/scrypt/asm/obj/scrypt-x86_64.o: crypto/scrypt/asm/scrypt-x86_64.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< crypto/scrypt/asm/obj/scrypt-arm.o: crypto/scrypt/asm/scrypt-arm.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< crypto/scrypt/asm/obj/asm-wrapper.o: crypto/scrypt/asm/asm-wrapper.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< else ifeq (${USE_SSE2}, 1) # Intrinsic implementation @@ -151,13 +151,13 @@ DEFS += -DUSE_SSE2 OBJS += crypto/scrypt/intrin/obj/scrypt-sse2.o crypto/scrypt/intrin/obj/scrypt-sse2.o: crypto/scrypt/intrin/scrypt-sse2.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< else # Generic implementation OBJS += crypto/scrypt/generic/obj/scrypt-generic.o crypto/scrypt/generic/obj/scrypt-generic.o: crypto/scrypt/generic/scrypt-generic.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< endif endif diff --git a/src/makefile.unix b/src/makefile.unix index 708695d..bc06fc4 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -94,10 +94,14 @@ ifeq (${ARCH}, i686) EXT_OPTIONS=-msse2 endif +xOPT_LEVEL=-O2 +ifeq (${USE_O3}, 1) + xOPT_LEVEL=-O3 +endif # CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only # adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. -xCXXFLAGS=-O2 $(EXT_OPTIONS) -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter \ +xCXXFLAGS=$(xOPT_LEVEL) $(EXT_OPTIONS) -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter \ $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) # LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only -- 1.7.1