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

📄 common.jam

📁 boost库提供标准的C++ API 配合dev c++使用,功能更加强大
💻 JAM
字号:
#  Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears in
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

#  Provides actions common to all toolsets, for as making directoies and
#  removing files.

import os ;
import modules ;
import utility ;
import print ;
import type ;

if [ os.name ] = NT
{
    RM = del /f ;
    CP = copy ;
}
else
{
    RM = rm ;
    CP = cp ;
}

nl = "
" ;

# Returns the command needed to set shell variable on the
# current platform.
rule variable-setting-command ( variable value )
{
    if [ modules.peek : NT ]
    {
        return "set $(variable)=$(value)$(nl)" ;
    }
    else
    {
        return "$(variable)=$(value)" ;
    }
}

# Returns the command needed to set shell variable on the
# current platform. Each element of values is expected to be a path,
# elements are joined with os-specific characer which delimits paths in
# environment variables.
rule path-variable-setting-command ( variable : values * : exported ? )
{   
    local result ;
    if [ modules.peek : NT ]
    {
        result = set $(variable)=$(values:J=";")$(nl) ;                
    }
    else
    {
        # We can't put ":" directly in :J modifier.
        local sep = ":" ;
        if $(exported)
        {                       
            result = export $(variable)=$(values:J=$(sep)) ;            
        }
        else
        {
            result = $(variable)=$(values:J=$(sep)) ;    
        }                
    }
    return $(result:J=" ") ;
}


# Return a command which can create a file. If 'r' is result of invocation,
# then 
#   r foobar
# will create foobar with unspecified content. What happens if file already 
# exists is unspecified.
rule file-creation-command ( )
{
    if [ modules.peek : NT ]
    {
        return "echo. > " ;
    }
    else
    {
        return "touch " ;
    }
}

        
rule MkDir
{
    # If dir exists, don't update it
    # Do this even for $(DOT).

    NOUPDATE $(<) ;

    if $(<) != $(DOT) && ! $($(<)-mkdir)
    {
        local s ;

        # Cheesy gate to prevent multiple invocations on same dir
        # MkDir1 has the actions
        # Arrange for jam dirs

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

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

        s = $(<:P) ;

        if $(NT)
        {
            switch $(s)
            {
                case *:   : s = ;
                case *:\\ : s = ;
            }
        }
        
        if $(s) && $(s) != $(<)
        {
            Depends $(<) : $(s) ;
            MkDir $(s) ;
        }
        else if $(s)
        {
            NOTFILE $(s) ;
        }
    }
}

actions MkDir1
{
    mkdir "$(<)"
}

actions piecemeal together existing Clean
{
    $(RM) "$(>)"
}

rule copy 
{    
}


actions copy
{
    $(CP) "$(>)" "$(<)"
}

# Cause creation of response file, containing the sources in 'sources'
# All the targets in 'targets' will depend on response file, and response
# file will be created before the targets are built.
rule response-file ( targets + : sources * : the-response-file : properties * )
{
    # Manufacture a fake target for response file.
    # If response file is in targets, we're in trouble.
    # The actions for response file are already generated, and bjam thinks it's 
    # created. So setting dependency on response file will not help to create
    # it before other targets. So, we need another target.
    
    local g = [ utility.ungrist $(the-response-file:G) ] ;
    local rsp = $(the-response-file:G=$(g)-rsp) ;
    LOCATE on $(rsp) = [ on $(the-response-file) return $(LOCATE) ] ;    
    DEPENDS $(targets) : $(rsp) ;
    # Cause RSP to be recreated if sources are out-of-date.
    DEPENDS $(rsp) : $(sources) ;
        
    # Add libraries from <library> property to the list of sources.
    local libraries ;
    for local p in $(properties)
    {
        if $(p:G) = <library-file> && 
          ! [ type.is-derived [ $(p:G=).type ] SHARED_LIB ] 
        {
            libraries += $(p:G=) ;
        }          
    }
    # Get real jam targets
    local xlibraries ;
    for local l in $(libraries)
    {
        xlibraries += [ $(l).actualize ] ;
    }
    
    sources += $(xlibraries) ; 
       
    response-file-1 $(rsp) : $(sources[1]) ;
    if $(sources[2-])
    {
        response-file-2 $(rsp) : $(sources[2-]) ;
    }
    
    print.output $(rsp) ;
    print.text [ utility.apply-default-suffix .lib :
        [ on $(targets[1])
          return "$(LIBRARY_OPTION)$(FINDLIBS_ST)"
            "$(LIBRARY_OPTION)$(FINDLIBS_SA)"
        ] ] ;    
}

# response-file generation is broken up into two phases, the first of
# which overwrites any existing file and the second of which appends
# to the file, piecemeal, so that no command-line is too long.
actions quietly response-file-1
{
    echo "$(>)" > "$(<)"
}

actions quietly piecemeal response-file-2
{
    echo "$(>)" >> "$(<)"
}

⌨️ 快捷键说明

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