Remove support for building LLVM libraries into "relinked"

object files.  Now we always build LLVM libraries into archives (.a files).

This makes the 'make' build work more like the cmake build, among other
things.  Doing this exposed some latent circular library dependencies, so
I think that llvm-config wasn't quite right for .o files anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73579 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-06-16 23:00:42 +00:00
parent 1527f5442a
commit 6be926647d
3 changed files with 21 additions and 75 deletions

View File

@ -287,10 +287,8 @@ endif
ifdef ENABLE_COVERAGE
BuildMode := $(BuildMode)+Coverage
# These only go to .NoRelink because otherwise we will end up
# linking -lgcov into the .o libraries that get built.
CXX.Flags.NoRelink += -ftest-coverage -fprofile-arcs
C.Flags.NoRelink += -ftest-coverage -fprofile-arcs
CXX.Flags += -ftest-coverage -fprofile-arcs
C.Flags += -ftest-coverage -fprofile-arcs
endif
# If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
@ -315,7 +313,6 @@ endif
# defined/on.
ifdef LOADABLE_MODULE
SHARED_LIBRARY := 1
DONT_BUILD_RELINKED := 1
LINK_LIBS_IN_SHARED := 1
endif
@ -548,10 +545,8 @@ ifdef UNIVERSAL
endif
UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS)
ifdef UNIVERSAL_SDK_PATH
CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
Relink.Flags += -isysroot $(UNIVERSAL_SDK_PATH)
endif
# Building universal cannot compute dependencies automatically.
@ -582,27 +577,23 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
$(CPP.BaseFlags)
ifeq ($(BUILD_COMPONENT), 1)
Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(C.Flags.NoRelink) \
Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \
Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(CXX.Flags) $(CXX.Flags.NoRelink) -E
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
Relink = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(Relink.Flags)
else
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(C.Flags.NoRelink) \
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(CXX.Flags) $(CXX.Flags.NoRelink) -E
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(Relink.Flags)
endif
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) \
@ -1048,48 +1039,13 @@ endif
endif
#---------------------------------------------------------
# ReLinked Library Targets:
# If the user explicitly requests a relinked library with
# BUILD_RELINKED, provide it. Otherwise, if they specify
# neither of BUILD_ARCHIVE or DONT_BUILD_RELINKED, give
# them one.
# Library Targets:
# If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
# building an archive.
#---------------------------------------------------------
ifndef BUILD_ARCHIVE
ifndef DONT_BUILD_RELINKED
BUILD_RELINKED = 1
endif
endif
ifdef BUILD_RELINKED
all-local:: $(LibName.O)
$(LibName.O): $(ObjectsO) $(LibDir)/.dir
$(Echo) Linking $(BuildMode) Object Library $(notdir $@)
$(Verb) $(Relink) -r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO)
clean-local::
ifneq ($(strip $(LibName.O)),)
-$(Verb) $(RM) -f $(LibName.O)
endif
ifdef NO_INSTALL
install-local::
$(Echo) Install circumvented with NO_INSTALL
uninstall-local::
$(Echo) Uninstall circumvented with NO_INSTALL
else
DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
install-local:: $(DestRelinkedLib)
$(DestRelinkedLib): $(LibName.O) $(PROJ_libdir)
$(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
$(Verb) $(INSTALL) $(LibName.O) $(DestRelinkedLib)
uninstall-local::
$(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
-$(Verb) $(RM) -f $(DestRelinkedLib)
ifndef LOADABLE_MODULE
BUILD_ARCHIVE = 1
endif
endif

View File

@ -232,17 +232,16 @@
Normally, the makefile system will build all the software into a single
<tt>libname.o</tt> (pre-linked) object. This means the library is not
searchable and that the distinction between compilation units has been
dissolved. Optionally, you can ask for a shared library (.so), archive library
(.a) or to not have the default (relinked) library built. For example:</p>
dissolved. Optionally, you can ask for a shared library (.so) or archive
library (.a) built. Archive libraries are the default. For example:</p>
<pre><tt>
LIBRARYNAME = mylib
SHARED_LIBRARY = 1
ARCHIVE_LIBRARY = 1
DONT_BUILD_RELINKED = 1
</tt></pre>
<p>says to build a library named "mylib" with both a shared library
(<tt>mylib.so</tt>) and an archive library (<tt>mylib.a</tt>) version but
not to build the relinked object (<tt>mylib.o</tt>). The contents of all the
(<tt>mylib.so</tt>) and an archive library (<tt>mylib.a</tt>) version. The
contents of all the
libraries produced will be the same, they are just constructed differently.
Note that you normally do not need to specify the sources involved. The LLVM
Makefile system will infer the source files from the contents of the source
@ -307,8 +306,6 @@
on.</li>
<li>The <a href="#LINK_LIBS_IN_SHARED">LINK_LIBS_IN_SHARED</a> variable
is turned on.</li>
<li>The <a href="#DONT_BUILD_RELINKED">DONT_BUILD_RELINKED</a> variable
is turned on.</li>
</ol>
<p>A loadable module is loaded by LLVM via the facilities of libtool's libltdl
library which is part of <tt>lib/System</tt> implementation.</p>
@ -637,11 +634,6 @@
<dd>If set to any value, causes the makefiles to <b>not</b> automatically
generate dependencies when running the compiler. Use of this feature is
discouraged and it may be removed at a later date.</dd>
<dt><a name="DONT_BUILD_RELINKED"><tt>DONT_BUILD_RELINKED</tt></a></dt>
<dd>If set to any value, causes a relinked library (.o) not to be built. By
default, libraries are built as re-linked since most LLVM libraries are
needed in their entirety and re-linked libraries will be linked more quickly
than equivalent archive libraries.</dd>
<dt><a name="ENABLE_OPTIMIZED"><tt>ENABLE_OPTIMIZED</tt></a></dt>
<dd>If set to any value, causes the build to generate optimized objects,
libraries and executables. This alters the flags specified to the compilers
@ -960,7 +952,6 @@
DestArchiveLib
DestBitcodeLib
DestModule
DestRelinkedLib
DestSharedLib
DestTool
DistAlways
@ -1004,7 +995,6 @@
ProjUsedLibs
Ranlib
RecursiveTargets
Relink
SrcMakefiles
Strip
StripWarnMsg

View File

@ -10,10 +10,10 @@
LEVEL = ../../..
TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
LLVMLIBS = CompilerDriver
LLVMLIBS = CompilerDriver.a
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
USEDLIBS += $(patsubst %,plugin_llvmc_%,$(LLVMC_BUILTIN_PLUGINS))
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
endif
LINK_COMPONENTS = support system