diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-10-23 07:57:22 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-10-23 07:57:22 +0000 |
commit | 504b21ac2c1a5b084edcd59b840724c99c7b3dfc (patch) | |
tree | 37254c4bcae79caa3fe6ae49786b2e85e7f79aac /docs/MakefileGuide.html | |
parent | bd7780bc6004e8545042e0aaf7d0d98082baf422 (diff) | |
download | external_llvm-504b21ac2c1a5b084edcd59b840724c99c7b3dfc.zip external_llvm-504b21ac2c1a5b084edcd59b840724c99c7b3dfc.tar.gz external_llvm-504b21ac2c1a5b084edcd59b840724c99c7b3dfc.tar.bz2 |
First cut at the LLVM Makefile Guide. There's lots to correct and lots more
to write, but this is all my brain can muster for tonight.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/MakefileGuide.html')
-rw-r--r-- | docs/MakefileGuide.html | 458 |
1 files changed, 458 insertions, 0 deletions
diff --git a/docs/MakefileGuide.html b/docs/MakefileGuide.html new file mode 100644 index 0000000..f7cf48f --- /dev/null +++ b/docs/MakefileGuide.html @@ -0,0 +1,458 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>LLVM Makefile Guide</title> + <link rel="stylesheet" href="llvm.css" type="text/css"> +</head> +<body> + +<div class="doc_title">LLVM Makefile Guide</div> + +<ol> + <li><a href="#introduction">Introduction</a></li> + <li><a href="#general">General Concepts</a> + <ol> + <li><a href="#projects">Projects</a></li> + <li><a href="#Makefile">Makefile</a></li> + <li><a href="#Makefile.common">Makefile.common</a></li> + <li><a href="#Makefile.config">Makefile.config</a></li> + <li><a href="#Makefile.rules">Makefil.rules</a></li> + <li><a href="#Comments">Comments</a></li> + </ol> + </li> + <li><a href="#targets">Targets Supported</a> + <ol> + <li><a href="#all">all</a></li> + <li><a href="#all-local">all-local</a></li> + <li><a href="#check">check</a></li> + <li><a href="#check-local">check-local</a></li> + <li><a href="#clean">clean</a></li> + <li><a href="#clean-local">clean-local</a></li> + <li><a href="#dist">dist</a></li> + <li><a href="#dist-check">dist-check</a></li> + <li><a href="#dist-clean">dist-clean</a></li> + <li><a href="#install">install</a></li> + <li><a href="#tags">tags</a></li> + <li><a href="#uninstall">uninstall</a></li> + </ol> + </li> + <li><a href="#variables">Using Variables</a> + <ol> + <li><a href="#setvars">Control Variables</a></li> + <li><a href="#overvars">Override Variables</a></li> + <li><a href="#getvars">Readable Variables</a></li> + </ol> + </li> +</ol> + +<div class="doc_author"> + <p>Written by <a href="mailto:reid@x10sys.com">Reid Spencer</a></p> +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="introduction">Introduction </a></div> +<!-- *********************************************************************** --> + +<div class="doc_text"> + <p>This document provides <em>usage</em> information about the LLVM makefile + system. While loosely patterned after the BSD makefile system, LLVM has taken + a deparature from BSD in order to implement additional features needed by LLVM. + </p> + <p>Although makefile systems such as automake were attempted at one point, it + has become clear that the variations requried by LLVM from any Makefle norm + are too many to strictly use a more limited tool. Consequently, LLVM requires + simply GNU Make 3.79, a widely portably makefile processor. LLVM unabashedly + makes heavy use of the features of GNU Make so the dependency on GNU Make is + firm. If you're not familiar with <tt>make</tt>, it is recommended that you + read the <a href="http://www.gnu.org/software/make/manual/make.html"> + GNU Makefile Manual</a>.</p> + <p>While this document is rightly part of the + <a href="ProgrammersManual.html">LLVM Programmer's Manual</a>, it is treated + separately here because of the volume of content and because it is often an + early source of bewilderment for new developers.</p> +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="general">General Concepts</a></div> +<!-- *********************************************************************** --> + +<div class="doc_text"> + <p>The LLVM makefile system is the component of LLVM that is responsible for + building the software, testing it, generating distributions, rpms and other + packages, installing and uninstalling, etc.</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="projects">Projects</a></div> +<div class="doc_text"> + <p>The LLVM Makefile System is quite generous. It not only builds its own + software, but it can build yours too. Built into the system is knowledge of + the <tt>llvm/projects</tt> directory. Any directory under <tt>projects</tt> + that has both a <tt>configure</tt> script and a <tt>Makefile</tt> is assumed + to be a project that uses the LLVM Makefile system. This allows your project + to get up and running quickly by utilizing the built-in features that are used + to compile LLVM.</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="Makefile">Makefile</a></div> +<div class="doc_text"> + <p>Each directory to participate in the build needs to have a file named + <tt>Makefile</tt>. This is the file first read by <tt>make</tt>. It has three + sections:</p> + <ol> + <li><a href="setvars">Settable Variables</a> - Required that must be set + first.</li> + <li><a href="Makefile.common">include <tt>$(LEVEL)/Makefile.common</tt></a> + - include the LLVM Makefile system. + <li><a href="overvars">Overridable Variables</a> - Override variables set by + the LLVM Makefile system. + </ol> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="Makefile.common">Makefile.common</a></div> +<div class="doc_text"> + <p>Every project must have a <tt>Makefile.common</tt> file at its top source + directory. This file serves three purposes:</p> + <ol> + <li>It includes the project's configuration makefile to obtain values + determined by the <tt>configure</tt> script. This is done by including the + <a href="Makefile.config"><tt>$(LEVEL)/Makefile.config</tt></a> file.</li> + <li>It specifies any other (static) values that are needed throughout the + project. Only values that are used in all or a large proportion of the + project's directories should be placed here.</li> + <li>It include's the standard rules for the LLVM Makefile system, + <a href="Makefile.rules"><tt>$(LLVM_SRC_ROOT)/Makefile.rules</tt></a>. + This file is the "guts" of the LLVM Makefile system.</li> + </ol> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="Makefile.config">Makefile.config</a></div> +<div class="doc_text"> + <p>Every project must have a <tt>Makefile.config</tt> at the top of its + <em>build</em> directory. This file is <b>generated</b> by the + <tt>configure</tt> script from the pattern provided by the + <tt>Makefile.config.in</tt> file located at the top of the project's + <em>source</em> directory. The contents of this file depend largely on what + configuration items the project uses, however most projects can get what they + need by just relying on LLVM's configuration found in + <tt>$(LLVM_OBJ_ROOT)/Makefile.config</tt>. +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="Makefile.rules">Makefile.rules</a></div> +<div class="doc_text"> + <p>This file, located at <tt>$(LLVM_SRC_ROOT)/Makefile.rules</tt> is the heart + of the LLVM Makefile System. It provides all the logic, dependencies, and + rules for building the targets supported by the system. What it does largely + depends on the values of <tt>make</tt> <a href="variables">variables</a> that + have been set <em>before</em> <tt>Makefile.rules</tt> is included. +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="Comments">Comments</a></div> +<div class="doc_text"> + <p>User Makefiles need not have comments in them unless the construction is + unusual or it doesn't strictly follow the rules and patterns of the LLVM + makefile system. Makefile comments are invoked with the pound (#) character. + The # character and any text following it, to the end of the line, are ignored + by <tt>make</tt>.</p> +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="targets">Targets Supported</a></div> +<!-- *********************************************************************** --> + +<div class="doc_text"> + <p>This section describes each of the targets that can be built using the LLVM + Makefile system. Any target can be invoked from any directory but not all are + applicabe to a given directory (e.g. "dist" and "install" will always operate + as if invoked from the top level directory).</p> + + <table style="text-align:left"> + <tr><th>Target Name</th><th>Implied Targets</th><th>Target Description</th></tr> + <tr><td><a href="#all"><tt>all</tt></td><td></td> + <td>Compile the software recursively. Default target. + </td></tr> + <tr><td><a href="#all-local"><tt>all-local</tt></td><td></td> + <td>Compile the software in the local directory only. + </td></tr> + <tr><td><a href="#check"><tt>check</tt></td><td>all</td> + <td>Test the software recursively. + </td></tr> + <tr><td><a href="#check-local"><tt>check-local</tt></td><td>all-local</td> + <td>Test the software in the local directory only. + </td></tr> + <tr><td><a href="#clean"><tt>clean</tt></td><td></td> + <td>Remove built objects recursively. + </td></tr> + <tr><td><a href="#clean-local"><tt>clean-local</tt></td><td></td> + <td>Remove built objects from the local directory only. + </td></tr> + <tr><td><a href="#dist"><tt>dist</tt></td><td>all</td> + <td>Prepare a source distribution tarball. + </td></tr> + <tr><td><a href="#dist-check"><tt>dist-check</tt></td><td>all check</td> + <td>Prepare a source distribution tarball and check that it builds. + </td></tr> + <tr><td><a href="#dist-clean"><tt>dist-clean</tt></td><td>clean</td> + <td>Clean source distribution tarball temporary files. + </td></tr> + <tr><td><a href="#install"><tt>install</tt></td><td>all</td> + <td>Copy built objects to installation directory. + </td></tr> + <tr><td><a href="#tags"><tt>tags</tt></td><td></td> + <td>Make C and C++ tags files for emacs and vi. + </td></tr> + <tr><td><a href="#uninstall"><tt>uninstall</tt></td><td></td> + <td>Remove built objects from installation directory. + </td></tr> + </table> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="all">all (default)</a></div> +<div class="doc_text"> + <p>When you invoke <tt>make</tt> with no arguments, you are implicitly + instructing it to seek the "all" target (goal). This target is used for + building the software and will do different things in different directories. + For example, in a <tt>lib</tt> directory, the "all" target will compile source + files and generate libraries. But, in a <tt>tools</tt> directory, it will link + libraries and generate executables.</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="all-local">all-local</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="check">check</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="check-local">check-local</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="clean">clean</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="clean-local">clean-local</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="dist">dist</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="dist-check">dist-check</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="dist-clean">dist-clean</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="install">install</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="tags">tags</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="uninstall">uninstall</a></div> +<div class="doc_text"> + <p>TBD</p> +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="variables">Variables</a></div> +<!-- *********************************************************************** --> +<div class="doc_text"> + <p>Variables are used to tell the LLVM Makefile System what to do and to + obtain information from it. The sections below describe the three kinds of + variables.</p> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="setvars">Control Variables</a></div> +<div class="doc_text"> + <p>Variables listed in the table below should be set <em>before</em> the + inclusion of <a href="Makefile.common"><tt>$(LEVEL)/Makefile.common</tt></a>. + These variables provide input to the LLVM make system that tell it what to do + for the current directory.</p> + <table style="text-align:left"> + <tr><th>Variable Name</th><th>Variable Description</th></tr> + <tr> + <td><a href="#BUILD_ARCHIVE"><tt>BUILD_ARCHIVE</tt></a></td> + <td>If set to any value, causes an archive (.a) library to be built.</td> + </tr><tr><td><a href="#BUILT_SOURCES"><tt>BUILT_SOURCES</tt></a></td> + <td>Specifies a set of source files that are generated. These will be + built before any other target processing to ensure they are present.</td> + </tr><tr><td><a href="#BYTECODE_LIBRARY"><tt>BUILT_SOURCES</tt></a></td> + <td>If set to any value, causes a bytecode library (.bc) to be built.</td> + </tr><tr><td><a href="#CONFIG_FILES"><tt>BUILT_SOURCES</tt></a></td> + <td>Specivies a set of configuration files to be installed.</td> + </tr><tr><td><a href="#DIRS"><tt>DIRS</tt></a></td> + <td>Specifies a set of directories that should also be made using the + same goal. These directories will be built serially.</td> + </tr><tr><td><a href="#DONT_BUILD_RELINKED"><tt>DONT_BUILD_RELINKED</tt></a></td> + <td>If set to any value, causes a relinked library (.o) not to be built.</td> + </tr><tr><td><a href="#EXPORTED_SYMBOL_FILE"><tt>EXPORTED_SYMBOL_FILE</tt></a></td> + <td>Specifies the name of a single file that contains a list of the + symbols to be exported by the linker. One symbol per line.</td> + </tr><tr><td><a href="#LEVEL"><tt>LEVEL</tt></a></td> + <td>Specify the level of nesting from the top level. (Required)</td> + </tr><tr><td><a href="#LIBRARYNAME"><tt>LIBRARYNAME</tt></a></td> + <td>Specify the name of the library to be built. (Required For Libraries)</td> + </tr><tr><td><a href="#LLVMLIBS"><tt>LLVMLIBS</tt></a></td> + <td>Specify the set of libraries from the LLVM $(OBJDIR) that will be + linked into the tool or library.</td> + </tr><tr><td><a href="#OPTIONAL_DIRS"><tt>OPTIONAL_DIRS</tt></a></td> + <td>Specify a set of directories that may be built, but if they don't + build, the recursive make doesn't stop.</td> + </tr><tr><td><a href="#PARALLEL_DIRS"><tt>PARALLEL_DIRS</tt></a></td> + <td>Specify a set of directories to build recursively and in parallel if + the -j option was used with <tt>make</tt>.</td> + </tr><tr><td><a href="#SHARED_LIBRARY"><tt>SHARED_LIBRARY</tt></a></td> + <td>If set to any value, causes a shared library (.so) to be built. + (Optional)</td> + </tr><tr><td><a href="#SOURCES"><tt>SOURCES</tt></a></td> + <td>Specifies the list of source files in the current directory to be + acted upon. Source files of any type may be specified (programs, + documentation, config files, etc.)</td> + </tr><tr><td><a href="#TARGET"><tt>TARGET</tt></a></td> + <td>Specifies the name of the LLVM code generation target that the + current directory builds.</td> + </tr><tr><td><a href="#TOOLNAME"><tt>TOOLNAME</tt></a></td> + <td>Specifies the name of the tool to build. (Required For Tools)</td> + </tr><tr><td><a href="#USEDLIBS"><tt>USEDLIBS</tt></a></td> + <td>Specifies the list of project libraries that will be linked into the + tool or library.</td> + </tr> + </table> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="overvars">Overridable Variables</a></div> +<div class="doc_text"> + <p>Variables listed in the table below can be used to override the default + values provided by the LLVM makefile system. These variables should be set + <em>after</em> the inclusion of <a + href="Makefile.common"><tt>$(LEVEL)/Makefile.common</tt></a>.</p> + <table style="text-align:left"> + <tr><th>Variable Name</th><th>Variable Description</th></tr> + <tr> + <td><a href="#C"><tt>C</tt></a></td> + <td>The name (and optional path) of the 'C' compiler (gcc normally).</td> + </tr> + <tr> + <td><a href="#CFLAGS"><tt>CFLAGS</tt></a></td> + <td>The set of options to be passed to the 'C' compiler on <em>every</em> + compile.</td> + </tr> + <tr> + <td><a href="#CPP"><tt>CPP</tt></a></td> + <td>The name (and optional path) of the 'C' pre-processor (cpp normally). + </td> + </tr> + <tr> + <td><a href="#CXX"><tt>CXX</tt></a></td> + <td>The name (and optional path) of the C++ compiler (g++ normally).</td> + </tr> + <tr> + <td><a href="#LD"><tt>LD</tt></a></td> + <td>The name (and optional path) of the system linker (gcc normally).</td> + </tr> + <tr> + <td><a href="#LIBTOOL"><tt>LIBTOOL</tt></a></td> + <td>The name (and optional path) of the libtool tool (libtool normally).</td> + </tr> + </table> +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"><a name="getvars">Readable Variables</a></div> +<div class="doc_text"> + <p>Variables listed in the table below can be used by the user's Makefile but + should not be changed. Changing the value will generally cause the build to go + wrong, so don't do it.</p> + <table style="text-align:left"> + <tr><th>Variable Name</th><th>Variable Description</th></tr> + <tr> + <td><a href="#BUILD_SRC_DIR"><tt>BUILD_SRC_DIR</tt></a></td> + <td>The project directory contaning the directories source files.</td> + </tr> + <tr> + <td><a href="#BUILD_OBJ_DIR"><tt>BUILD_OBJ_DIR</tt></a></td> + <td>The project directory that will receive the object files.</td> + </tr> + <tr> + <td><a href="#DESTDIR"><tt>DESTDIR</tt></a></td> + <td>The top level directory into which files are installed.</td> + </tr> + <tr> + <td><a href="#LLVM_SRC_ROOT"><tt>LLVM_SRC_ROOT</tt></a></td> + <td>The top level directory of the LLVM source.</td> + </tr> + <tr> + <td><a href="#LLVM_OBJ_ROOT"><tt>LLVM_OBJ_ROOT</tt></a></td> + <td>The top level directory of the LLVM objects.</td> + </tr> + <tr> + <td><a href="#OBJDIR"><tt>OBJDIR</tt></a></td> + <td>The directory in which the project's object files should be placed.</td> + </tr> + <tr> + <td><a href="#LIBDIR"><tt>LIBDIR</tt></a></td> + <td>The directory in which the project's library files should be placed.</td> + </tr> + <tr> + <td><a href="#TOOLDIR"><tt>TOOLDIR</tt></a></td> + <td>The directory in which the project's executable tools should be + placed.</td> + </tr> + </table> +</div> + +<!-- *********************************************************************** --> +<hr> +<address> + <a href="http://jigsaw.w3.org/css-validator/check/referer"><img + 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:rspencer@x10sys.com">Reid Spencer</a><br> + <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br> + Last modified: $Date$ +</address> + +</body> +</html> +<!-- vim: sw=2 noai +--> |