[Lldb-commits] [lldb] r123451 - /lldb/trunk/test/make/Makefile.rules

Johnny Chen johnny.chen at apple.com
Fri Jan 14 10:19:53 PST 2011


Author: johnny
Date: Fri Jan 14 12:19:53 2011
New Revision: 123451

URL: http://llvm.org/viewvc/llvm-project?rev=123451&view=rev
Log:
The cxx_compiler function should not blindly return clang++ as the C++ compiler if $(CC) contains "clang".
Instead, it should perform a textual replacement of $(CC) from "clang" to "clang++".  The same is true
for "llvm-gcc" to "llvm-g++" and for "gcc" to "g++".  This way, we keep the path component of the $(CC)
passed in from the user and do not end up with a mixed toolchains with different paths.

Ditto for a newly added function called cxx_linker.

Modified:
    lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=123451&r1=123450&r2=123451&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Fri Jan 14 12:19:53 2011
@@ -31,8 +31,11 @@
 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 @@
 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 @@
 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





More information about the lldb-commits mailing list