Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 3 | <html> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 4 | <head> |
| 5 | <title>Creating an LLVM Project</title> |
| 6 | <link rel="stylesheet" href="llvm.css" type="text/css"> |
| 7 | </head> |
| 8 | <body> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 9 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 10 | <div class="doc_title">Creating an LLVM Project</div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 11 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 12 | <ol> |
| 13 | <li><a href="#overview">Overview</a></li> |
| 14 | <li><a href="#create">Create a project from the Sample Project</a></li> |
| 15 | <li><a href="#source">Source tree layout</a></li> |
| 16 | <li><a href="#makefiles">Writing LLVM-style Makefiles</a> |
| 17 | <ol> |
| 18 | <li><a href="#reqVars">Required Variables</a></li> |
| 19 | <li><a href="#varsBuildDir">Variables for Building Subdirectories</a></li> |
| 20 | <li><a href="#varsBuildLib">Variables for Building Libraries</a></li> |
| 21 | <li><a href="#varsBuildProg">Variables for Building Programs</a></li> |
| 22 | <li><a href="#miscVars">Miscellaneous Variables</a></li> |
| 23 | </ol></li> |
| 24 | <li><a href="#objcode">Placement of object code</a></li> |
| 25 | <li><a href="#help">Further help</a></li> |
| 26 | </ol> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 27 | |
Chris Lattner | 7911ce2 | 2004-05-23 21:07:27 +0000 | [diff] [blame] | 28 | <div class="doc_author"> |
| 29 | <p>Written by John Criswell</p> |
| 30 | </div> |
| 31 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 32 | <!-- *********************************************************************** --> |
| 33 | <div class="doc_section"><a name="overview">Overview</a></div> |
| 34 | <!-- *********************************************************************** --> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 35 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 36 | <div class="doc_text"> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 37 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 38 | <p>The LLVM build system is designed to facilitate the building of third party |
| 39 | projects that use LLVM header files, libraries, and tools. In order to use |
| 40 | these facilities, a Makefile from a project must do the following things:</p> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 41 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 42 | <ol> |
Reid Spencer | 39865c0 | 2005-01-16 02:21:18 +0000 | [diff] [blame] | 43 | <li>Set <tt>make</tt> variables. There are several variables that a Makefile |
| 44 | needs to set to use the LLVM build system: |
| 45 | <ul> |
| 46 | <li><tt>PROJECT_NAME</tt> - The name by which your project is known.</li> |
| 47 | <li><tt>LLVM_SRC_ROOT</tt> - The root of the LLVM source tree.</li> |
| 48 | <li><tt>LLVM_OBJ_ROOT</tt> - The root of the LLVM object tree.</li> |
| 49 | <li><tt>PROJ_SRC_ROOT</tt> - The root of the project's source tree.</li> |
| 50 | <li><tt>PROJ_OBJ_ROOT</tt> - The root of the project's object tree.</li> |
| 51 | <li><tt>PROJ_INSTALL_ROOT</tt> - The root installation directory.</li> |
| 52 | <li><tt>LEVEL</tt> - The relative path from the current directory to the |
| 53 | project's root ($PROJ_OBJ_ROOT).</li> |
| 54 | </ul></li> |
| 55 | <li>Include <tt>Makefile.config</tt> from <tt>$(LLVM_OBJ_ROOT)</tt>.</li> |
| 56 | <li>Include <tt>Makefile.rules</tt> from <tt>$(LLVM_SRC_ROOT)</tt>.</li> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 57 | </ol> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 58 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 59 | <p>There are two ways that you can set all of these variables:</p> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 60 | <ol> |
Reid Spencer | 39865c0 | 2005-01-16 02:21:18 +0000 | [diff] [blame] | 61 | <li>You can write your own Makefiles which hard-code these values.</li> |
| 62 | <li>You can use the pre-made LLVM sample project. This sample project |
| 63 | includes Makefiles, a configure script that can be used to configure the |
| 64 | location of LLVM, and the ability to support multiple object directories |
| 65 | from a single source directory.</li> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 66 | </ol> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 67 | |
Reid Spencer | 39865c0 | 2005-01-16 02:21:18 +0000 | [diff] [blame] | 68 | <p>This document assumes that you will base your project on the LLVM sample |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 69 | project found in <tt>llvm/projects/sample</tt>. If you want to devise your own |
| 70 | build system, studying the sample project and LLVM Makefiles will probably |
| 71 | provide enough information on how to write your own Makefiles.</p> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 72 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 73 | </div> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 74 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 75 | <!-- *********************************************************************** --> |
| 76 | <div class="doc_section"> |
| 77 | <a name="create">Create a Project from the Sample Project</a> |
| 78 | </div> |
| 79 | <!-- *********************************************************************** --> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 80 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 81 | <div class="doc_text"> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 82 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 83 | <p>Follow these simple steps to start your project:</p> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 84 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 85 | <ol> |
| 86 | <li>Copy the <tt>llvm/projects/sample</tt> directory to any place of your |
| 87 | choosing. You can place it anywhere you like. Rename the directory to match |
| 88 | the name of your project.</li> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 89 | |
John Criswell | ff3468e | 2005-10-24 16:43:08 +0000 | [diff] [blame] | 90 | <li> |
Reid Spencer | 669ed45 | 2007-07-09 08:04:31 +0000 | [diff] [blame] | 91 | If you downloaded LLVM using Subversion, remove all the directories named .svn |
| 92 | (and all the files therein) from your project's new source tree. This will |
| 93 | keep Subversion from thinking that your project is inside |
| 94 | <tt>llvm/trunk/projects/sample</tt>.</li> |
John Criswell | ff3468e | 2005-10-24 16:43:08 +0000 | [diff] [blame] | 95 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 96 | <li>Add your source code and Makefiles to your source tree.</li> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 97 | |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 98 | <li>If you want your project to be configured with the <tt>configure</tt> script |
| 99 | then you need to edit <tt>autoconf/configure.ac</tt> as follows: |
| 100 | <ul> |
| 101 | <li><b>AC_INIT</b>. Place the name of your project, its version number and |
| 102 | a contact email address for your project as the arguments to this macro</li> |
Chris Lattner | 623751f | 2006-03-16 16:14:59 +0000 | [diff] [blame] | 103 | <li><b>AC_CONFIG_AUX_DIR</b>. If your project isn't in the |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 104 | <tt>llvm/projects</tt> directory then you might need to adjust this so that |
| 105 | it specifies a relative path to the <tt>llvm/autoconf</tt> directory.</li> |
| 106 | <li><b>LLVM_CONFIG_PROJECT</b>. Just leave this alone.</li> |
| 107 | <li><b>AC_CONFIG_SRCDIR</b>. Specify a path to a file name that identifies |
Reid Spencer | 64f9930 | 2006-03-17 08:04:25 +0000 | [diff] [blame] | 108 | your project; or just leave it at <tt>Makefile.common.in</tt></li> |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 109 | <li><b>AC_CONFIG_FILES</b>. Do not change.</li> |
| 110 | <li><b>AC_CONFIG_MAKEFILE</b>. Use one of these macros for each Makefile |
| 111 | that your project uses. This macro arranges for your makefiles to be copied |
| 112 | from the source directory, unmodified, to the build directory.</li> |
| 113 | </ul> |
| 114 | </li> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 115 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 116 | <li>After updating <tt>autoconf/configure.ac</tt>, regenerate the |
| 117 | configure script with these commands: |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 118 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 119 | <div class="doc_code"> |
| 120 | <p><tt>% cd autoconf<br> |
Dan Gohman | 30e5e55 | 2009-01-12 21:29:24 +0000 | [diff] [blame] | 121 | % ./AutoRegen.sh</tt></p> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 122 | </div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 123 | |
Misha Brukman | 0f6d5f8 | 2009-08-13 20:08:52 +0000 | [diff] [blame] | 124 | <p>You must be using Autoconf version 2.59 or later and your aclocal version |
| 125 | should be 1.9 or later.</p></li> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 126 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 127 | <li>Run <tt>configure</tt> in the directory in which you want to place |
| 128 | object code. Use the following options to tell your project where it |
| 129 | can find LLVM: |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 130 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 131 | <dl> |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 132 | <dt><tt>--with-llvmsrc=<directory></tt></dt> |
| 133 | <dd>Tell your project where the LLVM source tree is located.</dd> |
Misha Brukman | f00ddb0 | 2008-12-11 18:23:24 +0000 | [diff] [blame] | 134 | <dt><br><tt>--with-llvmobj=<directory></tt></dt> |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 135 | <dd>Tell your project where the LLVM object tree is located.</dd> |
Misha Brukman | f00ddb0 | 2008-12-11 18:23:24 +0000 | [diff] [blame] | 136 | <dt><br><tt>--prefix=<directory></tt></dt> |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 137 | <dd>Tell your project where it should get installed.</dd> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 138 | </dl> |
| 139 | </ol> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 140 | |
Reid Spencer | 5175b82 | 2005-02-28 00:40:29 +0000 | [diff] [blame] | 141 | <p>That's it! Now all you have to do is type <tt>gmake</tt> (or <tt>make</tt> |
| 142 | if your on a GNU/Linux system) in the root of your object directory, and your |
| 143 | project should build.</p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 144 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 145 | </div> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 146 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 147 | <!-- *********************************************************************** --> |
| 148 | <div class="doc_section"> |
| 149 | <a name="source">Source Tree Layout</a> |
| 150 | </div> |
| 151 | <!-- *********************************************************************** --> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 152 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 153 | <div class="doc_text"> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 154 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 155 | <p>In order to use the LLVM build system, you will want to organize your |
| 156 | source code so that it can benefit from the build system's features. |
| 157 | Mainly, you want your source tree layout to look similar to the LLVM |
| 158 | source tree layout. The best way to do this is to just copy the |
| 159 | project tree from <tt>llvm/projects/sample</tt> and modify it to meet |
| 160 | your needs, but you can certainly add to it if you want.</p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 161 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 162 | <p>Underneath your top level directory, you should have the following |
| 163 | directories:</p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 164 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 165 | <dl> |
| 166 | <dt><b>lib</b> |
| 167 | <dd> |
| 168 | This subdirectory should contain all of your library source |
| 169 | code. For each library that you build, you will have one |
| 170 | directory in <b>lib</b> that will contain that library's source |
| 171 | code. |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 172 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 173 | <p> |
| 174 | Libraries can be object files, archives, or dynamic libraries. |
| 175 | The <b>lib</b> directory is just a convenient place for libraries |
| 176 | as it places them all in a directory from which they can be linked |
| 177 | later. |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 178 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 179 | <dt><b>include</b> |
| 180 | <dd> |
| 181 | This subdirectory should contain any header files that are |
| 182 | global to your project. By global, we mean that they are used |
| 183 | by more than one library or executable of your project. |
| 184 | <p> |
| 185 | By placing your header files in <b>include</b>, they will be |
| 186 | found automatically by the LLVM build system. For example, if |
| 187 | you have a file <b>include/jazz/note.h</b>, then your source |
| 188 | files can include it simply with <b>#include "jazz/note.h"</b>. |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 189 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 190 | <dt><b>tools</b> |
| 191 | <dd> |
| 192 | This subdirectory should contain all of your source |
| 193 | code for executables. For each program that you build, you |
| 194 | will have one directory in <b>tools</b> that will contain that |
| 195 | program's source code. |
| 196 | <p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 197 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 198 | <dt><b>test</b> |
| 199 | <dd> |
| 200 | This subdirectory should contain tests that verify that your code |
| 201 | works correctly. Automated tests are especially useful. |
| 202 | <p> |
Tanya Lattner | d10bc6e | 2004-12-08 17:25:46 +0000 | [diff] [blame] | 203 | Currently, the LLVM build system provides basic support for tests. |
| 204 | The LLVM system provides the following: |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 205 | <ul> |
| 206 | <li> |
Tanya Lattner | d10bc6e | 2004-12-08 17:25:46 +0000 | [diff] [blame] | 207 | LLVM provides a tcl procedure that is used by Dejagnu to run |
| 208 | tests. It can be found in <tt>llvm/lib/llvm-dg.exp</tt>. This |
| 209 | test procedure uses RUN lines in the actual test case to determine |
| 210 | how to run the test. See the <a |
| 211 | href="TestingGuide.html">TestingGuide</a> for more details. You |
Reid Spencer | f8b235d | 2005-02-28 01:10:48 +0000 | [diff] [blame] | 212 | can easily write Makefile support similar to the Makefiles in |
Misha Brukman | f00ddb0 | 2008-12-11 18:23:24 +0000 | [diff] [blame] | 213 | <tt>llvm/test</tt> to use Dejagnu to run your project's tests.<br></li> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 214 | <li> |
John Criswell | 9e2485c | 2004-12-10 15:51:16 +0000 | [diff] [blame] | 215 | LLVM contains an optional package called <tt>llvm-test</tt> |
| 216 | which provides benchmarks and programs that are known to compile with the |
| 217 | LLVM GCC front ends. You can use these |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 218 | programs to test your code, gather statistics information, and |
John Criswell | 9e2485c | 2004-12-10 15:51:16 +0000 | [diff] [blame] | 219 | compare it to the current LLVM performance statistics. |
Misha Brukman | f00ddb0 | 2008-12-11 18:23:24 +0000 | [diff] [blame] | 220 | <br>Currently, there is no way to hook your tests directly into the |
John Criswell | 9e2485c | 2004-12-10 15:51:16 +0000 | [diff] [blame] | 221 | <tt>llvm/test</tt> testing harness. You will simply |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 222 | need to find a way to use the source provided within that directory |
| 223 | on your own. |
| 224 | </ul> |
| 225 | </dl> |
John Criswell | 2b89a6a | 2003-10-21 19:35:06 +0000 | [diff] [blame] | 226 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 227 | <p>Typically, you will want to build your <b>lib</b> directory first followed by |
| 228 | your <b>tools</b> directory.</p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 229 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 230 | </div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 231 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 232 | <!-- *********************************************************************** --> |
| 233 | <div class="doc_section"> |
| 234 | <a name="makefiles">Writing LLVM Style Makefiles</a> |
| 235 | </div> |
| 236 | <!-- *********************************************************************** --> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 237 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 238 | <div class="doc_text"> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 239 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 240 | <p>The LLVM build system provides a convenient way to build libraries and |
| 241 | executables. Most of your project Makefiles will only need to define a few |
| 242 | variables. Below is a list of the variables one can set and what they can |
| 243 | do:</p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 244 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 245 | </div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 246 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 247 | <!-- ======================================================================= --> |
| 248 | <div class="doc_subsection"> |
| 249 | <a name="reqVars">Required Variables</a> |
| 250 | </div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 251 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 252 | <div class="doc_text"> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 253 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 254 | <dl> |
| 255 | <dt>LEVEL |
| 256 | <dd> |
| 257 | This variable is the relative path from this Makefile to the |
| 258 | top directory of your project's source code. For example, if |
| 259 | your source code is in <tt>/tmp/src</tt>, then the Makefile in |
| 260 | <tt>/tmp/src/jump/high</tt> would set <tt>LEVEL</tt> to <tt>"../.."</tt>. |
| 261 | </dl> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 262 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 263 | </div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 264 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 265 | <!-- ======================================================================= --> |
| 266 | <div class="doc_subsection"> |
| 267 | <a name="varsBuildDir">Variables for Building Subdirectories</a> |
| 268 | </div> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 269 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 270 | <div class="doc_text"> |
John Criswell | 37c154a | 2003-10-17 21:50:38 +0000 | [diff] [blame] | 271 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 272 | <dl> |
| 273 | <dt>DIRS |
| 274 | <dd> |
| 275 | This is a space separated list of subdirectories that should be |
| 276 | built. They will be built, one at a time, in the order |
| 277 | specified. |
| 278 | <p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 279 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 280 | <dt>PARALLEL_DIRS |
| 281 | <dd> |
| 282 | This is a list of directories that can be built in parallel. |
| 283 | These will be built after the directories in DIRS have been |
| 284 | built. |
| 285 | <p> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 286 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 287 | <dt>OPTIONAL_DIRS |
| 288 | <dd> |
| 289 | This is a list of directories that can be built if they exist, |
| 290 | but will not cause an error if they do not exist. They are |
| 291 | built serially in the order in which they are listed. |
| 292 | </dl> |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 293 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 294 | </div> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 295 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 296 | <!-- ======================================================================= --> |
| 297 | <div class="doc_subsection"> |
| 298 | <a name="varsBuildLib">Variables for Building Libraries</a> |
| 299 | </div> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 300 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 301 | <div class="doc_text"> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 302 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 303 | <dl> |
| 304 | <dt>LIBRARYNAME |
| 305 | <dd> |
| 306 | This variable contains the base name of the library that will |
| 307 | be built. For example, to build a library named |
| 308 | <tt>libsample.a</tt>, LIBRARYNAME should be set to |
| 309 | <tt>sample</tt>. |
| 310 | <p> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 311 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 312 | <dt>BUILD_ARCHIVE |
| 313 | <dd> |
| 314 | By default, a library is a <tt>.o</tt> file that is linked |
| 315 | directly into a program. To build an archive (also known as |
| 316 | a static library), set the BUILD_ARCHIVE variable. |
| 317 | <p> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 318 | |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 319 | <dt>SHARED_LIBRARY |
| 320 | <dd> |
| 321 | If SHARED_LIBRARY is defined in your Makefile, a shared |
| 322 | (or dynamic) library will be built. |
| 323 | </dl> |
| 324 | |
| 325 | </div> |
| 326 | |
| 327 | <!-- ======================================================================= --> |
| 328 | <div class="doc_subsection"> |
| 329 | <a name="varsBuildProg">Variables for Building Programs</a> |
| 330 | </div> |
| 331 | |
| 332 | <div class="doc_text"> |
| 333 | |
| 334 | <dl> |
| 335 | <dt>TOOLNAME |
| 336 | <dd> |
| 337 | This variable contains the name of the program that will |
| 338 | be built. For example, to build an executable named |
| 339 | <tt>sample</tt>, TOOLNAME should be set to <tt>sample</tt>. |
| 340 | <p> |
| 341 | |
| 342 | <dt>USEDLIBS |
| 343 | <dd> |
| 344 | This variable holds a space separated list of libraries that |
| 345 | should be linked into the program. These libraries must either |
| 346 | be LLVM libraries or libraries that come from your <b>lib</b> |
| 347 | directory. The libraries must be specified by their base name. |
| 348 | For example, to link libsample.a, you would set USEDLIBS to |
| 349 | <tt>sample</tt>. |
| 350 | <p> |
| 351 | Note that this works only for statically linked libraries. |
| 352 | <p> |
| 353 | |
| 354 | <dt>LIBS |
| 355 | <dd> |
| 356 | To link dynamic libraries, add <tt>-l<library base name></tt> to |
| 357 | the LIBS variable. The LLVM build system will look in the same places |
| 358 | for dynamic libraries as it does for static libraries. |
| 359 | <p> |
| 360 | For example, to link <tt>libsample.so</tt>, you would have the |
| 361 | following line in your <tt>Makefile</tt>: |
| 362 | <p> |
| 363 | <tt> |
| 364 | LIBS += -lsample |
| 365 | </tt> |
| 366 | </dl> |
| 367 | |
| 368 | </div> |
| 369 | |
| 370 | <!-- ======================================================================= --> |
| 371 | <div class="doc_subsection"> |
| 372 | <a name="miscVars">Miscellaneous Variables</a> |
| 373 | </div> |
| 374 | |
| 375 | <div class="doc_text"> |
| 376 | |
| 377 | <dl> |
| 378 | <dt>ExtraSource |
| 379 | <dd> |
| 380 | This variable contains a space separated list of extra source |
| 381 | files that need to be built. It is useful for including the |
| 382 | output of Lex and Yacc programs. |
| 383 | <p> |
| 384 | |
| 385 | <dt>CFLAGS |
| 386 | <dt>CPPFLAGS |
| 387 | <dd> |
| 388 | This variable can be used to add options to the C and C++ |
| 389 | compiler, respectively. It is typically used to add options |
| 390 | that tell the compiler the location of additional directories |
| 391 | to search for header files. |
| 392 | <p> |
| 393 | It is highly suggested that you append to CFLAGS and CPPFLAGS as |
| 394 | opposed to overwriting them. The master Makefiles may already |
| 395 | have useful options in them that you may not want to overwrite. |
| 396 | <p> |
| 397 | </dl> |
| 398 | |
| 399 | </div> |
| 400 | |
| 401 | <!-- *********************************************************************** --> |
| 402 | <div class="doc_section"> |
| 403 | <a name="objcode">Placement of Object Code</a> |
| 404 | </div> |
| 405 | <!-- *********************************************************************** --> |
| 406 | |
| 407 | <div class="doc_text"> |
| 408 | |
| 409 | <p>The final location of built libraries and executables will depend upon |
| 410 | whether you do a Debug, Release, or Profile build.</p> |
| 411 | |
| 412 | <dl> |
| 413 | <dt>Libraries |
| 414 | <dd> |
| 415 | All libraries (static and dynamic) will be stored in |
Reid Spencer | d967c80 | 2005-01-16 02:38:06 +0000 | [diff] [blame] | 416 | <tt>PROJ_OBJ_ROOT/<type>/lib</tt>, where type is <tt>Debug</tt>, |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 417 | <tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or |
| 418 | profiled build, respectively.<p> |
| 419 | |
| 420 | <dt>Executables |
| 421 | <dd>All executables will be stored in |
Reid Spencer | d967c80 | 2005-01-16 02:38:06 +0000 | [diff] [blame] | 422 | <tt>PROJ_OBJ_ROOT/<type>/bin</tt>, where type is <tt>Debug</tt>, |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 423 | <tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or profiled |
| 424 | build, respectively. |
| 425 | </dl> |
| 426 | |
| 427 | </div> |
| 428 | |
| 429 | <!-- *********************************************************************** --> |
| 430 | <div class="doc_section"> |
| 431 | <a name="help">Further Help</a> |
| 432 | </div> |
| 433 | <!-- *********************************************************************** --> |
| 434 | |
| 435 | <div class="doc_text"> |
| 436 | |
| 437 | <p>If you have any questions or need any help creating an LLVM project, |
| 438 | the LLVM team would be more than happy to help. You can always post your |
| 439 | questions to the <a |
| 440 | href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developers |
| 441 | Mailing List</a>.</p> |
| 442 | |
| 443 | </div> |
| 444 | |
| 445 | <!-- *********************************************************************** --> |
John Criswell | 7a4b96d | 2003-10-16 19:53:53 +0000 | [diff] [blame] | 446 | <hr> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 447 | <address> |
| 448 | <a href="http://jigsaw.w3.org/css-validator/check/referer"><img |
Misha Brukman | 4440870 | 2008-12-11 17:34:48 +0000 | [diff] [blame] | 449 | src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 450 | <a href="http://validator.w3.org/check/referer"><img |
Misha Brukman | f00ddb0 | 2008-12-11 18:23:24 +0000 | [diff] [blame] | 451 | src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 452 | |
| 453 | <a href="mailto:criswell@uiuc.edu">John Criswell</a><br> |
Reid Spencer | 05fe4b0 | 2006-03-14 05:39:39 +0000 | [diff] [blame] | 454 | <a href="http://llvm.org">The LLVM Compiler Infrastructure</a> |
Misha Brukman | f6a0407 | 2004-05-12 20:57:43 +0000 | [diff] [blame] | 455 | <br> |
| 456 | Last modified: $Date$ |
| 457 | </address> |
Misha Brukman | 733adcb | 2003-10-30 01:23:40 +0000 | [diff] [blame] | 458 | |
John Criswell | f2413ae | 2003-07-03 15:37:52 +0000 | [diff] [blame] | 459 | </body> |
| 460 | </html> |