aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/make/Makefile.rules
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/make/Makefile.rules')
-rw-r--r--packages/Python/lldbsuite/test/make/Makefile.rules92
1 files changed, 52 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