diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/make/Makefile.rules')
-rw-r--r-- | packages/Python/lldbsuite/test/make/Makefile.rules | 91 |
1 files changed, 67 insertions, 24 deletions
diff --git a/packages/Python/lldbsuite/test/make/Makefile.rules b/packages/Python/lldbsuite/test/make/Makefile.rules index 32f41b24d5dce..a2dc6cc66595e 100644 --- a/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/packages/Python/lldbsuite/test/make/Makefile.rules @@ -29,10 +29,10 @@ # SHELL = /bin/sh -x SRCDIR := $(shell dirname $(firstword $(MAKEFILE_LIST)))/ +BUILDDIR := $(shell pwd) THIS_FILE_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/ LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../ - #---------------------------------------------------------------------- # If OS is not defined, use 'uname -s' to determine the OS name. # @@ -50,6 +50,33 @@ ifeq "$(OS)" "" endif #---------------------------------------------------------------------- +# If OS is Windows, force SHELL to be cmd +# +# Some versions of make on Windows will search for other shells such as +# C:\cygwin\bin\sh.exe. This shell fails for numerous different reasons +# so default to using cmd.exe. +#---------------------------------------------------------------------- +ifeq "$(OS)" "Windows_NT" + SHELL = $(WINDIR)\system32\cmd.exe +endif + +#---------------------------------------------------------------------- +# If the OS is Windows use double-quotes in commands +# +# For other operating systems, single-quotes work fine, but on Windows +# we strictly required double-quotes +#---------------------------------------------------------------------- +ifeq "$(HOST_OS)" "Windows_NT" + JOIN_CMD = & + QUOTE = " + FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = " +else + JOIN_CMD = ; + QUOTE = ' + FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = ' +endif + +#---------------------------------------------------------------------- # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more # from the triple alone #---------------------------------------------------------------------- @@ -63,7 +90,8 @@ ifneq "$(TRIPLE)" "" TRIPLE_VERSION =$(word 2, $(triple_os_and_version)) ifeq "$(TRIPLE_VENDOR)" "apple" ifeq "$(TRIPLE_OS)" "ios" - ifeq "$(SDKROOT)" "" + CODESIGN := codesign + ifeq "$(SDKROOT)" "" # Set SDKROOT if it wasn't set ifneq (,$(findstring arm,$(ARCH))) SDKROOT = $(shell xcrun --sdk iphoneos --show-sdk-path) @@ -81,7 +109,8 @@ ifneq "$(TRIPLE)" "" endif endif ifeq "$(TRIPLE_OS)" "watchos" - ifeq "$(SDKROOT)" "" + CODESIGN := codesign + ifeq "$(SDKROOT)" "" # Set SDKROOT if it wasn't set ifneq (,$(findstring arm,$(ARCH))) SDKROOT = $(shell xcrun --sdk watchos --show-sdk-path) @@ -228,6 +257,12 @@ endif CFLAGS += -I$(SRCDIR) -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR) CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS) +# If the OS is Windows, we need to pass -gdwarf to clang, otherwise it will build +# with codeview by default but all the tests rely on dwarf. +ifeq "$(OS)" "Windows_NT" + CFLAGS += -gdwarf +endif + # Use this one if you want to build one part of the result without debug information: ifeq "$(OS)" "Darwin" CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS) @@ -239,12 +274,22 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif -CLANG_MODULE_CACHE_DIR := module-cache +# Use a shared module cache when building in the default test build directory. +CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed $(QUOTE)s/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/$(QUOTE)) + +ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" "" +CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache +$(warning failed to set the shared clang module cache dir) +endif MANDATORY_MODULE_BUILD_CFLAGS := -fmodules -gmodules -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR) ifeq "$(MAKE_GMODULES)" "YES" CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) + CXXFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) + ifeq "$(OS)" "Darwin" + CXXFLAGS += -fcxx-modules + endif endif CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS) @@ -315,7 +360,7 @@ ifneq "$(OS)" "Darwin" endif ifdef PIE - LDFLAGS += -pie + LDFLAGS += -pie endif #---------------------------------------------------------------------- @@ -380,17 +425,17 @@ ifneq "$(strip $(DYLIB_OBJC_SOURCES))" "" endif ifneq "$(strip $(DYLIB_CXX_SOURCES))" "" - DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o)) - CXX = $(call cxx_compiler,$(CC)) - LD = $(call cxx_linker,$(CC)) + DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o)) + CXX = $(call cxx_compiler,$(CC)) + LD = $(call cxx_linker,$(CC)) endif #---------------------------------------------------------------------- # Check if we have a precompiled header #---------------------------------------------------------------------- ifneq "$(strip $(PCH_CXX_SOURCE))" "" - PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch) - PCHFLAGS = -include $(PCH_CXX_SOURCE) + PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch) + PCHFLAGS = -include $(PCH_CXX_SOURCE) endif #---------------------------------------------------------------------- @@ -472,21 +517,21 @@ ifneq "$(strip $(CXX_SOURCES) $(OBJCXX_SOURCES))" "" ifneq "$(filter g++,$(CXX))" "" CXXVERSION = $(shell $(CXX) -dumpversion | cut -b 1-3) ifeq "$(CXXVERSION)" "4.6" - # GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x - # instead. FIXME: remove once GCC version is upgraded. + # GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x + # instead. FIXME: remove once GCC version is upgraded. override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS)) endif endif endif ifeq ($(findstring clang, $(CXX)), clang) - CXXFLAGS += --driver-mode=g++ + CXXFLAGS += --driver-mode=g++ endif ifneq "$(CXX)" "" - ifeq ($(findstring clang, $(LD)), clang) - LDFLAGS += --driver-mode=g++ - endif + ifeq ($(findstring clang, $(LD)), clang) + LDFLAGS += --driver-mode=g++ + endif endif #---------------------------------------------------------------------- @@ -508,6 +553,9 @@ endif else $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)" +ifneq "$(CODESIGN)" "" + $(CODESIGN) -s - "$(EXE)" +endif endif #---------------------------------------------------------------------- @@ -552,6 +600,9 @@ endif $(DYLIB_FILENAME) : $(DYLIB_OBJECTS) ifeq "$(OS)" "Darwin" $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_EXECUTABLE_PATH)/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)" +ifneq "$(CODESIGN)" "" + $(CODESIGN) -s - "$(DYLIB_FILENAME)" +endif ifneq "$(MAKE_DSYM)" "NO" ifneq "$(DS)" "" "$(DS)" $(DSFLAGS) "$(DYLIB_FILENAME)" @@ -594,14 +645,6 @@ endif # the compiler -MM option. The -M option will list all system headers, # and the -MM option will list all non-system dependencies. #---------------------------------------------------------------------- -ifeq "$(HOST_OS)" "Windows_NT" - JOIN_CMD = & - QUOTE = " -else - JOIN_CMD = ; - QUOTE = ' -endif - %.d: %.c @rm -f $@ $(JOIN_CMD) \ $(CC) -M $(CFLAGS) $< > $@.tmp && \ |