From f6afae2f49ed65a6a482257c7e55520857d751b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Thu, 18 Feb 2010 02:36:02 +0000 Subject: Add a shared library for LLVM, named libLLVM2.7svn.(so|dylib), and add an --enable-shared configure flag to have the tools linked shared. (2.7svn is just $(LLVMVersion) so it'll change to "2.7" in the release.) Always link the example programs shared to test that the shared library keeps working. On my mac laptop, Debug libLLVM2.7svn.dylib is 39MB, and opt (for example) is 16M static vs 440K shared. Two things are less than ideal here: 1) The library doesn't include any version information. Since we expect to break the ABI with every release, this shouldn't be much of a problem. If we do release a compatible 2.7.1, we may be able to hack its library to work with binaries compiled against 2.7.0, or we can just ask them to recompile. I'm hoping to get a real packaging expert to look at this for the 2.8 release. 2) llvm-config doesn't yet have an option to print link options for the shared library. I'll add this as a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96559 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Makefile.unittest | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'unittests/Makefile.unittest') diff --git a/unittests/Makefile.unittest b/unittests/Makefile.unittest index 6fbef54691d..5094a7e1c3e 100644 --- a/unittests/Makefile.unittest +++ b/unittests/Makefile.unittest @@ -28,6 +28,10 @@ CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/ CPP.Flags += $(NO_VARIADIC_MACROS) TESTLIBS = -lGoogleTest -lUnitTestMain +ifeq ($(ENABLE_SHARED), 1) +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 +42,6 @@ $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) all:: $(LLVMUnitTestExe) unitcheck:: $(LLVMUnitTestExe) - $(LLVMUnitTestExe) + $(Run.Shared) $(LLVMUnitTestExe) endif -- cgit v1.2.3