diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 | 
| commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
| tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/make | |
| parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/make')
| -rw-r--r-- | packages/Python/lldbsuite/test/make/Makefile.rules | 92 | ||||
| -rw-r--r-- | packages/Python/lldbsuite/test/make/test_common.h | 6 | 
2 files changed, 58 insertions, 40 deletions
| diff --git a/packages/Python/lldbsuite/test/make/Makefile.rules b/packages/Python/lldbsuite/test/make/Makefile.rules index c37ef745e8b4..5abbc85e649b 100644 --- a/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/packages/Python/lldbsuite/test/make/Makefile.rules @@ -242,30 +242,52 @@ 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))) -OBJCOPY := $(CROSS_COMPILE)objcopy +ifneq "$(OS)" "Darwin" +    CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \ +                                 $(findstring clang,$(CC)), \ +                                 $(if $(findstring gcc,$(CC)), \ +                                      $(findstring gcc,$(CC)), \ +                                      cc))) + +    CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC)))) + +    replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \ +                           $(subst $(3),$(1),$(2)), \ +                           $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2))))) + +    ifeq "$(notdir $(CC))" "$(CC)" +        replace_cc_with = $(call replace_with,$(1),$(CC),$(CLANG_OR_GCC)) +    else +        replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(1),$(notdir $(CC)),$(CLANG_OR_GCC))) +    endif + +    OBJCOPY ?= $(call replace_cc_with,objcopy) +    ARCHIVER ?= $(call replace_cc_with,ar) +    override AR = $(ARCHIVER) +endif + +ifdef PIE +    LDFLAGS += -pie +endif  #----------------------------------------------------------------------  # Windows specific options @@ -277,6 +299,7 @@ ifeq "$(OS)" "Windows_NT"  		CXXFLAGS += -D_HAS_EXCEPTIONS=0  		ifeq "$(VisualStudioVersion)" "14.0"  			CXXFLAGS += -fms-compatibility-version=19.0 +			override CXXFLAGS := $(subst -std=c++11,-std=c++14,$(CXXFLAGS))  		endif  		# The MSVC linker doesn't understand long section names  		# generated by the clang compiler. @@ -285,27 +308,6 @@ ifeq "$(OS)" "Windows_NT"  endif  #---------------------------------------------------------------------- -# Android specific options -#---------------------------------------------------------------------- -ifeq "$(OS)" "Android" -    ifdef PIE -        LDFLAGS += -pie -    endif -    replace_with = $(if $(findstring clang,$(1)), \ -                        $(subst clang,$(2),$(1)), \ -                        $(if $(findstring gcc,$(1)), \ -                             $(subst gcc,$(2),$(1)), \ -                             $(subst cc,$(2),$(1)))) -    ifeq "$(notdir $(CC))" "$(CC)" -        replace_cc_with = $(call replace_with,$(CC),$(1)) -    else -        replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(notdir $(CC)),$(1))) -    endif -    OBJCOPY = $(call replace_cc_with,objcopy) -    AR = $(call replace_cc_with,ar) -endif - -#----------------------------------------------------------------------  # C++ standard library options  #----------------------------------------------------------------------  ifeq (1,$(USE_LIBSTDCPP)) @@ -444,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 diff --git a/packages/Python/lldbsuite/test/make/test_common.h b/packages/Python/lldbsuite/test/make/test_common.h index b0151afb892e..575ca62c2fc0 100644 --- a/packages/Python/lldbsuite/test/make/test_common.h +++ b/packages/Python/lldbsuite/test/make/test_common.h @@ -18,6 +18,12 @@  #include <eh.h>  #endif +#if defined(_WIN32) +#define LLVM_PRETTY_FUNCTION __FUNCSIG__ +#else +#define LLVM_PRETTY_FUNCTION LLVM_PRETTY_FUNCTION +#endif +  // On some systems (e.g., some versions of linux) it is not possible to attach to a process  // without it giving us special permissions. This defines the lldb_enable_attach macro, which | 
