--- a/Makefile +++ b/Makefile @@ -61,8 +61,8 @@ # compiler settings: ifneq ($(CC),use__A_CC__instead_of__CC) -A_CC:=$(CC)# compile C -A_CXX:=$(CXX)# compile C++ +A_CC:=${CC}# compile C +A_CXX:=${CXX}# compile C++ # uncomment to ensure no submakefile uses CC and CXX directly override CC:=use__A_CC__instead_of__CC @@ -119,12 +119,7 @@ endif endif -ifeq ($(USE_CLANG),1) -# accept all clang versions: ALLOWED_COMPILER_VERSIONS=$(COMPILER_VERSION) -else -ALLOWED_COMPILER_VERSIONS=$(ALLOWED_gcc_VERSIONS) -endif COMPILER_VERSION_ALLOWED=$(strip $(subst ___,,$(foreach version,$(ALLOWED_COMPILER_VERSIONS),$(findstring ___$(version)___,___$(COMPILER_VERSION)___)))) @@ -184,20 +179,13 @@ shared_cflags :=# flags for shared lib compilation lflags :=# linker flags -clflags :=# linker flags (when passed through gcc) +clflags := ${LDFLAGS} # linker flags (when passed through gcc) extended_warnings :=# warning flags for C and C++-compiler extended_cpp_warnings :=# warning flags for C++-compiler only ifeq ($(DEBUG),0) dflags := -DNDEBUG# defines - ifeq ($(USE_CLANG),1) - cflags := -O3# compiler flags (C and C++) - else - cflags := -O3# compiler flags (C and C++) - lflags += -O2# linker flags - clflags += -Wl,-O2# passthrough linker flags - endif endif ifeq ($(DEBIAN),1) @@ -526,6 +514,9 @@ cxxflags += $(CPPFLAGS) endif +cflags := ${CFLAGS} $(cflags) +cxxflags += ${CXXFLAGS} + ifeq ('$(USE_GCC_47_OR_HIGHER)','yes') cxxflags += -std=gnu++11# see also TEMPLATES/cxxforward.h@USE_Cxx11 else