summaryrefslogtreecommitdiff
path: root/unittests/Makefile.unittest
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-02-23 18:10:07 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-02-23 18:10:07 +0000
commitea6c39d417172a8edb99667e93cd6b67cd024e6a (patch)
tree3c6c8f110eb785834997bfe59326bc8022f68dfd /unittests/Makefile.unittest
parente3d97c744772c075e11f372548cc8d848d555ee9 (diff)
Roll r96559 forward again, adding libLLVM-2.7svn.so to LLVM. This links 3 of
the examples shared to make sure the shared library keeps working. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Makefile.unittest')
-rw-r--r--unittests/Makefile.unittest13
1 files changed, 12 insertions, 1 deletions
diff --git a/unittests/Makefile.unittest b/unittests/Makefile.unittest
index 6fbef54691d..9dfb965d38f 100644
--- a/unittests/Makefile.unittest
+++ b/unittests/Makefile.unittest
@@ -28,6 +28,17 @@ CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
CPP.Flags += $(NO_VARIADIC_MACROS)
TESTLIBS = -lGoogleTest -lUnitTestMain
+ifeq ($(ENABLE_SHARED), 1)
+ # Add the absolute path to the dynamic library. This is ok because
+ # we'll never install unittests.
+ LD.Flags += $(RPATH) -Wl,$(LibDir)
+endif
+ifeq ($(ENABLE_SHARED), 1)
+ # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
+ # of the time.
+ Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
+endif
+
$(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
$(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
@@ -38,6 +49,6 @@ $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
all:: $(LLVMUnitTestExe)
unitcheck:: $(LLVMUnitTestExe)
- $(LLVMUnitTestExe)
+ $(Run.Shared) $(LLVMUnitTestExe)
endif