2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00
Files
build/v2/tools/common.jam
Vladimir Prus 5365de8675 Make 'regression.py' work with msvc.
* tools/builtin.jam
  (exe-target-class.compute-usage-requirements): Pass <dll-path> properties
  as usage requirements.

* tools/testing.jam
  (capture-output): Handle <dll-path> properties.

* tools/common.jam
  (path-variable-setting-command): New rule.


[SVN r20522]
2003-10-28 12:16:10 +00:00

152 lines
2.9 KiB
Plaintext

# 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 ;
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) "$(>)" "$(<)"
}