X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FMakefileGuide.html;h=d8c5029f95cb481ffde6f6e8e8c9036b82bbd0d3;hb=87ac97270988778f40c9e7c9ed712e4e421e35a6;hp=af06d757120dd088e0142f9f945eb0fe078d2d20;hpb=2734bf754ac62150a8385f9a9a74860a09bd18ba;p=oota-llvm.git
diff --git a/docs/MakefileGuide.html b/docs/MakefileGuide.html
index af06d757120..d8c5029f95c 100644
--- a/docs/MakefileGuide.html
+++ b/docs/MakefileGuide.html
@@ -15,20 +15,30 @@
For complete details on setting up your projects configuration, simply
+ mimic the llvm/projects/sample project or for further details,
+ consult the Projects.html page.
@@ -134,11 +152,11 @@
User Makefiles need not have comments in them unless the construction is
- unusual or it doesn't strictly follow the rules and patterns of the LLVM
+ unusual or it does not strictly follow the rules and patterns of the LLVM
makefile system. Makefile comments are invoked with the pound (#) character.
The # character and any text following it, to the end of the line, are ignored
by make.
@@ -228,6 +246,37 @@
Note that you normally do not need to specify the sources involved. The LLVM
Makefile system will infer the source files from the contents of the source
directory.
+
The LOADABLE_MODULE=1 directive can be used in conjunction with
+ SHARED_LIBRARY=1 to indicate that the resulting shared library should
+ be openable with the dlopen function and searchable with the
+ dlsym function (or your operating system's equivalents). While this
+ isn't strictly necessary on Linux and a few other platforms, it is required
+ on systems like HP-UX and Darwin. You should use LOADABLE_MODULE for
+ any shared library that you intend to be loaded into an tool via the
+ -load option. See the
+ WritingAnLLVMPass.html document
+ for an example of why you might want to do this.
+
+
+
+
+
In some situations, it is desireable to build a single bytecode module from
+ a variety of sources, instead of an archive, shared library, or bytecode
+ library. Bytecode modules can be specified in addition to any of the other
+ types of libraries by defining the MODULE_NAME
+ variable. For example:
+
+ LIBRARYNAME = mylib
+ BYTECODE_LIBRARY = 1
+ MODULE_NAME = mymod
+
+
will build a module named mymod.bc from the sources in the
+ directory. This module will be an aggregation of all the bytecode modules
+ derived from the sources. The example will also build a bytecode archive
+ containing a bytecode module for each compiled source file. The difference is
+ subtle, but important depending on how the module or library is to be linked.
+
@@ -265,6 +314,41 @@
+
+
+
Many tools will want to use the JIT features of LLVM. However, getting the
+ right set of libraries to link with is tedious, platform specific, and error
+ prone. Additionally, the JIT has special linker switch options that it needs.
+ Consequently, to make it easier to build tools that use the JIT, you can
+ use a special value for the LLVMLIBS variable:
+
+ TOOLNAME = my_jit_tool
+ USEDLIBS = mylib
+ LLVMLIBS = JIT
+
+
Using a value of JIT for LLVMLIBS tells the makefile
+ system to construct a special value for LLVMLIBS that gives the program all
+ the LLVM libraries needed to run the JIT. Any additional libraries needed can
+ still be specified with USEDLIBS. To get a full understanding of how
+ this changes the linker command, it is recommended that you:
+
+ cd examples/Fibonacci
+ make VERBOSE=1
+
+
By default, using LLVMLIBS=JIT will link in enough to support JIT
+ code generation for the architecture on which the tool is linked. If you need
+ additional target architectures linked in, you may specify them on the command
+ line or in your Makefile. For example:
+
+ ENABLE_X86_JIT=1
+ ENABLE_SPARCV9_JIT=1
+ ENALBE_PPC_JIT=1
+
+
will cause the tool to be able to generate code for all three platforms.
+
+
+
This section describes each of the targets that can be built using the LLVM
Makefile system. Any target can be invoked from any directory but not all are
- applicable to a given directory (e.g. "dist" and "install" will always operate
- as if invoked from the top level directory).
+ applicable to a given directory (e.g. "check", "dist" and "install" will
+ always operate as if invoked from the top level directory).
- Target Name | Implied Targets | Target Description |
+
+ Target Name | Implied Targets | Target Description |
+
all | |
Compile the software recursively. Default target.
|
all-local | |
Compile the software in the local directory only.
|
- check | all |
- Test the software recursively.
+ |
check | |
+ Change to the test directory in a project and run the
+ test suite there.
|
- check-local | all-local |
- Test the software in the local directory only.
+ |
check-local | |
+ Run a local test suite. Generally this is only defined in the
+ Makefile of the project's test directory.
|
clean | |
Remove built objects recursively.
@@ -298,7 +386,7 @@
|
dist | all |
Prepare a source distribution tarball.
|
- dist-check | all check |
+
dist-check | all |
Prepare a source distribution tarball and check that it builds.
|
dist-clean | clean |
@@ -307,6 +395,9 @@
install | all |
Copy built objects to installation directory.
|
+ preconditions | all |
+ Check to make sure configuration and makefiles are up to date.
+ |
printvars | all |
Prints variables defined by the makefile system (for debugging).
|
@@ -340,30 +431,38 @@
-
This target is used to perform any functional, unit or sanity tests as the
- software is being built. The check target depends on the
- all target so the software is built in each
- directory first and then the "check" is applied.
-
The definition of "check" is pretty general. It depends on the value of the
- TESTS variable. This variable should be set to a
- list of executables to run in order to test the software. If they all return
- 0 then the check succeeds, otherwise not. The programs run can be anything but
- they should either be local to the directory or in your path.
+
This target can be invoked from anywhere within a project's directories
+ but always invokes the check-local target
+ in the project's test directory, if it exists and has a
+ Makefile. A warning is produced otherwise. If
+ TESTSUITE is defined on the make
+ command line, it will be passed down to the invocation of
+ make check-local in the test directory. The intended usage
+ for this is to assist in running specific suites of tests. If
+ TESTSUITE is not set, the implementation of check-local
+ should run all normal tests. It is up to the project to define what
+ different values for TESTSUTE will do. See the
+ TestingGuide for further details.
-
This target does the same thing as check but only for the current
- (local) directory.
+
This target should be implemented by the Makefile in the project's
+ test directory. It is invoked by the check target elsewhere.
+ Each project is free to define the actions of check-local as
+ appropriate for that project. The LLVM project itself uses dejagnu to run a
+ suite of feature and regresson tests. Other projects may choose to use
+ dejagnu or any other testing mechanism.
This target cleans the build directory, recursively removing all things
- that the Makefile builds. Despite once or twice attempting to remove /*, the
- cleaning rules have been made guarded so they shouldn't go awry.
+ that the Makefile builds. The cleaning rules have been made guarded so they
+ shouldn't go awry (via
rm -f $(UNSET_VARIABLE)/* which will attempt
+ to erase the entire directory structure.
@@ -406,16 +505,58 @@
This target finalizes shared objects and executables and copies all
- libraries, headers and executables to the directory given with the
- --prefix option to configure. When completed, the prefix
- directory will have everything needed to use LLVM.
+ libraries, headers, executables and documentation to the directory given
+ with the
--prefix option to
configure. When completed,
+ the prefix directory will have everything needed to
use LLVM.
+
The LLVM makefiles can generate complete internal documentation
+ for all the classes by using doxygen. By default, this feature is
+ not enabled because it takes a long time and generates a massive
+ amount of data (>100MB). If you want this feature, you must configure LLVM
+ with the --enable-doxygen switch and ensure that a modern version of doxygen
+ (1.3.7 or later) is available in your PATH. You can download
+ doxygen from
+
+ here.
+
+
+
+
+
+
This utility target checks to see if the Makefile in the object
+ directory is older than the Makefile in the source directory and
+ copies it if so. It also reruns the configure script if that needs to
+ be done and rebuilds the Makefile.config file similarly. Users may
+ overload this target to ensure that sanity checks are run before any
+ building of targets as all the targets depend on preconditions.
-
This utility target just causes LLVM to print out some of its variables so
- that you can double check how things are set.
+
This utility target just causes the LLVM makefiles to print out some of
+ the makefile variables so that you can double check how things are set.
+
+
+
+
+
+
This utility target will force a reconfigure of LLVM or your project. It
+ simply runs $(PROJ_OBJ_ROOT)/config.status --recheck to rerun the
+ configuration tests and rebuild the configured files. This isn't generally
+ useful as the makefiles will reconfigure themselves whenever its necessary.
+
+
+
+
+
+
+
This utility target, only available when $(PROJ_OBJ_ROOT) is not
+ the same as $(PROJ_SRC_ROOT), will completely clean the
+ $(PROJ_OBJ_ROOT) directory by removing its content entirely and
+ reconfiguring the directory. This returns the $(PROJ_OBJ_ROOT)
+ directory to a completely fresh state. All content in the directory except
+ configured files and top-level makefiles will be lost.
+
@@ -453,7 +594,7 @@
Variables listed in the table below should be set before the
- inclusion of $(LEVEL)/Makefile.common.
+ inclusion of $(LEVEL)/Makefile.common.
These variables provide input to the LLVM make system that tell it what to do
for the current directory.
@@ -462,7 +603,7 @@
- BUILT_SOURCES
- Specifies a set of source files that are generated from other source
files. These sources will be built before any other target processing to
- ensure they are present.
+ ensure they are present.
- BYTECODE_LIBRARY
- If set to any value, causes a bytecode library (.bc) to be built.
- CONFIG_FILES
@@ -505,20 +646,39 @@
source files, all built sources, all Makefiles, and most documentation files
will be automatically distributed. Use this variable to distribute any
files that are not automatically distributed.
+ - FAKE_SOURCES(optional)
+
+ - This variable is like SOURCES except that
+ the source files don't need to exist. The makefiles only use
+ FAKE_SOURCES to create the names of derived objects that should be
+ included in the directory's result. It is assumed that the project's
+ Makefile will define how to build the derived objects
+ necessary.
- KEEP_SYMBOLS
- If set to any value, specifies that when linking executables the
makefiles should retain debug symbols in the executable. Normally, symbols
are stripped from the executable.
- - LEVEL(required)
+ - LEVEL(required)
- Specify the level of nesting from the top level. This variable must be
set in each makefile as it is used to find the top level and thus the other
makefiles.
- LIBRARYNAME
- - Specify the name of the library to be built. (Required For Libraries)
- BUILD_OBJ_DIR directory.
+ - Specify the name of the library to be built. (Required For
+ Libraries)
- LLVMLIBS
- Specifies the set of libraries from the LLVM $(ObjDir) that will be
linked into the tool or library.
+ - LOADABLE_MODULE
+ - If set to any value, causes the shared library being built to also be
+ a loadable module. Loadable modules can be opened with the dlopen() function
+ and searched with dlsym (or the operating system's equivalent). Note that
+ setting this variable without also setting SHARED_LIBRARY will have
+ no effect.
+ - MODULE_NAME
+ - Specifies the name of a bytecode module to be created. A bytecode
+ module can be specified in conjunction with other kinds of library builds
+ or by itself. It constructs from the sources a single linked bytecode
+ file.
- OPTIONAL_DIRS
- Specify a set of directories that may be built, if they exist, but its
not an error for them not to exist.
@@ -531,7 +691,7 @@
all source files to be built twice: once with options for position
independent code and once without. Use it only where you really need a
shared library.
- - SOURCES(optional)
+
- SOURCES(optional)
- Specifies the list of source files in the current directory to be
built. Source files of any type may be specified (programs, documentation,
config files, etc.). If not specified, the makefile system will infer the
@@ -544,13 +704,21 @@
- Specifies the name of the LLVM code generation target that the
current directory builds. Setting this variable enables additional rules to
build .inc files from .td files.
+ - TESTSUITE
+ - Specifies the directory of tests to run in llvm/test.
- TOOLNAME
- Specifies the name of the tool that the current directory should
build.
- - USEDLIBS
+
- TOOL_VERBOSE
+ - Implies VERBOSE and also tells each tool invoked to be verbose. This is
+ handy when you're trying to see the sub-tools invoked by each tool invoked
+ by the makefile. For example, this will pass -v to the GCC
+ compilers which causes it to print out the command lines it uses to invoke
+ sub-tools (compiler, assembler, linker).
+ - USEDLIBS
- Specifies the list of project libraries that will be linked into the
tool or library.
- - VERBOSE
+
- VERBOSE
- Tells the Makefile system to produce detailed output of what it is doing
instead of just summary comments. This will generate a LOT of output.
@@ -567,20 +735,20 @@
On the make command line -- recommended.
On the configure command line
In the Makefile (only after the inclusion of $(LEVEL)/Makefile.common.
+ href="#Makefile.common">
$(LEVEL)/Makefile.common).
-
The overridable variables are given below:
+
The override variables are given below:
- AR (defaulted)
- Specifies the path to the ar tool.
- BISON(configured)
- Specifies the path to the bison tool.
- - BUILD_OBJ_DIR
+ - PROJ_OBJ_DIR
- The directory into which the products of build rules will be placed.
This might be the same as
- BUILD_SRC_DIR but typically is
+ PROJ_SRC_DIR but typically is
not.
- - BUILD_SRC_DIR
+ - PROJ_SRC_DIR
- The directory which contains the source files to be built.
- BURG
- Specifies the path to the burg tool.
@@ -614,12 +782,6 @@
- Specifies the path to the flex tool.
- GCCLD(defaulted)
- Specifies the path to the gccld tool.
- - HAVE_BZIP2(configured)
- - This variable is set automatically if the configure script
- could find the bzip2 library.
- - HAVE_ZLIB(configured)
- - This variable is set automatically if the configure script
- could find the zlib library.
- INSTALL(configured)
- Specifies the path to the install tool.
- LDFLAGS(configured)
@@ -677,6 +839,9 @@
- The directory into which executables will ultimately be installed. This
value is derived from the --prefix option given to
configure.
+ - BuildMode
+ - The name of the type of build being performed: Debug, Release, or
+ Profile
- bytecode_libdir
- The directory into which bytecode libraries will ultimately be installed.
This value is derived from the --prefix option given to
@@ -718,14 +883,15 @@
- Sources
- The complete list of source files.
- sysconfdir
- - The directory into which configuration files will ulitmately be
+
- The directory into which configuration files will ultimately be
installed. This value is derived from the --prefix option given to
configure.
- ToolDir
- The configuration specific directory into which executables are placed
before they are installed.
- TopDistDir
- - The top most directory into which the distribution files are copied.
+ - The top most directory into which the distribution files are copied.
+
- Verb
- Use this as the first thing on your build script lines to enable or
disable verbose mode. It expands to either an @ (quiet mode) or nothing
@@ -739,84 +905,88 @@
Variables listed below are used by the LLVM Makefile System
and considered internal. You should not use these variables under any
circumstances.
-
- - Archive
- - AR.Flags
- - BaseNameSources
- - BCCompile.C
- - BCCompile.CXX
- - BCLinkLib
- - Burg
- - C.Flags
- - Compile.C
- - CompileCommonOpts
- - Compile.CXX
- - ConfigStatusScript
- - Configuration
- - ConfigureScript
- - CPP.Flags
- - CPP.Flags
- - CXX.Flags
- - DependFiles
- - DestArchiveLib
- - DestBytecodeLib
- - DestRelinkedLib
- - DestSharedLib
- - DestTool
- - DistAlways
- - DistCheckDir
- - DistCheckTop
- - DistFiles
- - DistName
- - DistOther
- - DistSources
- - DistSubDirs
- - DistTarBZ2
- - DistTarGZip
- - DistZip
- - ExtraLibs
- - INCFiles
- - InternalTargets
- - LD.Flags
- - LexOutput
- - LibName.A
- - LibName.BC
- - LibName.LA
- - LibName.O
- - LibTool.Flags
- - Link
- - LLVMGCCLibDir
- - LLVMLibDir
- - LLVMLibsOptions
- - LLVMLibsPaths
- - LLVMToolDir
- - LLVMUsedLibs
- - LocalTargets
- - LTCompile.C
- - LTCompile.CXX
- - LTInstall
- - ObjectsBC
- - ObjectsLO
- - ObjectsO
- - ObjMakefiles
- - Parallel_Targets
- - PreConditions
- - ProjLibsOptions
- - ProjLibsPaths
- - ProjUsedLibs
- - Ranlib
- - RecursiveTargets
- - Relink
- - SrcMakefiles
- - Strip
- - StripWarnMsg
- - TableGen
- - TDFiles
- - ToolBuildPath
- - TopLevelTargets
- - UserTargets
- - YaccOutput
-
+
+ Archive
+ AR.Flags
+ BaseNameSources
+ BCCompile.C
+ BCCompile.CXX
+ BCLinkLib
+ Burg
+ C.Flags
+ Compile.C
+ CompileCommonOpts
+ Compile.CXX
+ ConfigStatusScript
+ ConfigureScript
+ CPP.Flags
+ CPP.Flags
+ CXX.Flags
+ DependFiles
+ DestArchiveLib
+ DestBytecodeLib
+ DestModule
+ DestRelinkedLib
+ DestSharedLib
+ DestTool
+ DistAlways
+ DistCheckDir
+ DistCheckTop
+ DistFiles
+ DistName
+ DistOther
+ DistSources
+ DistSubDirs
+ DistTarBZ2
+ DistTarGZip
+ DistZip
+ ExtraLibs
+ FakeSources
+ INCFiles
+ InternalTargets
+ LD.Flags
+ LexFiles
+ LexOutput
+ LibName.A
+ LibName.BC
+ LibName.LA
+ LibName.O
+ LibTool.Flags
+ Link
+ LinkModule
+ LLVMLibDir
+ LLVMLibsOptions
+ LLVMLibsPaths
+ LLVMToolDir
+ LLVMUsedLibs
+ LocalTargets
+ LTCompile.C
+ LTCompile.CXX
+ LTInstall
+ Module
+ ObjectsBC
+ ObjectsLO
+ ObjectsO
+ ObjMakefiles
+ ParallelTargets
+ PreConditions
+ ProjLibsOptions
+ ProjLibsPaths
+ ProjUsedLibs
+ Ranlib
+ RecursiveTargets
+ Relink
+ SrcMakefiles
+ Strip
+ StripWarnMsg
+ TableGen
+ TDFiles
+ ToolBuildPath
+ TopLevelTargets
+ UserTargets
+ YaccFiles
+ YaccOutput
+
@@ -834,5 +1004,3 @@