X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=docs%2FMakefileGuide.html;h=5f561f3a9783cb7de9efde15cf7a5ea814e1fc21;hp=43ed704c9033611f4f07a69803cc5b04675f0864;hb=a15dc035a6d4153bece7a067e037e5d6f5d58b16;hpb=cceed9fc770e1501540f81b8dce5dfd83421a7ca diff --git a/docs/MakefileGuide.html b/docs/MakefileGuide.html index 43ed704c903..5f561f3a978 100644 --- a/docs/MakefileGuide.html +++ b/docs/MakefileGuide.html @@ -28,8 +28,18 @@
  • Tutorial
      -
    1. Libraries
    2. -
    3. Tools
    4. +
    5. Libraries +
        +
      1. Bitcode Modules
      2. +
      3. Loadable Modules
      4. +
      +
    6. +
    7. Tools +
        +
      1. JIT Tools
      2. +
      +
    8. +
    9. Projects
  • Targets Supported @@ -46,6 +56,8 @@
  • install
  • preconditions
  • printvars
  • +
  • reconfigure
  • +
  • spotless
  • tags
  • uninstall
  • @@ -78,8 +90,8 @@ Make 3.79, a widely portable makefile processor. LLVM unabashedly makes heavy use of the features of GNU Make so the dependency on GNU Make is firm. If you're not familiar with make, it is recommended that you read the - GNU Makefile Manual - .

    + GNU Makefile + Manual.

    While this document is rightly part of the LLVM Programmer's Manual, it is treated separately here because of the volume of content and because it is often an @@ -105,10 +117,15 @@ software, but it can build yours too. Built into the system is knowledge of the llvm/projects directory. Any directory under projects that has both a configure script and a Makefile is assumed - to be a project that uses the LLVM Makefile system. This allows your project + to be a project that uses the LLVM Makefile system. Building software that + uses LLVM does not require the LLVM Makefile System nor even placement in the + llvm/projects directory. However, doing so will allow your project to get up and running quickly by utilizing the built-in features that are used to compile LLVM. LLVM compiles itself using the same features of the makefile system as used for projects.

    +

    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.

    @@ -192,7 +209,7 @@
    Comments

    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.

    @@ -221,7 +238,7 @@ LIBRARYNAME = mylib SHARED_LIBRARY = 1 ARCHIVE_LIBRARY = 1 - DONT_BUILT_RELINKED = 1 + DONT_BUILD_RELINKED = 1

    says to build a library named "mylib" with both a shared library (mylib.so) and an archive library (mylib.a) version but @@ -230,6 +247,71 @@ 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. +

    + + +
    Bitcode Modules
    +
    +

    In some situations, it is desireable to build a single bitcode module from + a variety of sources, instead of an archive, shared library, or bitcode + library. Bitcode 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 bitcode modules + derived from the sources. The example will also build a bitcode archive + containing a bitcode module for each compiled source file. The difference is + subtle, but important depending on how the module or library is to be linked. +

    +
    + + +
    + Loadable Modules +
    +
    +

    In some situations, you need to create a loadable module. Loadable modules + can be loaded into programs like opt or llc to specify + additional passes to run or targets to support. Loadable modules are also + useful for debugging a pass or providing a pass with another package if that + pass can't be included in LLVM.

    +

    LLVM provides complete support for building such a module. All you need to + do is use the LOADABLE_MODULE variable in your Makefile. For example, to + build a loadable module named MyMod that uses the LLVM libraries + LLVMSupport.a and LLVMSystem.a, you would specify:

    +
    
    +     LIBRARYNAME := MyMod
    +     LOADABLE_MODULE := 1
    +     LINK_COMPONENTS := support system
    +  
    +

    Use of the LOADABLE_MODULE facility implies several things:

    +
      +
    1. There will be no "lib" prefix on the module. This differentiates it from + a standard shared library of the same name.
    2. +
    3. The SHARED_LIBRARY variable is turned + on.
    4. +
    5. The LINK_LIBS_IN_SHARED variable + is turned on.
    6. +
    7. The DONT_BUILD_RELINKED variable + is turned on.
    8. +
    +

    A loadable module is loaded by LLVM via the facilities of libtool's libltdl + library which is part of lib/System implementation.

    @@ -241,7 +323,7 @@
    
           TOOLNAME = mytool
           USEDLIBS = mylib
    -      LLVMLIBS = LLVMSupport.a LLVMSystem.a
    +      LINK_COMPONENTS = support system
       

    says that we are to build a tool name mytool and that it requires three libraries: mylib, LLVMSupport.a and @@ -267,6 +349,27 @@

    + +
    JIT Tools
    +
    +

    Many tools will want to use the JIT features of LLVM. To do this, you + simply specify that you want an execution 'engine', and the makefiles will + automatically link in the appropriate JIT for the host or an interpreter + if none is available:

    +
    
    +      TOOLNAME = my_jit_tool
    +      USEDLIBS = mylib
    +      LINK_COMPONENTS = engine
    +  
    +

    Of course, any additional libraries may be listed as other components. To + get a full understanding of how this changes the linker command, it is + recommended that you:

    +
    
    +      cd examples/Fibonacci
    +      make VERBOSE=1
    +  
    +
    +
    Targets Supported
    @@ -274,22 +377,26 @@

    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).

    - + + + - - + - - + - + @@ -345,30 +452,38 @@
    check
    -

    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.

    check-local
    -

    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.

    clean

    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.

    @@ -411,9 +526,18 @@
    install

    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.

    @@ -430,8 +554,30 @@
    printvars
    -

    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.

    +
    + + +
    reconfigure
    +
    +

    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. +

    +
    + + +
    spotless
    +
    +

    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.

    +

    Use with caution.

    @@ -480,7 +626,7 @@ files. These sources will be built before any other target processing to ensure they are present.
    BYTECODE_LIBRARY
    -
    If set to any value, causes a bytecode library (.bc) to be built.
    +
    If set to any value, causes a bitcode library (.bc) to be built.
    CONFIG_FILES
    Specifies a set of configuration files to be installed.
    DIRS
    @@ -507,6 +653,11 @@ to the compilers and linkers to ensure that profile data can be collected from the tools built. Use the gprof tool to analyze the output from the profiled tools (gmon.out). +
    DISABLE_ASSERTIONS
    +
    If set to any value, causes the build to disable assertions, even if + building a release or profile build. This will exclude all assertion check + code from the build. LLVM will execute faster, but with little help when + things go wrong.
    EXPERIMENTAL_DIRS
    Specify a set of directories that should be built, but if they fail, it should not cause the build to fail. Note that this should only be used @@ -518,7 +669,7 @@
    Specifies a set of symbols to be exported by the linker.
    EXTRA_DIST
    Specifies additional files that should be distributed with LLVM. All - source files, all built sources, all Makefiles, and most documentation files + 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.
    KEEP_SYMBOLS
    @@ -532,9 +683,42 @@
    LIBRARYNAME
    Specify the name of the library to be built. (Required For Libraries)
    +
    LINK_COMPONENTS
    +
    When specified for building a tool, the value of this variable will be + passed to the llvm-config tool to generate a link line for the + tool. Unlike USEDLIBS and LLVMLIBS, not all libraries need + to be specified. The llvm-config tool will figure out the library + dependencies and add any libraries that are needed. The USEDLIBS + variable can still be used in conjunction with LINK_COMPONENTS so + that additional project-specific libraries can be linked with the LLVM + libraries specified by LINK_COMPONENTS
    +
    LINK_LIBS_IN_SHARED
    +
    By default, shared library linking will ignore any libraries specified + with the LLVMLIBS or USEDLIBS. + This prevents shared libs from including things that will be in the LLVM + tool the shared library will be loaded into. However, sometimes it is useful + to link certain libraries into your shared library and this option enables + that feature.
    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 bitcode module to be created. A bitcode + module can be specified in conjunction with other kinds of library builds + or by itself. It constructs from the sources a single linked bitcode + file.
    +
    NO_INSTALL
    +
    Specifies that the build products of the directory should not be + installed but should be built even if the install target is given. + This is handy for directories that build libraries or tools that are only + used as part of the build process, such as code generators (e.g. + tblgen).
    OPTIONAL_DIRS
    Specify a set of directories that may be built, if they exist, but its not an error for them not to exist.
    @@ -560,6 +744,8 @@
    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.
    @@ -591,21 +777,17 @@
  • In the Makefile (only after the inclusion of $(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.
    BZIP2(configured)
    The path to the bzip2 tool.
    CC(configured)
    @@ -624,24 +806,10 @@ isn't one.
    ECHO(configured)
    Specifies the path to the echo tool for printing output.
    -
    ETAGS(configured)
    -
    Specifies the path to the etags tool.
    -
    ETAGSFLAGS(configured)
    -
    Provides flags to be passed to the etags tool.
    EXEEXT(configured)
    Provides the extension to be used on executables built by the makefiles. The value may be empty on platforms that do not use file extensions for executables (e.g. Unix).
    -
    FLEX(configured)
    -
    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)
    @@ -657,12 +825,17 @@
    Specifies the path to the LLVM version of the GCC 'C' Compiler
    LLVMGXX(defaulted)
    Specifies the path to the LLVM version of the GCC C++ Compiler
    -
    LLVM_OBJ_ROOT(configured)
    +
    LLVMLD(defaulted)
    +
    Specifies the path to the LLVM bitcode linker tool
    +
    LLVM_OBJ_ROOT(configured) +
    Specifies the top directory into which the output of the build is placed.
    -
    LLVM_SRC_ROOT(configured)
    +
    LLVM_SRC_ROOT(configured) +
    Specifies the top directory in which the sources are found.
    -
    LLVM_TARBALL_NAME(configured)
    +
    LLVM_TARBALL_NAME + (configured)
    Specifies the name of the distribution tarball to create. This is configured from the name of the project and its version number.
    MKDIR(defaulted)
    @@ -702,9 +875,9 @@
    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 +
    bytecode_libdir
    +
    The directory into which bitcode libraries will ultimately be + installed. This value is derived from the --prefix option given to configure.
    ConfigureScriptFLAGS
    Additional flags given to the configure script when @@ -743,14 +916,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 @@ -764,99 +938,93 @@

    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
    -
    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 + C.Flags + Compile.C + CompileCommonOpts + Compile.CXX + ConfigStatusScript + ConfigureScript + CPP.Flags + CPP.Flags + CXX.Flags + DependFiles + DestArchiveLib + DestBitcodeLib + DestModule + DestRelinkedLib + DestSharedLib + DestTool + DistAlways + DistCheckDir + DistCheckTop + DistFiles + DistName + DistOther + DistSources + DistSubDirs + DistTarBZ2 + DistTarGZip + DistZip + ExtraLibs + FakeSources + INCFiles + InternalTargets + LD.Flags + LibName.A + LibName.BC + LibName.LA + LibName.O + LibTool.Flags + Link + LinkModule + LLVMLibDir + LLVMLibsOptions + LLVMLibsPaths + LLVMToolDir + LLVMUsedLibs + LocalTargets + Module + ObjectsBC + ObjectsLO + ObjectsO + ObjMakefiles + ParallelTargets + PreConditions + ProjLibsOptions + ProjLibsPaths + ProjUsedLibs + Ranlib + RecursiveTargets + Relink + SrcMakefiles + Strip + StripWarnMsg + TableGen + TDFiles + ToolBuildPath + TopLevelTargets + UserTargets +


    Valid CSS! + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"> Valid HTML 4.01! + src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> Reid Spencer
    - The LLVM Compiler Infrastructure
    + The LLVM Compiler Infrastructure
    Last modified: $Date$
    - -
    Target NameImplied TargetsTarget Description
    Target NameImplied TargetsTarget Description
    all Compile the software recursively. Default target.
    all-local Compile the software in the local directory only.
    checkallTest the software recursively. +
    checkChange to the test directory in a project and run the + test suite there.
    check-localall-localTest the software in the local directory only. +
    check-localRun a local test suite. Generally this is only defined in the + Makefile of the project's test directory.
    clean Remove built objects recursively. @@ -300,7 +407,7 @@
    distall Prepare a source distribution tarball.
    dist-checkall check
    dist-checkall Prepare a source distribution tarball and check that it builds.
    dist-cleanclean