| 1 |
project |
| 2 |
: requirements <include>/home/ghost/Work/boost <threading>multi |
| 3 |
; |
| 4 |
project a : : debug ; |
| 5 |
|
| 6 |
exe hello : hello.cpp ; |
| 7 |
|
| 8 |
exe hello |
| 9 |
: hello.cpp |
| 10 |
: <include>boost <threading>multi |
| 11 |
; |
| 12 |
exe app : app.cpp ../util/foo//bar ; |
| 13 |
exe important : main.cpp helpers/<link>static ; |
| 14 |
|
| 15 |
exe b : [ glob *.cpp ] ; |
| 16 |
|
| 17 |
lib tools : |
| 18 |
[ glob *.cpp ] ; |
| 19 |
|
| 20 |
lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ; |
| 21 |
|
| 22 |
lib network : network.cpp |
| 23 |
: <conditional>@my-rule |
| 24 |
; |
| 25 |
|
| 26 |
DEPENDS foo.o : foo.c ; |
| 27 |
|
| 28 |
using msvc : : "Z:/Programs/Microsoft Visual Studio/vc98/bin/cl" ; |
| 29 |
using msvc : : echo Compiling && foo/bar/baz/cl ; |
| 30 |
using gcc : 5 : : <cxxflags>"-std=c++14 -O2" ; |
| 31 |
using clang : 3.9 : : <cxxflags>-std=c++14 <cxxflags>-O2 ; |
| 32 |
exe test3 : test3.cpp : -<threading>multi ; |
| 33 |
XYZ += <cxxflags>-Wzero-as-null-pointer-constant&&-Wno-zero-as-null-pointer-constant ; |
| 34 |
exe hello : hello.cpp : <os>NT,<toolset>gcc:<link>static ; |
| 35 |
|
| 36 |
install dist : hello helpers : |
| 37 |
<variant>release:<location>dist/release |
| 38 |
<variant>debug:<location>dist/debug ; |
| 39 |
install dist2 : hello helpers : <location>$(DIST) ; |
| 40 |
|
| 41 |
exe app : app.cpp : [ check-target-builds has_foo "System has foo" : <library>foo : <define>FOO_MISSING=1 ] ; |
| 42 |
|
| 43 |
import path : * ; |
| 44 |
|
| 45 |
using python |
| 46 |
: 2.7 # version |
| 47 |
: # Interpreter/path to dir |
| 48 |
: /usr/include/python2.7 # includes |
| 49 |
: /usr/lib/x86_64-linux-gnu # libs |
| 50 |
: # conditions |
| 51 |
; |
| 52 |
|
| 53 |
xx ; |
| 54 |
xx ;; ; |
| 55 |
xx ;a ; |
| 56 |
xx a; ; |
| 57 |
xx ;a; ; |
| 58 |
|
| 59 |
## comment title |
| 60 |
# BUG |
| 61 |
# TODO |
| 62 |
# aTODOa |
| 63 |
|
| 64 |
#| multi |
| 65 |
line |
| 66 |
comment |
| 67 |
TODO |
| 68 |
bla bla |
| 69 |
|# |
| 70 |
|
| 71 |
if cond { |
| 72 |
statements ; |
| 73 |
} |
| 74 |
else { |
| 75 |
statements ; |
| 76 |
} |
| 77 |
|
| 78 |
for var in list { |
| 79 |
statements ; |
| 80 |
} |
| 81 |
|
| 82 |
while cond { |
| 83 |
statements ; |
| 84 |
} |
| 85 |
|
| 86 |
switch value |
| 87 |
{ |
| 88 |
case pattern1 : statements ; |
| 89 |
case pattern2 : statements ; |
| 90 |
other ; |
| 91 |
} |
| 92 |
|
| 93 |
if xxinxx { |
| 94 |
} |
| 95 |
|
| 96 |
ifxxx s ; |
| 97 |
|
| 98 |
rule a? ( x ) |
| 99 |
{ |
| 100 |
echo $(x) ; |
| 101 |
} |
| 102 |
a? 23 ; |
| 103 |
|
| 104 |
local rule test ( a ) |
| 105 |
{ |
| 106 |
} |
| 107 |
|
| 108 |
rule example |
| 109 |
( |
| 110 |
parameter1 : |
| 111 |
parameter2 ? : |
| 112 |
parameter3 + : |
| 113 |
parameter4 * |
| 114 |
) |
| 115 |
{ |
| 116 |
if <variant>debug in $(properties) |
| 117 |
{ |
| 118 |
OPTIONS on $(targets) = --debug ; |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
rule my-rule ( properties * ) |
| 123 |
{ |
| 124 |
local result ; |
| 125 |
if <toolset>gcc <optimization>speed in $(properties) |
| 126 |
{ |
| 127 |
result += <define>USE_INLINE_ASSEMBLER ; |
| 128 |
return $(result) ; |
| 129 |
} |
| 130 |
|
| 131 |
local m = [ CALLER_MODULE ] ; |
| 132 |
local result ; |
| 133 |
for v in $(values) |
| 134 |
{ |
| 135 |
if [ modules.call-in $(m) : $(f) $(v) ] |
| 136 |
{ |
| 137 |
result += $(v) ; |
| 138 |
} |
| 139 |
} |
| 140 |
return result ; |
| 141 |
return <name>$(name) ; |
| 142 |
return [ virtual-target.register $(t) ] ; |
| 143 |
return [ sequence.transform virtual-target.register : $(targets) ] ; |
| 144 |
} |
| 145 |
|
| 146 |
rule run ( project name ? : property-set : sources * ) |
| 147 |
{ |
| 148 |
if [ $(s).type ] = PY |
| 149 |
{ |
| 150 |
python = $(s) ; |
| 151 |
} |
| 152 |
|
| 153 |
local new-sources ; |
| 154 |
for local s in $(sources) |
| 155 |
{ |
| 156 |
if [ type.is-derived [ $(s).type ] CPP ] |
| 157 |
{ |
| 158 |
local name = [ $(s).name ] ; # get the target's basename |
| 159 |
if $(name) = [ $(python).name ] |
| 160 |
{ |
| 161 |
name = $(name)_ext ; # rename the target |
| 162 |
} |
| 163 |
new-sources += [ generators.construct $(project) $(name) : |
| 164 |
PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ; |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
result = [ construct-result $(python) $(new-sources) : $(project) $(name) |
| 169 |
: $(property-set) ] ; |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
rule link |
| 174 |
{ |
| 175 |
DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ; |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
actions link bind DEF_FILE |
| 180 |
{ |
| 181 |
$(.LD) .... /DEF:$(DEF_FILE) .... |
| 182 |
} |
| 183 |
|
| 184 |
actions create-file-from-another |
| 185 |
{ |
| 186 |
create-file-from-another $(OPTIONS) $(<) $(>) |
| 187 |
} |
| 188 |
|
| 189 |
|
| 190 |
mypackage = |
| 191 |
[ pkg-config.import mypackage : usage-requirements <conditional>@define_ns |
| 192 |
] ; |
| 193 |
|
| 194 |
me = [ modules.binding $(__name__) ] ; |
| 195 |
|
| 196 |
local ZLIB_INCLUDE = [ modules.peek : ZLIB_INCLUDE ] ; |
| 197 |
|
| 198 |
local t = [ new file-target $(name) : CPP : $(project) : $(a) ] ; |
| 199 |
|
| 200 |
$(var) field1 : field2 : ... : fieldN ; |
| 201 |
$(var)o aaaa ; |
| 202 |
|
| 203 |
on target $(var) field1 : field2 : ... : fieldN ; |
| 204 |
|
| 205 |
[ $(var) field1 : field2 : ... : fieldN ] |
| 206 |
[ on target $(var) field1 : field2 : ... : fieldN ] |
| 207 |
|
| 208 |
local key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths" ; |
| 209 |
local values = [ W32_GETREGNAMES "$(key)\\$(subkey)" : values ] ; |
| 210 |
|
| 211 |
variable = $(b) $(c) ; |
| 212 |
variable += elements ; |
| 213 |
variable on targets = elements ; |
| 214 |
variable on targets += "elements" ; |
| 215 |
variable default = elements ; |
| 216 |
variable ?= elements ; |
| 217 |
|
| 218 |
defs += <define>NAME='\"$(VALUE)\"' ; |
| 219 |
|
| 220 |
x = $($(Z)) ; |
| 221 |
x = $(Z)x ; |
| 222 |
x = x$(Z) ; |
| 223 |
x = x$(Z)x ; |
| 224 |
|
| 225 |
x = "C:\\Program Files\\Borland" ; ECHO $(x:T) ; |
| 226 |
|
| 227 |
module my_module # my module |
| 228 |
{ |
| 229 |
rule salute ( x ) { ECHO $(x), world ; } |
| 230 |
rule greet ( ) { salute hello ; } |
| 231 |
greet ; # ok |
| 232 |
} |
| 233 |
|
| 234 |
class verbatim-scanner : common-scanner |
| 235 |
{ |
| 236 |
rule pattern ( ) |
| 237 |
{ |
| 238 |
return "//###include[ ]*\"([^\"]*)\"" ; |
| 239 |
} |
| 240 |
greet ; # error |
| 241 |
} |
| 242 |
|
| 243 |
# test crazy (and valid) name |
| 244 |
a<b> a<b> [ a<b> a<b> a] ] ; |
| 245 |
rule a<b>() () { } |
| 246 |
actions a<b> { } |
| 247 |
local a<x> ; |
| 248 |
local a<x> = a<b> ; |