⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 allyourbase.jam

📁 C++的一个好库。。。现在很流行
💻 JAM
📖 第 1 页 / 共 4 页
字号:
# description files.
rule Archive
{
    Archive-action $(<) : $(>) ;
}

rule As
{
    DEPENDS $(<) : $(>) ;
    ASFLAGS on $(<) += $(ASFLAGS) $(SUBDIRASFLAGS) ;
}

rule Bulk
{
    local i ;

    for i in $(>)
    {
        File $(i:D=$(<)) : $(i) ;
    }
}

# dwa 6/4/01 - modified for boost
# factored out stuff from the builtin Cc and C++ rules
rule Cc-platform-specifics
{
    # If the compiler's -o flag doesn't work, relocate the .o

    if $(RELOCATE)
    {
        CcMv $(<) : $(>) ;
    }

    local _h = $(SEARCH_SOURCE) $(HDRS) ;

    if $(VMS) && $(_h)
    {
        SLASHINC on $(<) = "/inc=(" $(_h[1]) ,$(_h[2-]) ")" ;
    }
    else if $(MAC) && $(_h)
    {
        local _i _j ;
        _j = $(_h[1]) ;
        for _i in $(_h[2-])
        {
            _j = $(_j),$(_i) ;
        }
        MACINC on $(<) = \"$(_j)\" ;
    }
}

# dwa 6/4/01 - added for boost
# always-c++ filename...
#
# declares that the given files should be compiled as C++, regardless of their
# filename extension.
rule always-c++
{
    gALWAYS_C++ += [ FGristFiles $(<) ] ;
}

# dwa 6/4/01 - modified for boost
rule Cc
{
    DEPENDS $(<) : $(>) ;

    Cc-platform-specifics $(<) : $(>) ;

    if $(>) in $(gALWAYS_C++)
    {
        C++-action $(<) : $(>) ;
    }
    else
    {
        Cc-action $(<) : $(>) ;
    }
}

# dwa 6/4/01 - modified for boost
rule C++
{
    DEPENDS $(<) : $(>) ;

    Cc-platform-specifics $(<) : $(>) ;
    
    C++-action $(<) : $(>) ;
}

rule Chmod
{
    if $(CHMOD) { Chmod1 $(<) ; }
}

# dwa 6/4/01 - added for boost
# conditional <cond> : <true-value> : <false-value>
# returns <true-value> if <cond>, <false-value> otherwise
rule conditional
{
    if $(1) { return $(2) ; } else { return $(3) ; }
}

# dwa 6/4/01 - modified for boost
rule File
{
    type-DEPENDS files : $(<) ;
    DEPENDS $(<) : $(>) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
    MODE on $(<) = $(FILEMODE) ;
    Chmod $(<) ;
}

rule FileClone
{
    type-DEPENDS files : $(<) ;
    DEPENDS $(<) : $(>) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
}

rule Fortran
{
    DEPENDS $(<) : $(>) ;
}

rule GenFile 
{
    local _t = [ FGristSourceFiles $(<) ] ;
    local _s = [ FAppendSuffix $(>[1]) : $(SUFEXE) ] ;
    Depends $(_t) : $(_s) $(>[2-]) ;
    GenFile1 $(_t) : $(_s) $(>[2-]) ;
    Clean clean : $(_t) ;
}

rule GenFile1
{
    MakeLocate $(<) : $(LOCATE_SOURCE) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
}

# dwa 6/4/01 - modified for boost
rule HardLink
{
    type-DEPENDS files : $(<) ;
    DEPENDS $(<) : $(>) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
}

rule HdrRule
{
    # HdrRule source : headers ;

    # N.B.  This rule is called during binding, potentially after
    # the fate of many targets has been determined, and must be
    # used with caution: don't add dependencies to unrelated
    # targets, and don't set variables on $(<).

    # Tell Jam that anything depending on $(<) also depends on $(>),
    # set SEARCH so Jam can find the headers, but then say we don't
    # care if we can't actually find the headers (they may have been
    # within ifdefs),

    local angle-includes = [ MATCH "[<]([^>]+)[>]" : $(>) ] ;
    local quoted-includes = [ MATCH "[\"]([^\"]+)[\"]" : $(>) ] ;

    local s ;

    if $(HDRGRIST) 
    { 
        angle-includes = $(angle-includes:G=$(HDRGRIST)) ;
        quoted-includes = $(quoted-includes:G=$(HDRGRIST)) ;
    } 

    local s = $(angle-includes) $(quoted-includes) ;

    INCLUDES $(<) : $(s) ;
    NOCARE $(s) ;

    SEARCH on $(angle-includes) = $(HDRSEARCH)  ;
    SEARCH on $(quoted-includes) = $(gBINDING($(<)):D) $(HDRSEARCH)  ;
    
    BINDRULE on $(s) = remember-binding ;

    # Propagate on $(<) to $(>)

    HDRSEARCH on $(s) = $(HDRSEARCH) ;
    HDRSCAN on $(s) = $(HDRSCAN) ;
    HDRRULE on $(s) = $(HDRRULE) ;
    HDRGRIST on $(s) = $(HDRGRIST) ;
}
rule HdrSearchAndLocate ( header : search * )
{
    if ! $(gBINDING($(header)))
    {
        local header-glob = [ GLOB "$(search:G=)" : $(header:G=) ] ;
        local header-locate = ;
        for local bound-path in $(header-glob)
        {
            if ! $(header-locate)
            {
                if ! [ GLOB "$(bound-path)" : * ]
                {
                    header-locate = $(bound-path) ;
                }
            }
        }
        if $(header-locate)
        {
            LOCATE on $(header) = $(header-locate:D) ;
            gBINDING($(header)) = $(header-locate) ;
        }
        else
        {
            LOCATE on $(header) = $(DOT) ;
            gBINDING($(header)) = $(header:G=:R=$(DOT)) ;
        }
    }
}

