[2146] | 1 | <?xml version="1.0" encoding="utf-8" ?>
|
---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
---|
| 6 | <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
|
---|
| 7 | <title>kmk Quick Reference</title>
|
---|
| 8 | <style type="text/css">
|
---|
| 9 |
|
---|
| 10 | /*
|
---|
| 11 | :Author: David Goodger
|
---|
| 12 | :Contact: goodger@users.sourceforge.net
|
---|
| 13 | :Date: $Date: 2009-04-18 12:05:47 +0000 (Sat, 18 Apr 2009) $
|
---|
| 14 | :Revision: $Revision: 2340 $
|
---|
| 15 | :Copyright: This stylesheet has been placed in the public domain.
|
---|
| 16 |
|
---|
| 17 | Default cascading style sheet for the HTML output of Docutils.
|
---|
| 18 |
|
---|
| 19 | See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
---|
| 20 | customize this style sheet.
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /* used to remove borders from tables and images */
|
---|
| 24 | .borderless, table.borderless td, table.borderless th {
|
---|
| 25 | border: 0 }
|
---|
| 26 |
|
---|
| 27 | table.borderless td, table.borderless th {
|
---|
| 28 | /* Override padding for "table.docutils td" with "! important".
|
---|
| 29 | The right padding separates the table cells. */
|
---|
| 30 | padding: 0 0.5em 0 0 ! important }
|
---|
| 31 |
|
---|
| 32 | .first {
|
---|
| 33 | /* Override more specific margin styles with "! important". */
|
---|
| 34 | margin-top: 0 ! important }
|
---|
| 35 |
|
---|
| 36 | .last, .with-subtitle {
|
---|
| 37 | margin-bottom: 0 ! important }
|
---|
| 38 |
|
---|
| 39 | .hidden {
|
---|
| 40 | display: none }
|
---|
| 41 |
|
---|
| 42 | a.toc-backref {
|
---|
| 43 | text-decoration: none ;
|
---|
| 44 | color: black }
|
---|
| 45 |
|
---|
| 46 | blockquote.epigraph {
|
---|
| 47 | margin: 2em 5em ; }
|
---|
| 48 |
|
---|
| 49 | dl.docutils dd {
|
---|
| 50 | margin-bottom: 0.5em }
|
---|
| 51 |
|
---|
| 52 | /* Uncomment (and remove this text!) to get bold-faced definition list terms
|
---|
| 53 | dl.docutils dt {
|
---|
| 54 | font-weight: bold }
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | div.abstract {
|
---|
| 58 | margin: 2em 5em }
|
---|
| 59 |
|
---|
| 60 | div.abstract p.topic-title {
|
---|
| 61 | font-weight: bold ;
|
---|
| 62 | text-align: center }
|
---|
| 63 |
|
---|
| 64 | div.admonition, div.attention, div.caution, div.danger, div.error,
|
---|
| 65 | div.hint, div.important, div.note, div.tip, div.warning {
|
---|
| 66 | margin: 2em ;
|
---|
| 67 | border: medium outset ;
|
---|
| 68 | padding: 1em }
|
---|
| 69 |
|
---|
| 70 | div.admonition p.admonition-title, div.hint p.admonition-title,
|
---|
| 71 | div.important p.admonition-title, div.note p.admonition-title,
|
---|
| 72 | div.tip p.admonition-title {
|
---|
| 73 | font-weight: bold ;
|
---|
| 74 | font-family: sans-serif }
|
---|
| 75 |
|
---|
| 76 | div.attention p.admonition-title, div.caution p.admonition-title,
|
---|
| 77 | div.danger p.admonition-title, div.error p.admonition-title,
|
---|
| 78 | div.warning p.admonition-title {
|
---|
| 79 | color: red ;
|
---|
| 80 | font-weight: bold ;
|
---|
| 81 | font-family: sans-serif }
|
---|
| 82 |
|
---|
| 83 | /* Uncomment (and remove this text!) to get reduced vertical space in
|
---|
| 84 | compound paragraphs.
|
---|
| 85 | div.compound .compound-first, div.compound .compound-middle {
|
---|
| 86 | margin-bottom: 0.5em }
|
---|
| 87 |
|
---|
| 88 | div.compound .compound-last, div.compound .compound-middle {
|
---|
| 89 | margin-top: 0.5em }
|
---|
| 90 | */
|
---|
| 91 |
|
---|
| 92 | div.dedication {
|
---|
| 93 | margin: 2em 5em ;
|
---|
| 94 | text-align: center ;
|
---|
| 95 | font-style: italic }
|
---|
| 96 |
|
---|
| 97 | div.dedication p.topic-title {
|
---|
| 98 | font-weight: bold ;
|
---|
| 99 | font-style: normal }
|
---|
| 100 |
|
---|
| 101 | div.figure {
|
---|
| 102 | margin-left: 2em ;
|
---|
| 103 | margin-right: 2em }
|
---|
| 104 |
|
---|
| 105 | div.footer, div.header {
|
---|
| 106 | clear: both;
|
---|
| 107 | font-size: smaller }
|
---|
| 108 |
|
---|
| 109 | div.line-block {
|
---|
| 110 | display: block ;
|
---|
| 111 | margin-top: 1em ;
|
---|
| 112 | margin-bottom: 1em }
|
---|
| 113 |
|
---|
| 114 | div.line-block div.line-block {
|
---|
| 115 | margin-top: 0 ;
|
---|
| 116 | margin-bottom: 0 ;
|
---|
| 117 | margin-left: 1.5em }
|
---|
| 118 |
|
---|
| 119 | div.sidebar {
|
---|
| 120 | margin-left: 1em ;
|
---|
| 121 | border: medium outset ;
|
---|
| 122 | padding: 1em ;
|
---|
| 123 | background-color: #ffffee ;
|
---|
| 124 | width: 40% ;
|
---|
| 125 | float: right ;
|
---|
| 126 | clear: right }
|
---|
| 127 |
|
---|
| 128 | div.sidebar p.rubric {
|
---|
| 129 | font-family: sans-serif ;
|
---|
| 130 | font-size: medium }
|
---|
| 131 |
|
---|
| 132 | div.system-messages {
|
---|
| 133 | margin: 5em }
|
---|
| 134 |
|
---|
| 135 | div.system-messages h1 {
|
---|
| 136 | color: red }
|
---|
| 137 |
|
---|
| 138 | div.system-message {
|
---|
| 139 | border: medium outset ;
|
---|
| 140 | padding: 1em }
|
---|
| 141 |
|
---|
| 142 | div.system-message p.system-message-title {
|
---|
| 143 | color: red ;
|
---|
| 144 | font-weight: bold }
|
---|
| 145 |
|
---|
| 146 | div.topic {
|
---|
| 147 | margin: 2em }
|
---|
| 148 |
|
---|
| 149 | h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
---|
| 150 | h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
---|
| 151 | margin-top: 0.4em }
|
---|
| 152 |
|
---|
| 153 | h1.title {
|
---|
| 154 | text-align: center }
|
---|
| 155 |
|
---|
| 156 | h2.subtitle {
|
---|
| 157 | text-align: center }
|
---|
| 158 |
|
---|
| 159 | hr.docutils {
|
---|
| 160 | width: 75% }
|
---|
| 161 |
|
---|
| 162 | img.align-left {
|
---|
| 163 | clear: left }
|
---|
| 164 |
|
---|
| 165 | img.align-right {
|
---|
| 166 | clear: right }
|
---|
| 167 |
|
---|
| 168 | ol.simple, ul.simple {
|
---|
| 169 | margin-bottom: 1em }
|
---|
| 170 |
|
---|
| 171 | ol.arabic {
|
---|
| 172 | list-style: decimal }
|
---|
| 173 |
|
---|
| 174 | ol.loweralpha {
|
---|
| 175 | list-style: lower-alpha }
|
---|
| 176 |
|
---|
| 177 | ol.upperalpha {
|
---|
| 178 | list-style: upper-alpha }
|
---|
| 179 |
|
---|
| 180 | ol.lowerroman {
|
---|
| 181 | list-style: lower-roman }
|
---|
| 182 |
|
---|
| 183 | ol.upperroman {
|
---|
| 184 | list-style: upper-roman }
|
---|
| 185 |
|
---|
| 186 | p.attribution {
|
---|
| 187 | text-align: right ;
|
---|
| 188 | margin-left: 50% }
|
---|
| 189 |
|
---|
| 190 | p.caption {
|
---|
| 191 | font-style: italic }
|
---|
| 192 |
|
---|
| 193 | p.credits {
|
---|
| 194 | font-style: italic ;
|
---|
| 195 | font-size: smaller }
|
---|
| 196 |
|
---|
| 197 | p.label {
|
---|
| 198 | white-space: nowrap }
|
---|
| 199 |
|
---|
| 200 | p.rubric {
|
---|
| 201 | font-weight: bold ;
|
---|
| 202 | font-size: larger ;
|
---|
| 203 | color: maroon ;
|
---|
| 204 | text-align: center }
|
---|
| 205 |
|
---|
| 206 | p.sidebar-title {
|
---|
| 207 | font-family: sans-serif ;
|
---|
| 208 | font-weight: bold ;
|
---|
| 209 | font-size: larger }
|
---|
| 210 |
|
---|
| 211 | p.sidebar-subtitle {
|
---|
| 212 | font-family: sans-serif ;
|
---|
| 213 | font-weight: bold }
|
---|
| 214 |
|
---|
| 215 | p.topic-title {
|
---|
| 216 | font-weight: bold }
|
---|
| 217 |
|
---|
| 218 | pre.address {
|
---|
| 219 | margin-bottom: 0 ;
|
---|
| 220 | margin-top: 0 ;
|
---|
| 221 | font-family: serif ;
|
---|
| 222 | font-size: 100% }
|
---|
| 223 |
|
---|
| 224 | pre.literal-block, pre.doctest-block {
|
---|
| 225 | margin-left: 2em ;
|
---|
| 226 | margin-right: 2em ;
|
---|
| 227 | background-color: #eeeeee }
|
---|
| 228 |
|
---|
| 229 | span.classifier {
|
---|
| 230 | font-family: sans-serif ;
|
---|
| 231 | font-style: oblique }
|
---|
| 232 |
|
---|
| 233 | span.classifier-delimiter {
|
---|
| 234 | font-family: sans-serif ;
|
---|
| 235 | font-weight: bold }
|
---|
| 236 |
|
---|
| 237 | span.interpreted {
|
---|
| 238 | font-family: sans-serif }
|
---|
| 239 |
|
---|
| 240 | span.option {
|
---|
| 241 | white-space: nowrap }
|
---|
| 242 |
|
---|
| 243 | span.pre {
|
---|
| 244 | white-space: pre }
|
---|
| 245 |
|
---|
| 246 | span.problematic {
|
---|
| 247 | color: red }
|
---|
| 248 |
|
---|
| 249 | span.section-subtitle {
|
---|
| 250 | /* font-size relative to parent (h1..h6 element) */
|
---|
| 251 | font-size: 80% }
|
---|
| 252 |
|
---|
| 253 | table.citation {
|
---|
| 254 | border-left: solid 1px gray;
|
---|
| 255 | margin-left: 1px }
|
---|
| 256 |
|
---|
| 257 | table.docinfo {
|
---|
| 258 | margin: 2em 4em }
|
---|
| 259 |
|
---|
| 260 | table.docutils {
|
---|
| 261 | margin-top: 0.5em ;
|
---|
| 262 | margin-bottom: 0.5em }
|
---|
| 263 |
|
---|
| 264 | table.footnote {
|
---|
| 265 | border-left: solid 1px black;
|
---|
| 266 | margin-left: 1px }
|
---|
| 267 |
|
---|
| 268 | table.docutils td, table.docutils th,
|
---|
| 269 | table.docinfo td, table.docinfo th {
|
---|
| 270 | padding-left: 0.5em ;
|
---|
| 271 | padding-right: 0.5em ;
|
---|
| 272 | vertical-align: top }
|
---|
| 273 |
|
---|
| 274 | table.docutils th.field-name, table.docinfo th.docinfo-name {
|
---|
| 275 | font-weight: bold ;
|
---|
| 276 | text-align: left ;
|
---|
| 277 | white-space: nowrap ;
|
---|
| 278 | padding-left: 0 }
|
---|
| 279 |
|
---|
| 280 | h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
---|
| 281 | h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
---|
| 282 | font-size: 100% }
|
---|
| 283 |
|
---|
| 284 | tt.docutils {
|
---|
| 285 | background-color: #eeeeee }
|
---|
| 286 |
|
---|
| 287 | ul.auto-toc {
|
---|
| 288 | list-style-type: none }
|
---|
| 289 |
|
---|
| 290 | </style>
|
---|
| 291 | </head>
|
---|
| 292 | <body>
|
---|
| 293 | <div class="document" id="kmk-quick-reference">
|
---|
| 294 | <h1 class="title">kmk Quick Reference</h1>
|
---|
[2166] | 295 | <p>This is an attempt at summarizing all directives, functions, special variables,
|
---|
[2167] | 296 | special targets, built-in commands, external commands, and <tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions.
|
---|
[2166] | 297 | Since <em>all</em> the features are included, the quickness of this reference can be
|
---|
| 298 | disputed. ;-)</p>
|
---|
[2146] | 299 | <div class="section">
|
---|
| 300 | <h1><a id="directives" name="directives">Directives</a></h1>
|
---|
| 301 | <p>Here is a summary of the directives <tt class="docutils literal"><span class="pre">kmk</span></tt> recognizes:</p>
|
---|
| 302 | <blockquote>
|
---|
| 303 | <p>Define a multi-line, recursively-expanded variable:</p>
|
---|
| 304 | <pre class="literal-block">
|
---|
| 305 | define variable
|
---|
| 306 | endef
|
---|
| 307 | </pre>
|
---|
| 308 | <p>Conditionally evaluate part of the makefile:</p>
|
---|
| 309 | <pre class="literal-block">
|
---|
| 310 | ifdef variable
|
---|
| 311 | ifndef variable
|
---|
| 312 | ifeq (a,b)
|
---|
| 313 | ifeq "a" "b"
|
---|
| 314 | ifeq 'a' 'b'
|
---|
| 315 | ifneq (a,b)
|
---|
| 316 | ifneq "a" "b"
|
---|
| 317 | ifneq 'a' 'b'
|
---|
[2169] | 318 | if1of (set-a,set-b) [1]
|
---|
| 319 | ifn1of (set-a,set-b) [1]
|
---|
| 320 | if expression [1]
|
---|
[2146] | 321 | else
|
---|
| 322 | endif
|
---|
| 323 | </pre>
|
---|
| 324 | <p>Include another makefile:</p>
|
---|
| 325 | <pre class="literal-block">
|
---|
| 326 | include file
|
---|
| 327 | -include file
|
---|
| 328 | sinclude file
|
---|
| 329 | </pre>
|
---|
[2340] | 330 | <p>Include another dependency file <a class="footnote-reference" href="#id84" id="id1" name="id1">[1]</a>:</p>
|
---|
[2146] | 331 | <pre class="literal-block">
|
---|
| 332 | includedep file
|
---|
| 333 | </pre>
|
---|
| 334 | <p>Define a variable, overriding any previous definition, even one from the
|
---|
| 335 | command line:</p>
|
---|
| 336 | <pre class="literal-block">
|
---|
| 337 | override variable = value
|
---|
| 338 | override variable := value
|
---|
| 339 | override variable += value
|
---|
[2169] | 340 | override variable <= value [1]
|
---|
[2146] | 341 | override variable ?= value
|
---|
| 342 | override define variable
|
---|
| 343 | endef
|
---|
| 344 | </pre>
|
---|
| 345 | <p>Tell <tt class="docutils literal"><span class="pre">kmk</span></tt> to export all variables to child processes by default:</p>
|
---|
| 346 | <pre class="literal-block">
|
---|
| 347 | export
|
---|
| 348 | </pre>
|
---|
| 349 | <p>Tell <tt class="docutils literal"><span class="pre">kmk</span></tt> whether or not to export a particular variable to child
|
---|
| 350 | processes:</p>
|
---|
| 351 | <pre class="literal-block">
|
---|
| 352 | export variable
|
---|
| 353 | export variable = value
|
---|
| 354 | export variable := value
|
---|
| 355 | export variable += value
|
---|
[2169] | 356 | export variable <= value [1]
|
---|
[2146] | 357 | export variable ?= value
|
---|
| 358 | unexport variable
|
---|
| 359 | </pre>
|
---|
[2340] | 360 | <p>Define a variable in the local context instead of the global one <a class="footnote-reference" href="#id84" id="id2" name="id2">[1]</a>:</p>
|
---|
[2146] | 361 | <pre class="literal-block">
|
---|
| 362 | local variable = value
|
---|
| 363 | local variable := value
|
---|
| 364 | local variable += value
|
---|
| 365 | local variable <= value
|
---|
| 366 | local variable ?= value
|
---|
| 367 | local define variable
|
---|
| 368 | endef
|
---|
| 369 | </pre>
|
---|
| 370 | <p>Specify a search path for files matching a <tt class="docutils literal"><span class="pre">%</span></tt> pattern:</p>
|
---|
| 371 | <pre class="literal-block">
|
---|
| 372 | vpath pattern path
|
---|
| 373 | </pre>
|
---|
| 374 | <p>Remove all search paths previously specified for pattern:</p>
|
---|
| 375 | <pre class="literal-block">
|
---|
| 376 | vpath pattern
|
---|
| 377 | </pre>
|
---|
| 378 | <p>Remove all search paths previously specified in any vpath directive:</p>
|
---|
| 379 | <pre class="literal-block">
|
---|
| 380 | vpath
|
---|
| 381 | </pre>
|
---|
| 382 | </blockquote>
|
---|
| 383 | </div>
|
---|
| 384 | <div class="section">
|
---|
| 385 | <h1><a id="automatic-variables" name="automatic-variables">Automatic variables</a></h1>
|
---|
| 386 | <p>Here is a summary of the automatic variables.</p>
|
---|
| 387 | <table border="1" class="docutils">
|
---|
| 388 | <colgroup>
|
---|
| 389 | <col width="14%" />
|
---|
| 390 | <col width="86%" />
|
---|
| 391 | </colgroup>
|
---|
| 392 | <thead valign="bottom">
|
---|
| 393 | <tr><th class="head">Variable</th>
|
---|
| 394 | <th class="head">Description</th>
|
---|
| 395 | </tr>
|
---|
| 396 | </thead>
|
---|
| 397 | <tbody valign="top">
|
---|
| 398 | <tr><td><tt class="docutils literal"><span class="pre">$@</span></tt></td>
|
---|
| 399 | <td>The file name of the target.</td>
|
---|
| 400 | </tr>
|
---|
| 401 | <tr><td><tt class="docutils literal"><span class="pre">$<</span></tt></td>
|
---|
| 402 | <td>The name of the first prerequisite.</td>
|
---|
| 403 | </tr>
|
---|
| 404 | <tr><td><tt class="docutils literal"><span class="pre">$?</span></tt></td>
|
---|
| 405 | <td>The names of all the prerequisites that are newer than the
|
---|
| 406 | target, with spaces between them.</td>
|
---|
| 407 | </tr>
|
---|
| 408 | <tr><td><tt class="docutils literal"><span class="pre">$^</span></tt></td>
|
---|
| 409 | <td>The names of all the prerequisites, duplicates omitted.</td>
|
---|
| 410 | </tr>
|
---|
| 411 | <tr><td><tt class="docutils literal"><span class="pre">$+</span></tt></td>
|
---|
| 412 | <td>The names of all the prerequisites, duplicates and order
|
---|
| 413 | preserved</td>
|
---|
| 414 | </tr>
|
---|
| 415 | <tr><td><tt class="docutils literal"><span class="pre">$*</span></tt></td>
|
---|
| 416 | <td>The stem with which an implicit rule matches.</td>
|
---|
| 417 | </tr>
|
---|
| 418 | <tr><td><tt class="docutils literal"><span class="pre">$|</span></tt></td>
|
---|
| 419 | <td>The name of all the order only prerequisites.</td>
|
---|
| 420 | </tr>
|
---|
| 421 | <tr><td><tt class="docutils literal"><span class="pre">$(@D)</span></tt></td>
|
---|
| 422 | <td>The directory part of <tt class="docutils literal"><span class="pre">$@</span></tt>.</td>
|
---|
| 423 | </tr>
|
---|
| 424 | <tr><td><tt class="docutils literal"><span class="pre">$(<D)</span></tt></td>
|
---|
| 425 | <td>The directory part of <tt class="docutils literal"><span class="pre">$<</span></tt>.</td>
|
---|
| 426 | </tr>
|
---|
| 427 | <tr><td><tt class="docutils literal"><span class="pre">$(?D)</span></tt></td>
|
---|
| 428 | <td>The directory part of <tt class="docutils literal"><span class="pre">$?</span></tt>.</td>
|
---|
| 429 | </tr>
|
---|
| 430 | <tr><td><tt class="docutils literal"><span class="pre">$(^D)</span></tt></td>
|
---|
| 431 | <td>The directory part of <tt class="docutils literal"><span class="pre">%^</span></tt>.</td>
|
---|
| 432 | </tr>
|
---|
| 433 | <tr><td><tt class="docutils literal"><span class="pre">$(+D)</span></tt></td>
|
---|
| 434 | <td>The directory part of <tt class="docutils literal"><span class="pre">$+</span></tt>.</td>
|
---|
| 435 | </tr>
|
---|
| 436 | <tr><td><tt class="docutils literal"><span class="pre">$(*D)</span></tt></td>
|
---|
| 437 | <td>The directory part of <tt class="docutils literal"><span class="pre">$*</span></tt>.</td>
|
---|
| 438 | </tr>
|
---|
| 439 | <tr><td><tt class="docutils literal"><span class="pre">$(|D)</span></tt></td>
|
---|
| 440 | <td>The directory part of <tt class="docutils literal"><span class="pre">$|</span></tt>.</td>
|
---|
| 441 | </tr>
|
---|
| 442 | <tr><td><tt class="docutils literal"><span class="pre">$(@F)</span></tt></td>
|
---|
| 443 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$@</span></tt>.</td>
|
---|
| 444 | </tr>
|
---|
| 445 | <tr><td><tt class="docutils literal"><span class="pre">$(<F)</span></tt></td>
|
---|
| 446 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$<</span></tt>.</td>
|
---|
| 447 | </tr>
|
---|
| 448 | <tr><td><tt class="docutils literal"><span class="pre">$(?F)</span></tt></td>
|
---|
| 449 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$?</span></tt>.</td>
|
---|
| 450 | </tr>
|
---|
| 451 | <tr><td><tt class="docutils literal"><span class="pre">$(^F)</span></tt></td>
|
---|
| 452 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$^</span></tt>.</td>
|
---|
| 453 | </tr>
|
---|
| 454 | <tr><td><tt class="docutils literal"><span class="pre">$(+F)</span></tt></td>
|
---|
| 455 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$+</span></tt>.</td>
|
---|
| 456 | </tr>
|
---|
| 457 | <tr><td><tt class="docutils literal"><span class="pre">$(*F)</span></tt></td>
|
---|
| 458 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$*</span></tt>.</td>
|
---|
| 459 | </tr>
|
---|
| 460 | <tr><td><tt class="docutils literal"><span class="pre">$(|F)</span></tt></td>
|
---|
| 461 | <td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$|</span></tt>.</td>
|
---|
| 462 | </tr>
|
---|
| 463 | </tbody>
|
---|
| 464 | </table>
|
---|
| 465 | </div>
|
---|
| 466 | <div class="section">
|
---|
| 467 | <h1><a id="special-variables" name="special-variables">Special variables</a></h1>
|
---|
| 468 | <p>All variables starting with a <tt class="docutils literal"><span class="pre">.</span></tt> is reserved by <tt class="docutils literal"><span class="pre">kmk</span></tt>. The following
|
---|
| 469 | variables are specially used or/and defined by <tt class="docutils literal"><span class="pre">kmk</span></tt>:</p>
|
---|
| 470 | <table border="1" class="docutils">
|
---|
| 471 | <colgroup>
|
---|
| 472 | <col width="34%" />
|
---|
| 473 | <col width="66%" />
|
---|
| 474 | </colgroup>
|
---|
| 475 | <thead valign="bottom">
|
---|
| 476 | <tr><th class="head">Variable</th>
|
---|
| 477 | <th class="head">Description</th>
|
---|
| 478 | </tr>
|
---|
| 479 | </thead>
|
---|
| 480 | <tbody valign="top">
|
---|
| 481 | <tr><td><tt class="docutils literal"><span class="pre">.DEFAULT_GOAL</span></tt></td>
|
---|
| 482 | <td>The makefile default goal. You can set this in
|
---|
| 483 | the makefile, if you don't it will default to
|
---|
| 484 | the first target that is encountered.</td>
|
---|
| 485 | </tr>
|
---|
| 486 | <tr><td><tt class="docutils literal"><span class="pre">.FEATURES</span></tt></td>
|
---|
| 487 | <td>List of GNU <tt class="docutils literal"><span class="pre">make</span></tt> features. Do not set this.</td>
|
---|
| 488 | </tr>
|
---|
| 489 | <tr><td><tt class="docutils literal"><span class="pre">.INCLUDE_DIRS</span></tt></td>
|
---|
| 490 | <td>List of include directories, <tt class="docutils literal"><span class="pre">-I</span></tt> arguments
|
---|
| 491 | and defaults. Do not set this.</td>
|
---|
| 492 | </tr>
|
---|
| 493 | <tr><td><tt class="docutils literal"><span class="pre">.RECIPEPREFIX</span></tt></td>
|
---|
| 494 | <td>Recipe prefix, defaults to tab.</td>
|
---|
| 495 | </tr>
|
---|
| 496 | <tr><td><tt class="docutils literal"><span class="pre">.VARIABLES</span></tt></td>
|
---|
| 497 | <td>Special variable which exands to the list of
|
---|
| 498 | variable. Do not set this.</td>
|
---|
| 499 | </tr>
|
---|
| 500 | <tr><td><tt class="docutils literal"><span class="pre">CURDIR</span></tt></td>
|
---|
| 501 | <td>Set to the pathname of the current working
|
---|
| 502 | directory (after all <tt class="docutils literal"><span class="pre">-C</span></tt> options are
|
---|
| 503 | processed, if any). Do not set this.</td>
|
---|
| 504 | </tr>
|
---|
| 505 | <tr><td><tt class="docutils literal"><span class="pre">KBUILD_VERSION</span></tt>,
|
---|
| 506 | <tt class="docutils literal"><span class="pre">KBUILD_VERSION_MAJOR</span></tt>,
|
---|
| 507 | <tt class="docutils literal"><span class="pre">KBUILD_VERSION_MINOR</span></tt>,
|
---|
| 508 | <tt class="docutils literal"><span class="pre">KBUILD_VERSION_PATCH</span></tt>,
|
---|
| 509 | <tt class="docutils literal"><span class="pre">KBUILD_KMK_REVISION</span></tt></td>
|
---|
| 510 | <td>The kBuild version string and the break down
|
---|
[2340] | 511 | into individual components. <a class="footnote-reference" href="#id84" id="id3" name="id3">[1]</a></td>
|
---|
[2146] | 512 | </tr>
|
---|
[2340] | 513 | <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST</span></tt> <a class="footnote-reference" href="#id84" id="id4" name="id4">[1]</a></td>
|
---|
[2146] | 514 | <td>The host operating system.</td>
|
---|
| 515 | </tr>
|
---|
[2340] | 516 | <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_ARCH</span></tt> <a class="footnote-reference" href="#id84" id="id5" name="id5">[1]</a></td>
|
---|
[2146] | 517 | <td>The host architecture.</td>
|
---|
| 518 | </tr>
|
---|
[2340] | 519 | <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_CPU</span></tt> <a class="footnote-reference" href="#id84" id="id6" name="id6">[1]</a></td>
|
---|
[2146] | 520 | <td>The host CPU <tt class="docutils literal"><span class="pre">kmk</span></tt> is built for, set to
|
---|
| 521 | <tt class="docutils literal"><span class="pre">blend</span></tt> if not any particular CPU.</td>
|
---|
| 522 | </tr>
|
---|
[2340] | 523 | <tr><td><tt class="docutils literal"><span class="pre">KBUILD_PATH</span></tt> <a class="footnote-reference" href="#id84" id="id7" name="id7">[1]</a></td>
|
---|
[2146] | 524 | <td>Where the kBuild scripts are.</td>
|
---|
| 525 | </tr>
|
---|
[2340] | 526 | <tr><td><tt class="docutils literal"><span class="pre">KBUILD_BIN_PATH</span></tt> <a class="footnote-reference" href="#id84" id="id8" name="id8">[1]</a></td>
|
---|
[2146] | 527 | <td>Where the host specific kBuild binaries are.</td>
|
---|
| 528 | </tr>
|
---|
[2340] | 529 | <tr><td><tt class="docutils literal"><span class="pre">KMK</span></tt> <a class="footnote-reference" href="#id84" id="id9" name="id9">[1]</a>,
|
---|
[2146] | 530 | <tt class="docutils literal"><span class="pre">MAKE</span></tt></td>
|
---|
| 531 | <td>The name with which <tt class="docutils literal"><span class="pre">kmk</span></tt> was invoked. Using
|
---|
| 532 | this variable in recipes has special meaning.</td>
|
---|
| 533 | </tr>
|
---|
[2340] | 534 | <tr><td><tt class="docutils literal"><span class="pre">KMK_BUILTIN</span></tt> <a class="footnote-reference" href="#id84" id="id10" name="id10">[1]</a></td>
|
---|
[2146] | 535 | <td>List of built-in commands.</td>
|
---|
| 536 | </tr>
|
---|
[2340] | 537 | <tr><td><tt class="docutils literal"><span class="pre">KMK_FEATURES</span></tt> <a class="footnote-reference" href="#id84" id="id11" name="id11">[1]</a></td>
|
---|
[2146] | 538 | <td>List of <tt class="docutils literal"><span class="pre">kmk</span></tt> specific features.</td>
|
---|
| 539 | </tr>
|
---|
[2340] | 540 | <tr><td><tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt> <a class="footnote-reference" href="#id84" id="id12" name="id12">[1]</a></td>
|
---|
[2146] | 541 | <td><p class="first">The flags given to <tt class="docutils literal"><span class="pre">kmk</span></tt>. You can set this in
|
---|
| 542 | the environment or a makefile to set flags.</p>
|
---|
| 543 | <p class="last">It is never appropriate to use <tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt>
|
---|
| 544 | directly in a recipe line: its contents may not
|
---|
| 545 | be quoted correctly for use in the shell. Always
|
---|
| 546 | allow recursive <tt class="docutils literal"><span class="pre">kmk</span></tt>'s to obtain these values
|
---|
| 547 | through the environment from its parent.</p>
|
---|
| 548 | </td>
|
---|
| 549 | </tr>
|
---|
[2340] | 550 | <tr><td><tt class="docutils literal"><span class="pre">KMK_LEVEL</span></tt> <a class="footnote-reference" href="#id84" id="id13" name="id13">[1]</a></td>
|
---|
[2146] | 551 | <td>The number of levels of recursion (sub-makes).</td>
|
---|
| 552 | </tr>
|
---|
[2340] | 553 | <tr><td><tt class="docutils literal"><span class="pre">KMK_VERSION</span></tt> <a class="footnote-reference" href="#id84" id="id14" name="id14">[1]</a></td>
|
---|
[2146] | 554 | <td>The GNU <tt class="docutils literal"><span class="pre">make</span></tt> version number.</td>
|
---|
| 555 | </tr>
|
---|
| 556 | <tr><td><tt class="docutils literal"><span class="pre">MAKECMDGOALS</span></tt></td>
|
---|
| 557 | <td>The targets given to <tt class="docutils literal"><span class="pre">kmk</span></tt> on the command line.
|
---|
| 558 | Do not set this.</td>
|
---|
| 559 | </tr>
|
---|
| 560 | <tr><td><tt class="docutils literal"><span class="pre">MAKEFILES</span></tt></td>
|
---|
| 561 | <td>Makefiles to be read on every invocation of
|
---|
| 562 | <tt class="docutils literal"><span class="pre">kmk</span></tt>.</td>
|
---|
| 563 | </tr>
|
---|
| 564 | <tr><td><tt class="docutils literal"><span class="pre">MAKEFILE_LIST</span></tt></td>
|
---|
| 565 | <td>List of the makefiles that <tt class="docutils literal"><span class="pre">kmk</span></tt> has opened.</td>
|
---|
| 566 | </tr>
|
---|
| 567 | <tr><td><tt class="docutils literal"><span class="pre">MAKESHELL</span></tt></td>
|
---|
| 568 | <td>OS/2 and MS-DOS only, the name of the command
|
---|
| 569 | interpreter that is to be used by <tt class="docutils literal"><span class="pre">kmk</span></tt>. This
|
---|
| 570 | value takes precedence over the value of SHELL.</td>
|
---|
| 571 | </tr>
|
---|
| 572 | <tr><td><tt class="docutils literal"><span class="pre">SHELL</span></tt></td>
|
---|
| 573 | <td>The name of the default command interpreter,
|
---|
| 574 | kmk_ash. You can set SHELL in the makefile to
|
---|
| 575 | change the shell used to run recipes. The SHELL
|
---|
| 576 | variable is handled specially when importing
|
---|
| 577 | from and exporting to the environment.</td>
|
---|
| 578 | </tr>
|
---|
| 579 | <tr><td><tt class="docutils literal"><span class="pre">SUFFIXES</span></tt></td>
|
---|
| 580 | <td>The default list of suffixes before <tt class="docutils literal"><span class="pre">kmk</span></tt>
|
---|
| 581 | reads any makefiles (always empty).</td>
|
---|
| 582 | </tr>
|
---|
| 583 | <tr><td><tt class="docutils literal"><span class="pre">VPATH</span></tt></td>
|
---|
| 584 | <td>Directory search path for files not found in the
|
---|
| 585 | current directory.</td>
|
---|
| 586 | </tr>
|
---|
| 587 | </tbody>
|
---|
| 588 | </table>
|
---|
[2340] | 589 | <p>The following variables reflects <tt class="docutils literal"><span class="pre">kmk</span></tt> options. Do not set these. <a class="footnote-reference" href="#id84" id="id15" name="id15">[1]</a></p>
|
---|
[2146] | 590 | <table border="1" class="docutils">
|
---|
| 591 | <colgroup>
|
---|
| 592 | <col width="49%" />
|
---|
| 593 | <col width="51%" />
|
---|
| 594 | </colgroup>
|
---|
| 595 | <thead valign="bottom">
|
---|
| 596 | <tr><th class="head">Variable</th>
|
---|
| 597 | <th class="head">Description</th>
|
---|
| 598 | </tr>
|
---|
| 599 | </thead>
|
---|
| 600 | <tbody valign="top">
|
---|
| 601 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_JOBS</span></tt></td>
|
---|
| 602 | <td>-j slots, <tt class="docutils literal"><span class="pre">0</span></tt> if not given.</td>
|
---|
| 603 | </tr>
|
---|
| 604 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_KEEP_GOING</span></tt></td>
|
---|
| 605 | <td>-k indictor (<tt class="docutils literal"><span class="pre">0</span></tt>/<tt class="docutils literal"><span class="pre">1</span></tt>).</td>
|
---|
| 606 | </tr>
|
---|
| 607 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_JUST_PRINT</span></tt></td>
|
---|
| 608 | <td>-n indicator (<tt class="docutils literal"><span class="pre">0</span></tt>/<tt class="docutils literal"><span class="pre">1</span></tt>).</td>
|
---|
| 609 | </tr>
|
---|
| 610 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_PRORITY</span></tt></td>
|
---|
| 611 | <td>--priority level, <tt class="docutils literal"><span class="pre">0</span></tt> if not given.</td>
|
---|
| 612 | </tr>
|
---|
| 613 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_AFFINITY</span></tt></td>
|
---|
| 614 | <td>--affinity mask, <tt class="docutils literal"><span class="pre">0</span></tt> if not given.</td>
|
---|
| 615 | </tr>
|
---|
| 616 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_STATISTICS</span></tt></td>
|
---|
| 617 | <td>--statistics indicator (<tt class="docutils literal"><span class="pre">0</span></tt>/<tt class="docutils literal"><span class="pre">1</span></tt>).</td>
|
---|
| 618 | </tr>
|
---|
| 619 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_PRINT_TIME</span></tt></td>
|
---|
| 620 | <td>The --print-time value.</td>
|
---|
| 621 | </tr>
|
---|
| 622 | <tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_PRETTY_COMMAND_PRINTING</span></tt></td>
|
---|
| 623 | <td>--pretty-command-printing indicator.</td>
|
---|
| 624 | </tr>
|
---|
| 625 | </tbody>
|
---|
| 626 | </table>
|
---|
| 627 | </div>
|
---|
| 628 | <div class="section">
|
---|
[2168] | 629 | <h1><a id="special-targets" name="special-targets">Special Targets</a></h1>
|
---|
[2171] | 630 | <p>Certain names have special meanings if they appear as targets.</p>
|
---|
| 631 | <table border="1" class="docutils">
|
---|
| 632 | <colgroup>
|
---|
| 633 | <col width="41%" />
|
---|
| 634 | <col width="59%" />
|
---|
| 635 | </colgroup>
|
---|
| 636 | <thead valign="bottom">
|
---|
| 637 | <tr><th class="head">Target</th>
|
---|
| 638 | <th class="head">Description</th>
|
---|
| 639 | </tr>
|
---|
| 640 | </thead>
|
---|
| 641 | <tbody valign="top">
|
---|
| 642 | <tr><td><tt class="docutils literal"><span class="pre">.DEFAULT</span></tt></td>
|
---|
| 643 | <td>The recipe is used for any target for which
|
---|
| 644 | no rules are found.</td>
|
---|
| 645 | </tr>
|
---|
| 646 | <tr><td><tt class="docutils literal"><span class="pre">.DELETE_ON_ERROR</span></tt></td>
|
---|
| 647 | <td>If mentioned, <tt class="docutils literal"><span class="pre">kmk</span></tt> will delete the
|
---|
[2172] | 648 | targets of a rule if it has changed and its
|
---|
[2171] | 649 | recipe fails or is interrupted.</td>
|
---|
| 650 | </tr>
|
---|
| 651 | <tr><td><tt class="docutils literal"><span class="pre">.EXPORT_ALL_VARIABLES</span></tt></td>
|
---|
| 652 | <td>If mentioned, all variables will by default
|
---|
| 653 | be exported to child processes.</td>
|
---|
| 654 | </tr>
|
---|
| 655 | <tr><td><tt class="docutils literal"><span class="pre">.IGNORE</span></tt></td>
|
---|
| 656 | <td>Ignore errors in the execution of the recipe
|
---|
| 657 | for the targets <tt class="docutils literal"><span class="pre">.IGNORE</span></tt> depends on, if
|
---|
| 658 | no prequisites all targets are affected.</td>
|
---|
| 659 | </tr>
|
---|
[2172] | 660 | <tr><td><tt class="docutils literal"><span class="pre">.INTERMEDIATE</span></tt></td>
|
---|
[2171] | 661 | <td>The prerequisites are treated as
|
---|
| 662 | intermediate files (implicite rules).</td>
|
---|
| 663 | </tr>
|
---|
| 664 | <tr><td><tt class="docutils literal"><span class="pre">.LOW_RESOLUTION_TIME</span></tt></td>
|
---|
| 665 | <td><tt class="docutils literal"><span class="pre">kmk</span></tt> will assume prerequisite files are
|
---|
| 666 | created with low resolution time stamps.</td>
|
---|
| 667 | </tr>
|
---|
| 668 | <tr><td><tt class="docutils literal"><span class="pre">.NOTPARALLEL</span></tt></td>
|
---|
| 669 | <td>If mentioned without any prerequisites,
|
---|
| 670 | <tt class="docutils literal"><span class="pre">kmk</span></tt> will run serially as if -j1 was
|
---|
[2340] | 671 | given. If it has prerequisites <tt class="docutils literal"><span class="pre">kmk</span></tt> <a class="footnote-reference" href="#id84" id="id16" name="id16">[1]</a>
|
---|
[2171] | 672 | will only do this for the targets among
|
---|
| 673 | them.</td>
|
---|
| 674 | </tr>
|
---|
| 675 | <tr><td><tt class="docutils literal"><span class="pre">.PHONY</span></tt></td>
|
---|
| 676 | <td>The prerequisites are considered phony and
|
---|
| 677 | will be rebuilt unconditionally.</td>
|
---|
| 678 | </tr>
|
---|
| 679 | <tr><td><tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt></td>
|
---|
[2172] | 680 | <td>The targets which <tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt> depends
|
---|
| 681 | will to be deleted if <tt class="docutils literal"><span class="pre">kmk</span></tt> is killed or
|
---|
[2171] | 682 | interrupted while their building.</td>
|
---|
| 683 | </tr>
|
---|
| 684 | <tr><td><tt class="docutils literal"><span class="pre">.SECONDARY</span></tt></td>
|
---|
| 685 | <td>The prerequisites are treated as
|
---|
| 686 | intermediate files, except that they are
|
---|
| 687 | never automatically deleted. If used with
|
---|
| 688 | no prerequisites all targets gets this
|
---|
| 689 | treatement.</td>
|
---|
| 690 | </tr>
|
---|
| 691 | <tr><td><tt class="docutils literal"><span class="pre">.SECONDEXPANSION</span></tt></td>
|
---|
| 692 | <td>If mentioned, all prerequisite lists after
|
---|
| 693 | it will be expanded a second time after all
|
---|
| 694 | makefiles have been read.</td>
|
---|
| 695 | </tr>
|
---|
| 696 | <tr><td><tt class="docutils literal"><span class="pre">.SECONDTARGETEXPANSION</span></tt>
|
---|
[2340] | 697 | <a class="footnote-reference" href="#id84" id="id17" name="id17">[1]</a></td>
|
---|
[2172] | 698 | <td>If mentioned, all targets after it will be
|
---|
| 699 | expanded a second time after all makefiles
|
---|
| 700 | have been read.</td>
|
---|
[2171] | 701 | </tr>
|
---|
| 702 | <tr><td><tt class="docutils literal"><span class="pre">.SILENT</span></tt></td>
|
---|
| 703 | <td><tt class="docutils literal"><span class="pre">kmk</span></tt> will not print the recipe for
|
---|
| 704 | targets listed as prerequisites, if none
|
---|
| 705 | then it applies to all targets.</td>
|
---|
| 706 | </tr>
|
---|
| 707 | <tr><td><tt class="docutils literal"><span class="pre">.SUFFIXES</span></tt></td>
|
---|
| 708 | <td>The prerequisites are the list of suffixes
|
---|
[2172] | 709 | used in checking for suffix rules. If it
|
---|
| 710 | appears without prerequisites it the suffix
|
---|
| 711 | will be cleared.</td>
|
---|
[2171] | 712 | </tr>
|
---|
| 713 | </tbody>
|
---|
| 714 | </table>
|
---|
[2168] | 715 | </div>
|
---|
| 716 | <div class="section">
|
---|
| 717 | <h1><a id="commands" name="commands">Commands</a></h1>
|
---|
[2340] | 718 | <p>Builtin commands <a class="footnote-reference" href="#id84" id="id18" name="id18">[1]</a> all start with <tt class="docutils literal"><span class="pre">kmk_builtin_</span></tt>, so in order to save
|
---|
[2170] | 719 | space this prefix has been omitted in the table below. All commands comes in an
|
---|
[2168] | 720 | external edition that can be used by/in the shell, these are prefixed <tt class="docutils literal"><span class="pre">kmk_</span></tt>.</p>
|
---|
| 721 | <table border="1" class="docutils">
|
---|
| 722 | <colgroup>
|
---|
| 723 | <col width="20%" />
|
---|
| 724 | <col width="80%" />
|
---|
| 725 | </colgroup>
|
---|
| 726 | <thead valign="bottom">
|
---|
| 727 | <tr><th class="head">Command</th>
|
---|
| 728 | <th class="head">Description</th>
|
---|
| 729 | </tr>
|
---|
| 730 | </thead>
|
---|
| 731 | <tbody valign="top">
|
---|
| 732 | <tr><td><tt class="docutils literal"><span class="pre">append</span></tt></td>
|
---|
| 733 | <td>Append text to a file. The builtin version can output the
|
---|
| 734 | value of a variable or the commands of a target.</td>
|
---|
| 735 | </tr>
|
---|
| 736 | <tr><td><tt class="docutils literal"><span class="pre">cat</span></tt></td>
|
---|
| 737 | <td>The BSD <tt class="docutils literal"><span class="pre">cat</span></tt> command.</td>
|
---|
| 738 | </tr>
|
---|
| 739 | <tr><td><tt class="docutils literal"><span class="pre">chmod</span></tt></td>
|
---|
| 740 | <td>The BSD <tt class="docutils literal"><span class="pre">chmod</span></tt> command.</td>
|
---|
| 741 | </tr>
|
---|
| 742 | <tr><td><tt class="docutils literal"><span class="pre">cmp</span></tt></td>
|
---|
| 743 | <td>The BSD <tt class="docutils literal"><span class="pre">cmp</span></tt> command.</td>
|
---|
| 744 | </tr>
|
---|
| 745 | <tr><td><tt class="docutils literal"><span class="pre">cp</span></tt></td>
|
---|
| 746 | <td>The BSD <tt class="docutils literal"><span class="pre">cp</span></tt> command with some twaking.</td>
|
---|
| 747 | </tr>
|
---|
| 748 | <tr><td><tt class="docutils literal"><span class="pre">echo</span></tt></td>
|
---|
| 749 | <td>The BSD <tt class="docutils literal"><span class="pre">echo</span></tt> command.</td>
|
---|
| 750 | </tr>
|
---|
| 751 | <tr><td><tt class="docutils literal"><span class="pre">expr</span></tt></td>
|
---|
| 752 | <td>The BSD <tt class="docutils literal"><span class="pre">expr</span></tt> command.</td>
|
---|
| 753 | </tr>
|
---|
| 754 | <tr><td><tt class="docutils literal"><span class="pre">install</span></tt></td>
|
---|
| 755 | <td>The BSD <tt class="docutils literal"><span class="pre">install</span></tt> command with some tweaking.</td>
|
---|
| 756 | </tr>
|
---|
| 757 | <tr><td><tt class="docutils literal"><span class="pre">kDepIDB</span></tt></td>
|
---|
| 758 | <td>Extract dependencies from a Visual C++ .IDB file.</td>
|
---|
| 759 | </tr>
|
---|
| 760 | <tr><td><tt class="docutils literal"><span class="pre">ln</span></tt></td>
|
---|
| 761 | <td>The BSD <tt class="docutils literal"><span class="pre">ln</span></tt> command.</td>
|
---|
| 762 | </tr>
|
---|
| 763 | <tr><td><tt class="docutils literal"><span class="pre">md5sum</span></tt></td>
|
---|
| 764 | <td>Typical MD5 sum program, custom kBuild version.</td>
|
---|
| 765 | </tr>
|
---|
| 766 | <tr><td><tt class="docutils literal"><span class="pre">mkdir</span></tt></td>
|
---|
| 767 | <td>The BSD <tt class="docutils literal"><span class="pre">mkdir</span></tt> command.</td>
|
---|
| 768 | </tr>
|
---|
| 769 | <tr><td><tt class="docutils literal"><span class="pre">mv</span></tt></td>
|
---|
| 770 | <td>The BSD <tt class="docutils literal"><span class="pre">mv</span></tt> command with some tweaking.</td>
|
---|
| 771 | </tr>
|
---|
| 772 | <tr><td><tt class="docutils literal"><span class="pre">printf</span></tt></td>
|
---|
| 773 | <td>The BSD <tt class="docutils literal"><span class="pre">printf</span></tt> command.</td>
|
---|
| 774 | </tr>
|
---|
| 775 | <tr><td><tt class="docutils literal"><span class="pre">rm</span></tt></td>
|
---|
| 776 | <td>The BSD <tt class="docutils literal"><span class="pre">rm</span></tt> command with some tweaking.</td>
|
---|
| 777 | </tr>
|
---|
| 778 | <tr><td><tt class="docutils literal"><span class="pre">rmdir</span></tt></td>
|
---|
| 779 | <td>The BSD <tt class="docutils literal"><span class="pre">rmdir</span></tt> command with some tweaking.</td>
|
---|
| 780 | </tr>
|
---|
| 781 | <tr><td><tt class="docutils literal"><span class="pre">sleep</span></tt></td>
|
---|
| 782 | <td>Typical <tt class="docutils literal"><span class="pre">sleep</span></tt> program, custom kBuild version.</td>
|
---|
| 783 | </tr>
|
---|
| 784 | <tr><td><tt class="docutils literal"><span class="pre">test</span></tt></td>
|
---|
| 785 | <td>The BSD <tt class="docutils literal"><span class="pre">test</span></tt> program with some tweaking.</td>
|
---|
| 786 | </tr>
|
---|
| 787 | </tbody>
|
---|
| 788 | </table>
|
---|
| 789 | <p>Some additional external commands are available in the <tt class="docutils literal"><span class="pre">kmk</span></tt> / <tt class="docutils literal"><span class="pre">kBuild</span></tt>
|
---|
| 790 | environment (<tt class="docutils literal"><span class="pre">kSomething</span></tt> command are not prefixed with <tt class="docutils literal"><span class="pre">kmk_</span></tt>):</p>
|
---|
| 791 | <table border="1" class="docutils">
|
---|
| 792 | <colgroup>
|
---|
| 793 | <col width="20%" />
|
---|
| 794 | <col width="80%" />
|
---|
| 795 | </colgroup>
|
---|
| 796 | <thead valign="bottom">
|
---|
| 797 | <tr><th class="head">Command</th>
|
---|
| 798 | <th class="head">Description</th>
|
---|
| 799 | </tr>
|
---|
| 800 | </thead>
|
---|
| 801 | <tbody valign="top">
|
---|
| 802 | <tr><td><tt class="docutils literal"><span class="pre">kDepPre</span></tt></td>
|
---|
| 803 | <td>Extract dependencies from the C/C++ preprocessor output.</td>
|
---|
| 804 | </tr>
|
---|
| 805 | <tr><td><tt class="docutils literal"><span class="pre">kObjCache</span></tt></td>
|
---|
| 806 | <td>Simple object file cache program.</td>
|
---|
| 807 | </tr>
|
---|
| 808 | <tr><td><tt class="docutils literal"><span class="pre">ash</span></tt></td>
|
---|
| 809 | <td>Almquist's shell (NetBSD variant).</td>
|
---|
| 810 | </tr>
|
---|
| 811 | <tr><td><tt class="docutils literal"><span class="pre">gmake</span></tt></td>
|
---|
| 812 | <td>Vanilla GNU <tt class="docutils literal"><span class="pre">make</span></tt> from same sources as <tt class="docutils literal"><span class="pre">kmk</span></tt>.</td>
|
---|
| 813 | </tr>
|
---|
| 814 | <tr><td><tt class="docutils literal"><span class="pre">redirect</span></tt></td>
|
---|
| 815 | <td>Shell avoidance tool. Sets up file descriptors, environment
|
---|
| 816 | variables and current directory before kicking of program.</td>
|
---|
| 817 | </tr>
|
---|
| 818 | <tr><td><tt class="docutils literal"><span class="pre">sed</span></tt></td>
|
---|
| 819 | <td>GNU <tt class="docutils literal"><span class="pre">sed</span></tt> with some tweaks to avoid involving the shell.</td>
|
---|
| 820 | </tr>
|
---|
| 821 | <tr><td><tt class="docutils literal"><span class="pre">time</span></tt></td>
|
---|
| 822 | <td>Stopwatch utility for measuring program execution time(s).</td>
|
---|
| 823 | </tr>
|
---|
| 824 | </tbody>
|
---|
| 825 | </table>
|
---|
| 826 | </div>
|
---|
| 827 | <div class="section">
|
---|
| 828 | <h1><a id="kmk-expression" name="kmk-expression">kmk-expression</a></h1>
|
---|
[2340] | 829 | <p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions <a class="footnote-reference" href="#id84" id="id19" name="id19">[1]</a> are related to the C/C++ preprocessor in some ways as
|
---|
[2170] | 830 | well as <tt class="docutils literal"><span class="pre">nmake</span></tt> and BSD <tt class="docutils literal"><span class="pre">make</span></tt>. There are however some peculiarities
|
---|
| 831 | because of the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function
|
---|
| 832 | library, so, strings can be turned into boolean by taking any non-empty string
|
---|
| 833 | as true.</p>
|
---|
[2168] | 834 | <p>Quoting using single quotes results in hard strings, while double quotes and
|
---|
| 835 | unquoted string results in soft strings that can be converted to number or
|
---|
| 836 | boolean to fit the situation.</p>
|
---|
| 837 | <p>Here's the operator table in decending precedence order:</p>
|
---|
| 838 | <table border="1" class="docutils">
|
---|
| 839 | <colgroup>
|
---|
| 840 | <col width="20%" />
|
---|
| 841 | <col width="11%" />
|
---|
| 842 | <col width="70%" />
|
---|
| 843 | </colgroup>
|
---|
| 844 | <thead valign="bottom">
|
---|
| 845 | <tr><th class="head">Operator</th>
|
---|
| 846 | <th class="head">Type</th>
|
---|
| 847 | <th class="head">Description</th>
|
---|
| 848 | </tr>
|
---|
| 849 | </thead>
|
---|
| 850 | <tbody valign="top">
|
---|
| 851 | <tr><td><tt class="docutils literal"><span class="pre">defined</span></tt></td>
|
---|
| 852 | <td rowspan="6">Unary</td>
|
---|
| 853 | <td>Checks if the following variable exists.</td>
|
---|
| 854 | </tr>
|
---|
| 855 | <tr><td><tt class="docutils literal"><span class="pre">exists</span></tt></td>
|
---|
| 856 | <td>Checks if the following file exists.</td>
|
---|
| 857 | </tr>
|
---|
| 858 | <tr><td><tt class="docutils literal"><span class="pre">target</span></tt></td>
|
---|
| 859 | <td>Checks if the following target exists.</td>
|
---|
| 860 | </tr>
|
---|
| 861 | <tr><td><tt class="docutils literal"><span class="pre">bool</span></tt></td>
|
---|
| 862 | <td>Casts the following value to boolean.</td>
|
---|
| 863 | </tr>
|
---|
| 864 | <tr><td><tt class="docutils literal"><span class="pre">num</span></tt></td>
|
---|
| 865 | <td>Casts the following value to a number.</td>
|
---|
| 866 | </tr>
|
---|
| 867 | <tr><td><tt class="docutils literal"><span class="pre">str</span></tt></td>
|
---|
| 868 | <td>Casts the following value to a string.</td>
|
---|
| 869 | </tr>
|
---|
| 870 | <tr><td><tt class="docutils literal"><span class="pre">!</span></tt></td>
|
---|
| 871 | <td rowspan="4">Unary</td>
|
---|
| 872 | <td>Logical NOT.</td>
|
---|
| 873 | </tr>
|
---|
| 874 | <tr><td><tt class="docutils literal"><span class="pre">+</span></tt></td>
|
---|
| 875 | <td>Pluss prefix.</td>
|
---|
| 876 | </tr>
|
---|
| 877 | <tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
|
---|
| 878 | <td>Minus prefix.</td>
|
---|
| 879 | </tr>
|
---|
| 880 | <tr><td><tt class="docutils literal"><span class="pre">~</span></tt></td>
|
---|
| 881 | <td>Bitwise one's complement.</td>
|
---|
| 882 | </tr>
|
---|
| 883 | <tr><td><tt class="docutils literal"><span class="pre">*</span></tt></td>
|
---|
| 884 | <td rowspan="3">Binary</td>
|
---|
| 885 | <td>Multiplication (product).</td>
|
---|
| 886 | </tr>
|
---|
| 887 | <tr><td><tt class="docutils literal"><span class="pre">/</span></tt></td>
|
---|
| 888 | <td>Division (quotient).</td>
|
---|
| 889 | </tr>
|
---|
| 890 | <tr><td><tt class="docutils literal"><span class="pre">%</span></tt></td>
|
---|
| 891 | <td>Modulus (remainder).</td>
|
---|
| 892 | </tr>
|
---|
| 893 | <tr><td><tt class="docutils literal"><span class="pre">+</span></tt></td>
|
---|
| 894 | <td rowspan="2">Binary</td>
|
---|
| 895 | <td>Addition (sum).</td>
|
---|
| 896 | </tr>
|
---|
| 897 | <tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
|
---|
| 898 | <td>Subtraction (difference).</td>
|
---|
| 899 | </tr>
|
---|
| 900 | <tr><td><tt class="docutils literal"><span class="pre"><<</span></tt></td>
|
---|
| 901 | <td rowspan="2">Binary</td>
|
---|
| 902 | <td>Bitwise left shift.</td>
|
---|
| 903 | </tr>
|
---|
| 904 | <tr><td><tt class="docutils literal"><span class="pre">>></span></tt></td>
|
---|
| 905 | <td>Bitwise right shift.</td>
|
---|
| 906 | </tr>
|
---|
| 907 | <tr><td><tt class="docutils literal"><span class="pre"><=</span></tt></td>
|
---|
| 908 | <td rowspan="4">Binary</td>
|
---|
| 909 | <td>Less or equal than.</td>
|
---|
| 910 | </tr>
|
---|
| 911 | <tr><td><tt class="docutils literal"><span class="pre"><</span></tt></td>
|
---|
| 912 | <td>Less than.</td>
|
---|
| 913 | </tr>
|
---|
| 914 | <tr><td><tt class="docutils literal"><span class="pre">>=</span></tt></td>
|
---|
| 915 | <td>Greater or equal than.</td>
|
---|
| 916 | </tr>
|
---|
| 917 | <tr><td><tt class="docutils literal"><span class="pre">></span></tt></td>
|
---|
| 918 | <td>Greater than.</td>
|
---|
| 919 | </tr>
|
---|
| 920 | <tr><td><tt class="docutils literal"><span class="pre">==</span></tt></td>
|
---|
| 921 | <td rowspan="2">Binary</td>
|
---|
| 922 | <td>Equal to.</td>
|
---|
| 923 | </tr>
|
---|
| 924 | <tr><td><tt class="docutils literal"><span class="pre">!=</span></tt></td>
|
---|
| 925 | <td>Not equal to.</td>
|
---|
| 926 | </tr>
|
---|
| 927 | <tr><td><tt class="docutils literal"><span class="pre">&</span></tt></td>
|
---|
| 928 | <td>Binary</td>
|
---|
| 929 | <td>Bitwise AND.</td>
|
---|
| 930 | </tr>
|
---|
| 931 | <tr><td><tt class="docutils literal"><span class="pre">^</span></tt></td>
|
---|
| 932 | <td>Binary</td>
|
---|
| 933 | <td>Bitwise XOR.</td>
|
---|
| 934 | </tr>
|
---|
| 935 | <tr><td><tt class="docutils literal"><span class="pre">|</span></tt></td>
|
---|
| 936 | <td>Binary</td>
|
---|
| 937 | <td>Bitwise OR.</td>
|
---|
| 938 | </tr>
|
---|
| 939 | <tr><td><tt class="docutils literal"><span class="pre">&&</span></tt></td>
|
---|
| 940 | <td>Binary</td>
|
---|
| 941 | <td>Logical AND.</td>
|
---|
| 942 | </tr>
|
---|
| 943 | <tr><td><tt class="docutils literal"><span class="pre">||</span></tt></td>
|
---|
| 944 | <td>Binary</td>
|
---|
| 945 | <td>Logical OR.</td>
|
---|
| 946 | </tr>
|
---|
| 947 | </tbody>
|
---|
| 948 | </table>
|
---|
| 949 | </div>
|
---|
| 950 | <div class="section">
|
---|
[2146] | 951 | <h1><a id="built-in-functions" name="built-in-functions">Built-in functions</a></h1>
|
---|
| 952 | <p>String Manipulation Functions:</p>
|
---|
| 953 | <blockquote>
|
---|
| 954 | <p>Replace <tt class="docutils literal"><span class="pre">from</span></tt> with <tt class="docutils literal"><span class="pre">to</span></tt> in <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 955 | <pre class="literal-block">
|
---|
| 956 | $(subst from,to,text)
|
---|
| 957 | </pre>
|
---|
| 958 | <p>Replace words matching <tt class="docutils literal"><span class="pre">pattern</span></tt> with <tt class="docutils literal"><span class="pre">replacement</span></tt> in <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 959 | <pre class="literal-block">
|
---|
| 960 | $(patsubst pattern,replacement,text)
|
---|
| 961 | </pre>
|
---|
| 962 | <p>Remove excess whitespace characters from <tt class="docutils literal"><span class="pre">string</span></tt>:</p>
|
---|
| 963 | <pre class="literal-block">
|
---|
| 964 | $(strip string)
|
---|
| 965 | </pre>
|
---|
| 966 | <p>Locate <tt class="docutils literal"><span class="pre">find</span></tt> in <tt class="docutils literal"><span class="pre">text</span></tt>, returning <tt class="docutils literal"><span class="pre">find</span></tt> if found:</p>
|
---|
| 967 | <pre class="literal-block">
|
---|
| 968 | $(findstring find,text)
|
---|
| 969 | </pre>
|
---|
| 970 | <p>Select words in <tt class="docutils literal"><span class="pre">text</span></tt> that match one of the <tt class="docutils literal"><span class="pre">pattern</span></tt> words:</p>
|
---|
| 971 | <pre class="literal-block">
|
---|
| 972 | $(filter pattern...,text)
|
---|
| 973 | </pre>
|
---|
| 974 | <p>Select words in <tt class="docutils literal"><span class="pre">text</span></tt> that do not match any of the <tt class="docutils literal"><span class="pre">pattern</span></tt> words:</p>
|
---|
| 975 | <pre class="literal-block">
|
---|
| 976 | $(filter-out pattern...,text)
|
---|
| 977 | </pre>
|
---|
| 978 | <p>Sort the words in <tt class="docutils literal"><span class="pre">list</span></tt> lexicographically, removing duplicates:</p>
|
---|
| 979 | <pre class="literal-block">
|
---|
| 980 | $(sort list)
|
---|
| 981 | </pre>
|
---|
| 982 | <p>Sort the words in <tt class="docutils literal"><span class="pre">list</span></tt> lexicographically in reserve order, removing
|
---|
[2340] | 983 | duplicates <a class="footnote-reference" href="#id84" id="id20" name="id20">[1]</a>:</p>
|
---|
[2146] | 984 | <pre class="literal-block">
|
---|
| 985 | $(rsort list)
|
---|
| 986 | </pre>
|
---|
| 987 | <p>Count the number of words in <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 988 | <pre class="literal-block">
|
---|
| 989 | $(words text)
|
---|
| 990 | </pre>
|
---|
| 991 | <p>Extract the <tt class="docutils literal"><span class="pre">n</span></tt>th word (one-origin) of <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 992 | <pre class="literal-block">
|
---|
| 993 | $(word n,text)
|
---|
| 994 | </pre>
|
---|
| 995 | <p>Returns the list of words in <tt class="docutils literal"><span class="pre">text</span></tt> from <tt class="docutils literal"><span class="pre">s</span></tt> to <tt class="docutils literal"><span class="pre">e</span></tt> (one-origin):</p>
|
---|
| 996 | <pre class="literal-block">
|
---|
| 997 | $(wordlist s,e,text)
|
---|
| 998 | </pre>
|
---|
| 999 | <p>Extract the first word of <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
|
---|
| 1000 | <pre class="literal-block">
|
---|
| 1001 | $(firstword names...)
|
---|
| 1002 | </pre>
|
---|
| 1003 | <p>Extract the last word of <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
|
---|
| 1004 | <pre class="literal-block">
|
---|
| 1005 | $(lastword names...)
|
---|
| 1006 | </pre>
|
---|
| 1007 | <p>Join two parallel lists of words:</p>
|
---|
| 1008 | <pre class="literal-block">
|
---|
| 1009 | $(join list1,list2)
|
---|
| 1010 | </pre>
|
---|
[2340] | 1011 | <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to upper case <a class="footnote-reference" href="#id84" id="id21" name="id21">[1]</a>:</p>
|
---|
[2146] | 1012 | <pre class="literal-block">
|
---|
| 1013 | $(toupper text)
|
---|
| 1014 | </pre>
|
---|
[2340] | 1015 | <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to lower case <a class="footnote-reference" href="#id84" id="id22" name="id22">[1]</a>:</p>
|
---|
[2146] | 1016 | <pre class="literal-block">
|
---|
| 1017 | $(tolower text)
|
---|
| 1018 | </pre>
|
---|
[2340] | 1019 | <p>String formatting a la the unix <tt class="docutils literal"><span class="pre">printf</span></tt> command <a class="footnote-reference" href="#id84" id="id23" name="id23">[1]</a>:</p>
|
---|
[2146] | 1020 | <pre class="literal-block">
|
---|
| 1021 | $(printf fmt, arg...)
|
---|
| 1022 | </pre>
|
---|
[2340] | 1023 | <p>Return the length of a string or a (unexpanded) variable <a class="footnote-reference" href="#id84" id="id24" name="id24">[1]</a>:</p>
|
---|
[2155] | 1024 | <pre class="literal-block">
|
---|
| 1025 | $(length string)
|
---|
| 1026 | $(length-var var)
|
---|
| 1027 | </pre>
|
---|
| 1028 | <p>Find the position of <tt class="docutils literal"><span class="pre">needle</span></tt> in <tt class="docutils literal"><span class="pre">haystack</span></tt>, returns 0 if not found.
|
---|
| 1029 | Negative <tt class="docutils literal"><span class="pre">start</span></tt> indices are relative to the end of <tt class="docutils literal"><span class="pre">haystack</span></tt>, while
|
---|
[2340] | 1030 | positive ones are one based <a class="footnote-reference" href="#id84" id="id25" name="id25">[1]</a>:</p>
|
---|
[2155] | 1031 | <pre class="literal-block">
|
---|
| 1032 | $(pos needle, haystack[, start])
|
---|
| 1033 | $(lastpos needle, haystack[, start])
|
---|
| 1034 | </pre>
|
---|
| 1035 | <p>Returns the specified substring. The <tt class="docutils literal"><span class="pre">start</span></tt> works like with <tt class="docutils literal"><span class="pre">$(pos</span> <span class="pre">)</span></tt>.
|
---|
| 1036 | If the substring is partially outside the <tt class="docutils literal"><span class="pre">string</span></tt> the result will be
|
---|
[2340] | 1037 | padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present <a class="footnote-reference" href="#id84" id="id26" name="id26">[1]</a>:</p>
|
---|
[2155] | 1038 | <pre class="literal-block">
|
---|
| 1039 | $(substr string, start[, length[, pad]])
|
---|
| 1040 | </pre>
|
---|
| 1041 | <p>Insert <tt class="docutils literal"><span class="pre">in</span></tt> into <tt class="docutils literal"><span class="pre">str</span></tt> at the specified position. <tt class="docutils literal"><span class="pre">n</span></tt> works like with
|
---|
[2340] | 1042 | <tt class="docutils literal"><span class="pre">$(pos</span> <span class="pre">)</span></tt>, except that <tt class="docutils literal"><span class="pre">0</span></tt> is the end of the string <a class="footnote-reference" href="#id84" id="id27" name="id27">[1]</a>:</p>
|
---|
[2155] | 1043 | <pre class="literal-block">
|
---|
| 1044 | $(insert in, str[, n[, length[, pad]]])
|
---|
| 1045 | </pre>
|
---|
| 1046 | <p>Translate <tt class="docutils literal"><span class="pre">string</span></tt> exchanging characters in <tt class="docutils literal"><span class="pre">from-set</span></tt> with <tt class="docutils literal"><span class="pre">to-set</span></tt>,
|
---|
| 1047 | optionally completing <tt class="docutils literal"><span class="pre">to-set</span></tt> with <tt class="docutils literal"><span class="pre">pad-char</span></tt> if specified. If no
|
---|
[2340] | 1048 | <tt class="docutils literal"><span class="pre">pad-char</span></tt> characters absent in <tt class="docutils literal"><span class="pre">to-set</span></tt> will be deleted <a class="footnote-reference" href="#id84" id="id28" name="id28">[1]</a>:</p>
|
---|
[2155] | 1049 | <pre class="literal-block">
|
---|
| 1050 | $(translate string, from-set[, to-set[, pad-char]])
|
---|
| 1051 | </pre>
|
---|
[2146] | 1052 | </blockquote>
|
---|
| 1053 | <p>Functions for file names:</p>
|
---|
| 1054 | <blockquote>
|
---|
| 1055 | <p>Extract the directory part of each file <tt class="docutils literal"><span class="pre">name</span></tt>:</p>
|
---|
| 1056 | <pre class="literal-block">
|
---|
| 1057 | $(dir names...)
|
---|
| 1058 | </pre>
|
---|
| 1059 | <p>Extract the non-directory part of each file <tt class="docutils literal"><span class="pre">name</span></tt>:</p>
|
---|
| 1060 | <pre class="literal-block">
|
---|
| 1061 | $(notdir names...)
|
---|
| 1062 | </pre>
|
---|
| 1063 | <p>Extract the suffix (the last <tt class="docutils literal"><span class="pre">.</span></tt> and following characters) of each file
|
---|
| 1064 | <tt class="docutils literal"><span class="pre">name</span></tt>:</p>
|
---|
| 1065 | <pre class="literal-block">
|
---|
| 1066 | $(suffix names...)
|
---|
| 1067 | </pre>
|
---|
| 1068 | <p>Extract the base name (name without suffix) of each file name:</p>
|
---|
| 1069 | <pre class="literal-block">
|
---|
| 1070 | $(basename names...)
|
---|
| 1071 | </pre>
|
---|
[2172] | 1072 | <p>Extract the root specification of each file name (a bit complicated on
|
---|
[2340] | 1073 | Windows & OS/2) <a class="footnote-reference" href="#id84" id="id29" name="id29">[1]</a>:</p>
|
---|
[2172] | 1074 | <pre class="literal-block">
|
---|
| 1075 | $(root names...)
|
---|
| 1076 | </pre>
|
---|
[2146] | 1077 | <p>Append <tt class="docutils literal"><span class="pre">suffix</span></tt> to each word in <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
|
---|
| 1078 | <pre class="literal-block">
|
---|
| 1079 | $(addsuffix suffix,names...)
|
---|
| 1080 | </pre>
|
---|
| 1081 | <p>Prepend <tt class="docutils literal"><span class="pre">prefix</span></tt> to each word in <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
|
---|
| 1082 | <pre class="literal-block">
|
---|
| 1083 | $(addprefix prefix,names...)
|
---|
| 1084 | </pre>
|
---|
| 1085 | <p>Find file names matching a shell file name <tt class="docutils literal"><span class="pre">pattern</span></tt> (not a <tt class="docutils literal"><span class="pre">%</span></tt>
|
---|
| 1086 | pattern):</p>
|
---|
| 1087 | <pre class="literal-block">
|
---|
| 1088 | $(wildcard pattern...)
|
---|
| 1089 | </pre>
|
---|
| 1090 | <p>For each file name in <tt class="docutils literal"><span class="pre">names</span></tt>, expand to an absolute name that does not
|
---|
| 1091 | contain any <tt class="docutils literal"><span class="pre">.</span></tt>, <tt class="docutils literal"><span class="pre">..</span></tt>, nor symlinks:</p>
|
---|
| 1092 | <pre class="literal-block">
|
---|
| 1093 | $(realpath names...)
|
---|
| 1094 | </pre>
|
---|
| 1095 | <p>For each file name in <tt class="docutils literal"><span class="pre">names</span></tt>, expand to an absolute name that does not
|
---|
| 1096 | contain any <tt class="docutils literal"><span class="pre">.</span></tt> or <tt class="docutils literal"><span class="pre">..</span></tt> components, but preserves symlinks:</p>
|
---|
| 1097 | <pre class="literal-block">
|
---|
| 1098 | $(abspath names...)
|
---|
| 1099 | </pre>
|
---|
| 1100 | <p>Same as <tt class="docutils literal"><span class="pre">$(abspath</span> <span class="pre">)</span></tt> except that the current directory can be
|
---|
[2340] | 1101 | specified as <tt class="docutils literal"><span class="pre">curdir</span></tt> <a class="footnote-reference" href="#id84" id="id30" name="id30">[1]</a>:</p>
|
---|
[2146] | 1102 | <pre class="literal-block">
|
---|
| 1103 | $(abspathex names...[, curdir])
|
---|
| 1104 | </pre>
|
---|
| 1105 | </blockquote>
|
---|
| 1106 | <p>Arithmetic Functions:</p>
|
---|
| 1107 | <blockquote>
|
---|
[2340] | 1108 | <p>Returns the sum of the arguments <a class="footnote-reference" href="#id84" id="id31" name="id31">[1]</a>:</p>
|
---|
[2146] | 1109 | <pre class="literal-block">
|
---|
| 1110 | $(int-add addend1, addend2[, addendN])
|
---|
| 1111 | </pre>
|
---|
[2170] | 1112 | <p>Returns the difference between the first argument and the sum of the
|
---|
[2340] | 1113 | rest <a class="footnote-reference" href="#id84" id="id32" name="id32">[1]</a>:</p>
|
---|
[2146] | 1114 | <pre class="literal-block">
|
---|
| 1115 | $(int-sub minuend, subtrahend[, subtrahendN])
|
---|
| 1116 | </pre>
|
---|
[2340] | 1117 | <p>Returns the product of the arguments <a class="footnote-reference" href="#id84" id="id33" name="id33">[1]</a>:</p>
|
---|
[2146] | 1118 | <pre class="literal-block">
|
---|
| 1119 | $(int-mul factor1, factor2[, factorN])
|
---|
| 1120 | </pre>
|
---|
[2340] | 1121 | <p>Returns the quotient of first argument and the rest <a class="footnote-reference" href="#id84" id="id34" name="id34">[1]</a>:</p>
|
---|
[2146] | 1122 | <pre class="literal-block">
|
---|
| 1123 | $(int-div dividend, divisor[, divisorN])
|
---|
| 1124 | </pre>
|
---|
[2340] | 1125 | <p>Returns the modulus of the two arguments <a class="footnote-reference" href="#id84" id="id35" name="id35">[1]</a>:</p>
|
---|
[2146] | 1126 | <pre class="literal-block">
|
---|
| 1127 | $(int-mod dividend, divisor)
|
---|
| 1128 | </pre>
|
---|
[2340] | 1129 | <p>Returns the bitwise two-complement of argument <a class="footnote-reference" href="#id84" id="id36" name="id36">[1]</a>:</p>
|
---|
[2146] | 1130 | <pre class="literal-block">
|
---|
| 1131 | $(int-not val)
|
---|
| 1132 | </pre>
|
---|
[2340] | 1133 | <p>Returns the result of a bitwise AND of the arguments <a class="footnote-reference" href="#id84" id="id37" name="id37">[1]</a>:</p>
|
---|
[2146] | 1134 | <pre class="literal-block">
|
---|
| 1135 | $(int-and val1, val2[, valN])
|
---|
| 1136 | </pre>
|
---|
[2340] | 1137 | <p>Returns the result of a bitwise OR of the arguments <a class="footnote-reference" href="#id84" id="id38" name="id38">[1]</a>:</p>
|
---|
[2146] | 1138 | <pre class="literal-block">
|
---|
| 1139 | $(int-or val1, val2[, valN])
|
---|
| 1140 | </pre>
|
---|
[2340] | 1141 | <p>Returns the result of a bitwise XOR of the arguments <a class="footnote-reference" href="#id84" id="id39" name="id39">[1]</a>:</p>
|
---|
[2146] | 1142 | <pre class="literal-block">
|
---|
| 1143 | $(int-xor val1, val2[, valN])
|
---|
| 1144 | </pre>
|
---|
| 1145 | <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true = non-empty, false = empty) result
|
---|
[2340] | 1146 | of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">==</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id40" name="id40">[1]</a>:</p>
|
---|
[2146] | 1147 | <pre class="literal-block">
|
---|
| 1148 | $(int-eq val1, val2)
|
---|
| 1149 | </pre>
|
---|
[2340] | 1150 | <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean result of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">!=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id41" name="id41">[1]</a>:</p>
|
---|
[2146] | 1151 | <pre class="literal-block">
|
---|
| 1152 | $(int-ne val1, val2)
|
---|
| 1153 | </pre>
|
---|
[2340] | 1154 | <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean result of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">></span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id42" name="id42">[1]</a>:</p>
|
---|
[2146] | 1155 | <pre class="literal-block">
|
---|
| 1156 | $(int-gt val1, val2)
|
---|
| 1157 | </pre>
|
---|
[2340] | 1158 | <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean result of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">>=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id43" name="id43">[1]</a>:</p>
|
---|
[2146] | 1159 | <pre class="literal-block">
|
---|
| 1160 | $(int-ge val1, val2)
|
---|
| 1161 | </pre>
|
---|
[2340] | 1162 | <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean result of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre"><</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id44" name="id44">[1]</a>:</p>
|
---|
[2146] | 1163 | <pre class="literal-block">
|
---|
| 1164 | $(int-lt val1, val2)
|
---|
| 1165 | </pre>
|
---|
[2340] | 1166 | <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean result of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre"><=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id45" name="id45">[1]</a>:</p>
|
---|
[2146] | 1167 | <pre class="literal-block">
|
---|
| 1168 | $(int-le val1, val2)
|
---|
| 1169 | </pre>
|
---|
| 1170 | </blockquote>
|
---|
[2163] | 1171 | <p>Boolean and Conditional Functions:</p>
|
---|
[2146] | 1172 | <blockquote>
|
---|
| 1173 | <p>Condition is false if the <tt class="docutils literal"><span class="pre">condition</span></tt> evaluates to an empty string
|
---|
| 1174 | (stripped). Evaluate the <tt class="docutils literal"><span class="pre">true-part</span></tt> if the condition is true, otherwise
|
---|
| 1175 | the <tt class="docutils literal"><span class="pre">false-part</span></tt>:</p>
|
---|
| 1176 | <pre class="literal-block">
|
---|
| 1177 | $(if condition,true-part[,false-part])
|
---|
| 1178 | </pre>
|
---|
| 1179 | <p>Test if any of the conditions evalues to non-empty string, returning the
|
---|
| 1180 | first one:</p>
|
---|
| 1181 | <pre class="literal-block">
|
---|
| 1182 | $(or condition1[,condition2[,condition3[...]]])
|
---|
| 1183 | </pre>
|
---|
| 1184 | <p>Test if all of the conditions evaluates to non-empty strings, returning the
|
---|
| 1185 | last one:</p>
|
---|
| 1186 | <pre class="literal-block">
|
---|
| 1187 | $(and condition1[,condition2[,condition3[...]]])
|
---|
| 1188 | </pre>
|
---|
| 1189 | <p>Test if the two strings are identical, returning <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true =
|
---|
[2340] | 1190 | non-empty, false = empty) <a class="footnote-reference" href="#id85" id="id46" name="id46">[2]</a>:</p>
|
---|
[2146] | 1191 | <pre class="literal-block">
|
---|
| 1192 | $(eq str1, str2)
|
---|
| 1193 | </pre>
|
---|
[2340] | 1194 | <p>Invert a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id85" id="id47" name="id47">[2]</a>:</p>
|
---|
[2146] | 1195 | <pre class="literal-block">
|
---|
| 1196 | $(not val)
|
---|
| 1197 | </pre>
|
---|
[2340] | 1198 | <p>Test if <tt class="docutils literal"><span class="pre">variable</span></tt> is defined, returning a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id84" id="id48" name="id48">[1]</a>:</p>
|
---|
[2146] | 1199 | <pre class="literal-block">
|
---|
| 1200 | $(defined variable)
|
---|
| 1201 | </pre>
|
---|
| 1202 | <p>Test if <tt class="docutils literal"><span class="pre">set-a</span></tt> and <tt class="docutils literal"><span class="pre">set-b</span></tt> intersects, returning a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean
|
---|
[2340] | 1203 | value <a class="footnote-reference" href="#id84" id="id49" name="id49">[1]</a>:</p>
|
---|
[2146] | 1204 | <pre class="literal-block">
|
---|
| 1205 | $(intersects set-a, set-b)
|
---|
| 1206 | </pre>
|
---|
[2340] | 1207 | <p>Same as <tt class="docutils literal"><span class="pre">$(if</span> <span class="pre">)</span></tt> execpt that the condition is a <tt class="docutils literal"><span class="pre">kmk</span></tt>-expression <a class="footnote-reference" href="#id84" id="id50" name="id50">[1]</a>:</p>
|
---|
[2146] | 1208 | <pre class="literal-block">
|
---|
[2163] | 1209 | $(if-expr kmk-expression,true-part[,false-part])
|
---|
[2146] | 1210 | </pre>
|
---|
[2167] | 1211 | <p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) and expand the
|
---|
[2170] | 1212 | following body. Special condition strings <tt class="docutils literal"><span class="pre">default</span></tt> and
|
---|
[2340] | 1213 | <tt class="docutils literal"><span class="pre">otherwise</span></tt> <a class="footnote-reference" href="#id84" id="id51" name="id51">[1]</a>:</p>
|
---|
[2163] | 1214 | <pre class="literal-block">
|
---|
| 1215 | $(select when1-cond, when1-body[, whenN-cond, whenN-body])
|
---|
| 1216 | </pre>
|
---|
[2167] | 1217 | <p>Evalutate the <tt class="docutils literal"><span class="pre">kmk-expression</span></tt> returning what it evalues as. This is
|
---|
[2340] | 1218 | the preferred way of doing arithmentic now <a class="footnote-reference" href="#id84" id="id52" name="id52">[1]</a>:</p>
|
---|
[2146] | 1219 | <pre class="literal-block">
|
---|
| 1220 | $(expr kmk-expression)
|
---|
| 1221 | </pre>
|
---|
| 1222 | </blockquote>
|
---|
| 1223 | <p>Stack Fuctions:</p>
|
---|
| 1224 | <blockquote>
|
---|
[2340] | 1225 | <p>Push <tt class="docutils literal"><span class="pre">item</span></tt> onto the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string <a class="footnote-reference" href="#id84" id="id53" name="id53">[1]</a>:</p>
|
---|
[2146] | 1226 | <pre class="literal-block">
|
---|
| 1227 | $(stack-push stack-var, item)
|
---|
| 1228 | </pre>
|
---|
[2340] | 1229 | <p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt> <a class="footnote-reference" href="#id84" id="id54" name="id54">[1]</a>:</p>
|
---|
[2146] | 1230 | <pre class="literal-block">
|
---|
| 1231 | $(stack-pop stack-var)
|
---|
| 1232 | </pre>
|
---|
[2340] | 1233 | <p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string <a class="footnote-reference" href="#id84" id="id55" name="id55">[1]</a>:</p>
|
---|
[2146] | 1234 | <pre class="literal-block">
|
---|
| 1235 | $(stack-popv stack-var)
|
---|
| 1236 | </pre>
|
---|
[2340] | 1237 | <p>Get the top item of the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string <a class="footnote-reference" href="#id84" id="id56" name="id56">[1]</a>:</p>
|
---|
[2146] | 1238 | <pre class="literal-block">
|
---|
| 1239 | $(stack-top stack-var)
|
---|
| 1240 | </pre>
|
---|
| 1241 | </blockquote>
|
---|
| 1242 | <p>Advanced Functions:</p>
|
---|
| 1243 | <blockquote>
|
---|
| 1244 | <p>Evaluates to the contents of the variable <tt class="docutils literal"><span class="pre">var</span></tt>, with no expansion
|
---|
| 1245 | performed on it:</p>
|
---|
| 1246 | <pre class="literal-block">
|
---|
| 1247 | $(value var)
|
---|
| 1248 | </pre>
|
---|
[2161] | 1249 | <p>Evaluate <tt class="docutils literal"><span class="pre">body</span></tt> with <tt class="docutils literal"><span class="pre">var</span></tt> bound to each word in <tt class="docutils literal"><span class="pre">words</span></tt>, and
|
---|
[2146] | 1250 | concatenate the results (spaced):</p>
|
---|
| 1251 | <pre class="literal-block">
|
---|
[2161] | 1252 | $(foreach var,words,body)
|
---|
[2146] | 1253 | </pre>
|
---|
[2161] | 1254 | <p>C-style for-loop. Start by evaluating <tt class="docutils literal"><span class="pre">init</span></tt>. Each iteration will
|
---|
| 1255 | first check whether the <tt class="docutils literal"><span class="pre">condition</span></tt> (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) is true,
|
---|
| 1256 | then expand <tt class="docutils literal"><span class="pre">body</span></tt> concatenating the result to the previous iterations
|
---|
[2340] | 1257 | (spaced), and finally evaluate <tt class="docutils literal"><span class="pre">next</span></tt> <a class="footnote-reference" href="#id84" id="id57" name="id57">[1]</a>:</p>
|
---|
[2161] | 1258 | <pre class="literal-block">
|
---|
| 1259 | $(for init,conditions,next,body)
|
---|
| 1260 | </pre>
|
---|
| 1261 | <p>C-style while-loop. Each iteration will check whether the <tt class="docutils literal"><span class="pre">condition</span></tt>
|
---|
| 1262 | (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) is true, then expand <tt class="docutils literal"><span class="pre">body</span></tt> concatenating the
|
---|
[2340] | 1263 | result to the previous iterations <a class="footnote-reference" href="#id84" id="id58" name="id58">[1]</a>:</p>
|
---|
[2161] | 1264 | <pre class="literal-block">
|
---|
| 1265 | $(while conditions,body)
|
---|
| 1266 | </pre>
|
---|
[2146] | 1267 | <p>Evaluate the variable <tt class="docutils literal"><span class="pre">var</span></tt> replacing any references to <tt class="docutils literal"><span class="pre">$(1)</span></tt>,
|
---|
| 1268 | <tt class="docutils literal"><span class="pre">$(2)</span></tt> with the first, second, etc. <tt class="docutils literal"><span class="pre">param</span></tt> values:</p>
|
---|
| 1269 | <pre class="literal-block">
|
---|
| 1270 | $(call var,param,...)
|
---|
| 1271 | </pre>
|
---|
| 1272 | <p>Evaluate <tt class="docutils literal"><span class="pre">text</span></tt> then read the results as makefile commands. Expands
|
---|
| 1273 | to the empty string:</p>
|
---|
| 1274 | <pre class="literal-block">
|
---|
| 1275 | $(eval text)
|
---|
| 1276 | </pre>
|
---|
| 1277 | <p>Same as <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">text)</span></tt> except that the <tt class="docutils literal"><span class="pre">text</span></tt> is expanded in its
|
---|
[2340] | 1278 | own variable context <a class="footnote-reference" href="#id84" id="id59" name="id59">[1]</a>:</p>
|
---|
[2146] | 1279 | <pre class="literal-block">
|
---|
| 1280 | $(evalctx text)
|
---|
| 1281 | </pre>
|
---|
[2340] | 1282 | <p>Same as <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">$(value</span> <span class="pre">var))</span></tt> <a class="footnote-reference" href="#id84" id="id60" name="id60">[1]</a>:</p>
|
---|
[2146] | 1283 | <pre class="literal-block">
|
---|
| 1284 | $(evalval var)
|
---|
| 1285 | </pre>
|
---|
[2340] | 1286 | <p>Same as <tt class="docutils literal"><span class="pre">$(evalctx</span> <span class="pre">$(value</span> <span class="pre">var))</span></tt> <a class="footnote-reference" href="#id84" id="id61" name="id61">[1]</a>:</p>
|
---|
[2146] | 1287 | <pre class="literal-block">
|
---|
| 1288 | $(evalvalctx var)
|
---|
| 1289 | </pre>
|
---|
[2340] | 1290 | <p>A combination of <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">)</span></tt>, <tt class="docutils literal"><span class="pre">$(call</span> <span class="pre">)</span></tt> and <tt class="docutils literal"><span class="pre">$(value</span> <span class="pre">)</span></tt> <a class="footnote-reference" href="#id84" id="id62" name="id62">[1]</a>:</p>
|
---|
[2146] | 1291 | <pre class="literal-block">
|
---|
| 1292 | $(evalcall var)
|
---|
| 1293 | </pre>
|
---|
[2340] | 1294 | <p>A combination of <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">)</span></tt> and <tt class="docutils literal"><span class="pre">$(call</span> <span class="pre">)</span></tt> <a class="footnote-reference" href="#id84" id="id63" name="id63">[1]</a>:</p>
|
---|
[2146] | 1295 | <pre class="literal-block">
|
---|
| 1296 | $(evalcall var)
|
---|
| 1297 | </pre>
|
---|
| 1298 | <p>Remove comments and blank lines from the variable <tt class="docutils literal"><span class="pre">var</span></tt>. Expands to
|
---|
[2340] | 1299 | the empty string <a class="footnote-reference" href="#id84" id="id64" name="id64">[1]</a>:</p>
|
---|
[2146] | 1300 | <pre class="literal-block">
|
---|
| 1301 | $(eval-opt-var var)
|
---|
| 1302 | </pre>
|
---|
| 1303 | <p>Returns accessing <tt class="docutils literal"><span class="pre">$<</span></tt> of <tt class="docutils literal"><span class="pre">target</span></tt>, either retriving the whole thing
|
---|
[2340] | 1304 | or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id65" name="id65">[1]</a>:</p>
|
---|
[2146] | 1305 | <pre class="literal-block">
|
---|
| 1306 | $(deps target[, pos])
|
---|
| 1307 | </pre>
|
---|
| 1308 | <p>Returns accessing <tt class="docutils literal"><span class="pre">$+</span></tt> (order + duplicates) of <tt class="docutils literal"><span class="pre">target</span></tt>, either
|
---|
[2340] | 1309 | retriving the whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id66" name="id66">[1]</a>:</p>
|
---|
[2146] | 1310 | <pre class="literal-block">
|
---|
| 1311 | $(deps-all target[, pos])
|
---|
| 1312 | </pre>
|
---|
| 1313 | <p>Returns accessing <tt class="docutils literal"><span class="pre">$?</span></tt> of <tt class="docutils literal"><span class="pre">target</span></tt>, either retriving the whole
|
---|
[2340] | 1314 | thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id67" name="id67">[1]</a>:</p>
|
---|
[2146] | 1315 | <pre class="literal-block">
|
---|
| 1316 | $(deps-newer target[, pos])
|
---|
| 1317 | </pre>
|
---|
| 1318 | <p>Returns accessing <tt class="docutils literal"><span class="pre">$|</span></tt> (order only) of <tt class="docutils literal"><span class="pre">target</span></tt>, either retriving the
|
---|
[2340] | 1319 | whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id68" name="id68">[1]</a>:</p>
|
---|
[2146] | 1320 | <pre class="literal-block">
|
---|
| 1321 | $(deps-oo target[, pos])
|
---|
| 1322 | </pre>
|
---|
| 1323 | </blockquote>
|
---|
| 1324 | <p>Command Functions:</p>
|
---|
| 1325 | <blockquote>
|
---|
| 1326 | <p>Create one or more command lines avoiding the max argument
|
---|
[2340] | 1327 | length restriction of the host OS <a class="footnote-reference" href="#id84" id="id69" name="id69">[1]</a>:</p>
|
---|
[2146] | 1328 | <pre class="literal-block">
|
---|
| 1329 | $(xargs ar cas mylib.a,$(objects))
|
---|
| 1330 | $(xargs ar cas mylib.a,ar as mylib.a,$(objects))
|
---|
| 1331 | </pre>
|
---|
| 1332 | <p>Returns the commands for the specified target separated by new-line, space,
|
---|
| 1333 | or a user defined string. Note that this might not produce the 100% correct
|
---|
[2340] | 1334 | result if any of the prerequisite automatic variables are used <a class="footnote-reference" href="#id84" id="id70" name="id70">[1]</a>:</p>
|
---|
[2146] | 1335 | <pre class="literal-block">
|
---|
| 1336 | $(commands target)
|
---|
| 1337 | $(commands-sc target)
|
---|
| 1338 | $(commands-usr target,sep)
|
---|
| 1339 | </pre>
|
---|
| 1340 | <p>Compares two commands returning the empty string if equal and the 3rd
|
---|
| 1341 | argument if not. This differs from <tt class="docutils literal"><span class="pre">$(comp-vars</span> <span class="pre">v1,v2,ne)</span></tt> in that
|
---|
| 1342 | line by line is stripped of leading spaces, command prefixes and
|
---|
[2340] | 1343 | trailing spaces before comparing <a class="footnote-reference" href="#id84" id="id71" name="id71">[1]</a>:</p>
|
---|
[2146] | 1344 | <pre class="literal-block">
|
---|
| 1345 | $(comp-cmds cmds-var1, cmds-var2, ne)
|
---|
| 1346 | $(comp-cmds-ex cmds1, cmd2, ne)
|
---|
| 1347 | </pre>
|
---|
| 1348 | <p>Compares the values of the two variables returning the empty string if
|
---|
[2170] | 1349 | equal and the 3rd argument if not. Leading and trailing spaces is
|
---|
[2340] | 1350 | ignored <a class="footnote-reference" href="#id84" id="id72" name="id72">[1]</a>:</p>
|
---|
[2146] | 1351 | <pre class="literal-block">
|
---|
| 1352 | $(comp-var var1, var2, ne)
|
---|
| 1353 | </pre>
|
---|
| 1354 | </blockquote>
|
---|
| 1355 | <p>Utility functions:</p>
|
---|
| 1356 | <blockquote>
|
---|
| 1357 | <p>When this function is evaluated, <tt class="docutils literal"><span class="pre">kmk</span></tt> generates a fatal error with the
|
---|
| 1358 | message <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 1359 | <pre class="literal-block">
|
---|
| 1360 | $(error text...)
|
---|
| 1361 | </pre>
|
---|
| 1362 | <p>When this function is evaluated, <tt class="docutils literal"><span class="pre">kmk</span></tt> generates a warning with the
|
---|
| 1363 | message <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 1364 | <pre class="literal-block">
|
---|
| 1365 | $(warning text...)
|
---|
| 1366 | </pre>
|
---|
| 1367 | <p>When this function is evaluated, <tt class="docutils literal"><span class="pre">kmk</span></tt> generates a info with the
|
---|
| 1368 | message <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
|
---|
| 1369 | <pre class="literal-block">
|
---|
| 1370 | $(info text...)
|
---|
| 1371 | </pre>
|
---|
| 1372 | <p>Execute a shell <tt class="docutils literal"><span class="pre">command</span></tt> and return its output:</p>
|
---|
| 1373 | <pre class="literal-block">
|
---|
| 1374 | $(shell command)
|
---|
| 1375 | </pre>
|
---|
| 1376 | <p>Return a string describing how the <tt class="docutils literal"><span class="pre">kmk</span></tt> variable <tt class="docutils literal"><span class="pre">variable</span></tt> was defined:</p>
|
---|
| 1377 | <pre class="literal-block">
|
---|
| 1378 | $(origin variable)
|
---|
| 1379 | </pre>
|
---|
| 1380 | <p>Return a string describing the flavor of the <tt class="docutils literal"><span class="pre">kmk</span></tt> variable <tt class="docutils literal"><span class="pre">variable</span></tt>:</p>
|
---|
| 1381 | <pre class="literal-block">
|
---|
| 1382 | $(flavor variable)
|
---|
| 1383 | </pre>
|
---|
| 1384 | <p>Returns the current local time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt>
|
---|
| 1385 | style specifier <tt class="docutils literal"><span class="pre">fmt</span></tt>. <tt class="docutils literal"><span class="pre">fmt</span></tt> defaults to <tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%S</span></tt> when
|
---|
[2340] | 1386 | not specified <a class="footnote-reference" href="#id84" id="id73" name="id73">[1]</a>:</p>
|
---|
[2146] | 1387 | <pre class="literal-block">
|
---|
| 1388 | $(date fmt)
|
---|
| 1389 | </pre>
|
---|
| 1390 | <p>Returns the current UTC time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt>
|
---|
| 1391 | style specifier <tt class="docutils literal"><span class="pre">fmt</span></tt>. <tt class="docutils literal"><span class="pre">fmt</span></tt> defaults to <tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> when
|
---|
[2340] | 1392 | not specified <a class="footnote-reference" href="#id84" id="id74" name="id74">[1]</a>:</p>
|
---|
[2146] | 1393 | <pre class="literal-block">
|
---|
| 1394 | $(date-utc fmt)
|
---|
| 1395 | </pre>
|
---|
| 1396 | <p>Reformats the <tt class="docutils literal"><span class="pre">in</span></tt> time and date using <tt class="docutils literal"><span class="pre">fmt</span></tt>. The <tt class="docutils literal"><span class="pre">in-fmt</span></tt> defaults
|
---|
| 1397 | to <tt class="docutils literal"><span class="pre">fmt</span></tt> if not specified. While <tt class="docutils literal"><span class="pre">fmt</span></tt> defaults to
|
---|
[2340] | 1398 | <tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> if not specified <a class="footnote-reference" href="#id84" id="id75" name="id75">[1]</a>:</p>
|
---|
[2146] | 1399 | <pre class="literal-block">
|
---|
| 1400 | $(date-utc fmt,time,in-fmt)
|
---|
| 1401 | </pre>
|
---|
[2340] | 1402 | <p>Returns the current nanosecond timestamp (monotonic when possible) <a class="footnote-reference" href="#id84" id="id76" name="id76">[1]</a>:</p>
|
---|
[2146] | 1403 | <pre class="literal-block">
|
---|
| 1404 | $(nanots )
|
---|
| 1405 | </pre>
|
---|
| 1406 | <p>Returns the size of the specified file, or -1 if the size could not
|
---|
[2340] | 1407 | be obtained. This can be used to check if a file exist or not <a class="footnote-reference" href="#id84" id="id77" name="id77">[1]</a>:</p>
|
---|
[2146] | 1408 | <pre class="literal-block">
|
---|
| 1409 | $(file-size file)
|
---|
| 1410 | </pre>
|
---|
[2340] | 1411 | <p>Searches the <tt class="docutils literal"><span class="pre">PATH</span></tt> <tt class="docutils literal"><span class="pre">kmk</span></tt> variable for the specified <tt class="docutils literal"><span class="pre">files</span></tt> <a class="footnote-reference" href="#id84" id="id78" name="id78">[1]</a>:</p>
|
---|
[2146] | 1412 | <pre class="literal-block">
|
---|
| 1413 | $(which files...)
|
---|
| 1414 | </pre>
|
---|
[2340] | 1415 | <p>OS/2: Returns the specified LIBPATH variable value <a class="footnote-reference" href="#id84" id="id79" name="id79">[1]</a>:</p>
|
---|
[2146] | 1416 | <pre class="literal-block">
|
---|
| 1417 | $(libpath var)
|
---|
| 1418 | </pre>
|
---|
[2170] | 1419 | <p>OS/2: Sets the specified LIBPATH variable value, returning the empty
|
---|
[2340] | 1420 | string <a class="footnote-reference" href="#id84" id="id80" name="id80">[1]</a>:</p>
|
---|
[2146] | 1421 | <pre class="literal-block">
|
---|
| 1422 | $(libpath var,value)
|
---|
| 1423 | </pre>
|
---|
| 1424 | </blockquote>
|
---|
| 1425 | <p>Debugging Functions:</p>
|
---|
| 1426 | <blockquote>
|
---|
| 1427 | <p>Returns various make statistics, if no item is specified a default
|
---|
[2340] | 1428 | selection is returned <a class="footnote-reference" href="#id84" id="id81" name="id81">[1]</a>:</p>
|
---|
[2146] | 1429 | <pre class="literal-block">
|
---|
| 1430 | $(make-stats item[,itemN])
|
---|
| 1431 | </pre>
|
---|
[2170] | 1432 | <p>Raise a debug breakpoint. Used for debugging <tt class="docutils literal"><span class="pre">kmk</span></tt> makefile
|
---|
[2340] | 1433 | parsing <a class="footnote-reference" href="#id84" id="id82" name="id82">[1]</a>:</p>
|
---|
[2146] | 1434 | <pre class="literal-block">
|
---|
| 1435 | $(breakpoint )
|
---|
| 1436 | </pre>
|
---|
| 1437 | </blockquote>
|
---|
[2340] | 1438 | </div>
|
---|
| 1439 | <div class="section">
|
---|
| 1440 | <h1><a id="recipes" name="recipes">Recipes</a></h1>
|
---|
| 1441 | <blockquote>
|
---|
| 1442 | <p>A typical recipe takes one of the two following forms:</p>
|
---|
| 1443 | <pre class="literal-block">
|
---|
| 1444 | targets : normal-prerequisites | order-only-prerequisites
|
---|
| 1445 | command
|
---|
| 1446 | ...
|
---|
| 1447 |
|
---|
| 1448 | targets : normal-prerequisites | order-only-prerequisites ; command
|
---|
| 1449 | command
|
---|
| 1450 | ...
|
---|
| 1451 | </pre>
|
---|
| 1452 | <p>Specifying more than one file in the <tt class="docutils literal"><span class="pre">targets</span></tt> lists is the same as
|
---|
| 1453 | repeating the recipe for each of the files.</p>
|
---|
| 1454 | <p>Use <tt class="docutils literal"><span class="pre">+</span></tt> and <tt class="docutils literal"><span class="pre">+|</span></tt> in the list of <tt class="docutils literal"><span class="pre">targets</span></tt> to tell <tt class="docutils literal"><span class="pre">kmk</span></tt> that the
|
---|
| 1455 | recipe has more than one output. <a class="footnote-reference" href="#id84" id="id83" name="id83">[1]</a> The files after a <tt class="docutils literal"><span class="pre">+</span></tt> will
|
---|
| 1456 | always be remade, while the files after a <tt class="docutils literal"><span class="pre">+|</span></tt> don't have to be remade.
|
---|
| 1457 | The latter is frequently employed to update files which prerequisites
|
---|
| 1458 | change wihtout the output files necessarily changing. See also
|
---|
| 1459 | <tt class="docutils literal"><span class="pre">kmk_cp</span> <span class="pre">--changed</span></tt>.</p>
|
---|
| 1460 | </blockquote>
|
---|
| 1461 | <p>Double colon recipes</p>
|
---|
| 1462 | <blockquote>
|
---|
| 1463 | Double colon recipes are written with <tt class="docutils literal"><span class="pre">::</span></tt> instead of <tt class="docutils literal"><span class="pre">:</span></tt> and are
|
---|
| 1464 | handled differently from ordinary recipes if the target appears in more
|
---|
| 1465 | than one recipe. First, all the recipes must be of the double colon type.
|
---|
| 1466 | Second, the recipes are executed individually and may be omitted depending
|
---|
| 1467 | on the state of their prerequisites. Double colon recipes without any
|
---|
| 1468 | prerequisites will always be executed.</blockquote>
|
---|
| 1469 | <p>Pattern rules</p>
|
---|
| 1470 | <blockquote>
|
---|
| 1471 | <p>A couple of examples:</p>
|
---|
| 1472 | <pre class="literal-block">
|
---|
| 1473 | %.o : %.c
|
---|
| 1474 | gcc -o $@ $<
|
---|
| 1475 | %.tab.c %.tab.h : %.y
|
---|
| 1476 | bison -d $<
|
---|
| 1477 | </pre>
|
---|
| 1478 | <p>The latter has two outputs.</p>
|
---|
| 1479 | </blockquote>
|
---|
[2146] | 1480 | <hr class="docutils" />
|
---|
[2340] | 1481 | <table class="docutils footnote" frame="void" id="id84" rules="none">
|
---|
[2169] | 1482 | <colgroup><col class="label" /><col /></colgroup>
|
---|
| 1483 | <tbody valign="top">
|
---|
[2340] | 1484 | <tr><td class="label"><a name="id84">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id2">2</a>, <a class="fn-backref" href="#id3">3</a>, <a class="fn-backref" href="#id4">4</a>, <a class="fn-backref" href="#id5">5</a>, <a class="fn-backref" href="#id6">6</a>, <a class="fn-backref" href="#id7">7</a>, <a class="fn-backref" href="#id8">8</a>, <a class="fn-backref" href="#id9">9</a>, <a class="fn-backref" href="#id10">10</a>, <a class="fn-backref" href="#id11">11</a>, <a class="fn-backref" href="#id12">12</a>, <a class="fn-backref" href="#id13">13</a>, <a class="fn-backref" href="#id14">14</a>, <a class="fn-backref" href="#id15">15</a>, <a class="fn-backref" href="#id16">16</a>, <a class="fn-backref" href="#id17">17</a>, <a class="fn-backref" href="#id18">18</a>, <a class="fn-backref" href="#id19">19</a>, <a class="fn-backref" href="#id20">20</a>, <a class="fn-backref" href="#id21">21</a>, <a class="fn-backref" href="#id22">22</a>, <a class="fn-backref" href="#id23">23</a>, <a class="fn-backref" href="#id24">24</a>, <a class="fn-backref" href="#id25">25</a>, <a class="fn-backref" href="#id26">26</a>, <a class="fn-backref" href="#id27">27</a>, <a class="fn-backref" href="#id28">28</a>, <a class="fn-backref" href="#id29">29</a>, <a class="fn-backref" href="#id30">30</a>, <a class="fn-backref" href="#id31">31</a>, <a class="fn-backref" href="#id32">32</a>, <a class="fn-backref" href="#id33">33</a>, <a class="fn-backref" href="#id34">34</a>, <a class="fn-backref" href="#id35">35</a>, <a class="fn-backref" href="#id36">36</a>, <a class="fn-backref" href="#id37">37</a>, <a class="fn-backref" href="#id38">38</a>, <a class="fn-backref" href="#id39">39</a>, <a class="fn-backref" href="#id40">40</a>, <a class="fn-backref" href="#id41">41</a>, <a class="fn-backref" href="#id42">42</a>, <a class="fn-backref" href="#id43">43</a>, <a class="fn-backref" href="#id44">44</a>, <a class="fn-backref" href="#id45">45</a>, <a class="fn-backref" href="#id48">46</a>, <a class="fn-backref" href="#id49">47</a>, <a class="fn-backref" href="#id50">48</a>, <a class="fn-backref" href="#id51">49</a>, <a class="fn-backref" href="#id52">50</a>, <a class="fn-backref" href="#id53">51</a>, <a class="fn-backref" href="#id54">52</a>, <a class="fn-backref" href="#id55">53</a>, <a class="fn-backref" href="#id56">54</a>, <a class="fn-backref" href="#id57">55</a>, <a class="fn-backref" href="#id58">56</a>, <a class="fn-backref" href="#id59">57</a>, <a class="fn-backref" href="#id60">58</a>, <a class="fn-backref" href="#id61">59</a>, <a class="fn-backref" href="#id62">60</a>, <a class="fn-backref" href="#id63">61</a>, <a class="fn-backref" href="#id64">62</a>, <a class="fn-backref" href="#id65">63</a>, <a class="fn-backref" href="#id66">64</a>, <a class="fn-backref" href="#id67">65</a>, <a class="fn-backref" href="#id68">66</a>, <a class="fn-backref" href="#id69">67</a>, <a class="fn-backref" href="#id70">68</a>, <a class="fn-backref" href="#id71">69</a>, <a class="fn-backref" href="#id72">70</a>, <a class="fn-backref" href="#id73">71</a>, <a class="fn-backref" href="#id74">72</a>, <a class="fn-backref" href="#id75">73</a>, <a class="fn-backref" href="#id76">74</a>, <a class="fn-backref" href="#id77">75</a>, <a class="fn-backref" href="#id78">76</a>, <a class="fn-backref" href="#id79">77</a>, <a class="fn-backref" href="#id80">78</a>, <a class="fn-backref" href="#id81">79</a>, <a class="fn-backref" href="#id82">80</a>, <a class="fn-backref" href="#id83">81</a>)</em> <tt class="docutils literal"><span class="pre">kmk</span></tt> only feature.</td></tr>
|
---|
[2169] | 1485 | </tbody>
|
---|
| 1486 | </table>
|
---|
[2340] | 1487 | <table class="docutils footnote" frame="void" id="id85" rules="none">
|
---|
[2170] | 1488 | <colgroup><col class="label" /><col /></colgroup>
|
---|
| 1489 | <tbody valign="top">
|
---|
[2340] | 1490 | <tr><td class="label"><a name="id85">[2]</a></td><td><em>(<a class="fn-backref" href="#id46">1</a>, <a class="fn-backref" href="#id47">2</a>)</em> Experimental GNU <tt class="docutils literal"><span class="pre">make</span></tt> feature that is not enabled by default.</td></tr>
|
---|
[2170] | 1491 | </tbody>
|
---|
| 1492 | </table>
|
---|
[2169] | 1493 | <hr class="docutils" />
|
---|
[2146] | 1494 | <table class="docutils field-list" frame="void" rules="none">
|
---|
| 1495 | <col class="field-name" />
|
---|
| 1496 | <col class="field-body" />
|
---|
| 1497 | <tbody valign="top">
|
---|
| 1498 | <tr class="field"><th class="field-name">Status:</th><td class="field-body"><p class="first">$Id: QuickReference-kmk.html 2340 2009-04-18 12:05:47Z bird $</p>
|
---|
| 1499 | </td>
|
---|
| 1500 | </tr>
|
---|
| 1501 | <tr class="field"><th class="field-name">Copyright:</th><td class="field-body"><p class="first">Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
---|
| 1502 | 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
---|
| 1503 | 2007 Free Software Foundation, Inc.</p>
|
---|
[2243] | 1504 | <p class="last">Copyright (c) 2008-2009 knut st. osmundsen</p>
|
---|
[2146] | 1505 | </td>
|
---|
| 1506 | </tr>
|
---|
| 1507 | </tbody>
|
---|
| 1508 | </table>
|
---|
| 1509 | </div>
|
---|
| 1510 | </div>
|
---|
| 1511 | </body>
|
---|
| 1512 | </html>
|
---|