Remove support for building LLVM libraries into "relinked"
authorChris Lattner <sabre@nondot.org>
Tue, 16 Jun 2009 23:00:42 +0000 (23:00 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 16 Jun 2009 23:00:42 +0000 (23:00 +0000)
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

Makefile.rules
docs/MakefileGuide.html
tools/llvmc/driver/Makefile

index 4a77bf536dffcdcbd98a53bd7947683b4542141d..94d8e98c16b24b59cc2dc7fe1ef1f495e7f7f492 100644 (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
 
index 5e918bf0fd47c992852cc15610144309d09bbf65..f996144e145372156f5e0d5b7acef8bfecc98864 100644 (file)
   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
     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>
     <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
     DestArchiveLib
     DestBitcodeLib
     DestModule
-    DestRelinkedLib
     DestSharedLib
     DestTool
     DistAlways
     ProjUsedLibs
     Ranlib
     RecursiveTargets
-    Relink
     SrcMakefiles
     Strip
     StripWarnMsg
index 3dd373a51ed20efc0501c28a26803d61ea5d2d29..5f5ec533dd0dbd39ecc097c9d087d7055e41f164 100644 (file)
 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