# dwa 6/4/01 - modified for boost
rule InstallInto
{
    local i t ;

    t = $(>:G=installed) ;

    type-DEPENDS install : $(t) ;
    DEPENDS $(t) : $(>) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
    MakeLocate $(t) : $(<) ;

    # Arrange for jam uninstall

    Clean uninstall : $(t) ;

    for i in $(>)
    {
        Install $(i:G=installed) : $(i) ;
    }

    Chmod $(t) ;

    if $(UNIX)
    {
        if $(OWNER) { Chown $(t) ; OWNER on $(t) = $(OWNER) ; }
        if $(GROUP) { Chgrp $(t) ; GROUP on $(t) = $(GROUP) ; }
    }
}

rule InstallBin
{
    local _t = [ FAppendSuffix $(>) : $(SUFEXE) ] ;

    InstallInto $(<) : $(_t) ;
    MODE on $(_t:G=installed) = $(EXEMODE) ;
}

rule InstallFile
{
    InstallInto $(<) : $(>) ;
    MODE on $(>:G=installed) = $(FILEMODE) ;
}

rule InstallLib
{
    InstallInto $(<) : $(>) ;
    MODE on $(>:G=installed) = $(FILEMODE) ;
}

rule InstallMan
{
    # Really this just strips the . from the suffix

    local i s d ;

    for i in $(>)
    {
        switch $(i:S)
        {
        case .1 : s = 1 ; case .2 : s = 2 ; case .3 : s = 3 ;
        case .4 : s = 4 ; case .5 : s = 5 ; case .6 : s = 6 ;
        case .7 : s = 7 ; case .8 : s = 8 ; case .l : s = l ;
        case .n : s = n ; case .man : s = 1 ;
        }

        d = man$(s) ;

        InstallInto $(d:R=$(<)) : $(i) ;
    }

    MODE on $(>:G=installed) = $(FILEMODE) ;
}

rule InstallShell
{
    InstallInto $(<) : $(>) ;
    MODE on $(>:G=installed) = $(SHELLMODE) ;
}

# dwa 6/4/01 - modified for boost
rule Lex # file.c : file.l
{
    # If we don't have a way of specifying the lex output file, we'll have to move it
    # We'd rather not do this if possible because: a. lex generates #line
    # directives for the output file which would refer to the wrong place and
    # b. the Jam invocation directory could be read-only
    if ! $(LEX_OUTPUT)
    {
        LexMv $(<) : $(>) ;
    }
    
    DEPENDS $(<) : $(>) ;
    MakeLocate $(<) : $(LOCATE_SOURCE) ;
    SEARCH on $(<) = $(LOCATE_SOURCE) ;
    Clean clean : $(<) ;
}

# dwa 6/4/01 - modified for boost
rule Library
{
    LibraryFromObjects $(<) : [ Objects $(>) ] ;
}

# dwa 6/4/01 - modified for boost
rule LibraryFromObjects
{
    local _i _l ;

    _l = $(<:S=$(SUFLIB)) ;

    # library depends on its member objects

    if $(KEEPOBJS)
    {
        type-DEPENDS obj : $(>) ;
    }
    else
    {
        type-DEPENDS lib : $(_l) ;
    }

    # Set LOCATE for the library and its contents.  The bound
    # value shows up as $(NEEDLIBS) on the Link actions.
    # For compatibility, we only do this if the library doesn't
    # already have a path.

    if ! $(_l:D)
    {
        MakeLocate $(_l) $(_l)($(>:BS)) : $(LOCATE_TARGET) ;
    }

    if $(NOARSCAN) 
    { 
        # If we can't scan the library to timestamp its contents,
        # we have to just make the library depend directly on the
        # on-disk object files.  

        DEPENDS $(_l) : $(>) ;
    }
    else
    {
        # If we can scan the library, we make the library depend
        # on its members and each member depend on the on-disk
        # object file.

        DEPENDS $(_l) : $(_l)($(>:BS)) ;

        for _i in $(>)
        {
            DEPENDS $(_l)($(_i:BS)) : $(_i) ;
        }
    }

    Clean clean : $(_l) ;

    if $(CRELIB) { CreLib $(_l) : $(>[1]) ; }

    Archive $(_l) : $(>) ;

    if $(RANLIB) { Ranlib $(_l) ; }

    # If we can't scan the library, we have to leave the .o's around.

    if ! ( $(NOARSCAN) || $(KEEPOBJS) ) { RmTemps $(_l) : $(>) ; }
}

