forked from OSchip/llvm-project
Added the ability for the "make" command to take a triple:
% cd lldb/test/lang/c/array_types % make TRIPLE=x86_64-apple-ios % make clean % make TRIPLE=x86_64-apple-ios8.1 % make clean % make TRIPLE=armv7-apple-ios % make clean % make TRIPLE=armv7-apple-ios8.1 % make clean The TRIPLE variable will automatically set the following variables: SDKROOT if it isn't specified manually ARCH will be set to the architecture from the triple CFLAGS will include the extras needed for the triple which are set in TRIPLE_CFLAGS TRIPLE_VENDOR set to the triple vendor ("apple" in the above cases) TRIPLE_OS set to the triple OS ("ios" in the above cases) TRIPLE_VERSION set to the version that was specified, or automatically set to the SDK version if it is missing This allows you to change directory into any test case on MacOSX and quickly build for desktop: % make iOS simulator: % make TRIPLE=x86_64-apple-ios or iOS device: % make TRIPLE=armv7-apple-ios llvm-svn: 238869
This commit is contained in:
parent
0ccf9b71f3
commit
315b88d0cf
|
@ -30,6 +30,39 @@
|
|||
THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
|
||||
LLDB_BASE_DIR := $(THIS_FILE_DIR)../../
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
|
||||
# from the triple alone
|
||||
#----------------------------------------------------------------------
|
||||
TRIPLE_CFLAGS :=
|
||||
ifneq "$(TRIPLE)" ""
|
||||
triple_space = $(subst -, ,$(TRIPLE))
|
||||
ARCH =$(word 1, $(triple_space))
|
||||
TRIPLE_VENDOR =$(word 2, $(triple_space))
|
||||
triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed -e 's/\(.*\)\([0-9]\.[0-9]\).*/\1 \2/')
|
||||
TRIPLE_OS =$(word 1, $(triple_os_and_version))
|
||||
TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
|
||||
ifeq "$(TRIPLE_VERSION)" ""
|
||||
TRIPLE_VERSION =$(shell echo $(sdk_basename) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
|
||||
endif
|
||||
ifeq "$(TRIPLE_VENDOR)" "apple"
|
||||
ifeq "$(TRIPLE_OS)" "ios"
|
||||
ifeq "$(SDKROOT)" ""
|
||||
# Set SDKROOT if it wasn't set
|
||||
ifneq (,$(findstring arm,$(ARCH)))
|
||||
SDKROOT = $(shell xcrun --sdk iphoneos --show-sdk-path)
|
||||
TRIPLE_CFLAGS :=-mios-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)"
|
||||
else
|
||||
SDKROOT = $(shell xcrun --sdk iphonesimulator --show-sdk-path)
|
||||
TRIPLE_CFLAGS :=-mios-simulator-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)"
|
||||
endif
|
||||
endif
|
||||
sdk_basename = $(notdir $(SDKROOT))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# If OS is not defined, use 'uname -s' to determine the OS name.
|
||||
#
|
||||
|
@ -140,13 +173,13 @@ ifeq "$(OS)" "Darwin"
|
|||
else
|
||||
CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
|
||||
endif
|
||||
CFLAGS += -include $(THIS_FILE_DIR)test_common.h
|
||||
CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS)
|
||||
|
||||
# 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) $(CFLAGS_EXTRAS)
|
||||
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS)
|
||||
else
|
||||
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
|
||||
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS)
|
||||
endif
|
||||
|
||||
CXXFLAGS += -std=c++11
|
||||
|
|
Loading…
Reference in New Issue