Make file use stylesheets and be HTML-4.01 (Strict)-compliant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13506 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman 2004-05-12 20:57:43 +00:00
parent 3669299acd
commit f6a0407ee5

View File

@ -1,135 +1,116 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html> <html>
<head> <head>
<title>Creating an LLVM Project</title> <title>Creating an LLVM Project</title>
</head> <link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<body bgcolor=white> <div class="doc_title">Creating an LLVM Project</div>
<center><h1>Creating an LLVM Project<br></h1></center>
<!--===============================================================-->
<h2><a name="a">Overview</a><hr></h2>
<!--===============================================================-->
The LLVM build system is designed to facilitate the building of third party
projects that use LLVM header files, libraries, and tools. In order to use
these facilities, a Makefile from a project must do the following things:
<ol>
<li><a href="#overview">Overview</a></li>
<li><a href="#create">Create a project from the Sample Project</a></li>
<li><a href="#source">Source tree layout</a></li>
<li><a href="#makefiles">Writing LLVM-style Makefiles</a>
<ol> <ol>
<li>Set environment variables. <li><a href="#reqVars">Required Variables</a></li>
<p> <li><a href="#varsBuildDir">Variables for Building Subdirectories</a></li>
There are several environment variables that a Makefile needs to set to <li><a href="#varsBuildLib">Variables for Building Libraries</a></li>
use the LLVM build system: <li><a href="#varsBuildProg">Variables for Building Programs</a></li>
<dl compact> <li><a href="#miscVars">Miscellaneous Variables</a></li>
<dt>LLVM_SRC_ROOT </ol></li>
<dd> <li><a href="#objcode">Placement of object code</a></li>
The root of the LLVM source tree. <li><a href="#help">Further help</a></li>
<p> </ol>
<dt>LLVM_OBJ_ROOT <!-- *********************************************************************** -->
<dd> <div class="doc_section"><a name="overview">Overview</a></div>
The root of the LLVM object tree. <!-- *********************************************************************** -->
<p>
<dt>BUILD_SRC_ROOT <div class="doc_text">
<dd>
The root of the project's source tree.
<p>
<dt>BUILD_OBJ_ROOT <p>The LLVM build system is designed to facilitate the building of third party
<dd> projects that use LLVM header files, libraries, and tools. In order to use
The root of the project's object tree. these facilities, a Makefile from a project must do the following things:</p>
<p>
<dt>BUILD_SRC_DIR <ol>
<dd> <li>Set environment variables.There are several environment variables that a
The directory containing the current source to be compiled. Makefile needs to set to use the LLVM build system:
<p>
<dt>BUILD_OBJ_DIR <ul>
<dd> <li><tt>LLVM_SRC_ROOT</tt> - The root of the LLVM source tree.</li>
The directory where the current source will place the new object <li><tt>LLVM_OBJ_ROOT</tt> - The root of the LLVM object tree.</li>
files. This should always be the current directory. <li><tt>BUILD_SRC_ROOT</tt> - The root of the project's source tree.</li>
<p> <li><tt>BUILD_OBJ_ROOT</tt> - The root of the project's object tree.</li>
<li><tt>BUILD_SRC_DIR</tt> - The directory containing the current source to be
compiled.</li>
<li><tt>BUILD_OBJ_DIR</tt> - The directory where the current source will place
the new object files. This should always be the current directory.</li>
<li><tt>LEVEL</tt> - The relative path from the current directory to the root
of the object tree.</li>
</ul></li>
<li>Include <tt>Makefile.config</tt> from <tt>$(LLVM_OBJ_ROOT)</tt>.</li>
<li>Include <tt>Makefile.rules</tt> from <tt>$(LLVM_SRC_ROOT)</tt>.</li>
</ol>
<dt>LEVEL <p>There are two ways that you can set all of these variables:</p>
<dd>
The relative path from the current directory to the root of the
object tree.
<p>
</dl>
<li>Include the LLVM Makefile.config from $(LLVM_OBJ_ROOT). <ol>
<p> <li>You can write your own Makefiles which hard-code these values.</li>
<li>Include the LLVM Makefile.rules from $(LLVM_SRC_ROOT). <li> You can use the pre-made LLVM sample project. This sample project includes
</ol> Makefiles, a configure script that can be used to configure the location of
LLVM, and the ability to support multiple object directories from a single
source directory.</li>
</ol>
There are two ways that you can set all of these variables: <p>This document assumes that you will base your project off of the LLVM sample
<ol> project found in <tt>llvm/projects/sample</tt>. If you want to devise your own
<li> build system, studying the sample project and LLVM Makefiles will probably
You can write your own Makefiles which hard-code these values. provide enough information on how to write your own Makefiles.</p>
<li> </div>
You can use the pre-made LLVM sample project. This sample project
includes Makefiles, a configure script that can be used to configure
the location of LLVM, and the ability to support multiple object
directories from a single source directory.
</ol>
This document assumes that you will base your project off of the LLVM <!-- *********************************************************************** -->
sample project found in <tt>llvm/projects/sample</tt>. If you want to <div class="doc_section">
devise your own build system, studying the sample project and LLVM <a name="create">Create a Project from the Sample Project</a>
Makefiles will probably provide enough information on how to write your own </div>
Makefiles. <!-- *********************************************************************** -->
<p>
<!--===============================================================--> <div class="doc_text">
<h2><a name="a">Create a Project from the Sample Project</a><hr></h2>
<!--===============================================================-->
Follow these simple steps to start your project: <p>Follow these simple steps to start your project:</p>
<ol> <ol>
<li> <li>Copy the <tt>llvm/projects/sample</tt> directory to any place of your
Copy the <tt>llvm/projects/sample</tt> directory to any place choosing. You can place it anywhere you like. Rename the directory to match
of your choosing. You can place it anywhere you like. Rename the the name of your project.</li>
directory to match the name of your project.
<p>
<li> <li>Add your source code and Makefiles to your source tree.</li>
Add your source code and Makefiles to your source tree.
<p>
<li> <li>If you want your Makefiles to be configured by the <tt>configure</tt>
If you want your Makefiles to be configured by the script, or if you want to support multiple object directories, add your
<tt>configure</tt> script, or if you want to support multiple Makefiles to the <tt>configure</tt> script by adding them into the
object directories, add your Makefiles to the <tt>configure</tt> <tt>autoconf/configure.ac</tt> file. The macro <tt>AC_CONFIG_MAKEFILE</tt> will
script by adding them into the <tt>autoconf/configure.ac</tt> file. copy a file, unmodified, from the source directory to the object directory.</li>
The macro <tt>AC_CONFIG_MAKEFILE</tt> will copy a file, unmodified,
from the source directory to the object directory.
<p> <li>After updating <tt>autoconf/configure.ac</tt>, regenerate the
After updating <tt>autoconf/configure.ac</tt>, regenerate the configure script with these commands:
configure script with these commands:
<p>
<tt>
cd autoconf<br>
autoconf -o ../configure
</tt>
<p> <div class="doc_code">
<p><tt>% cd autoconf<br>
% autoconf -o ../configure</tt></p>
</div>
You must be using Autoconf version 2.57 or higher. <p>You must be using Autoconf version 2.57 or higher.</p></li>
<p>
<li> <li>Run <tt>configure</tt> in the directory in which you want to place
Run <tt>configure</tt> in the directory in which you want to place object code. Use the following options to tell your project where it
object code. Use the following options to tell your project where it can find LLVM:
can find LLVM:
<dl compact> <dl>
<dt><tt>--with-llvmsrc=&lt;directory&gt;</tt> <dt><tt>--with-llvmsrc=&lt;directory&gt;</tt>
<dd> <dd>
Tell your project where the LLVM source tree is located. Tell your project where the LLVM source tree is located.
@ -138,26 +119,32 @@
<dd> <dd>
Tell your project where the LLVM object tree is located. Tell your project where the LLVM object tree is located.
</dl> </dl>
</ol> </ol>
That's it! Now all you have to do is type <tt>gmake</tt> in the root of <p>That's it! Now all you have to do is type <tt>gmake</tt> in the root of
your object directory, and your project should build. your object directory, and your project should build.</p>
<!--===============================================================--> </div>
<h2><a name="Source Tree Layout">Source Tree Layout</a><hr></h2>
<!--===============================================================-->
In order to use the LLVM build system, you will want to organize your <!-- *********************************************************************** -->
source code so that it can benefit from the build system's features. <div class="doc_section">
Mainly, you want your source tree layout to look similar to the LLVM <a name="source">Source Tree Layout</a>
source tree layout. The best way to do this is to just copy the </div>
project tree from <tt>llvm/projects/sample</tt> and modify it to meet <!-- *********************************************************************** -->
your needs, but you can certainly add to it if you want.
Underneath your top level directory, you should have the following <div class="doc_text">
directories:
<dl compact> <p>In order to use the LLVM build system, you will want to organize your
source code so that it can benefit from the build system's features.
Mainly, you want your source tree layout to look similar to the LLVM
source tree layout. The best way to do this is to just copy the
project tree from <tt>llvm/projects/sample</tt> and modify it to meet
your needs, but you can certainly add to it if you want.</p>
<p>Underneath your top level directory, you should have the following
directories:</p>
<dl>
<dt><b>lib</b> <dt><b>lib</b>
<dd> <dd>
This subdirectory should contain all of your library source This subdirectory should contain all of your library source
@ -222,31 +209,54 @@
need to find a way to use the source provided within that directory need to find a way to use the source provided within that directory
on your own. on your own.
</ul> </ul>
</dl> </dl>
Typically, you will want to build your <b>lib</b> directory first <p>Typically, you will want to build your <b>lib</b> directory first followed by
followed by your <b>tools</b> directory. your <b>tools</b> directory.</p>
<!--===============================================================--> </div>
<h2><a name="Makefile Variables">Writing LLVM Style Makefiles</a><hr></h2>
<!--===============================================================-->
The LLVM build system provides a convenient way to build libraries and
executables. Most of your project Makefiles will only need to define a few
variables. Below is a list of the variables one can set and what they can
do:
<h3> Required Variables </h3> <!-- *********************************************************************** -->
<dl compact> <div class="doc_section">
<a name="makefiles">Writing LLVM Style Makefiles</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>The LLVM build system provides a convenient way to build libraries and
executables. Most of your project Makefiles will only need to define a few
variables. Below is a list of the variables one can set and what they can
do:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="reqVars">Required Variables</a>
</div>
<div class="doc_text">
<dl>
<dt>LEVEL <dt>LEVEL
<dd> <dd>
This variable is the relative path from this Makefile to the This variable is the relative path from this Makefile to the
top directory of your project's source code. For example, if top directory of your project's source code. For example, if
your source code is in /tmp/src, then the Makefile in your source code is in <tt>/tmp/src</tt>, then the Makefile in
/tmp/src/jump/high would set LEVEL to "../..". <tt>/tmp/src/jump/high</tt> would set <tt>LEVEL</tt> to <tt>"../.."</tt>.
</dl> </dl>
<h3> Variables for Building Subdirectories</h3> </div>
<dl compact>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="varsBuildDir">Variables for Building Subdirectories</a>
</div>
<div class="doc_text">
<dl>
<dt>DIRS <dt>DIRS
<dd> <dd>
This is a space separated list of subdirectories that should be This is a space separated list of subdirectories that should be
@ -266,10 +276,18 @@
This is a list of directories that can be built if they exist, This is a list of directories that can be built if they exist,
but will not cause an error if they do not exist. They are but will not cause an error if they do not exist. They are
built serially in the order in which they are listed. built serially in the order in which they are listed.
</dl> </dl>
<h3> Variables for Building Libraries</h3> </div>
<dl compact>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="varsBuildLib">Variables for Building Libraries</a>
</div>
<div class="doc_text">
<dl>
<dt>LIBRARYNAME <dt>LIBRARYNAME
<dd> <dd>
This variable contains the base name of the library that will This variable contains the base name of the library that will
@ -289,10 +307,18 @@
<dd> <dd>
If SHARED_LIBRARY is defined in your Makefile, a shared If SHARED_LIBRARY is defined in your Makefile, a shared
(or dynamic) library will be built. (or dynamic) library will be built.
</dl> </dl>
<h3> Variables for Building Programs</h3> </div>
<dl compact>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="varsBuildProg">Variables for Building Programs</a>
</div>
<div class="doc_text">
<dl>
<dt>TOOLNAME <dt>TOOLNAME
<dd> <dd>
This variable contains the name of the program that will This variable contains the name of the program that will
@ -322,12 +348,20 @@
following line in your <tt>Makefile</tt>: following line in your <tt>Makefile</tt>:
<p> <p>
<tt> <tt>
LIBS+=-lsample LIBS += -lsample
</tt> </tt>
</dl> </dl>
<h3> Miscellaneous Variables</h3> </div>
<dl compact>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="miscVars">Miscellaneous Variables</a>
</div>
<div class="doc_text">
<dl>
<dt>ExtraSource <dt>ExtraSource
<dd> <dd>
This variable contains a space separated list of extra source This variable contains a space separated list of extra source
@ -347,45 +381,67 @@
opposed to overwriting them. The master Makefiles may already opposed to overwriting them. The master Makefiles may already
have useful options in them that you may not want to overwrite. have useful options in them that you may not want to overwrite.
<p> <p>
</dl> </dl>
<!--===============================================================--> </div>
<h2><a name="objcode">Placement of Object Code</a><hr></h2>
<!--===============================================================-->
The final location of built libraries and executables will depend upon <!-- *********************************************************************** -->
whether you do a Debug, Release, or Profile build. <div class="doc_section">
<a name="objcode">Placement of Object Code</a>
</div>
<!-- *********************************************************************** -->
<dl compact> <div class="doc_text">
<p>The final location of built libraries and executables will depend upon
whether you do a Debug, Release, or Profile build.</p>
<dl>
<dt>Libraries <dt>Libraries
<dd> <dd>
All libraries (static and dynamic) will be stored in All libraries (static and dynamic) will be stored in
BUILD_OBJ_ROOT/lib/&lt;type&gt;, where type is <tt>Debug</tt>, <tt>BUILD_OBJ_ROOT/lib/&lt;type&gt;</tt>, where type is <tt>Debug</tt>,
<tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or <tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or
profiled build, respectively. profiled build, respectively.<p>
<p>
<dt>Executables <dt>Executables
<dd> <dd>All executables will be stored in
All executables will be stored in BUILD_OBJ_ROOT/lib/&lt;type&gt;, <tt>BUILD_OBJ_ROOT/tools/&lt;type&gt;</tt>, where type is <tt>Debug</tt>,
where type is <tt>Debug</tt>, <tt>Release</tt>, or <tt>Profile</tt> for <tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or profiled
a debug, optimized, or profiled build, respectively. build, respectively.
</dl> </dl>
<!--===============================================================--> </div>
<h2><a name="help">Further Help</a><hr></h2>
<!--===============================================================-->
If you have any questions or need any help creating an LLVM project, <!-- *********************************************************************** -->
the LLVM team would be more than happy to help. You can always post your <div class="doc_section">
questions to the <a <a name="help">Further Help</a>
href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developers </div>
Mailing List</a>. <!-- *********************************************************************** -->
<div class="doc_text">
<p>If you have any questions or need any help creating an LLVM project,
the LLVM team would be more than happy to help. You can always post your
questions to the <a
href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developers
Mailing List</a>.</p>
</div>
<!-- *********************************************************************** -->
<hr> <hr>
<address><a href="mailto:criswell@uiuc.edu">John Criswell</a></address><br> <address>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
Last modified: $Date$ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
<a href="mailto:criswell@uiuc.edu">John Criswell</a><br>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date$
</address>
</body> </body>
</html> </html>