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

Johnny Chen johnny.chen at apple.com
Wed Sep 29 18:22:34 PDT 2010


Author: johnny
Date: Wed Sep 29 20:22:34 2010
New Revision: 115125

URL: http://llvm.org/viewvc/llvm-project?rev=115125&view=rev
Log:
Added a utility function to return the counterpart C++ compiler of $(CC) and use
it inside Makefile.rules to return clang++ on clang and llvm-g++ on llvm-gcc.

Removed CPLUSPLUSFLAGS which is simply wrong and CPPFLAGS which is unnecessary.

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=115125&r1=115124&r2=115125&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Wed Sep 29 20:22:34 2010
@@ -24,14 +24,16 @@
 DSFLAGS =
 CC = gcc
 CFLAGS ?=-arch $(ARCH) -gdwarf-2 -O0
-CPLUSPLUSFLAGS +=$(CFLAGS)
-CPPFLAGS +=$(CFLAGS)
+CXXFLAGS +=$(CFLAGS)
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
 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++))
+
 #----------------------------------------------------------------------
 # dylib settings
 #----------------------------------------------------------------------
@@ -52,6 +54,7 @@
 #----------------------------------------------------------------------
 ifneq "$(strip $(CXX_SOURCES))" ""
 	OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
+	CXX = $(call cxx_compiler,$(CC))
 	LD = g++
 endif
 
@@ -68,6 +71,7 @@
 #----------------------------------------------------------------------
 ifneq "$(strip $(OBJCXX_SOURCES))" ""
 	OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
+	CXX = $(call cxx_compiler,$(CC))
 	LD = g++
 	ifeq $(findstring lobjc,$(LDFLAGS)) ""
 		LDFLAGS +=-lobjc





More information about the lldb-commits mailing list