+<!-- *********************************************************************** -->
+<div class="doc_section"><a name="tutorial">Tutorial</a></div>
+<!-- *********************************************************************** -->
+<div class="doc_text">
+ <p>This section provides some examples of the different kinds of modules you
+ can build with the LLVM makefile system. In general, each directory you
+ provide will build a single object although that object may be composed of
+ additionally compiled components.</p>
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="libraries">Libraries</a></div>
+<div class="doc_text">
+ <p>Only a few variable definitions are needed to build a regular library.
+ 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>
+ <pre><tt>
+ LIBRARYNAME = mylib
+ SHARED_LIBRARY = 1
+ ARCHIVE_LIBRARY = 1
+ DONT_BUILT_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
+ 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
+ directory.</p>
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="tools">Tools</a></div>
+<div class="doc_text">
+ <p>For building executable programs (tools), you must provide the name of the
+ tool and the names of the libraries you wish to link with the tool. For
+ example:</p>
+ <pre><tt>
+ TOOLNAME = mytool
+ USEDLIBS = mylib
+ LLVMLIBS = LLVMSupport.a LLVMSystem.a
+ </tt></pre>
+ <p>says that we are to build a tool name <tt>mytool</tt> and that it requires
+ three libraries: <tt>mylib</tt>, <tt>LLVMSupport.a</tt> and
+ <tt>LLVMSystem.a</tt>.</p>
+ <p>Note that two different variables are use to indicate which libraries are
+ linked: <tt>USEDLIBS</tt> and <tt>LLVMLIBS</tt>. This distinction is necessary
+ to support projects. <tt>LLVMLIBS</tt> refers to the LLVM libraries found in
+ the LLVM object directory. <tt>USEDLIBS</tt> refers to the libraries built by
+ your project. In the case of building LLVM tools, <tt>USEDLIBS</tt> and
+ <tt>LLVMLIBS</tt> can be used interchangeably since the "project" is LLVM
+ itself and <tt>USEDLIBS</tt> refers to the same place as <tt>LLVMLIBS</tt>.
+ </p>
+ <p>Also note that there are two different ways of specifying a library: with a
+ <tt>.a</tt> suffix and without. Without the suffix, the entry refers to the
+ re-linked (.o) file which will include <em>all</em> symbols of the library.
+ This is useful, for example, to include all passes from a library of passes.
+ If the <tt>.a</tt> suffix is used then the library is linked as a searchable
+ library (with the <tt>-l</tt> option). In this case, only the symbols that are
+ unresolved <em>at that point</em> will be resolved from the library, if they
+ exist. Other (unreferenced) symbols will not be included when the <tt>.a</tt>
+ syntax is used. Note that in order to use the <tt>.a</tt> suffix, the library
+ in question must have been built with the <tt>ARCHIVE_LIBRARY</tt> option set.
+ </p>
+</div>
+