mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
99 lines
2.5 KiB
Plaintext
99 lines
2.5 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.
|
|
|
|
import modules ;
|
|
.name = [ modules.peek : OS ] ;
|
|
.platform = [ modules.peek : OSPLAT ] ;
|
|
.version = [ modules.peek : OSVER ] ;
|
|
|
|
local rule constant ( c )
|
|
{
|
|
# First look for platform-specific name, then general value
|
|
local variables = .$(c)-$(.name) .$(c) ;
|
|
local result = $($(variables)) ;
|
|
return $(result[1]) ;
|
|
}
|
|
|
|
rule get-constant ( )
|
|
{
|
|
# Find the name of the constant being accessed, which is
|
|
# equal to the name used to invoke us.
|
|
local bt = [ BACKTRACE 1 ] ;
|
|
local rulename = [ MATCH ([^.]*)$ : $(bt[4]) ] ;
|
|
return [ constant $(rulename) ] ;
|
|
}
|
|
|
|
|
|
# export all the common constants
|
|
.constants = name platform version shared-library-path-variable path-separator ;
|
|
for local constant in $(.constants)
|
|
{
|
|
IMPORT $(__name__) : get-constant : $(__name__) : $(constant) ;
|
|
}
|
|
EXPORT $(__name__) : $(.constants) ;
|
|
|
|
.shared-library-path-variable-NT = PATH ;
|
|
.path-separator-NT = ";" ;
|
|
.expand-variable-prefix-NT = % ;
|
|
.expand-variable-suffix-NT = % ;
|
|
|
|
.shared-library-path-variable-CYGWIN = PATH ;
|
|
.path-separator-CYGWIN = ":" ;
|
|
.expand-variable-prefix-CYGWIN = $ ;
|
|
.expand-variable-suffix-CYGWIN = "" ;
|
|
|
|
|
|
.shared-library-path-variable = LD_LIBRARY_PATH ;
|
|
.path-separator = ":" ;
|
|
.expand-variable-prefix = $ ;
|
|
.expand-variable-suffix = "" ;
|
|
|
|
# Return the string needed to represent the expansion of the named
|
|
# shell variable.
|
|
rule expand-variable ( variable )
|
|
{
|
|
local prefix = [ constant expand-variable-prefix ] ;
|
|
local suffix = [ constant expand-variable-suffix ] ;
|
|
return $(prefix)$(variable)$(suffix) ;
|
|
}
|
|
|
|
# Returns true if running on windows, whether in cygwin or not.
|
|
rule on-windows
|
|
{
|
|
local result ;
|
|
if [ modules.peek : NT ]
|
|
{
|
|
result = true ;
|
|
}
|
|
else if [ modules.peek : UNIX ]
|
|
{
|
|
switch [ modules.peek : JAMUNAME ]
|
|
{
|
|
case CYGWIN* :
|
|
{
|
|
result = true ;
|
|
}
|
|
}
|
|
}
|
|
return $(result) ;
|
|
}
|
|
|
|
|
|
|
|
import regex ;
|
|
|
|
rule __test__
|
|
{
|
|
import assert ;
|
|
rule identity ( args * ) { return $(args) ; }
|
|
|
|
if ! ( --quiet in [ modules.peek : ARGV ] )
|
|
{
|
|
ECHO os: name= [ name ] ;
|
|
ECHO os: version= [ version ] ;
|
|
}
|
|
assert.true name ;
|
|
}
|