From 7555c94ede06439d70ea34dca41947c0caf2fa95 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Thu, 22 Feb 2018 11:27:53 +0100 Subject: [PATCH] Makefile: fix detecting the compiler Rely on the compiler version, to behave "more correctly" in case CXX is just c++. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6bb3c15..4e316b9 100644 --- a/Makefile +++ b/Makefile @@ -23,12 +23,14 @@ CXXFLAGS += -fno-common \ -fstack-protector \ --param=ssp-buffer-size=4 -ifneq ($(CXX),clang++) +COMPILER = $(shell $(CXX) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) + +ifeq ($(COMPILER), gcc) CXXFLAGS += -Wunsafe-loop-optimizations \ -Wunused-but-set-variable endif -ifeq ($(CXX),clang++) +ifeq ($(COMPILER), clang) LDFLAGS += -Qunused-arguments endif -- 2.1.4