From 1e7890bed9ca0d94a1fc858f86337cc38abcb920 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 26 Oct 2016 18:24:32 -0400 Subject: [PATCH] Additional use of $(strip $(CXXFLAGS)) cleanup --- GNUmakefile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index aba78325..d846d6b5 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -127,8 +127,10 @@ ifeq ($(IS_X86)$(IS_X32)$(IS_CYGWIN)$(IS_MINGW)$(SUN_COMPILER),00000) endif endif +# Guard use of -march=native (or -m{32|64} on some platforms) +# Don't add anything if -march=XXX or -mtune=XXX is specified ifeq ($(findstring -march,$(CXXFLAGS)),) - # Guard use of -march=native +ifeq ($(findstring -mtune,$(CXXFLAGS)),) ifeq ($(GCC42_OR_LATER)$(IS_NETBSD),10) CXXFLAGS += -march=native else ifneq ($(CLANG_COMPILER)$(INTEL_COMPILER),00) @@ -144,7 +146,8 @@ ifeq ($(findstring -march,$(CXXFLAGS)),) CXXFLAGS += -m32 endif # X86/X32/X64 endif -endif +endif # -mtune +endif # -march # Aligned access required for -O3 and above due to vectorization UNALIGNED_ACCESS := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h) @@ -637,26 +640,26 @@ libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX) | so_warning endif libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) - $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS) + $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) $(LDFLAGS) $(LIBOBJS) $(LDLIBS) ifeq ($(HAS_SOLIB_VERSION),1) -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX) endif libcryptopp.dylib: $(LIBOBJS) - $(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) + $(CXX) -dynamiclib -o $@ $(strip $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) cryptest.exe: libcryptopp.a $(TESTOBJS) - $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS) + $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS) # Makes it faster to test changes nolib: $(OBJS) - $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) + $(CXX) -o ct $(strip $(CXXFLAGS)) $(OBJS) $(LDFLAGS) $(LDLIBS) dll: cryptest.import.exe dlltest.exe cryptopp.dll: $(DLLOBJS) - $(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a + $(CXX) -shared -o $@ $(strip $(CXXFLAGS)) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a libcryptopp.import.a: $(LIBIMPORTOBJS) $(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS) @@ -665,10 +668,10 @@ ifeq ($(IS_SUN),0) endif cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS) - $(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS) + $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS) dlltest.exe: cryptopp.dll $(DLLTESTOBJS) - $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) + $(CXX) -o $@ $(strip $(CXXFLAGS)) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) # This recipe prepares the distro files TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt CMakeLists.txt config.compat Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestScripts/*.sh TestScripts/*.pl TestScripts/*.cmd @@ -752,7 +755,7 @@ endif # Dependencies # MacPorts/GCC issue with init_priority. Apple/GCC and Fink/GCC are fine; limit to MacPorts. # Also see http://lists.macosforge.org/pipermail/macports-users/2015-September/039223.html ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER),11) -ifeq ($(findstring -DMACPORTS_GCC_COMPILER,$(CXXFLAGS)),) +ifeq ($(findstring -DMACPORTS_GCC_COMPILER, $(strip $(CXXFLAGS))),) cryptlib.o: $(CXX) $(strip $(CXXFLAGS)) -DMACPORTS_GCC_COMPILER=1 -c cryptlib.cpp cpu.o: @@ -761,7 +764,7 @@ endif endif # Only use CRYPTOPP_DATA_DIR if its not set in CXXFLAGS -ifeq ($(findstring -DCRYPTOPP_DATA_DIR,$(CXXFLAGS)),) +ifeq ($(findstring -DCRYPTOPP_DATA_DIR, $(strip $(CXXFLAGS))),) ifneq ($(strip $(CRYPTOPP_DATA_DIR)),) validat%.o : validat%.cpp $(CXX) $(strip $(CXXFLAGS)) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c $<