defs.mk.in: Add support for redefining CC and CPP from the environment

.. most notably to clang and clang++, respectively

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2016-03-03 13:21:47 +00:00
commit ffba403256

View file

@ -235,6 +235,8 @@ ifeq ($(TARGET),mingw)
endif
GCC ?= $(CROSS_TOOL_BIN_PREFIX)gcc
GPP ?= $(CROSS_TOOL_BIN_PREFIX)g++
CLANG ?= $(CROSS_TOOL_BIN_PREFIX)clang
CLANGPP ?= $(CROSS_TOOL_BIN_PREFIX)clang++
STRIP ?= $(CROSS_TOOL_BIN_PREFIX)strip
RANLIB ?= $(CROSS_TOOL_BIN_PREFIX)ranlib
AR ?= $(CROSS_TOOL_BIN_PREFIX)ar
@ -246,6 +248,8 @@ LD = $(GPP)
else
GCC ?= gcc
GPP ?= g++
CLANG ?= clang
CLANGPP ?= clang++
STRIP ?= strip
LD = $(GPP)
RANLIB ?= ranlib
@ -761,8 +765,10 @@ ifeq ($(USE_GFILTER),true)
endif
endif
ifeq "$(origin CC)" "default"
CC = $(GCC)
CPP = $(GPP)
endif
PROJECTLIB_LDFLAGS += -L$(TOPDIR)/lib
@ -895,15 +901,25 @@ ifeq ($(USE_COMPILER_DEBUG_OPTS),true)
BUILD_LDFLAGS += -gdwarf-2 -g3 -ggdb
endif
ifeq ($(CC),$(GCC))
GCC_NO_OPT_FLAGS = \
-fno-inline-functions-called-once \
-fno-tree-loop-optimize \
-fno-early-inlining
else
ifeq ($(CC),$(CLANG))
BUILD_CFLAGS += -Werror
BUILD_CPPFLAGS += -Werror
endif
endif
ifeq ($(USE_COMPILER_OPTIMIZATION_OPTS),true)
BUILD_CFLAGS += -funroll-loops -O2
BUILD_CPPFLAGS += -funroll-loops -O2
else
NO_OPT_FLAGS = \
-O0 -g -fno-inline -fno-omit-frame-pointer -fno-builtin -fno-optimize-sibling-calls \
-fno-inline-functions-called-once \
-fno-tree-loop-optimize \
-fno-early-inlining
$(GCC_NO_OPT_FLAGS)
# -fconserve-stack
@ -915,10 +931,10 @@ else
-fno-inline \
-finline-limit=0 \
-fkeep-inline-functions \
-fno-inline-functions-called-once \
-fno-inline-functions \
-fno-early-inlining
BUILD_CFLAGS+= $(NO_OPT_FLAGS)
$(GCC_NO_OPT_FLAGS)
BUILD_CFLAGS += $(NO_OPT_FLAGS)
BUILD_CPPFLAGS += $(NO_OPT_FLAGS)
BUILD_LDFLAGS += $(NO_OPT_FLAGS)
endif