From 544ec21fc2fadd479c52c1b5bbb206fdaecbd79a Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 21 Sep 2016 01:09:07 +0200 Subject: [PATCH] Fix building with clang. --- src/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index c79126cc..676d45b9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,11 +10,9 @@ # dependencies on the default values of builtin variables, # then we cannot use builtin variables at all. # See: http://lists.gnu.org/archive/html/help-make/2016-08/msg00011.html -MAKEFLAGS += -rR +MAKEFLAGS += -r ifneq ($(upx_CXX),) CXX = $(upx_CXX) -else -CXX = g++ endif ifneq ($(upx_CXXLD),) CXXLD = $(upx_CXXLD) @@ -73,7 +71,10 @@ CXXFLAGS += -O2 LDFLAGS += -s endif # protect against security threats caused by misguided C++ compiler "optimizations" -CXXFLAGS += -fno-delete-null-pointer-checks -fno-strict-aliasing -fwrapv +ifeq ($(findstring clang,$(CXX)),) +CXXFLAGS += -fno-delete-null-pointer-checks +endif +CXXFLAGS += -fno-strict-aliasing -fwrapv CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wwrite-strings CXXFLAGS_WERROR ?= -Werror CXXFLAGS += $(CXXFLAGS_WERROR)