summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-06-02 21:38:10 +0000
committerGreg Clayton <gclayton@apple.com>2015-06-02 21:38:10 +0000
commit315b88d0cfe21a71df07123f49ec881cb731673a (patch)
treee2755411ed1e5e298f4299eda21389c5b8d1d2f2
parent0ccf9b71f3559f55ef228520686ad3619f83c606 (diff)
downloadbcm5719-llvm-315b88d0cfe21a71df07123f49ec881cb731673a.tar.gz
bcm5719-llvm-315b88d0cfe21a71df07123f49ec881cb731673a.zip
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
-rw-r--r--lldb/test/make/Makefile.rules39
1 files changed, 36 insertions, 3 deletions
diff --git a/lldb/test/make/Makefile.rules b/lldb/test/make/Makefile.rules
index fcb67adffea..c512e157dbc 100644
--- a/lldb/test/make/Makefile.rules
+++ b/lldb/test/make/Makefile.rules
@@ -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
OpenPOWER on IntegriCloud