Bjam is a project management tool similar to Make. It is a compilation manager customized for Boost. It is based on FTJam, which was developed from Perforce Jam. Bjam is backwards compatible with Perforce Jam.
The Bjam tool is maintained by the Boost.Jam project.
The current latest version of Bjam is: 3.1.9 (released with Boost-1.31.0). It is based on 2.4 of Jam/MR.
Jam language definition
lexical
Jam believes that all tokens (Token) are composed of blanks, tabs , or newlines).
Including symbols (:) and (;) must also be separated by whitespace characters.
Exception:
Tokens surrounded by quotation marks (") , you can use whitespace symbols.
The symbol (/) can escape quotes and whitespace characters.
A string surrounded by {} can use whitespace symbols and is considered just a string .
Keywords, when used as tokens, must be surrounded by quotation marks.
Built-in Rule semantics
1. Construct dependencies
DEPENDS targets1 : targets2 ;
Using target1 depends on targets2. If targets2 is newer than targets1, targets1 will be rebuilt.
INCLUDES targets1 : targets2 ;
Construct homogeneous dependencies so that targets that depend on targets2 also depend on targets1.
2. Modify dependencies
ALWAYS targets ;
LEAVES targets ;
NOCARE targets ;
NOTFILE targets ;
NOUPDATE targets ;
TEMPORARY targets ;
3.Tools
# ECHO args ;
Display parameters
EXIT args ;
Display parameters and exit.
GLOB directories: patterns: downcase-opt
Get the file names that match patterns from directories.
MATCH regexps: list
Get the symbols that match regexps from the list.
Flow controlfor var in list { statements }
Execute statements once for each item in the list, var is designed to be the value of the list element.
if cond { statements }
[ else statements ]
Obviously, the else part is optional.
The condition can be:
a 当a的元素中最少有一个非空字符串时为true; a = b 列表元素全部相同时为true a != b 列表元素不完全相同时为true a < b a和b中,第一个不相同的元素相比较, a的元素比b小(按字符串顺序). a <= b a中每个元素都比b对应元素小或相等 a > b a和b中,第一个不相同的元素相比较, a的元素比b大(按字符串顺序). a >= b a中每个元素都比b对应元素大或相等 a in b a所有元素都可以在b中找到,或者a是空表 ! cond 逻辑非 cond && cond 逻辑与 cond || cond 逻辑或 ( cond ) 优先运算
include file ;
Use jam to read file and process it.
This process occurs during the parsing phase, so file will not be constructed and there is no file scope.
local vars [ = values ] ;
Define a local variable, and the value of the original variable outside {} will be stored back.
return values ;
Set the return value, please note In the rule, return does not jump out of the execution process of the rule.
switch value { case pattern1 : statements ; case pattern2 : statements ; ... }
Execute one or zero statements according to the value. The pattern can be the following symbol wildcard
? Matches any character
* Match zero or more characters
[chars] Match any character in chars
[^chars] Match any character not in chars
/x Matches x (escapes other wildcards)
while cond { statements }
When the condition is true, statement is executed repeatedly.
Variable control and internal Create a variableThe Jam variable is a string list, its elements may be 0 or multiple strings. An undefined variable and an empty variable
(0 elements) There is no difference. But a variable can be defined to contain multiple empty strings.
Variables can take values through $(variable)
Variables have "global" or " There are two types of target-specific variables. Target-specific variables only take values when building the target.
There are several ways to define variables.
variable = elements ; variable += elements ; variable on targets = elements ; variable on targets += elements ; variable default = elements ; variable ?= elements ;
The first two ways define global variables, and the third way It is the same as the fourth way to define target-specific variables.
= can rewrite the content of the variable. = connects the original content and the new content.
The last two effects are the same: when the variable is not defined When, define a global variable.
The above is the detailed content of How to use jam in python. For more information, please follow other related articles on the PHP Chinese website!