Allow specifying tool path/prefix for tests with CROSS_COMPILE.
authorRobert Flack <flackr@gmail.com>
Mon, 20 Apr 2015 18:07:55 +0000 (18:07 +0000)
committerRobert Flack <flackr@gmail.com>
Mon, 20 Apr 2015 18:07:55 +0000 (18:07 +0000)
CROSS_COMPILE environment variable is a common convention to specify the path
and/or prefix to cross compilation tools (e.g. ar, objcopy).

Test Plan:
dotest.py $DOTEST_OPTS -t -p 'TestBSDArchives.py|TestBreakpointCommandsFromPython.py|TestFormats.py|TestObjCDynamicValue.py'
All of these tests now compile successfully and pass running macosx -> linux
using a cross compilation toolchain prefixed by CROSS_COMPILE without requiring
changing your PATH. They still pass when run locally on macosx.

Differential Revision: http://reviews.llvm.org/D9072

llvm-svn: 235320

lldb/test/make/Makefile.rules

index 796e16c..2d146a5 100644 (file)
 #
 # Also might be of interest:
 # FRAMEWORK_INCLUDES (Darwin only) :=
-# CFLAGS_EXTRAS +=
+# CFLAGS_EXTRAS :=
 # LD_EXTRAS :=
 # SPLIT_DEBUG_SYMBOLS := YES
+# CROSS_COMPILE :=
 #
 # And test/functionalities/archives/Makefile:
 # MAKE_DSYM := NO
@@ -84,9 +85,10 @@ ifeq "$(OS)" "Darwin"
        DS := $(shell xcrun -find -toolchain default dsymutil)
        DSFLAGS =
        DSYM = $(EXE).dSYM
-       AR := libtool
+       AR := $(CROSS_COMPILE)libtool
        ARFLAGS := -static -o
 else
+       AR := $(CROSS_COMPILE)ar
        # On non-Apple platforms, -arch becomes -m
        ARCHFLAG := -m
 
@@ -188,7 +190,7 @@ cxx_linker_notdir = $(if $(findstring clang,$(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 objcopy
+OBJCOPY := $(CROSS_COMPILE)objcopy
 
 #----------------------------------------------------------------------
 # Windows specific options