summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/make/Makefile.rules11
1 files changed, 7 insertions, 4 deletions
diff --git a/lldb/test/make/Makefile.rules b/lldb/test/make/Makefile.rules
index 524ddec20e2..e048f04c391 100644
--- a/lldb/test/make/Makefile.rules
+++ b/lldb/test/make/Makefile.rules
@@ -31,8 +31,11 @@ OBJECTS =
EXE = a.out
DSYM = $(EXE).dSYM
-# Function that returns the counterpart C++ compiler.
-cxx_compiler = $(if $(findstring clang,$(1)), clang++, $(if $(findstring llvm-gcc,$(1)), llvm-g++, g++))
+# Function that returns the counterpart C++ compiler, given $(CC) as arg.
+cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
+
+# Function that returns the C++ linker, given $(CC) as arg.
+cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,g++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,g++,$(1)), $(subst gcc,g++,$(1))))
#----------------------------------------------------------------------
# dylib settings
@@ -55,7 +58,7 @@ endif
ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
- LD = g++
+ LD = $(call cxx_linker,$(CC))
endif
#----------------------------------------------------------------------
@@ -72,7 +75,7 @@ endif
ifneq "$(strip $(OBJCXX_SOURCES))" ""
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
- LD = g++
+ LD = $(call cxx_linker,$(CC))
ifeq $(findstring lobjc,$(LDFLAGS)) ""
LDFLAGS +=-lobjc
endif
OpenPOWER on IntegriCloud