1f4a2713aSLionel Sambuc===================
2f4a2713aSLionel SambucLLVM Makefile Guide
3f4a2713aSLionel Sambuc===================
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc.. contents::
6f4a2713aSLionel Sambuc   :local:
7f4a2713aSLionel Sambuc
8f4a2713aSLionel SambucIntroduction
9f4a2713aSLionel Sambuc============
10f4a2713aSLionel Sambuc
11f4a2713aSLionel SambucThis document provides *usage* information about the LLVM makefile system. While
12f4a2713aSLionel Sambucloosely patterned after the BSD makefile system, LLVM has taken a departure from
13f4a2713aSLionel SambucBSD in order to implement additional features needed by LLVM.  Although makefile
14f4a2713aSLionel Sambucsystems, such as ``automake``, were attempted at one point, it has become clear
15f4a2713aSLionel Sambucthat the features needed by LLVM and the ``Makefile`` norm are too great to use
16f4a2713aSLionel Sambuca more limited tool. Consequently, LLVM requires simply GNU Make 3.79, a widely
17f4a2713aSLionel Sambucportable makefile processor. LLVM unabashedly makes heavy use of the features of
18f4a2713aSLionel SambucGNU Make so the dependency on GNU Make is firm. If you're not familiar with
19f4a2713aSLionel Sambuc``make``, it is recommended that you read the `GNU Makefile Manual
20f4a2713aSLionel Sambuc<http://www.gnu.org/software/make/manual/make.html>`_.
21f4a2713aSLionel Sambuc
22f4a2713aSLionel SambucWhile this document is rightly part of the `LLVM Programmer's
23f4a2713aSLionel SambucManual <ProgrammersManual.html>`_, it is treated separately here because of the
24f4a2713aSLionel Sambucvolume of content and because it is often an early source of bewilderment for
25f4a2713aSLionel Sambucnew developers.
26f4a2713aSLionel Sambuc
27f4a2713aSLionel SambucGeneral Concepts
28f4a2713aSLionel Sambuc================
29f4a2713aSLionel Sambuc
30f4a2713aSLionel SambucThe LLVM Makefile System is the component of LLVM that is responsible for
31f4a2713aSLionel Sambucbuilding the software, testing it, generating distributions, checking those
32f4a2713aSLionel Sambucdistributions, installing and uninstalling, etc. It consists of a several files
33f4a2713aSLionel Sambucthroughout the source tree. These files and other general concepts are described
34f4a2713aSLionel Sambucin this section.
35f4a2713aSLionel Sambuc
36f4a2713aSLionel SambucProjects
37f4a2713aSLionel Sambuc--------
38f4a2713aSLionel Sambuc
39f4a2713aSLionel SambucThe LLVM Makefile System is quite generous. It not only builds its own software,
40f4a2713aSLionel Sambucbut it can build yours too. Built into the system is knowledge of the
41f4a2713aSLionel Sambuc``llvm/projects`` directory. Any directory under ``projects`` that has both a
42f4a2713aSLionel Sambuc``configure`` script and a ``Makefile`` is assumed to be a project that uses the
43f4a2713aSLionel SambucLLVM Makefile system.  Building software that uses LLVM does not require the
44f4a2713aSLionel SambucLLVM Makefile System nor even placement in the ``llvm/projects``
45f4a2713aSLionel Sambucdirectory. However, doing so will allow your project to get up and running
46f4a2713aSLionel Sambucquickly by utilizing the built-in features that are used to compile LLVM. LLVM
47f4a2713aSLionel Sambuccompiles itself using the same features of the makefile system as used for
48f4a2713aSLionel Sambucprojects.
49f4a2713aSLionel Sambuc
50*0a6a1f1dSLionel SambucFor further details, consult the `Projects <Projects.html>`_ page.
51f4a2713aSLionel Sambuc
52f4a2713aSLionel SambucVariable Values
53f4a2713aSLionel Sambuc---------------
54f4a2713aSLionel Sambuc
55f4a2713aSLionel SambucTo use the makefile system, you simply create a file named ``Makefile`` in your
56f4a2713aSLionel Sambucdirectory and declare values for certain variables.  The variables and values
57f4a2713aSLionel Sambucthat you select determine what the makefile system will do. These variables
58f4a2713aSLionel Sambucenable rules and processing in the makefile system that automatically Do The
59f4a2713aSLionel SambucRight Thing (C).
60f4a2713aSLionel Sambuc
61f4a2713aSLionel SambucIncluding Makefiles
62f4a2713aSLionel Sambuc-------------------
63f4a2713aSLionel Sambuc
64f4a2713aSLionel SambucSetting variables alone is not enough. You must include into your Makefile
65f4a2713aSLionel Sambucadditional files that provide the rules of the LLVM Makefile system. The various
66f4a2713aSLionel Sambucfiles involved are described in the sections that follow.
67f4a2713aSLionel Sambuc
68f4a2713aSLionel Sambuc``Makefile``
69f4a2713aSLionel Sambuc^^^^^^^^^^^^
70f4a2713aSLionel Sambuc
71f4a2713aSLionel SambucEach directory to participate in the build needs to have a file named
72f4a2713aSLionel Sambuc``Makefile``. This is the file first read by ``make``. It has three
73f4a2713aSLionel Sambucsections:
74f4a2713aSLionel Sambuc
75f4a2713aSLionel Sambuc#. Settable Variables --- Required that must be set first.
76f4a2713aSLionel Sambuc#. ``include $(LEVEL)/Makefile.common`` --- include the LLVM Makefile system.
77f4a2713aSLionel Sambuc#. Override Variables --- Override variables set by the LLVM Makefile system.
78f4a2713aSLionel Sambuc
79f4a2713aSLionel Sambuc.. _$(LEVEL)/Makefile.common:
80f4a2713aSLionel Sambuc
81f4a2713aSLionel Sambuc``Makefile.common``
82f4a2713aSLionel Sambuc^^^^^^^^^^^^^^^^^^^
83f4a2713aSLionel Sambuc
84f4a2713aSLionel SambucEvery project must have a ``Makefile.common`` file at its top source
85f4a2713aSLionel Sambucdirectory. This file serves three purposes:
86f4a2713aSLionel Sambuc
87f4a2713aSLionel Sambuc#. It includes the project's configuration makefile to obtain values determined
88f4a2713aSLionel Sambuc   by the ``configure`` script. This is done by including the
89f4a2713aSLionel Sambuc   `$(LEVEL)/Makefile.config`_ file.
90f4a2713aSLionel Sambuc
91f4a2713aSLionel Sambuc#. It specifies any other (static) values that are needed throughout the
92f4a2713aSLionel Sambuc   project. Only values that are used in all or a large proportion of the
93f4a2713aSLionel Sambuc   project's directories should be placed here.
94f4a2713aSLionel Sambuc
95f4a2713aSLionel Sambuc#. It includes the standard rules for the LLVM Makefile system,
96f4a2713aSLionel Sambuc   `$(LLVM_SRC_ROOT)/Makefile.rules`_.  This file is the *guts* of the LLVM
97f4a2713aSLionel Sambuc   ``Makefile`` system.
98f4a2713aSLionel Sambuc
99f4a2713aSLionel Sambuc.. _$(LEVEL)/Makefile.config:
100f4a2713aSLionel Sambuc
101f4a2713aSLionel Sambuc``Makefile.config``
102f4a2713aSLionel Sambuc^^^^^^^^^^^^^^^^^^^
103f4a2713aSLionel Sambuc
104f4a2713aSLionel SambucEvery project must have a ``Makefile.config`` at the top of its *build*
105f4a2713aSLionel Sambucdirectory. This file is **generated** by the ``configure`` script from the
106f4a2713aSLionel Sambucpattern provided by the ``Makefile.config.in`` file located at the top of the
107f4a2713aSLionel Sambucproject's *source* directory. The contents of this file depend largely on what
108f4a2713aSLionel Sambucconfiguration items the project uses, however most projects can get what they
109f4a2713aSLionel Sambucneed by just relying on LLVM's configuration found in
110f4a2713aSLionel Sambuc``$(LLVM_OBJ_ROOT)/Makefile.config``.
111f4a2713aSLionel Sambuc
112f4a2713aSLionel Sambuc.. _$(LLVM_SRC_ROOT)/Makefile.rules:
113f4a2713aSLionel Sambuc
114f4a2713aSLionel Sambuc``Makefile.rules``
115f4a2713aSLionel Sambuc^^^^^^^^^^^^^^^^^^
116f4a2713aSLionel Sambuc
117f4a2713aSLionel SambucThis file, located at ``$(LLVM_SRC_ROOT)/Makefile.rules`` is the heart of the
118f4a2713aSLionel SambucLLVM Makefile System. It provides all the logic, dependencies, and rules for
119f4a2713aSLionel Sambucbuilding the targets supported by the system. What it does largely depends on
120f4a2713aSLionel Sambucthe values of ``make`` `variables`_ that have been set *before*
121f4a2713aSLionel Sambuc``Makefile.rules`` is included.
122f4a2713aSLionel Sambuc
123f4a2713aSLionel SambucComments
124f4a2713aSLionel Sambuc^^^^^^^^
125f4a2713aSLionel Sambuc
126f4a2713aSLionel SambucUser ``Makefile``\s need not have comments in them unless the construction is
127f4a2713aSLionel Sambucunusual or it does not strictly follow the rules and patterns of the LLVM
128f4a2713aSLionel Sambucmakefile system. Makefile comments are invoked with the pound (``#``) character.
129f4a2713aSLionel SambucThe ``#`` character and any text following it, to the end of the line, are
130f4a2713aSLionel Sambucignored by ``make``.
131f4a2713aSLionel Sambuc
132f4a2713aSLionel SambucTutorial
133f4a2713aSLionel Sambuc========
134f4a2713aSLionel Sambuc
135f4a2713aSLionel SambucThis section provides some examples of the different kinds of modules you can
136f4a2713aSLionel Sambucbuild with the LLVM makefile system. In general, each directory you provide will
137f4a2713aSLionel Sambucbuild a single object although that object may be composed of additionally
138f4a2713aSLionel Sambuccompiled components.
139f4a2713aSLionel Sambuc
140f4a2713aSLionel SambucLibraries
141f4a2713aSLionel Sambuc---------
142f4a2713aSLionel Sambuc
143f4a2713aSLionel SambucOnly a few variable definitions are needed to build a regular library.
144f4a2713aSLionel SambucNormally, the makefile system will build all the software into a single
145f4a2713aSLionel Sambuc``libname.o`` (pre-linked) object. This means the library is not searchable and
146f4a2713aSLionel Sambucthat the distinction between compilation units has been dissolved. Optionally,
147f4a2713aSLionel Sambucyou can ask for a shared library (.so) or archive library (.a) built.  Archive
148f4a2713aSLionel Sambuclibraries are the default. For example:
149f4a2713aSLionel Sambuc
150f4a2713aSLionel Sambuc.. code-block:: makefile
151f4a2713aSLionel Sambuc
152f4a2713aSLionel Sambuc  LIBRARYNAME = mylib
153f4a2713aSLionel Sambuc  SHARED_LIBRARY = 1
154f4a2713aSLionel Sambuc  BUILD_ARCHIVE = 1
155f4a2713aSLionel Sambuc
156f4a2713aSLionel Sambucsays to build a library named ``mylib`` with both a shared library
157f4a2713aSLionel Sambuc(``mylib.so``) and an archive library (``mylib.a``) version. The contents of all
158f4a2713aSLionel Sambucthe libraries produced will be the same, they are just constructed differently.
159f4a2713aSLionel SambucNote that you normally do not need to specify the sources involved. The LLVM
160f4a2713aSLionel SambucMakefile system will infer the source files from the contents of the source
161f4a2713aSLionel Sambucdirectory.
162f4a2713aSLionel Sambuc
163f4a2713aSLionel SambucThe ``LOADABLE_MODULE=1`` directive can be used in conjunction with
164f4a2713aSLionel Sambuc``SHARED_LIBRARY=1`` to indicate that the resulting shared library should be
165f4a2713aSLionel Sambucopenable with the ``dlopen`` function and searchable with the ``dlsym`` function
166f4a2713aSLionel Sambuc(or your operating system's equivalents). While this isn't strictly necessary on
167f4a2713aSLionel SambucLinux and a few other platforms, it is required on systems like HP-UX and
168f4a2713aSLionel SambucDarwin. You should use ``LOADABLE_MODULE`` for any shared library that you
169f4a2713aSLionel Sambucintend to be loaded into an tool via the ``-load`` option.  :ref:`Pass
170f4a2713aSLionel Sambucdocumentation <writing-an-llvm-pass-makefile>` has an example of why you might
171f4a2713aSLionel Sambucwant to do this.
172f4a2713aSLionel Sambuc
173f4a2713aSLionel SambucLoadable Modules
174f4a2713aSLionel Sambuc^^^^^^^^^^^^^^^^
175f4a2713aSLionel Sambuc
176f4a2713aSLionel SambucIn some situations, you need to create a loadable module. Loadable modules can
177f4a2713aSLionel Sambucbe loaded into programs like ``opt`` or ``llc`` to specify additional passes to
178f4a2713aSLionel Sambucrun or targets to support.  Loadable modules are also useful for debugging a
179f4a2713aSLionel Sambucpass or providing a pass with another package if that pass can't be included in
180f4a2713aSLionel SambucLLVM.
181f4a2713aSLionel Sambuc
182f4a2713aSLionel SambucLLVM provides complete support for building such a module. All you need to do is
183f4a2713aSLionel Sambucuse the ``LOADABLE_MODULE`` variable in your ``Makefile``. For example, to build
184f4a2713aSLionel Sambuca loadable module named ``MyMod`` that uses the LLVM libraries ``LLVMSupport.a``
185f4a2713aSLionel Sambucand ``LLVMSystem.a``, you would specify:
186f4a2713aSLionel Sambuc
187f4a2713aSLionel Sambuc.. code-block:: makefile
188f4a2713aSLionel Sambuc
189f4a2713aSLionel Sambuc  LIBRARYNAME := MyMod
190f4a2713aSLionel Sambuc  LOADABLE_MODULE := 1
191f4a2713aSLionel Sambuc  LINK_COMPONENTS := support system
192f4a2713aSLionel Sambuc
193f4a2713aSLionel SambucUse of the ``LOADABLE_MODULE`` facility implies several things:
194f4a2713aSLionel Sambuc
195f4a2713aSLionel Sambuc#. There will be no "``lib``" prefix on the module. This differentiates it from
196f4a2713aSLionel Sambuc    a standard shared library of the same name.
197f4a2713aSLionel Sambuc
198f4a2713aSLionel Sambuc#. The `SHARED_LIBRARY`_ variable is turned on.
199f4a2713aSLionel Sambuc
200f4a2713aSLionel Sambuc#. The `LINK_LIBS_IN_SHARED`_ variable is turned on.
201f4a2713aSLionel Sambuc
202f4a2713aSLionel SambucA loadable module is loaded by LLVM via the facilities of libtool's libltdl
203f4a2713aSLionel Sambuclibrary which is part of ``lib/System`` implementation.
204f4a2713aSLionel Sambuc
205f4a2713aSLionel SambucTools
206f4a2713aSLionel Sambuc-----
207f4a2713aSLionel Sambuc
208f4a2713aSLionel SambucFor building executable programs (tools), you must provide the name of the tool
209f4a2713aSLionel Sambucand the names of the libraries you wish to link with the tool. For example:
210f4a2713aSLionel Sambuc
211f4a2713aSLionel Sambuc.. code-block:: makefile
212f4a2713aSLionel Sambuc
213f4a2713aSLionel Sambuc  TOOLNAME = mytool
214f4a2713aSLionel Sambuc  USEDLIBS = mylib
215f4a2713aSLionel Sambuc  LINK_COMPONENTS = support system
216f4a2713aSLionel Sambuc
217f4a2713aSLionel Sambucsays that we are to build a tool name ``mytool`` and that it requires three
218f4a2713aSLionel Sambuclibraries: ``mylib``, ``LLVMSupport.a`` and ``LLVMSystem.a``.
219f4a2713aSLionel Sambuc
220f4a2713aSLionel SambucNote that two different variables are used to indicate which libraries are
221f4a2713aSLionel Sambuclinked: ``USEDLIBS`` and ``LLVMLIBS``. This distinction is necessary to support
222f4a2713aSLionel Sambucprojects. ``LLVMLIBS`` refers to the LLVM libraries found in the LLVM object
223f4a2713aSLionel Sambucdirectory. ``USEDLIBS`` refers to the libraries built by your project. In the
224f4a2713aSLionel Sambuccase of building LLVM tools, ``USEDLIBS`` and ``LLVMLIBS`` can be used
225f4a2713aSLionel Sambucinterchangeably since the "project" is LLVM itself and ``USEDLIBS`` refers to
226f4a2713aSLionel Sambucthe same place as ``LLVMLIBS``.
227f4a2713aSLionel Sambuc
228f4a2713aSLionel SambucAlso note that there are two different ways of specifying a library: with a
229f4a2713aSLionel Sambuc``.a`` suffix and without. Without the suffix, the entry refers to the re-linked
230f4a2713aSLionel Sambuc(.o) file which will include *all* symbols of the library.  This is
231f4a2713aSLionel Sambucuseful, for example, to include all passes from a library of passes.  If the
232f4a2713aSLionel Sambuc``.a`` suffix is used then the library is linked as a searchable library (with
233f4a2713aSLionel Sambucthe ``-l`` option). In this case, only the symbols that are unresolved *at
234f4a2713aSLionel Sambucthat point* will be resolved from the library, if they exist. Other
235f4a2713aSLionel Sambuc(unreferenced) symbols will not be included when the ``.a`` syntax is used. Note
236f4a2713aSLionel Sambucthat in order to use the ``.a`` suffix, the library in question must have been
237f4a2713aSLionel Sambucbuilt with the ``BUILD_ARCHIVE`` option set.
238f4a2713aSLionel Sambuc
239f4a2713aSLionel SambucJIT Tools
240f4a2713aSLionel Sambuc^^^^^^^^^
241f4a2713aSLionel Sambuc
242f4a2713aSLionel SambucMany tools will want to use the JIT features of LLVM.  To do this, you simply
243f4a2713aSLionel Sambucspecify that you want an execution 'engine', and the makefiles will
244f4a2713aSLionel Sambucautomatically link in the appropriate JIT for the host or an interpreter if none
245f4a2713aSLionel Sambucis available:
246f4a2713aSLionel Sambuc
247f4a2713aSLionel Sambuc.. code-block:: makefile
248f4a2713aSLionel Sambuc
249f4a2713aSLionel Sambuc  TOOLNAME = my_jit_tool
250f4a2713aSLionel Sambuc  USEDLIBS = mylib
251f4a2713aSLionel Sambuc  LINK_COMPONENTS = engine
252f4a2713aSLionel Sambuc
253f4a2713aSLionel SambucOf course, any additional libraries may be listed as other components.  To get a
254f4a2713aSLionel Sambucfull understanding of how this changes the linker command, it is recommended
255f4a2713aSLionel Sambucthat you:
256f4a2713aSLionel Sambuc
257f4a2713aSLionel Sambuc.. code-block:: bash
258f4a2713aSLionel Sambuc
259f4a2713aSLionel Sambuc  % cd examples/Fibonacci
260f4a2713aSLionel Sambuc  % make VERBOSE=1
261f4a2713aSLionel Sambuc
262f4a2713aSLionel SambucTargets Supported
263f4a2713aSLionel Sambuc=================
264f4a2713aSLionel Sambuc
265f4a2713aSLionel SambucThis section describes each of the targets that can be built using the LLVM
266f4a2713aSLionel SambucMakefile system. Any target can be invoked from any directory but not all are
267f4a2713aSLionel Sambucapplicable to a given directory (e.g. "check", "dist" and "install" will always
268f4a2713aSLionel Sambucoperate as if invoked from the top level directory).
269f4a2713aSLionel Sambuc
270f4a2713aSLionel Sambuc================= ===============      ==================
271f4a2713aSLionel SambucTarget Name       Implied Targets      Target Description
272f4a2713aSLionel Sambuc================= ===============      ==================
273f4a2713aSLionel Sambuc``all``           \                    Compile the software recursively. Default target.
274f4a2713aSLionel Sambuc``all-local``     \                    Compile the software in the local directory only.
275f4a2713aSLionel Sambuc``check``         \                    Change to the ``test`` directory in a project and run the test suite there.
276f4a2713aSLionel Sambuc``check-local``   \                    Run a local test suite. Generally this is only defined in the  ``Makefile`` of the project's ``test`` directory.
277f4a2713aSLionel Sambuc``clean``         \                    Remove built objects recursively.
278f4a2713aSLionel Sambuc``clean-local``   \                    Remove built objects from the local directory only.
279f4a2713aSLionel Sambuc``dist``          ``all``              Prepare a source distribution tarball.
280f4a2713aSLionel Sambuc``dist-check``    ``all``              Prepare a source distribution tarball and check that it builds.
281f4a2713aSLionel Sambuc``dist-clean``    ``clean``            Clean source distribution tarball temporary files.
282f4a2713aSLionel Sambuc``install``       ``all``              Copy built objects to installation directory.
283f4a2713aSLionel Sambuc``preconditions`` ``all``              Check to make sure configuration and makefiles are up to date.
284f4a2713aSLionel Sambuc``printvars``     ``all``              Prints variables defined by the makefile system (for debugging).
285f4a2713aSLionel Sambuc``tags``          \                    Make C and C++ tags files for emacs and vi.
286f4a2713aSLionel Sambuc``uninstall``     \                    Remove built objects from installation directory.
287f4a2713aSLionel Sambuc================= ===============      ==================
288f4a2713aSLionel Sambuc
289f4a2713aSLionel Sambuc.. _all:
290f4a2713aSLionel Sambuc
291f4a2713aSLionel Sambuc``all`` (default)
292f4a2713aSLionel Sambuc-----------------
293f4a2713aSLionel Sambuc
294f4a2713aSLionel SambucWhen you invoke ``make`` with no arguments, you are implicitly instructing it to
295f4a2713aSLionel Sambucseek the ``all`` target (goal). This target is used for building the software
296f4a2713aSLionel Sambucrecursively and will do different things in different directories.  For example,
297f4a2713aSLionel Sambucin a ``lib`` directory, the ``all`` target will compile source files and
298f4a2713aSLionel Sambucgenerate libraries. But, in a ``tools`` directory, it will link libraries and
299f4a2713aSLionel Sambucgenerate executables.
300f4a2713aSLionel Sambuc
301f4a2713aSLionel Sambuc``all-local``
302f4a2713aSLionel Sambuc-------------
303f4a2713aSLionel Sambuc
304f4a2713aSLionel SambucThis target is the same as `all`_ but it operates only on the current directory
305f4a2713aSLionel Sambucinstead of recursively.
306f4a2713aSLionel Sambuc
307f4a2713aSLionel Sambuc``check``
308f4a2713aSLionel Sambuc---------
309f4a2713aSLionel Sambuc
310f4a2713aSLionel SambucThis target can be invoked from anywhere within a project's directories but
311f4a2713aSLionel Sambucalways invokes the `check-local`_ target in the project's ``test`` directory, if
312f4a2713aSLionel Sambucit exists and has a ``Makefile``. A warning is produced otherwise.  If
313f4a2713aSLionel Sambuc`TESTSUITE`_ is defined on the ``make`` command line, it will be passed down to
314f4a2713aSLionel Sambucthe invocation of ``make check-local`` in the ``test`` directory. The intended
315f4a2713aSLionel Sambucusage for this is to assist in running specific suites of tests. If
316f4a2713aSLionel Sambuc``TESTSUITE`` is not set, the implementation of ``check-local`` should run all
317f4a2713aSLionel Sambucnormal tests.  It is up to the project to define what different values for
318f4a2713aSLionel Sambuc``TESTSUTE`` will do. See the :doc:`Testing Guide <TestingGuide>` for further
319f4a2713aSLionel Sambucdetails.
320f4a2713aSLionel Sambuc
321f4a2713aSLionel Sambuc``check-local``
322f4a2713aSLionel Sambuc---------------
323f4a2713aSLionel Sambuc
324f4a2713aSLionel SambucThis target should be implemented by the ``Makefile`` in the project's ``test``
325f4a2713aSLionel Sambucdirectory. It is invoked by the ``check`` target elsewhere.  Each project is
326f4a2713aSLionel Sambucfree to define the actions of ``check-local`` as appropriate for that
327f4a2713aSLionel Sambucproject. The LLVM project itself uses the :doc:`Lit <CommandGuide/lit>` testing
328f4a2713aSLionel Sambuctool to run a suite of feature and regression tests. Other projects may choose
329f4a2713aSLionel Sambucto use :program:`lit` or any other testing mechanism.
330f4a2713aSLionel Sambuc
331f4a2713aSLionel Sambuc``clean``
332f4a2713aSLionel Sambuc---------
333f4a2713aSLionel Sambuc
334f4a2713aSLionel SambucThis target cleans the build directory, recursively removing all things that the
335f4a2713aSLionel SambucMakefile builds. The cleaning rules have been made guarded so they shouldn't go
336f4a2713aSLionel Sambucawry (via ``rm -f $(UNSET_VARIABLE)/*`` which will attempt to erase the entire
337f4a2713aSLionel Sambucdirectory structure).
338f4a2713aSLionel Sambuc
339f4a2713aSLionel Sambuc``clean-local``
340f4a2713aSLionel Sambuc---------------
341f4a2713aSLionel Sambuc
342f4a2713aSLionel SambucThis target does the same thing as ``clean`` but only for the current (local)
343f4a2713aSLionel Sambucdirectory.
344f4a2713aSLionel Sambuc
345f4a2713aSLionel Sambuc``dist``
346f4a2713aSLionel Sambuc--------
347f4a2713aSLionel Sambuc
348f4a2713aSLionel SambucThis target builds a distribution tarball. It first builds the entire project
349f4a2713aSLionel Sambucusing the ``all`` target and then tars up the necessary files and compresses
350f4a2713aSLionel Sambucit. The generated tarball is sufficient for a casual source distribution, but
351f4a2713aSLionel Sambucprobably not for a release (see ``dist-check``).
352f4a2713aSLionel Sambuc
353f4a2713aSLionel Sambuc``dist-check``
354f4a2713aSLionel Sambuc--------------
355f4a2713aSLionel Sambuc
356f4a2713aSLionel SambucThis target does the same thing as the ``dist`` target but also checks the
357f4a2713aSLionel Sambucdistribution tarball. The check is made by unpacking the tarball to a new
358f4a2713aSLionel Sambucdirectory, configuring it, building it, installing it, and then verifying that
359f4a2713aSLionel Sambucthe installation results are correct (by comparing to the original build).  This
360f4a2713aSLionel Sambuctarget can take a long time to run but should be done before a release goes out
361f4a2713aSLionel Sambucto make sure that the distributed tarball can actually be built into a working
362f4a2713aSLionel Sambucrelease.
363f4a2713aSLionel Sambuc
364f4a2713aSLionel Sambuc``dist-clean``
365f4a2713aSLionel Sambuc--------------
366f4a2713aSLionel Sambuc
367f4a2713aSLionel SambucThis is a special form of the ``clean`` clean target. It performs a normal
368f4a2713aSLionel Sambuc``clean`` but also removes things pertaining to building the distribution.
369f4a2713aSLionel Sambuc
370f4a2713aSLionel Sambuc``install``
371f4a2713aSLionel Sambuc-----------
372f4a2713aSLionel Sambuc
373f4a2713aSLionel SambucThis target finalizes shared objects and executables and copies all libraries,
374f4a2713aSLionel Sambucheaders, executables and documentation to the directory given with the
375f4a2713aSLionel Sambuc``--prefix`` option to ``configure``.  When completed, the prefix directory will
376f4a2713aSLionel Sambuchave everything needed to **use** LLVM.
377f4a2713aSLionel Sambuc
378f4a2713aSLionel SambucThe LLVM makefiles can generate complete **internal** documentation for all the
379f4a2713aSLionel Sambucclasses by using ``doxygen``. By default, this feature is **not** enabled
380f4a2713aSLionel Sambucbecause it takes a long time and generates a massive amount of data (>100MB). If
381f4a2713aSLionel Sambucyou want this feature, you must configure LLVM with the --enable-doxygen switch
382f4a2713aSLionel Sambucand ensure that a modern version of doxygen (1.3.7 or later) is available in
383f4a2713aSLionel Sambucyour ``PATH``. You can download doxygen from `here
384f4a2713aSLionel Sambuc<http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc>`_.
385f4a2713aSLionel Sambuc
386f4a2713aSLionel Sambuc``preconditions``
387f4a2713aSLionel Sambuc-----------------
388f4a2713aSLionel Sambuc
389f4a2713aSLionel SambucThis utility target checks to see if the ``Makefile`` in the object directory is
390f4a2713aSLionel Sambucolder than the ``Makefile`` in the source directory and copies it if so. It also
391f4a2713aSLionel Sambucreruns the ``configure`` script if that needs to be done and rebuilds the
392f4a2713aSLionel Sambuc``Makefile.config`` file similarly. Users may overload this target to ensure
393f4a2713aSLionel Sambucthat sanity checks are run *before* any building of targets as all the targets
394f4a2713aSLionel Sambucdepend on ``preconditions``.
395f4a2713aSLionel Sambuc
396f4a2713aSLionel Sambuc``printvars``
397f4a2713aSLionel Sambuc-------------
398f4a2713aSLionel Sambuc
399f4a2713aSLionel SambucThis utility target just causes the LLVM makefiles to print out some of the
400f4a2713aSLionel Sambucmakefile variables so that you can double check how things are set.
401f4a2713aSLionel Sambuc
402f4a2713aSLionel Sambuc``reconfigure``
403f4a2713aSLionel Sambuc---------------
404f4a2713aSLionel Sambuc
405f4a2713aSLionel SambucThis utility target will force a reconfigure of LLVM or your project. It simply
406f4a2713aSLionel Sambucruns ``$(PROJ_OBJ_ROOT)/config.status --recheck`` to rerun the configuration
407f4a2713aSLionel Sambuctests and rebuild the configured files. This isn't generally useful as the
408f4a2713aSLionel Sambucmakefiles will reconfigure themselves whenever its necessary.
409f4a2713aSLionel Sambuc
410f4a2713aSLionel Sambuc``spotless``
411f4a2713aSLionel Sambuc------------
412f4a2713aSLionel Sambuc
413f4a2713aSLionel Sambuc.. warning::
414f4a2713aSLionel Sambuc
415f4a2713aSLionel Sambuc  Use with caution!
416f4a2713aSLionel Sambuc
417f4a2713aSLionel SambucThis utility target, only available when ``$(PROJ_OBJ_ROOT)`` is not the same as
418f4a2713aSLionel Sambuc``$(PROJ_SRC_ROOT)``, will completely clean the ``$(PROJ_OBJ_ROOT)`` directory
419f4a2713aSLionel Sambucby removing its content entirely and reconfiguring the directory. This returns
420f4a2713aSLionel Sambucthe ``$(PROJ_OBJ_ROOT)`` directory to a completely fresh state. All content in
421f4a2713aSLionel Sambucthe directory except configured files and top-level makefiles will be lost.
422f4a2713aSLionel Sambuc
423f4a2713aSLionel Sambuc``tags``
424f4a2713aSLionel Sambuc--------
425f4a2713aSLionel Sambuc
426f4a2713aSLionel SambucThis target will generate a ``TAGS`` file in the top-level source directory. It
427f4a2713aSLionel Sambucis meant for use with emacs, XEmacs, or ViM. The TAGS file provides an index of
428f4a2713aSLionel Sambucsymbol definitions so that the editor can jump you to the definition
429f4a2713aSLionel Sambucquickly.
430f4a2713aSLionel Sambuc
431f4a2713aSLionel Sambuc``uninstall``
432f4a2713aSLionel Sambuc-------------
433f4a2713aSLionel Sambuc
434f4a2713aSLionel SambucThis target is the opposite of the ``install`` target. It removes the header,
435f4a2713aSLionel Sambuclibrary and executable files from the installation directories. Note that the
436f4a2713aSLionel Sambucdirectories themselves are not removed because it is not guaranteed that LLVM is
437f4a2713aSLionel Sambucthe only thing installing there (e.g. ``--prefix=/usr``).
438f4a2713aSLionel Sambuc
439f4a2713aSLionel Sambuc.. _variables:
440f4a2713aSLionel Sambuc
441f4a2713aSLionel SambucVariables
442f4a2713aSLionel Sambuc=========
443f4a2713aSLionel Sambuc
444f4a2713aSLionel SambucVariables are used to tell the LLVM Makefile System what to do and to obtain
445f4a2713aSLionel Sambucinformation from it. Variables are also used internally by the LLVM Makefile
446f4a2713aSLionel SambucSystem. Variable names that contain only the upper case alphabetic letters and
447f4a2713aSLionel Sambucunderscore are intended for use by the end user. All other variables are
448f4a2713aSLionel Sambucinternal to the LLVM Makefile System and should not be relied upon nor
449f4a2713aSLionel Sambucmodified. The sections below describe how to use the LLVM Makefile
450f4a2713aSLionel Sambucvariables.
451f4a2713aSLionel Sambuc
452f4a2713aSLionel SambucControl Variables
453f4a2713aSLionel Sambuc-----------------
454f4a2713aSLionel Sambuc
455f4a2713aSLionel SambucVariables listed in the table below should be set *before* the inclusion of
456f4a2713aSLionel Sambuc`$(LEVEL)/Makefile.common`_.  These variables provide input to the LLVM make
457f4a2713aSLionel Sambucsystem that tell it what to do for the current directory.
458f4a2713aSLionel Sambuc
459f4a2713aSLionel Sambuc``BUILD_ARCHIVE``
460f4a2713aSLionel Sambuc    If set to any value, causes an archive (.a) library to be built.
461f4a2713aSLionel Sambuc
462f4a2713aSLionel Sambuc``BUILT_SOURCES``
463f4a2713aSLionel Sambuc    Specifies a set of source files that are generated from other source
464f4a2713aSLionel Sambuc    files. These sources will be built before any other target processing to
465f4a2713aSLionel Sambuc    ensure they are present.
466f4a2713aSLionel Sambuc
467f4a2713aSLionel Sambuc``CONFIG_FILES``
468f4a2713aSLionel Sambuc    Specifies a set of configuration files to be installed.
469f4a2713aSLionel Sambuc
470f4a2713aSLionel Sambuc``DEBUG_SYMBOLS``
471f4a2713aSLionel Sambuc    If set to any value, causes the build to include debugging symbols even in
472f4a2713aSLionel Sambuc    optimized objects, libraries and executables. This alters the flags
473f4a2713aSLionel Sambuc    specified to the compilers and linkers. Debugging isn't fun in an optimized
474f4a2713aSLionel Sambuc    build, but it is possible.
475f4a2713aSLionel Sambuc
476f4a2713aSLionel Sambuc``DIRS``
477f4a2713aSLionel Sambuc    Specifies a set of directories, usually children of the current directory,
478f4a2713aSLionel Sambuc    that should also be made using the same goal. These directories will be
479f4a2713aSLionel Sambuc    built serially.
480f4a2713aSLionel Sambuc
481f4a2713aSLionel Sambuc``DISABLE_AUTO_DEPENDENCIES``
482f4a2713aSLionel Sambuc    If set to any value, causes the makefiles to **not** automatically generate
483f4a2713aSLionel Sambuc    dependencies when running the compiler. Use of this feature is discouraged
484f4a2713aSLionel Sambuc    and it may be removed at a later date.
485f4a2713aSLionel Sambuc
486f4a2713aSLionel Sambuc``ENABLE_OPTIMIZED``
487f4a2713aSLionel Sambuc    If set to 1, causes the build to generate optimized objects, libraries and
488f4a2713aSLionel Sambuc    executables. This alters the flags specified to the compilers and
489f4a2713aSLionel Sambuc    linkers. Generally debugging won't be a fun experience with an optimized
490f4a2713aSLionel Sambuc    build.
491f4a2713aSLionel Sambuc
492f4a2713aSLionel Sambuc``ENABLE_PROFILING``
493f4a2713aSLionel Sambuc    If set to 1, causes the build to generate both optimized and profiled
494f4a2713aSLionel Sambuc    objects, libraries and executables. This alters the flags specified to the
495f4a2713aSLionel Sambuc    compilers and linkers to ensure that profile data can be collected from the
496f4a2713aSLionel Sambuc    tools built. Use the ``gprof`` tool to analyze the output from the profiled
497f4a2713aSLionel Sambuc    tools (``gmon.out``).
498f4a2713aSLionel Sambuc
499f4a2713aSLionel Sambuc``DISABLE_ASSERTIONS``
500f4a2713aSLionel Sambuc    If set to 1, causes the build to disable assertions, even if building a
501f4a2713aSLionel Sambuc    debug or profile build.  This will exclude all assertion check code from the
502f4a2713aSLionel Sambuc    build. LLVM will execute faster, but with little help when things go
503f4a2713aSLionel Sambuc    wrong.
504f4a2713aSLionel Sambuc
505f4a2713aSLionel Sambuc``EXPERIMENTAL_DIRS``
506f4a2713aSLionel Sambuc    Specify a set of directories that should be built, but if they fail, it
507f4a2713aSLionel Sambuc    should not cause the build to fail. Note that this should only be used
508f4a2713aSLionel Sambuc    temporarily while code is being written.
509f4a2713aSLionel Sambuc
510f4a2713aSLionel Sambuc``EXPORTED_SYMBOL_FILE``
511f4a2713aSLionel Sambuc    Specifies the name of a single file that contains a list of the symbols to
512f4a2713aSLionel Sambuc    be exported by the linker. One symbol per line.
513f4a2713aSLionel Sambuc
514f4a2713aSLionel Sambuc``EXPORTED_SYMBOL_LIST``
515f4a2713aSLionel Sambuc    Specifies a set of symbols to be exported by the linker.
516f4a2713aSLionel Sambuc
517f4a2713aSLionel Sambuc``EXTRA_DIST``
518f4a2713aSLionel Sambuc    Specifies additional files that should be distributed with LLVM. All source
519f4a2713aSLionel Sambuc    files, all built sources, all Makefiles, and most documentation files will
520f4a2713aSLionel Sambuc    be automatically distributed. Use this variable to distribute any files that
521f4a2713aSLionel Sambuc    are not automatically distributed.
522f4a2713aSLionel Sambuc
523f4a2713aSLionel Sambuc``KEEP_SYMBOLS``
524f4a2713aSLionel Sambuc    If set to any value, specifies that when linking executables the makefiles
525f4a2713aSLionel Sambuc    should retain debug symbols in the executable. Normally, symbols are
526f4a2713aSLionel Sambuc    stripped from the executable.
527f4a2713aSLionel Sambuc
528f4a2713aSLionel Sambuc``LEVEL`` (required)
529f4a2713aSLionel Sambuc    Specify the level of nesting from the top level. This variable must be set
530f4a2713aSLionel Sambuc    in each makefile as it is used to find the top level and thus the other
531f4a2713aSLionel Sambuc    makefiles.
532f4a2713aSLionel Sambuc
533f4a2713aSLionel Sambuc``LIBRARYNAME``
534f4a2713aSLionel Sambuc    Specify the name of the library to be built. (Required For Libraries)
535f4a2713aSLionel Sambuc
536f4a2713aSLionel Sambuc``LINK_COMPONENTS``
537f4a2713aSLionel Sambuc    When specified for building a tool, the value of this variable will be
538f4a2713aSLionel Sambuc    passed to the ``llvm-config`` tool to generate a link line for the
539f4a2713aSLionel Sambuc    tool. Unlike ``USEDLIBS`` and ``LLVMLIBS``, not all libraries need to be
540f4a2713aSLionel Sambuc    specified. The ``llvm-config`` tool will figure out the library dependencies
541f4a2713aSLionel Sambuc    and add any libraries that are needed. The ``USEDLIBS`` variable can still
542f4a2713aSLionel Sambuc    be used in conjunction with ``LINK_COMPONENTS`` so that additional
543f4a2713aSLionel Sambuc    project-specific libraries can be linked with the LLVM libraries specified
544f4a2713aSLionel Sambuc    by ``LINK_COMPONENTS``.
545f4a2713aSLionel Sambuc
546f4a2713aSLionel Sambuc.. _LINK_LIBS_IN_SHARED:
547f4a2713aSLionel Sambuc
548f4a2713aSLionel Sambuc``LINK_LIBS_IN_SHARED``
549f4a2713aSLionel Sambuc    By default, shared library linking will ignore any libraries specified with
550f4a2713aSLionel Sambuc    the `LLVMLIBS`_ or `USEDLIBS`_. This prevents shared libs from including
551f4a2713aSLionel Sambuc    things that will be in the LLVM tool the shared library will be loaded
552f4a2713aSLionel Sambuc    into. However, sometimes it is useful to link certain libraries into your
553f4a2713aSLionel Sambuc    shared library and this option enables that feature.
554f4a2713aSLionel Sambuc
555f4a2713aSLionel Sambuc.. _LLVMLIBS:
556f4a2713aSLionel Sambuc
557f4a2713aSLionel Sambuc``LLVMLIBS``
558f4a2713aSLionel Sambuc    Specifies the set of libraries from the LLVM ``$(ObjDir)`` that will be
559f4a2713aSLionel Sambuc    linked into the tool or library.
560f4a2713aSLionel Sambuc
561f4a2713aSLionel Sambuc``LOADABLE_MODULE``
562f4a2713aSLionel Sambuc    If set to any value, causes the shared library being built to also be a
563f4a2713aSLionel Sambuc    loadable module. Loadable modules can be opened with the dlopen() function
564f4a2713aSLionel Sambuc    and searched with dlsym (or the operating system's equivalent). Note that
565f4a2713aSLionel Sambuc    setting this variable without also setting ``SHARED_LIBRARY`` will have no
566f4a2713aSLionel Sambuc    effect.
567f4a2713aSLionel Sambuc
568f4a2713aSLionel Sambuc``NO_INSTALL``
569f4a2713aSLionel Sambuc    Specifies that the build products of the directory should not be installed
570f4a2713aSLionel Sambuc    but should be built even if the ``install`` target is given.  This is handy
571f4a2713aSLionel Sambuc    for directories that build libraries or tools that are only used as part of
572f4a2713aSLionel Sambuc    the build process, such as code generators (e.g.  ``tblgen``).
573f4a2713aSLionel Sambuc
574f4a2713aSLionel Sambuc``OPTIONAL_DIRS``
575f4a2713aSLionel Sambuc    Specify a set of directories that may be built, if they exist, but it is
576f4a2713aSLionel Sambuc    not an error for them not to exist.
577f4a2713aSLionel Sambuc
578f4a2713aSLionel Sambuc``PARALLEL_DIRS``
579f4a2713aSLionel Sambuc    Specify a set of directories to build recursively and in parallel if the
580f4a2713aSLionel Sambuc    ``-j`` option was used with ``make``.
581f4a2713aSLionel Sambuc
582f4a2713aSLionel Sambuc.. _SHARED_LIBRARY:
583f4a2713aSLionel Sambuc
584f4a2713aSLionel Sambuc``SHARED_LIBRARY``
585f4a2713aSLionel Sambuc    If set to any value, causes a shared library (``.so``) to be built in
586f4a2713aSLionel Sambuc    addition to any other kinds of libraries. Note that this option will cause
587f4a2713aSLionel Sambuc    all source files to be built twice: once with options for position
588f4a2713aSLionel Sambuc    independent code and once without. Use it only where you really need a
589f4a2713aSLionel Sambuc    shared library.
590f4a2713aSLionel Sambuc
591f4a2713aSLionel Sambuc``SOURCES`` (optional)
592f4a2713aSLionel Sambuc    Specifies the list of source files in the current directory to be
593f4a2713aSLionel Sambuc    built. Source files of any type may be specified (programs, documentation,
594f4a2713aSLionel Sambuc    config files, etc.). If not specified, the makefile system will infer the
595f4a2713aSLionel Sambuc    set of source files from the files present in the current directory.
596f4a2713aSLionel Sambuc
597f4a2713aSLionel Sambuc``SUFFIXES``
598f4a2713aSLionel Sambuc    Specifies a set of filename suffixes that occur in suffix match rules.  Only
599f4a2713aSLionel Sambuc    set this if your local ``Makefile`` specifies additional suffix match
600f4a2713aSLionel Sambuc    rules.
601f4a2713aSLionel Sambuc
602f4a2713aSLionel Sambuc``TARGET``
603f4a2713aSLionel Sambuc    Specifies the name of the LLVM code generation target that the current
604f4a2713aSLionel Sambuc    directory builds. Setting this variable enables additional rules to build
605f4a2713aSLionel Sambuc    ``.inc`` files from ``.td`` files.
606f4a2713aSLionel Sambuc
607f4a2713aSLionel Sambuc.. _TESTSUITE:
608f4a2713aSLionel Sambuc
609f4a2713aSLionel Sambuc``TESTSUITE``
610f4a2713aSLionel Sambuc    Specifies the directory of tests to run in ``llvm/test``.
611f4a2713aSLionel Sambuc
612f4a2713aSLionel Sambuc``TOOLNAME``
613f4a2713aSLionel Sambuc    Specifies the name of the tool that the current directory should build.
614f4a2713aSLionel Sambuc
615f4a2713aSLionel Sambuc``TOOL_VERBOSE``
616f4a2713aSLionel Sambuc    Implies ``VERBOSE`` and also tells each tool invoked to be verbose. This is
617f4a2713aSLionel Sambuc    handy when you're trying to see the sub-tools invoked by each tool invoked
618f4a2713aSLionel Sambuc    by the makefile. For example, this will pass ``-v`` to the GCC compilers
619f4a2713aSLionel Sambuc    which causes it to print out the command lines it uses to invoke sub-tools
620f4a2713aSLionel Sambuc    (compiler, assembler, linker).
621f4a2713aSLionel Sambuc
622f4a2713aSLionel Sambuc.. _USEDLIBS:
623f4a2713aSLionel Sambuc
624f4a2713aSLionel Sambuc``USEDLIBS``
625f4a2713aSLionel Sambuc    Specifies the list of project libraries that will be linked into the tool or
626f4a2713aSLionel Sambuc    library.
627f4a2713aSLionel Sambuc
628f4a2713aSLionel Sambuc``VERBOSE``
629f4a2713aSLionel Sambuc    Tells the Makefile system to produce detailed output of what it is doing
630f4a2713aSLionel Sambuc    instead of just summary comments. This will generate a LOT of output.
631f4a2713aSLionel Sambuc
632f4a2713aSLionel SambucOverride Variables
633f4a2713aSLionel Sambuc------------------
634f4a2713aSLionel Sambuc
635f4a2713aSLionel SambucOverride variables can be used to override the default values provided by the
636f4a2713aSLionel SambucLLVM makefile system. These variables can be set in several ways:
637f4a2713aSLionel Sambuc
638f4a2713aSLionel Sambuc* In the environment (e.g. setenv, export) --- not recommended.
639f4a2713aSLionel Sambuc* On the ``make`` command line --- recommended.
640f4a2713aSLionel Sambuc* On the ``configure`` command line.
641f4a2713aSLionel Sambuc* In the Makefile (only *after* the inclusion of `$(LEVEL)/Makefile.common`_).
642f4a2713aSLionel Sambuc
643f4a2713aSLionel SambucThe override variables are given below:
644f4a2713aSLionel Sambuc
645f4a2713aSLionel Sambuc``AR`` (defaulted)
646f4a2713aSLionel Sambuc    Specifies the path to the ``ar`` tool.
647f4a2713aSLionel Sambuc
648f4a2713aSLionel Sambuc``PROJ_OBJ_DIR``
649f4a2713aSLionel Sambuc    The directory into which the products of build rules will be placed.  This
650f4a2713aSLionel Sambuc    might be the same as `PROJ_SRC_DIR`_ but typically is not.
651f4a2713aSLionel Sambuc
652f4a2713aSLionel Sambuc.. _PROJ_SRC_DIR:
653f4a2713aSLionel Sambuc
654f4a2713aSLionel Sambuc``PROJ_SRC_DIR``
655f4a2713aSLionel Sambuc    The directory which contains the source files to be built.
656f4a2713aSLionel Sambuc
657f4a2713aSLionel Sambuc``BUILD_EXAMPLES``
658f4a2713aSLionel Sambuc    If set to 1, build examples in ``examples`` and (if building Clang)
659f4a2713aSLionel Sambuc    ``tools/clang/examples`` directories.
660f4a2713aSLionel Sambuc
661f4a2713aSLionel Sambuc``BZIP2`` (configured)
662f4a2713aSLionel Sambuc    The path to the ``bzip2`` tool.
663f4a2713aSLionel Sambuc
664f4a2713aSLionel Sambuc``CC`` (configured)
665f4a2713aSLionel Sambuc    The path to the 'C' compiler.
666f4a2713aSLionel Sambuc
667f4a2713aSLionel Sambuc``CFLAGS``
668f4a2713aSLionel Sambuc    Additional flags to be passed to the 'C' compiler.
669f4a2713aSLionel Sambuc
670f4a2713aSLionel Sambuc``CPPFLAGS``
671f4a2713aSLionel Sambuc    Additional flags passed to the C/C++ preprocessor.
672f4a2713aSLionel Sambuc
673f4a2713aSLionel Sambuc``CXX``
674f4a2713aSLionel Sambuc    Specifies the path to the C++ compiler.
675f4a2713aSLionel Sambuc
676f4a2713aSLionel Sambuc``CXXFLAGS``
677f4a2713aSLionel Sambuc    Additional flags to be passed to the C++ compiler.
678f4a2713aSLionel Sambuc
679f4a2713aSLionel Sambuc``DATE`` (configured)
680f4a2713aSLionel Sambuc    Specifies the path to the ``date`` program or any program that can generate
681f4a2713aSLionel Sambuc    the current date and time on its standard output.
682f4a2713aSLionel Sambuc
683f4a2713aSLionel Sambuc``DOT`` (configured)
684f4a2713aSLionel Sambuc    Specifies the path to the ``dot`` tool or ``false`` if there isn't one.
685f4a2713aSLionel Sambuc
686f4a2713aSLionel Sambuc``ECHO`` (configured)
687f4a2713aSLionel Sambuc    Specifies the path to the ``echo`` tool for printing output.
688f4a2713aSLionel Sambuc
689f4a2713aSLionel Sambuc``EXEEXT`` (configured)
690f4a2713aSLionel Sambuc    Provides the extension to be used on executables built by the makefiles.
691f4a2713aSLionel Sambuc    The value may be empty on platforms that do not use file extensions for
692f4a2713aSLionel Sambuc    executables (e.g. Unix).
693f4a2713aSLionel Sambuc
694f4a2713aSLionel Sambuc``INSTALL`` (configured)
695f4a2713aSLionel Sambuc    Specifies the path to the ``install`` tool.
696f4a2713aSLionel Sambuc
697f4a2713aSLionel Sambuc``LDFLAGS`` (configured)
698f4a2713aSLionel Sambuc    Allows users to specify additional flags to pass to the linker.
699f4a2713aSLionel Sambuc
700f4a2713aSLionel Sambuc``LIBS`` (configured)
701f4a2713aSLionel Sambuc    The list of libraries that should be linked with each tool.
702f4a2713aSLionel Sambuc
703f4a2713aSLionel Sambuc``LIBTOOL`` (configured)
704f4a2713aSLionel Sambuc    Specifies the path to the ``libtool`` tool. This tool is renamed ``mklib``
705f4a2713aSLionel Sambuc    by the ``configure`` script.
706f4a2713aSLionel Sambuc
707f4a2713aSLionel Sambuc``LLVMAS`` (defaulted)
708f4a2713aSLionel Sambuc    Specifies the path to the ``llvm-as`` tool.
709f4a2713aSLionel Sambuc
710f4a2713aSLionel Sambuc``LLVMGCC`` (defaulted)
711f4a2713aSLionel Sambuc    Specifies the path to the LLVM version of the GCC 'C' Compiler.
712f4a2713aSLionel Sambuc
713f4a2713aSLionel Sambuc``LLVMGXX`` (defaulted)
714f4a2713aSLionel Sambuc    Specifies the path to the LLVM version of the GCC C++ Compiler.
715f4a2713aSLionel Sambuc
716f4a2713aSLionel Sambuc``LLVMLD`` (defaulted)
717f4a2713aSLionel Sambuc    Specifies the path to the LLVM bitcode linker tool
718f4a2713aSLionel Sambuc
719f4a2713aSLionel Sambuc``LLVM_OBJ_ROOT`` (configured)
720f4a2713aSLionel Sambuc    Specifies the top directory into which the output of the build is placed.
721f4a2713aSLionel Sambuc
722f4a2713aSLionel Sambuc``LLVM_SRC_ROOT`` (configured)
723f4a2713aSLionel Sambuc    Specifies the top directory in which the sources are found.
724f4a2713aSLionel Sambuc
725f4a2713aSLionel Sambuc``LLVM_TARBALL_NAME`` (configured)
726f4a2713aSLionel Sambuc    Specifies the name of the distribution tarball to create. This is configured
727f4a2713aSLionel Sambuc    from the name of the project and its version number.
728f4a2713aSLionel Sambuc
729f4a2713aSLionel Sambuc``MKDIR`` (defaulted)
730f4a2713aSLionel Sambuc    Specifies the path to the ``mkdir`` tool that creates directories.
731f4a2713aSLionel Sambuc
732f4a2713aSLionel Sambuc``ONLY_TOOLS``
733f4a2713aSLionel Sambuc    If set, specifies the list of tools to build.
734f4a2713aSLionel Sambuc
735f4a2713aSLionel Sambuc``PLATFORMSTRIPOPTS``
736f4a2713aSLionel Sambuc    The options to provide to the linker to specify that a stripped (no symbols)
737f4a2713aSLionel Sambuc    executable should be built.
738f4a2713aSLionel Sambuc
739f4a2713aSLionel Sambuc``RANLIB`` (defaulted)
740f4a2713aSLionel Sambuc    Specifies the path to the ``ranlib`` tool.
741f4a2713aSLionel Sambuc
742f4a2713aSLionel Sambuc``RM`` (defaulted)
743f4a2713aSLionel Sambuc    Specifies the path to the ``rm`` tool.
744f4a2713aSLionel Sambuc
745f4a2713aSLionel Sambuc``SED`` (defaulted)
746f4a2713aSLionel Sambuc    Specifies the path to the ``sed`` tool.
747f4a2713aSLionel Sambuc
748f4a2713aSLionel Sambuc``SHLIBEXT`` (configured)
749f4a2713aSLionel Sambuc    Provides the filename extension to use for shared libraries.
750f4a2713aSLionel Sambuc
751f4a2713aSLionel Sambuc``TBLGEN`` (defaulted)
752f4a2713aSLionel Sambuc    Specifies the path to the ``tblgen`` tool.
753f4a2713aSLionel Sambuc
754f4a2713aSLionel Sambuc``TAR`` (defaulted)
755f4a2713aSLionel Sambuc    Specifies the path to the ``tar`` tool.
756f4a2713aSLionel Sambuc
757f4a2713aSLionel Sambuc``ZIP`` (defaulted)
758f4a2713aSLionel Sambuc    Specifies the path to the ``zip`` tool.
759f4a2713aSLionel Sambuc
760f4a2713aSLionel SambucReadable Variables
761f4a2713aSLionel Sambuc------------------
762f4a2713aSLionel Sambuc
763f4a2713aSLionel SambucVariables listed in the table below can be used by the user's Makefile but
764f4a2713aSLionel Sambucshould not be changed. Changing the value will generally cause the build to go
765f4a2713aSLionel Sambucwrong, so don't do it.
766f4a2713aSLionel Sambuc
767f4a2713aSLionel Sambuc``bindir``
768f4a2713aSLionel Sambuc    The directory into which executables will ultimately be installed. This
769f4a2713aSLionel Sambuc    value is derived from the ``--prefix`` option given to ``configure``.
770f4a2713aSLionel Sambuc
771f4a2713aSLionel Sambuc``BuildMode``
772f4a2713aSLionel Sambuc    The name of the type of build being performed: Debug, Release, or
773f4a2713aSLionel Sambuc    Profile.
774f4a2713aSLionel Sambuc
775f4a2713aSLionel Sambuc``bytecode_libdir``
776f4a2713aSLionel Sambuc    The directory into which bitcode libraries will ultimately be installed.
777f4a2713aSLionel Sambuc    This value is derived from the ``--prefix`` option given to ``configure``.
778f4a2713aSLionel Sambuc
779f4a2713aSLionel Sambuc``ConfigureScriptFLAGS``
780f4a2713aSLionel Sambuc    Additional flags given to the ``configure`` script when reconfiguring.
781f4a2713aSLionel Sambuc
782f4a2713aSLionel Sambuc``DistDir``
783f4a2713aSLionel Sambuc    The *current* directory for which a distribution copy is being made.
784f4a2713aSLionel Sambuc
785f4a2713aSLionel Sambuc.. _Echo:
786f4a2713aSLionel Sambuc
787f4a2713aSLionel Sambuc``Echo``
788f4a2713aSLionel Sambuc    The LLVM Makefile System output command. This provides the ``llvm[n]``
789f4a2713aSLionel Sambuc    prefix and starts with ``@`` so the command itself is not printed by
790f4a2713aSLionel Sambuc    ``make``.
791f4a2713aSLionel Sambuc
792f4a2713aSLionel Sambuc``EchoCmd``
793f4a2713aSLionel Sambuc    Same as `Echo`_ but without the leading ``@``.
794f4a2713aSLionel Sambuc
795f4a2713aSLionel Sambuc``includedir``
796f4a2713aSLionel Sambuc    The directory into which include files will ultimately be installed.  This
797f4a2713aSLionel Sambuc    value is derived from the ``--prefix`` option given to ``configure``.
798f4a2713aSLionel Sambuc
799f4a2713aSLionel Sambuc``libdir``
800f4a2713aSLionel Sambuc    The directory into which native libraries will ultimately be installed.
801f4a2713aSLionel Sambuc    This value is derived from the ``--prefix`` option given to
802f4a2713aSLionel Sambuc    ``configure``.
803f4a2713aSLionel Sambuc
804f4a2713aSLionel Sambuc``LibDir``
805f4a2713aSLionel Sambuc    The configuration specific directory into which libraries are placed before
806f4a2713aSLionel Sambuc    installation.
807f4a2713aSLionel Sambuc
808f4a2713aSLionel Sambuc``MakefileConfig``
809f4a2713aSLionel Sambuc    Full path of the ``Makefile.config`` file.
810f4a2713aSLionel Sambuc
811f4a2713aSLionel Sambuc``MakefileConfigIn``
812f4a2713aSLionel Sambuc    Full path of the ``Makefile.config.in`` file.
813f4a2713aSLionel Sambuc
814f4a2713aSLionel Sambuc``ObjDir``
815f4a2713aSLionel Sambuc    The configuration and directory specific directory where build objects
816f4a2713aSLionel Sambuc    (compilation results) are placed.
817f4a2713aSLionel Sambuc
818f4a2713aSLionel Sambuc``SubDirs``
819f4a2713aSLionel Sambuc    The complete list of sub-directories of the current directory as
820f4a2713aSLionel Sambuc    specified by other variables.
821f4a2713aSLionel Sambuc
822f4a2713aSLionel Sambuc``Sources``
823f4a2713aSLionel Sambuc    The complete list of source files.
824f4a2713aSLionel Sambuc
825f4a2713aSLionel Sambuc``sysconfdir``
826f4a2713aSLionel Sambuc    The directory into which configuration files will ultimately be
827f4a2713aSLionel Sambuc    installed. This value is derived from the ``--prefix`` option given to
828f4a2713aSLionel Sambuc    ``configure``.
829f4a2713aSLionel Sambuc
830f4a2713aSLionel Sambuc``ToolDir``
831f4a2713aSLionel Sambuc    The configuration specific directory into which executables are placed
832f4a2713aSLionel Sambuc    before they are installed.
833f4a2713aSLionel Sambuc
834f4a2713aSLionel Sambuc``TopDistDir``
835f4a2713aSLionel Sambuc    The top most directory into which the distribution files are copied.
836f4a2713aSLionel Sambuc
837f4a2713aSLionel Sambuc``Verb``
838f4a2713aSLionel Sambuc    Use this as the first thing on your build script lines to enable or disable
839f4a2713aSLionel Sambuc    verbose mode. It expands to either an ``@`` (quiet mode) or nothing (verbose
840f4a2713aSLionel Sambuc    mode).
841f4a2713aSLionel Sambuc
842f4a2713aSLionel SambucInternal Variables
843f4a2713aSLionel Sambuc------------------
844f4a2713aSLionel Sambuc
845f4a2713aSLionel SambucVariables listed below are used by the LLVM Makefile System and considered
846f4a2713aSLionel Sambucinternal. You should not use these variables under any circumstances.
847f4a2713aSLionel Sambuc
848f4a2713aSLionel Sambuc.. code-block:: makefile
849f4a2713aSLionel Sambuc
850f4a2713aSLionel Sambuc    Archive
851f4a2713aSLionel Sambuc    AR.Flags
852f4a2713aSLionel Sambuc    BaseNameSources
853f4a2713aSLionel Sambuc    BCLinkLib
854f4a2713aSLionel Sambuc    C.Flags
855f4a2713aSLionel Sambuc    Compile.C
856f4a2713aSLionel Sambuc    CompileCommonOpts
857f4a2713aSLionel Sambuc    Compile.CXX
858f4a2713aSLionel Sambuc    ConfigStatusScript
859f4a2713aSLionel Sambuc    ConfigureScript
860f4a2713aSLionel Sambuc    CPP.Flags
861f4a2713aSLionel Sambuc    CPP.Flags
862f4a2713aSLionel Sambuc    CXX.Flags
863f4a2713aSLionel Sambuc    DependFiles
864f4a2713aSLionel Sambuc    DestArchiveLib
865f4a2713aSLionel Sambuc    DestBitcodeLib
866f4a2713aSLionel Sambuc    DestModule
867f4a2713aSLionel Sambuc    DestSharedLib
868f4a2713aSLionel Sambuc    DestTool
869f4a2713aSLionel Sambuc    DistAlways
870f4a2713aSLionel Sambuc    DistCheckDir
871f4a2713aSLionel Sambuc    DistCheckTop
872f4a2713aSLionel Sambuc    DistFiles
873f4a2713aSLionel Sambuc    DistName
874f4a2713aSLionel Sambuc    DistOther
875f4a2713aSLionel Sambuc    DistSources
876f4a2713aSLionel Sambuc    DistSubDirs
877f4a2713aSLionel Sambuc    DistTarBZ2
878f4a2713aSLionel Sambuc    DistTarGZip
879f4a2713aSLionel Sambuc    DistZip
880f4a2713aSLionel Sambuc    ExtraLibs
881f4a2713aSLionel Sambuc    FakeSources
882f4a2713aSLionel Sambuc    INCFiles
883f4a2713aSLionel Sambuc    InternalTargets
884f4a2713aSLionel Sambuc    LD.Flags
885f4a2713aSLionel Sambuc    LibName.A
886f4a2713aSLionel Sambuc    LibName.BC
887f4a2713aSLionel Sambuc    LibName.LA
888f4a2713aSLionel Sambuc    LibName.O
889f4a2713aSLionel Sambuc    LibTool.Flags
890f4a2713aSLionel Sambuc    Link
891f4a2713aSLionel Sambuc    LinkModule
892f4a2713aSLionel Sambuc    LLVMLibDir
893f4a2713aSLionel Sambuc    LLVMLibsOptions
894f4a2713aSLionel Sambuc    LLVMLibsPaths
895f4a2713aSLionel Sambuc    LLVMToolDir
896f4a2713aSLionel Sambuc    LLVMUsedLibs
897f4a2713aSLionel Sambuc    LocalTargets
898f4a2713aSLionel Sambuc    Module
899f4a2713aSLionel Sambuc    ObjectsLO
900f4a2713aSLionel Sambuc    ObjectsO
901f4a2713aSLionel Sambuc    ObjMakefiles
902f4a2713aSLionel Sambuc    ParallelTargets
903f4a2713aSLionel Sambuc    PreConditions
904f4a2713aSLionel Sambuc    ProjLibsOptions
905f4a2713aSLionel Sambuc    ProjLibsPaths
906f4a2713aSLionel Sambuc    ProjUsedLibs
907f4a2713aSLionel Sambuc    Ranlib
908f4a2713aSLionel Sambuc    RecursiveTargets
909f4a2713aSLionel Sambuc    SrcMakefiles
910f4a2713aSLionel Sambuc    Strip
911f4a2713aSLionel Sambuc    StripWarnMsg
912f4a2713aSLionel Sambuc    TableGen
913f4a2713aSLionel Sambuc    TDFiles
914f4a2713aSLionel Sambuc    ToolBuildPath
915f4a2713aSLionel Sambuc    TopLevelTargets
916f4a2713aSLionel Sambuc    UserTargets
917