2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00
Files
build/v2/util/utility.jam
Vladimir Prus 082c25530d Beginning of the 'make' rule.
* new/targets.jam: Check for duplicate 'basic-target::generate()' calls.
        Use better logic to tell is source is another main target or file.
        (project-target::has-main-target): New rule.
    * new/project.jam (lookup): Fixes. (find-target): Implemented.
    * new/make.jam: New file, defines the 'make' rule and associated target
        class.
    * new/build-system.jam: Import 'make'. Generate virtual targets and
        actualize them.
    * new/utility.jam: Added "MkDir" rule and actions.
    * test/project_test3.py: New test.


[SVN r14249]
2002-06-27 14:00:30 +00:00

92 lines
1.8 KiB
Plaintext

# (C) Copyright David Abrahams 2001. 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.
rule ungrist ( names * )
{
local result ;
for local name in $(names)
{
local stripped = [ MATCH ^<(.*)>$ : $(name) ] ;
if ! $(stripped)
{
ECHO *** error: in ungrist $(names) ;
EXIT *** $(name) is not of the form <.*> ;
}
result += $(stripped) ;
}
return $(result) ;
}
# Return the file of the caller of the rule that called caller-file.
rule caller-file ( )
{
local bt = [ BACKTRACE ] ;
return $(bt[9]) ;
}
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 $(>)
}
local rule __test__ ( )
{
import assert ;
assert.result foo bar : ungrist <foo> <bar> ;
}