From: Antonio Ospite Date: Thu, 22 Feb 2018 10:27:53 +0000 (+0100) Subject: Makefile: fix detecting the compiler X-Git-Url: https://git.ao2.it/experiments/opencv_trail_effect.git/commitdiff_plain/7555c94ede06439d70ea34dca41947c0caf2fa95?ds=inline;hp=4eac1abc8f592c16e93a54f5b1d04c371d35f8da Makefile: fix detecting the compiler Rely on the compiler version, to behave "more correctly" in case CXX is just c++. --- 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