From 7ca731b12ce69596d7b9fec4a72d44ca8a3913c3 Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 29 Feb 2016 09:03:24 +0000 Subject: [PATCH] build: Improve -momit-leaf-frame-pointer usage -momit-leaf-frame-pointer is only supported on certain archs. Detect this automatically based on which flags the compiler understands. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0e3f11e65..018184c75 100644 --- a/Makefile +++ b/Makefile @@ -84,12 +84,11 @@ endif # compile with -O2 if debug level is not 2 ifneq ($(DEBUG_LEVEL), 2) OPT += -O2 -fno-omit-frame-pointer -ifeq (,$(findstring ppc64,$(MACHINE))) # ppc64[le] doesn't support -momit-leaf-frame-pointer -ifneq ($(MACHINE),armv7l) +# Skip for archs that don't support -momit-leaf-frame-pointer +ifeq (,$(shell $(CXX) -fsyntax-only -momit-leaf-frame-pointer -xc /dev/null 2>&1)) OPT += -momit-leaf-frame-pointer endif endif -endif # if we're compiling for release, compile without debug code (-DNDEBUG) and # don't treat warnings as errors