# dwa 6/4/01 - modified for boost to dispatch through Link-action and to pass
# the target-type through. *** NOW UNUSED BY BOOST ***
#
# Link executable-target : object-target...
rule Link
{
    MODE on $(<) = $(EXEMODE) ;
    Link-action $(<) : $(>) : $(3) ;
    Chmod $(<) ;
}

rule LinkLibraries
{
    # make library dependencies of target
    # set NEEDLIBS variable used by 'actions Main'

    local _t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;

    DEPENDS $(_t) : $(>:S=$(SUFLIB)) ;
    NEEDLIBS on $(_t) += $(>:S=$(SUFLIB)) ;
}

# dwa 6/4/01 - modified for boost
rule Main
{
    MainFromObjects $(<) : [ Objects $(>) ] ;
}

# dwa 6/4/01 - modified for boost
rule MainFromObjects
{
    local _s _t ;

    # Add grist to file names
    # Add suffix to exe

    _s = $(>) ;
    _t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;

    if $(_t) != $(<)
    {
        DEPENDS $(<) : $(_t) ;
        NOTFILE $(<) ;
    }

    # make compiled sources a dependency of target

    type-DEPENDS exe : $(_t) ;
    DEPENDS $(_t) : $(_s) ;
    MakeLocate $(_t) : $(LOCATE_TARGET) ;

    Clean clean : $(_t) ;

    Link $(_t) : $(_s) ;
}

# dwa 6/4/01 - modified for boost
rule MakeLocate
{
    if $(>)
    {
        LOCATE on $(<) = $(>) ;

        # provide a way to get back the location from a built target name.
        gLOCATE($(<)) = $(>) ; 
        
        # We add directory-grist here so that implicitly-created directory
        # target names don't collide with user-specified targets.
        Depends $(<) : [ MkDir $(>[1]:G=directory-grist) ] ;
    }
}

# now returns the created directory target -- dwa
rule MkDir
{
    # If dir exists, don't update it
    # Do this even for $(DOT).

    local dir = $(<) ;
    if $(NT)
    {
        # make sure slashes all go the right way
        dir = [ split-path $(dir) ] ;
        dir = $(dir:J=$(SLASH)) ;
    }
    
    local result = $(dir) ;
    
    while $(dir) && ( $(dir) != $(DOT) ) && ! $($(dir)-mkdir) 
    {
        # Cheesy gate to prevent multiple invocations on same dir
        # MkDir1 has the actions 
        # Arrange for jam dirs

        $(dir)-mkdir = true ;
        MkDir1 $(dir) ;
        Depends dirs : $(dir) ;
        NOUPDATE $(dir) ;


        # Recursively make parent directories.
        # $(dir:P) = $(dir)'s parent, & we recurse until root

        local s = $(dir:P) ;

        if $(NT)
        {
            switch $(s)
            {
            case *:   : s = ;
            case *:\\ : s = ;
            }
        }

        if $(s) && $(s) != $(dir)
        {
            Depends $(dir) : $(s) ;
            dir = $(s) ;
        }
        else 
        {
            dir = ; # stop iterating
            if $(s) { NOTFILE $(s) ; }
        }
    }
    return $(result) ;
}

# dwa 6/4/01 - modified for boost
rule Object
{
    local h ;

    type-DEPENDS obj : $(<) ;
    set-target-variables $(<) ;
    
    # Make it possible to compile a given source file by giving its
    # object file name as a target.
    type-DEPENDS $(<:G=) : $(<) ; 
    
    # locate object and search for source, if wanted

    Clean clean : $(<) ;

    MakeLocate $(<) : $(LOCATE_TARGET) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;

    # Save HDRS for -I$(HDRS) on compile.
    # We shouldn't need -I$(SEARCH_SOURCE) as cc can find headers
    # in the .c file's directory, but generated .c files (from
    # yacc, lex, etc) are located in $(LOCATE_TARGET), possibly
    # different from $(SEARCH_SOURCE).

    # Use unique to clean up confusing duplicates a bit
    HDRS on $(<) = [ unique $(LOCATE_SOURCE) $(HDRS) ] ;

    # Set STDHDRS on the object so that multi-compiler builds will search for
    # headers in the right places. 
    STDHDRS on $(<) = $(STDHDRS) ;
    SYSHDRS on $(<) = $(SYSHDRS) ;

    # handle #includes for source: Jam scans for headers with
    # the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
    # with the scanned file as the target and the found headers
    # as the sources.  HDRSEARCH is the value of SEARCH used for
    # the found header files.  Finally, if jam must deal with 
    # header files of the same name in different directories,
    # they can be distinguished with HDRGRIST.

    # $(h) is where cc first looks for #include "foo.h" files.
    # If the source file is in a distant directory, look there.
    # Else, look in "" (the current directory).

    if $(SEARCH_SOURCE)
    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -