llvm.org GIT mirror llvm / 4caaa1a
First attempt at Sphinx. Convert the Projects.html file to Sphinx format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158709 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 329 addition(s) and 482 deletion(s). Raw diff Collapse all Expand all
+0
-482
docs/Projects.html less more
None
1 "http://www.w3.org/TR/html4/strict.dtd">
2
3
4
5 Creating an LLVM Project
6
7
8
9
10

Creating an LLVM Project

11
12
13
  • Overview
  • 14
  • Create a project from the Sample Project
  • 15
  • Source tree layout
  • 16
  • Writing LLVM-style Makefiles
  • 17
    18
  • Required Variables
  • 19
  • Variables for Building Subdirectories
  • 20
  • Variables for Building Libraries
  • 21
  • Variables for Building Programs
  • 22
  • Miscellaneous Variables
  • 23
    24
  • Placement of object code
  • 25
  • Further help
  • 26
    27
    28
    29

    Written by John Criswell

    30
    31
    32
    33

    Overview

    34
    35
    36
    37
    38

    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:

    41
    42
    43
  • Set make variables. There are several variables that a Makefile
  • 44 needs to set to use the LLVM build system:
    45
    46
  • PROJECT_NAME - The name by which your project is known.
  • 47
  • LLVM_SRC_ROOT - The root of the LLVM source tree.
  • 48
  • LLVM_OBJ_ROOT - The root of the LLVM object tree.
  • 49
  • PROJ_SRC_ROOT - The root of the project's source tree.
  • 50
  • PROJ_OBJ_ROOT - The root of the project's object tree.
  • 51
  • PROJ_INSTALL_ROOT - The root installation directory.
  • 52
  • LEVEL - The relative path from the current directory to the
  • 53 project's root ($PROJ_OBJ_ROOT).
    54
    55
  • Include Makefile.config from $(LLVM_OBJ_ROOT).
  • 56
  • Include Makefile.rules from $(LLVM_SRC_ROOT).
  • 57
    58
    59

    There are two ways that you can set all of these variables:

    60
    61
  • You can write your own Makefiles which hard-code these values.
  • 62
  • 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.
    66
    67
    68

    This document assumes that you will base your project on the LLVM sample

    69 project found in llvm/projects/sample. 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.

    72
    73
    74
    75
    76

    77 Create a Project from the Sample Project
    78
    79
    80
    81
    82
    83

    Follow these simple steps to start your project:

    84
    85
    86
  • Copy the llvm/projects/sample 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.
    89
    90
  • 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 llvm/trunk/projects/sample.
    95
    96
  • Add your source code and Makefiles to your source tree.
  • 97
    98
  • If you want your project to be configured with the configure script
  • 99 then you need to edit autoconf/configure.ac as follows:
    100
    101
  • AC_INIT. Place the name of your project, its version number and
  • 102 a contact email address for your project as the arguments to this macro
    103
  • AC_CONFIG_AUX_DIR. If your project isn't in the
  • 104 llvm/projects directory then you might need to adjust this so that
    105 it specifies a relative path to the llvm/autoconf directory.
    106
  • LLVM_CONFIG_PROJECT. Just leave this alone.
  • 107
  • AC_CONFIG_SRCDIR. Specify a path to a file name that identifies
  • 108 your project; or just leave it at Makefile.common.in
    109
  • AC_CONFIG_FILES. Do not change.
  • 110
  • AC_CONFIG_MAKEFILE. 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.
    113
    114
    115
    116
  • After updating autoconf/configure.ac, regenerate the
  • 117 configure script with these commands:
    118
    119
    120

    % cd autoconf

    121 % ./AutoRegen.sh

    122
    123
    124

    You must be using Autoconf version 2.59 or later and your aclocal version

    125 should be 1.9 or later.

    126
    127
  • Run configure 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:
    130
    131
    132
    --with-llvmsrc=<directory>
    133
    Tell your project where the LLVM source tree is located.
    134

    --with-llvmobj=<directory>
    135
    Tell your project where the LLVM object tree is located.
    136

    --prefix=<directory>
    137
    Tell your project where it should get installed.
    138
    139
    140
    141

    That's it! Now all you have to do is type gmake (or make

    142 if your on a GNU/Linux system) in the root of your object directory, and your
    143 project should build.

    144
    145
    146
    147
    148

    149 Source Tree Layout
    150
    151
    152
    153
    154
    155

    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 llvm/projects/sample and modify it to meet
    160 your needs, but you can certainly add to it if you want.

    161
    162

    Underneath your top level directory, you should have the following

    163 directories:

    164
    165
    166
    lib
    167
    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 lib that will contain that library's source
    171 code.
    172
    173

    174 Libraries can be object files, archives, or dynamic libraries.
    175 The lib 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.
    178
    179
    include
    180
    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

    185 By placing your header files in include, they will be
    186 found automatically by the LLVM build system. For example, if
    187 you have a file include/jazz/note.h, then your source
    188 files can include it simply with #include "jazz/note.h".
    189
    190
    tools
    191
    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 tools that will contain that
    195 program's source code.
    196

    197
    198
    test
    199
    200 This subdirectory should contain tests that verify that your code
    201 works correctly. Automated tests are especially useful.
    202

    203 Currently, the LLVM build system provides basic support for tests.
    204 The LLVM system provides the following:
    205
    206
  • 207 LLVM provides a tcl procedure that is used by Dejagnu to run
    208 tests. It can be found in llvm/lib/llvm-dg.exp. This
    209 test procedure uses RUN lines in the actual test case to determine
    210 how to run the test. See the
    211 href="TestingGuide.html">TestingGuide for more details. You
    212 can easily write Makefile support similar to the Makefiles in
    213 llvm/test to use Dejagnu to run your project's tests.
    214
  • 215 LLVM contains an optional package called llvm-test
    216 which provides benchmarks and programs that are known to compile with the
    217 LLVM GCC front ends. You can use these
    218 programs to test your code, gather statistics information, and
    219 compare it to the current LLVM performance statistics.
    220
    Currently, there is no way to hook your tests directly into the
    221 llvm/test testing harness. You will simply
    222 need to find a way to use the source provided within that directory
    223 on your own.
    224
    225
    226
    227

    Typically, you will want to build your lib directory first followed by

    228 your tools directory.

    229
    230
    231
    232
    233

    234 Writing LLVM Style Makefiles
    235
    236
    237
    238
    239
    240

    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:

    244
    245
    246

    247 Required Variables
    248
    249
    250
    251
    252
    253
    LEVEL
    254
    255 This variable is the relative path from this Makefile to the
    256 top directory of your project's source code. For example, if
    257 your source code is in /tmp/src, then the Makefile in
    258 /tmp/src/jump/high would set LEVEL to "../..".
    259
    260
    261
    262
    263
    264

    265 Variables for Building Subdirectories
    266
    267
    268
    269
    270
    271
    DIRS
    272
    273 This is a space separated list of subdirectories that should be
    274 built. They will be built, one at a time, in the order
    275 specified.
    276

    277
    278
    PARALLEL_DIRS
    279
    280 This is a list of directories that can be built in parallel.
    281 These will be built after the directories in DIRS have been
    282 built.
    283

    284
    285
    OPTIONAL_DIRS
    286
    287 This is a list of directories that can be built if they exist,
    288 but will not cause an error if they do not exist. They are
    289 built serially in the order in which they are listed.
    290
    291
    292
    293
    294
    295

    296 Variables for Building Libraries
    297
    298
    299
    300
    301
    302
    LIBRARYNAME
    303
    304 This variable contains the base name of the library that will
    305 be built. For example, to build a library named
    306 libsample.a, LIBRARYNAME should be set to
    307 sample.
    308

    309
    310
    BUILD_ARCHIVE
    311
    312 By default, a library is a .o file that is linked
    313 directly into a program. To build an archive (also known as
    314 a static library), set the BUILD_ARCHIVE variable.
    315

    316
    317
    SHARED_LIBRARY
    318
    319 If SHARED_LIBRARY is defined in your Makefile, a shared
    320 (or dynamic) library will be built.
    321
    322
    323
    324
    325
    326

    327 Variables for Building Programs
    328
    329
    330
    331
    332
    333
    TOOLNAME
    334
    335 This variable contains the name of the program that will
    336 be built. For example, to build an executable named
    337 sample, TOOLNAME should be set to sample.
    338

    339
    340
    USEDLIBS
    341
    342 This variable holds a space separated list of libraries that should
    343 be linked into the program. These libraries must be libraries that
    344 come from your lib directory. The libraries must be
    345 specified without their "lib" prefix. For example, to link
    346 libsample.a, you would set USEDLIBS to
    347 sample.a.
    348

    349 Note that this works only for statically linked libraries.
    350

    351
    352
    LLVMLIBS
    353
    354 This variable holds a space separated list of libraries that should
    355 be linked into the program. These libraries must be LLVM libraries.
    356 The libraries must be specified without their "lib" prefix. For
    357 example, to link with a driver that performs an IR transformation
    358 you might set LLVMLIBS to this minimal set of libraries
    359 LLVMSupport.a LLVMCore.a LLVMBitReader.a LLVMAsmParser.a LLVMAnalysis.a LLVMTransformUtils.a LLVMScalarOpts.a LLVMTarget.a.
    360

    361 Note that this works only for statically linked libraries. LLVM is
    362 split into a large number of static libraries, and the list of libraries you
    363 require may be much longer than the list above. To see a full list
    364 of libraries use:
    365 llvm-config --libs all.
    366 Using LINK_COMPONENTS as described below, obviates the need to set LLVMLIBS.
    367

    368
    369
    LINK_COMPONENTS
    370
    This variable holds a space separated list of components that
    371 the LLVM Makefiles pass to the llvm-config tool to generate
    372 a link line for the program. For example, to link with all LLVM
    373 libraries use
    374 LINK_COMPONENTS = all.
    375

    376
    377
    LIBS
    378
    379 To link dynamic libraries, add -l<library base name> to
    380 the LIBS variable. The LLVM build system will look in the same places
    381 for dynamic libraries as it does for static libraries.
    382

    383 For example, to link libsample.so, you would have the
    384 following line in your Makefile:
    385

    386
    387 LIBS += -lsample
    388
    389

    390 Note that LIBS must occur in the Makefile after the inclusion of Makefile.common.
    391

    392
    393
    394
    395
    396
    397

    398 Miscellaneous Variables
    399
    400
    401
    402
    403
    404
    CFLAGS
    405
    CPPFLAGS
    406
    407 This variable can be used to add options to the C and C++
    408 compiler, respectively. It is typically used to add options
    409 that tell the compiler the location of additional directories
    410 to search for header files.
    411

    412 It is highly suggested that you append to CFLAGS and CPPFLAGS as
    413 opposed to overwriting them. The master Makefiles may already
    414 have useful options in them that you may not want to overwrite.
    415

    416
    417
    418
    419
    420
    421
    422
    423

    424 Placement of Object Code
    425
    426
    427
    428
    429
    430

    The final location of built libraries and executables will depend upon

    431 whether you do a Debug, Release, or Profile build.

    432
    433
    434
    Libraries
    435
    436 All libraries (static and dynamic) will be stored in
    437 PROJ_OBJ_ROOT/<type>/lib, where type is Debug,
    438 Release, or Profile for a debug, optimized, or
    439 profiled build, respectively.

    440
    441
    Executables
    442
    All executables will be stored in
    443 PROJ_OBJ_ROOT/<type>/bin, where type is Debug,
    444 Release, or Profile for a debug, optimized, or profiled
    445 build, respectively.
    446
    447
    448
    449
    450
    451

    452 Further Help
    453
    454
    455
    456
    457
    458

    If you have any questions or need any help creating an LLVM project,

    459 the LLVM team would be more than happy to help. You can always post your
    460 questions to the
    461 href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developers
    462 Mailing List.

    463
    464
    465
    466
    467
    468
    469
    470 src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS">
    471
    472 src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01">
    473
    474 John Criswell
    475 The LLVM Compiler Infrastructure
    476
    477 Last modified: $Date$
    478
    479
    480
    481
    0 .. _projects:
    1
    2 ========================
    3 Creating an LLVM Project
    4 ========================
    5
    6 .. contents::
    7 :local:
    8
    9 Overview
    10 ========
    11
    12 The LLVM build system is designed to facilitate the building of third party
    13 projects that use LLVM header files, libraries, and tools. In order to use
    14 these facilities, a ``Makefile`` from a project must do the following things:
    15
    16 * Set ``make`` variables. There are several variables that a ``Makefile`` needs
    17 to set to use the LLVM build system:
    18
    19 * ``PROJECT_NAME`` — The name by which your project is known.
    20 * ``LLVM_SRC_ROOT`` — The root of the LLVM source tree.
    21 * ``LLVM_OBJ_ROOT`` — The root of the LLVM object tree.
    22 * ``PROJ_SRC_ROOT`` — The root of the project's source tree.
    23 * ``PROJ_OBJ_ROOT`` — The root of the project's object tree.
    24 * ``PROJ_INSTALL_ROOT`` — The root installation directory.
    25 * ``LEVEL`` — The relative path from the current directory to the
    26 project's root ``($PROJ_OBJ_ROOT)``.
    27
    28 * Include ``Makefile.config`` from ``$(LLVM_OBJ_ROOT)``.
    29
    30 * Include ``Makefile.rules`` from ``$(LLVM_SRC_ROOT)``.
    31
    32 There are two ways that you can set all of these variables:
    33
    34 * You can write your own ``Makefiles`` which hard-code these values.
    35
    36 * You can use the pre-made LLVM sample project. This sample project includes
    37 ``Makefiles``, a configure script that can be used to configure the location
    38 of LLVM, and the ability to support multiple object directories from a single
    39 source directory.
    40
    41 This document assumes that you will base your project on the LLVM sample project
    42 found in ``llvm/projects/sample``. If you want to devise your own build system,
    43 studying the sample project and LLVM ``Makefiles`` will probably provide enough
    44 information on how to write your own ``Makefiles``.
    45
    46 Create a Project from the Sample Project
    47 ========================================
    48
    49 Follow these simple steps to start your project:
    50
    51 #. Copy the ``llvm/projects/sample`` directory to any place of your choosing.
    52 You can place it anywhere you like. Rename the directory to match the name
    53 of your project.
    54
    55 #. If you downloaded LLVM using Subversion, remove all the directories named
    56 ``.svn`` (and all the files therein) from your project's new source tree.
    57 This will keep Subversion from thinking that your project is inside
    58 ``llvm/trunk/projects/sample``.
    59
    60 #. Add your source code and Makefiles to your source tree.
    61
    62 #. If you want your project to be configured with the ``configure`` script then
    63 you need to edit ``autoconf/configure.ac`` as follows:
    64
    65 * **``AC_INIT``** — Place the name of your project, its version number
    66 and a contact email address for your project as the arguments to this macro
    67
    68 * **``AC_CONFIG_AUX_DIR``** — If your project isn't in the
    69 ``llvm/projects`` directory then you might need to adjust this so that it
    70 specifies a relative path to the ``llvm/autoconf`` directory.
    71
    72 * **``LLVM_CONFIG_PROJECT``** — Just leave this alone.
    73
    74 * **``AC_CONFIG_SRCDIR``** — Specify a path to a file name that
    75 identifies your project; or just leave it at ``Makefile.common.in``.
    76
    77 * **``AC_CONFIG_FILES``** — Do not change.
    78
    79 * **``AC_CONFIG_MAKEFILE``** — Use one of these macros for each
    80 Makefile that your project uses. This macro arranges for your makefiles to
    81 be copied from the source directory, unmodified, to the build directory.
    82
    83 #. After updating ``autoconf/configure.ac``, regenerate the configure script
    84 with these commands:
    85
    86 .. code-block:: bash
    87
    88 % cd autoconf
    89 % ./AutoRegen.sh
    90
    91 You must be using Autoconf version 2.59 or later and your ``aclocal`` version
    92 should be 1.9 or later.
    93
    94 #. Run ``configure`` in the directory in which you want to place object code.
    95 Use the following options to tell your project where it can find LLVM:
    96
    97 ``--with-llvmsrc=``
    98 Tell your project where the LLVM source tree is located.
    99
    100 ``--with-llvmobj=``
    101 Tell your project where the LLVM object tree is located.
    102
    103 ``--prefix=``
    104 Tell your project where it should get installed.
    105
    106 That's it! Now all you have to do is type ``gmake`` (or ``make`` if your on a
    107 GNU/Linux system) in the root of your object directory, and your project should
    108 build.
    109
    110 Source Tree Layout
    111 ==================
    112
    113 In order to use the LLVM build system, you will want to organize your source
    114 code so that it can benefit from the build system's features. Mainly, you want
    115 your source tree layout to look similar to the LLVM source tree layout. The
    116 best way to do this is to just copy the project tree from
    117 ``llvm/projects/sample`` and modify it to meet your needs, but you can certainly
    118 add to it if you want.
    119
    120 Underneath your top level directory, you should have the following directories:
    121
    122 **``lib``**
    123
    124 This subdirectory should contain all of your library source code. For each
    125 library that you build, you will have one directory in **``lib``** that will
    126 contain that library's source code.
    127
    128 Libraries can be object files, archives, or dynamic libraries. The
    129 **``lib``** directory is just a convenient place for libraries as it places
    130 them all in a directory from which they can be linked later.
    131
    132 **``include``**
    133
    134 This subdirectory should contain any header files that are global to your
    135 project. By global, we mean that they are used by more than one library or
    136 executable of your project.
    137
    138 By placing your header files in **``include``**, they will be found
    139 automatically by the LLVM build system. For example, if you have a file
    140 **``include/jazz/note.h``**, then your source files can include it simply
    141 with **``#include "jazz/note.h"``**.
    142
    143 **``tools``**
    144
    145 This subdirectory should contain all of your source code for executables.
    146 For each program that you build, you will have one directory in
    147 **``tools``** that will contain that program's source code.
    148
    149 **``test``**
    150
    151 This subdirectory should contain tests that verify that your code works
    152 correctly. Automated tests are especially useful.
    153
    154 Currently, the LLVM build system provides basic support for tests. The LLVM
    155 system provides the following:
    156
    157 * LLVM provides a ``tcl`` procedure that is used by ``Dejagnu`` to run tests.
    158 It can be found in ``llvm/lib/llvm-dg.exp``. This test procedure uses ``RUN``
    159 lines in the actual test case to determine how to run the test. See the
    160 `TestingGuide`_TestingGuide.html for more details. You can easily write
    161 Makefile support similar to the Makefiles in ``llvm/test`` to use ``Dejagnu``
    162 to run your project's tests.
    163
    164 * LLVM contains an optional package called ``llvm-test``, which provides
    165 benchmarks and programs that are known to compile with the Clang front
    166 end. You can use these programs to test your code, gather statistical
    167 information, and compare it to the current LLVM performance statistics.
    168
    169 Currently, there is no way to hook your tests directly into the ``llvm/test``
    170 testing harness. You will simply need to find a way to use the source
    171 provided within that directory on your own.
    172
    173 Typically, you will want to build your **``lib``** directory first followed by
    174 your **``tools``** directory.
    175
    176 Writing LLVM Style Makefiles
    177 ============================
    178
    179 The LLVM build system provides a convenient way to build libraries and
    180 executables. Most of your project Makefiles will only need to define a few
    181 variables. Below is a list of the variables one can set and what they can
    182 do:
    183
    184 Required Variables
    185 ------------------
    186
    187 ``LEVEL``
    188
    189 This variable is the relative path from this ``Makefile`` to the top
    190 directory of your project's source code. For example, if your source code
    191 is in ``/tmp/src``, then the ``Makefile`` in ``/tmp/src/jump/high``
    192 would set ``LEVEL`` to ``"../.."``.
    193
    194 Variables for Building Subdirectories
    195 -------------------------------------
    196
    197 ``DIRS``
    198
    199 This is a space separated list of subdirectories that should be built. They
    200 will be built, one at a time, in the order specified.
    201
    202 ``PARALLEL_DIRS``
    203
    204 This is a list of directories that can be built in parallel. These will be
    205 built after the directories in DIRS have been built.
    206
    207 ``OPTIONAL_DIRS``
    208
    209 This is a list of directories that can be built if they exist, but will not
    210 cause an error if they do not exist. They are built serially in the order
    211 in which they are listed.
    212
    213 Variables for Building Libraries
    214 --------------------------------
    215
    216 ``LIBRARYNAME``
    217
    218 This variable contains the base name of the library that will be built. For
    219 example, to build a library named ``libsample.a``, ``LIBRARYNAME`` should
    220 be set to ``sample``.
    221
    222 ``BUILD_ARCHIVE``
    223
    224 By default, a library is a ``.o`` file that is linked directly into a
    225 program. To build an archive (also known as a static library), set the
    226 ``BUILD_ARCHIVE`` variable.
    227
    228 ``SHARED_LIBRARY``
    229
    230 If ``SHARED_LIBRARY`` is defined in your Makefile, a shared (or dynamic)
    231 library will be built.
    232
    233 Variables for Building Programs
    234 -------------------------------
    235
    236 ``TOOLNAME``
    237
    238 This variable contains the name of the program that will be built. For
    239 example, to build an executable named ``sample``, ``TOOLNAME`` should be set
    240 to ``sample``.
    241
    242 ``USEDLIBS``
    243
    244 This variable holds a space separated list of libraries that should be
    245 linked into the program. These libraries must be libraries that come from
    246 your **``lib``** directory. The libraries must be specified without their
    247 ``lib`` prefix. For example, to link ``libsample.a``, you would set
    248 ``USEDLIBS`` to ``sample.a``.
    249
    250 Note that this works only for statically linked libraries.
    251
    252 ``LLVMLIBS``
    253
    254 This variable holds a space separated list of libraries that should be
    255 linked into the program. These libraries must be LLVM libraries. The
    256 libraries must be specified without their ``lib`` prefix. For example, to
    257 link with a driver that performs an IR transformation you might set
    258 ``LLVMLIBS`` to this minimal set of libraries ``LLVMSupport.a LLVMCore.a
    259 LLVMBitReader.a LLVMAsmParser.a LLVMAnalysis.a LLVMTransformUtils.a
    260 LLVMScalarOpts.a LLVMTarget.a``.
    261
    262 Note that this works only for statically linked libraries. LLVM is split
    263 into a large number of static libraries, and the list of libraries you
    264 require may be much longer than the list above. To see a full list of
    265 libraries use: ``llvm-config --libs all``. Using ``LINK_COMPONENTS`` as
    266 described below, obviates the need to set ``LLVMLIBS``.
    267
    268 ``LINK_COMPONENTS``
    269
    270 This variable holds a space separated list of components that the LLVM
    271 ``Makefiles`` pass to the ``llvm-config`` tool to generate a link line for
    272 the program. For example, to link with all LLVM libraries use
    273 ``LINK_COMPONENTS = all``.
    274
    275 ``LIBS``
    276
    277 To link dynamic libraries, add -l<library base name> to the
    278 ``LIBS`` variable. The LLVM build system will look in the same places for
    279 dynamic libraries as it does for static libraries.
    280
    281 For example, to link ``libsample.so``, you would have the following line in
    282 your ``Makefile``:
    283
    284 .. code-block: Makefile
    285
    286 LIBS += -lsample
    287
    288 Note that ``LIBS`` must occur in the Makefile after the inclusion of
    289 ``Makefile.common``.
    290
    291 Miscellaneous Variables
    292 -----------------------
    293
    294 ``CFLAGS``
    295 ``CPPFLAGS``
    296
    297 This variable can be used to add options to the C and C++ compiler,
    298 respectively. It is typically used to add options that tell the compiler
    299 the location of additional directories to search for header files.
    300
    301 It is highly suggested that you append to ``CFLAGS`` and ``CPPFLAGS`` as
    302 opposed to overwriting them. The master ``Makefiles`` may already have
    303 useful options in them that you may not want to overwrite.
    304
    305 Placement of Object Code
    306 ========================
    307
    308 The final location of built libraries and executables will depend upon whether
    309 you do a ``Debug``, ``Release``, or ``Profile`` build.
    310
    311 Libraries
    312
    313 All libraries (static and dynamic) will be stored in
    314 ``PROJ_OBJ_ROOT//lib``, where *``type``* is ``Debug``, ``Release``, or
    315 ``Profile`` for a debug, optimized, or profiled build, respectively.
    316
    317 Executables
    318
    319 All executables will be stored in ``PROJ_OBJ_ROOT//bin``, where
    320 *``type``* is ``Debug``, ``Release``, or ``Profile`` for a debug, optimized,
    321 or profiled build, respectively.
    322
    323 Further Help
    324 ============
    325
    326 If you have any questions or need any help creating an LLVM project, the LLVM
    327 team would be more than happy to help. You can always post your questions to
    328 the `LLVM Developers Mailing List`_http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev.