project
: requirements /home/ghost/Work/boost multi
;
project a : : debug ;
exe hello : hello.cpp ;
exe hello
: hello.cpp
: boost multi
;
exe app : app.cpp ../util/foo//bar ;
exe important : main.cpp helpers/static ;
exe b : [ glob *.cpp ] ;
lib tools :
[ glob *.cpp ] ;
lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ;
lib network : network.cpp
: @my-rule
;
DEPENDS foo.o : foo.c ;
using msvc : : "Z:/Programs/Microsoft Visual Studio/vc98/bin/cl" ;
using msvc : : echo Compiling && foo/bar/baz/cl ;
using gcc : 5 : : "-std=c++14 -O2" ;
using clang : 3.9 : : -std=c++14 -O2 ;
exe test3 : test3.cpp : -multi ;
XYZ += -Wzero-as-null-pointer-constant&&-Wno-zero-as-null-pointer-constant ;
exe hello : hello.cpp : NT,gcc:static ;
install dist : hello helpers :
release:dist/release
debug:dist/debug ;
install dist2 : hello helpers : $(DIST) ;
exe app : app.cpp : [ check-target-builds has_foo "System has foo" : foo : FOO_MISSING=1 ] ;
import path : * ;
using python
: 2.7 # version
: # Interpreter/path to dir
: /usr/include/python2.7 # includes
: /usr/lib/x86_64-linux-gnu # libs
: # conditions
;
xx ;
xx ;; ;
xx ;a ;
xx a; ;
xx ;a; ;
## comment title
# BUG
# TODO
# aTODOa
#| multi
line
comment
TODO
bla bla
|#
if cond {
statements ;
}
else {
statements ;
}
for var in list {
statements ;
}
while cond {
statements ;
}
switch value
{
case pattern1 : statements ;
case pattern2 : statements ;
other ;
}
if xxinxx {
}
ifxxx s ;
rule a? ( x )
{
echo $(x) ;
}
a? 23 ;
local rule test ( a )
{
}
rule example
(
parameter1 :
parameter2 ? :
parameter3 + :
parameter4 *
)
{
if debug in $(properties)
{
OPTIONS on $(targets) = --debug ;
}
}
rule my-rule ( properties * )
{
local result ;
if gcc speed in $(properties)
{
result += USE_INLINE_ASSEMBLER ;
return $(result) ;
}
local m = [ CALLER_MODULE ] ;
local result ;
for v in $(values)
{
if [ modules.call-in $(m) : $(f) $(v) ]
{
result += $(v) ;
}
}
return result ;
return $(name) ;
return [ virtual-target.register $(t) ] ;
return [ sequence.transform virtual-target.register : $(targets) ] ;
}
rule run ( project name ? : property-set : sources * )
{
if [ $(s).type ] = PY
{
python = $(s) ;
}
local new-sources ;
for local s in $(sources)
{
if [ type.is-derived [ $(s).type ] CPP ]
{
local name = [ $(s).name ] ; # get the target's basename
if $(name) = [ $(python).name ]
{
name = $(name)_ext ; # rename the target
}
new-sources += [ generators.construct $(project) $(name) :
PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ;
}
}
result = [ construct-result $(python) $(new-sources) : $(project) $(name)
: $(property-set) ] ;
}
rule link
{
DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
}
actions link bind DEF_FILE
{
$(.LD) .... /DEF:$(DEF_FILE) ....
}
actions create-file-from-another
{
create-file-from-another $(OPTIONS) $(<) $(>)
}
mypackage =
[ pkg-config.import mypackage : usage-requirements @define_ns
] ;
me = [ modules.binding $(__name__) ] ;
local ZLIB_INCLUDE = [ modules.peek : ZLIB_INCLUDE ] ;
local t = [ new file-target $(name) : CPP : $(project) : $(a) ] ;
$(var) field1 : field2 : ... : fieldN ;
$(var)o aaaa ;
on target $(var) field1 : field2 : ... : fieldN ;
[ $(var) field1 : field2 : ... : fieldN ]
[ on target $(var) field1 : field2 : ... : fieldN ]
local key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths" ;
local values = [ W32_GETREGNAMES "$(key)\\$(subkey)" : values ] ;
variable = $(b) $(c) ;
variable += elements ;
variable on targets = elements ;
variable on targets += "elements" ;
variable default = elements ;
variable ?= elements ;
defs += NAME='\"$(VALUE)\"' ;
x = $($(Z)) ;
x = $(Z)x ;
x = x$(Z) ;
x = x$(Z)x ;
x = "C:\\Program Files\\Borland" ; ECHO $(x:T) ;
module my_module # my module
{
rule salute ( x ) { ECHO $(x), world ; }
rule greet ( ) { salute hello ; }
greet ; # ok
}
class verbatim-scanner : common-scanner
{
rule pattern ( )
{
return "//###include[ ]*\"([^\"]*)\"" ;
}
greet ; # error
}
# test crazy (and valid) name
a a [ a a a] ] ;
rule a() () { }
actions a { }
local a ;
local a = a ;