From 53a7844383faecb8c3e0e7133bdfa8fdc0425f93 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 20 Oct 2016 18:01:19 +0000 Subject: Re-landing a cleaned up implementation of r284550 This time it should actually work. The previous implementaiton was not getting the linker or compiler flag set correctly in all the right situations. By moving the check down and basing it of whether or not CXX is set I we can have the logic to add the flags exist only once for the linker and once for the compiler instead of duplicating it. llvm-svn: 284756 --- .../Python/lldbsuite/test/make/Makefile.rules | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/make') diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 910dc6737c7..5abbc85e649 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -242,27 +242,23 @@ ifneq "$(DYLIB_NAME)" "" endif # Function that returns the counterpart C++ compiler, given $(CC) as arg. -cxx_compiler_notdir = $(if $(findstring clang,$(1)), \ - $(subst clang,clang++,$(1)), \ - $(if $(findstring icc,$(1)), \ - $(subst icc,icpc,$(1)), \ - $(if $(findstring llvm-gcc,$(1)), \ - $(subst llvm-gcc,llvm-g++,$(1)), \ - $(if $(findstring gcc,$(1)), \ - $(subst gcc,g++,$(1)), \ - $(subst cc,c++,$(1)))))) +cxx_compiler_notdir = $(if $(findstring icc,$(1)), \ + $(subst icc,icpc,$(1)), \ + $(if $(findstring llvm-gcc,$(1)), \ + $(subst llvm-gcc,llvm-g++,$(1)), \ + $(if $(findstring gcc,$(1)), \ + $(subst gcc,g++,$(1)), \ + $(subst cc,c++,$(1))))) cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_compiler_notdir,$(notdir $(1)))),$(call cxx_compiler_notdir,$(1))) # Function that returns the C++ linker, given $(CC) as arg. -cxx_linker_notdir = $(if $(findstring clang,$(1)), \ - $(subst clang,clang++,$(1)), \ - $(if $(findstring icc,$(1)), \ - $(subst icc,icpc,$(1)), \ - $(if $(findstring llvm-gcc,$(1)), \ - $(subst llvm-gcc,llvm-g++,$(1)), \ - $(if $(findstring gcc,$(1)), \ - $(subst gcc,g++,$(1)), \ - $(subst cc,c++,$(1)))))) +cxx_linker_notdir = $(if $(findstring icc,$(1)), \ + $(subst icc,icpc,$(1)), \ + $(if $(findstring llvm-gcc,$(1)), \ + $(subst llvm-gcc,llvm-g++,$(1)), \ + $(if $(findstring gcc,$(1)), \ + $(subst gcc,g++,$(1)), \ + $(subst cc,c++,$(1))))) cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1))) ifneq "$(OS)" "Darwin" @@ -450,6 +446,16 @@ ifneq "$(filter g++,$(CXX))" "" endif endif +ifeq ($(findstring clang, $(CXX)), clang) + CXXFLAGS += --driver-mode=g++ +endif + +ifneq "$(CXX)" "" + ifeq ($(findstring clang, $(LD)), clang) + LDFLAGS += --driver-mode=g++ + endif +endif + #---------------------------------------------------------------------- # DYLIB_ONLY variable can be used to skip the building of a.out. # See the sections below regarding dSYM file as well as the building of -- cgit v1.2.3