VirtualBox

Changeset 2172 in kBuild for trunk


Ignore:
Timestamp:
Dec 31, 2008 12:03:02 AM (16 years ago)
Author:
bird
Message:

kmk: Added $(root ) to help out with checking for absolute paths on Windows and OS/2.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/doc/QuickReference-kmk.html

    r2171 r2172  
    328328sinclude file
    329329</pre>
    330 <p>Include another dependency file <a class="footnote-reference" href="#id82" id="id1" name="id1">[1]</a>:</p>
     330<p>Include another dependency file <a class="footnote-reference" href="#id83" id="id1" name="id1">[1]</a>:</p>
    331331<pre class="literal-block">
    332332includedep file
     
    358358unexport variable
    359359</pre>
    360 <p>Define a variable in the local context instead of the global one <a class="footnote-reference" href="#id82" id="id2" name="id2">[1]</a>:</p>
     360<p>Define a variable in the local context instead of the global one <a class="footnote-reference" href="#id83" id="id2" name="id2">[1]</a>:</p>
    361361<pre class="literal-block">
    362362local variable = value
     
    509509<tt class="docutils literal"><span class="pre">KBUILD_KMK_REVISION</span></tt></td>
    510510<td>The kBuild version string and the break down
    511 into individual components. <a class="footnote-reference" href="#id82" id="id3" name="id3">[1]</a></td>
    512 </tr>
    513 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST</span></tt> <a class="footnote-reference" href="#id82" id="id4" name="id4">[1]</a></td>
     511into individual components. <a class="footnote-reference" href="#id83" id="id3" name="id3">[1]</a></td>
     512</tr>
     513<tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST</span></tt> <a class="footnote-reference" href="#id83" id="id4" name="id4">[1]</a></td>
    514514<td>The host operating system.</td>
    515515</tr>
    516 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_ARCH</span></tt> <a class="footnote-reference" href="#id82" id="id5" name="id5">[1]</a></td>
     516<tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_ARCH</span></tt> <a class="footnote-reference" href="#id83" id="id5" name="id5">[1]</a></td>
    517517<td>The host architecture.</td>
    518518</tr>
    519 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_CPU</span></tt> <a class="footnote-reference" href="#id82" id="id6" name="id6">[1]</a></td>
     519<tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_CPU</span></tt> <a class="footnote-reference" href="#id83" id="id6" name="id6">[1]</a></td>
    520520<td>The host CPU <tt class="docutils literal"><span class="pre">kmk</span></tt> is built for, set to
    521521<tt class="docutils literal"><span class="pre">blend</span></tt> if not any particular CPU.</td>
    522522</tr>
    523 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_PATH</span></tt> <a class="footnote-reference" href="#id82" id="id7" name="id7">[1]</a></td>
     523<tr><td><tt class="docutils literal"><span class="pre">KBUILD_PATH</span></tt> <a class="footnote-reference" href="#id83" id="id7" name="id7">[1]</a></td>
    524524<td>Where the kBuild scripts are.</td>
    525525</tr>
    526 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_BIN_PATH</span></tt> <a class="footnote-reference" href="#id82" id="id8" name="id8">[1]</a></td>
     526<tr><td><tt class="docutils literal"><span class="pre">KBUILD_BIN_PATH</span></tt> <a class="footnote-reference" href="#id83" id="id8" name="id8">[1]</a></td>
    527527<td>Where the host specific kBuild binaries are.</td>
    528528</tr>
    529 <tr><td><tt class="docutils literal"><span class="pre">KMK</span></tt> <a class="footnote-reference" href="#id82" id="id9" name="id9">[1]</a>,
     529<tr><td><tt class="docutils literal"><span class="pre">KMK</span></tt> <a class="footnote-reference" href="#id83" id="id9" name="id9">[1]</a>,
    530530<tt class="docutils literal"><span class="pre">MAKE</span></tt></td>
    531531<td>The name with which <tt class="docutils literal"><span class="pre">kmk</span></tt> was invoked. Using
    532532this variable in recipes has special meaning.</td>
    533533</tr>
    534 <tr><td><tt class="docutils literal"><span class="pre">KMK_BUILTIN</span></tt> <a class="footnote-reference" href="#id82" id="id10" name="id10">[1]</a></td>
     534<tr><td><tt class="docutils literal"><span class="pre">KMK_BUILTIN</span></tt> <a class="footnote-reference" href="#id83" id="id10" name="id10">[1]</a></td>
    535535<td>List of built-in commands.</td>
    536536</tr>
    537 <tr><td><tt class="docutils literal"><span class="pre">KMK_FEATURES</span></tt> <a class="footnote-reference" href="#id82" id="id11" name="id11">[1]</a></td>
     537<tr><td><tt class="docutils literal"><span class="pre">KMK_FEATURES</span></tt> <a class="footnote-reference" href="#id83" id="id11" name="id11">[1]</a></td>
    538538<td>List of <tt class="docutils literal"><span class="pre">kmk</span></tt> specific features.</td>
    539539</tr>
    540 <tr><td><tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt> <a class="footnote-reference" href="#id82" id="id12" name="id12">[1]</a></td>
     540<tr><td><tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt> <a class="footnote-reference" href="#id83" id="id12" name="id12">[1]</a></td>
    541541<td><p class="first">The flags given to <tt class="docutils literal"><span class="pre">kmk</span></tt>. You can set this in
    542542the environment or a makefile to set flags.</p>
     
    548548</td>
    549549</tr>
    550 <tr><td><tt class="docutils literal"><span class="pre">KMK_LEVEL</span></tt> <a class="footnote-reference" href="#id82" id="id13" name="id13">[1]</a></td>
     550<tr><td><tt class="docutils literal"><span class="pre">KMK_LEVEL</span></tt> <a class="footnote-reference" href="#id83" id="id13" name="id13">[1]</a></td>
    551551<td>The number of levels of recursion (sub-makes).</td>
    552552</tr>
    553 <tr><td><tt class="docutils literal"><span class="pre">KMK_VERSION</span></tt> <a class="footnote-reference" href="#id82" id="id14" name="id14">[1]</a></td>
     553<tr><td><tt class="docutils literal"><span class="pre">KMK_VERSION</span></tt> <a class="footnote-reference" href="#id83" id="id14" name="id14">[1]</a></td>
    554554<td>The GNU <tt class="docutils literal"><span class="pre">make</span></tt> version number.</td>
    555555</tr>
     
    587587</tbody>
    588588</table>
    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="#id82" id="id15" name="id15">[1]</a></p>
     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="#id83" id="id15" name="id15">[1]</a></p>
    590590<table border="1" class="docutils">
    591591<colgroup>
     
    646646<tr><td><tt class="docutils literal"><span class="pre">.DELETE_ON_ERROR</span></tt></td>
    647647<td>If mentioned, <tt class="docutils literal"><span class="pre">kmk</span></tt> will delete the
    648 targets of a rule if it hash changed and its
     648targets of a rule if it has changed and its
    649649recipe fails or is interrupted.</td>
    650650</tr>
     
    658658no prequisites all targets are affected.</td>
    659659</tr>
    660 <tr><td><tt class="docutils literal"><span class="pre">.INTERMEIDATE</span></tt></td>
     660<tr><td><tt class="docutils literal"><span class="pre">.INTERMEDIATE</span></tt></td>
    661661<td>The prerequisites are treated as
    662662intermediate files (implicite rules).</td>
     
    669669<td>If mentioned without any prerequisites,
    670670<tt class="docutils literal"><span class="pre">kmk</span></tt> will run serially as if -j1 was
    671 given. If it has prerequisites <tt class="docutils literal"><span class="pre">kmk</span></tt> <a class="footnote-reference" href="#id82" id="id16" name="id16">[1]</a>
     671given. If it has prerequisites <tt class="docutils literal"><span class="pre">kmk</span></tt> <a class="footnote-reference" href="#id83" id="id16" name="id16">[1]</a>
    672672will only do this for the targets among
    673673them.</td>
     
    678678</tr>
    679679<tr><td><tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt></td>
    680 <td>The targets which <tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt> depends will
    681 to be deleted if <tt class="docutils literal"><span class="pre">kmk</span></tt> is killed or
     680<td>The targets which <tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt> depends
     681will to be deleted if <tt class="docutils literal"><span class="pre">kmk</span></tt> is killed or
    682682interrupted while their building.</td>
    683683</tr>
     
    695695</tr>
    696696<tr><td><tt class="docutils literal"><span class="pre">.SECONDTARGETEXPANSION</span></tt>
    697 <a class="footnote-reference" href="#id82" id="id17" name="id17">[1]</a></td>
    698 <td>If mentioned, all prerequisite lists after
    699 it will be expanded a second time after all
    700 makefiles have been read.</td>
     697<a class="footnote-reference" href="#id83" id="id17" name="id17">[1]</a></td>
     698<td>If mentioned, all targets after it will be
     699expanded a second time after all makefiles
     700have been read.</td>
    701701</tr>
    702702<tr><td><tt class="docutils literal"><span class="pre">.SILENT</span></tt></td>
     
    707707<tr><td><tt class="docutils literal"><span class="pre">.SUFFIXES</span></tt></td>
    708708<td>The prerequisites are the list of suffixes
    709 used in checking for suffix rules.</td>
     709used in checking for suffix rules. If it
     710appears without prerequisites it the suffix
     711will be cleared.</td>
    710712</tr>
    711713</tbody>
     
    714716<div class="section">
    715717<h1><a id="commands" name="commands">Commands</a></h1>
    716 <p>Builtin commands <a class="footnote-reference" href="#id82" 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
     718<p>Builtin commands <a class="footnote-reference" href="#id83" 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
    717719space this prefix has been omitted in the table below. All commands comes in an
    718720external edition that can be used by/in the shell, these are prefixed <tt class="docutils literal"><span class="pre">kmk_</span></tt>.</p>
     
    825827<div class="section">
    826828<h1><a id="kmk-expression" name="kmk-expression">kmk-expression</a></h1>
    827 <p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions <a class="footnote-reference" href="#id82" id="id19" name="id19">[1]</a> are related to the C/C++ preprocessor in some ways as
     829<p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions <a class="footnote-reference" href="#id83" id="id19" name="id19">[1]</a> are related to the C/C++ preprocessor in some ways as
    828830well 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
    829831because of the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function
     
    979981</pre>
    980982<p>Sort the words in <tt class="docutils literal"><span class="pre">list</span></tt> lexicographically in reserve order, removing
    981 duplicates <a class="footnote-reference" href="#id82" id="id20" name="id20">[1]</a>:</p>
     983duplicates <a class="footnote-reference" href="#id83" id="id20" name="id20">[1]</a>:</p>
    982984<pre class="literal-block">
    983985$(rsort list)
     
    10071009$(join list1,list2)
    10081010</pre>
    1009 <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to upper case <a class="footnote-reference" href="#id82" id="id21" name="id21">[1]</a>:</p>
     1011<p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to upper case <a class="footnote-reference" href="#id83" id="id21" name="id21">[1]</a>:</p>
    10101012<pre class="literal-block">
    10111013$(toupper text)
    10121014</pre>
    1013 <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to lower case <a class="footnote-reference" href="#id82" id="id22" name="id22">[1]</a>:</p>
     1015<p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to lower case <a class="footnote-reference" href="#id83" id="id22" name="id22">[1]</a>:</p>
    10141016<pre class="literal-block">
    10151017$(tolower text)
    10161018</pre>
    1017 <p>String formatting a la the unix <tt class="docutils literal"><span class="pre">printf</span></tt> command <a class="footnote-reference" href="#id82" id="id23" name="id23">[1]</a>:</p>
     1019<p>String formatting a la the unix <tt class="docutils literal"><span class="pre">printf</span></tt> command <a class="footnote-reference" href="#id83" id="id23" name="id23">[1]</a>:</p>
    10181020<pre class="literal-block">
    10191021$(printf fmt, arg...)
    10201022</pre>
    1021 <p>Return the length of a string or a (unexpanded) variable <a class="footnote-reference" href="#id82" id="id24" name="id24">[1]</a>:</p>
     1023<p>Return the length of a string or a (unexpanded) variable <a class="footnote-reference" href="#id83" id="id24" name="id24">[1]</a>:</p>
    10221024<pre class="literal-block">
    10231025$(length string)
     
    10261028<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.
    10271029Negative <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
    1028 positive ones are one based <a class="footnote-reference" href="#id82" id="id25" name="id25">[1]</a>:</p>
     1030positive ones are one based <a class="footnote-reference" href="#id83" id="id25" name="id25">[1]</a>:</p>
    10291031<pre class="literal-block">
    10301032$(pos needle, haystack[, start])
     
    10331035<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>.
    10341036If the substring is partially outside the <tt class="docutils literal"><span class="pre">string</span></tt> the result will be
    1035 padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present <a class="footnote-reference" href="#id82" id="id26" name="id26">[1]</a>:</p>
     1037padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present <a class="footnote-reference" href="#id83" id="id26" name="id26">[1]</a>:</p>
    10361038<pre class="literal-block">
    10371039$(substr string, start[, length[, pad]])
    10381040</pre>
    10391041<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
    1040 <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="#id82" id="id27" name="id27">[1]</a>:</p>
     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="#id83" id="id27" name="id27">[1]</a>:</p>
    10411043<pre class="literal-block">
    10421044$(insert in, str[, n[, length[, pad]]])
     
    10441046<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>,
    10451047optionally 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
    1046 <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="#id82" id="id28" name="id28">[1]</a>:</p>
     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="#id83" id="id28" name="id28">[1]</a>:</p>
    10471049<pre class="literal-block">
    10481050$(translate string, from-set[, to-set[, pad-char]])
     
    10681070$(basename names...)
    10691071</pre>
     1072<p>Extract the root specification of each file name (a bit complicated on
     1073Windows &amp; OS/2) <a class="footnote-reference" href="#id83" id="id29" name="id29">[1]</a>:</p>
     1074<pre class="literal-block">
     1075$(root names...)
     1076</pre>
    10701077<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>
    10711078<pre class="literal-block">
     
    10921099</pre>
    10931100<p>Same as <tt class="docutils literal"><span class="pre">$(abspath</span> <span class="pre">)</span></tt> except that the current directory can be
    1094 specified as <tt class="docutils literal"><span class="pre">curdir</span></tt> <a class="footnote-reference" href="#id82" id="id29" name="id29">[1]</a>:</p>
     1101specified as <tt class="docutils literal"><span class="pre">curdir</span></tt> <a class="footnote-reference" href="#id83" id="id30" name="id30">[1]</a>:</p>
    10951102<pre class="literal-block">
    10961103$(abspathex names...[, curdir])
     
    10991106<p>Arithmetic Functions:</p>
    11001107<blockquote>
    1101 <p>Returns the sum of the arguments <a class="footnote-reference" href="#id82" id="id30" name="id30">[1]</a>:</p>
     1108<p>Returns the sum of the arguments <a class="footnote-reference" href="#id83" id="id31" name="id31">[1]</a>:</p>
    11021109<pre class="literal-block">
    11031110$(int-add addend1, addend2[, addendN])
    11041111</pre>
    11051112<p>Returns the difference between the first argument and the sum of the
    1106 rest <a class="footnote-reference" href="#id82" id="id31" name="id31">[1]</a>:</p>
     1113rest <a class="footnote-reference" href="#id83" id="id32" name="id32">[1]</a>:</p>
    11071114<pre class="literal-block">
    11081115$(int-sub minuend, subtrahend[, subtrahendN])
    11091116</pre>
    1110 <p>Returns the product of the arguments <a class="footnote-reference" href="#id82" id="id32" name="id32">[1]</a>:</p>
     1117<p>Returns the product of the arguments <a class="footnote-reference" href="#id83" id="id33" name="id33">[1]</a>:</p>
    11111118<pre class="literal-block">
    11121119$(int-mul factor1, factor2[, factorN])
    11131120</pre>
    1114 <p>Returns the quotient of first argument and the rest <a class="footnote-reference" href="#id82" id="id33" name="id33">[1]</a>:</p>
     1121<p>Returns the quotient of first argument and the rest <a class="footnote-reference" href="#id83" id="id34" name="id34">[1]</a>:</p>
    11151122<pre class="literal-block">
    11161123$(int-div dividend, divisor[, divisorN])
    11171124</pre>
    1118 <p>Returns the modulus of the two arguments <a class="footnote-reference" href="#id82" id="id34" name="id34">[1]</a>:</p>
     1125<p>Returns the modulus of the two arguments <a class="footnote-reference" href="#id83" id="id35" name="id35">[1]</a>:</p>
    11191126<pre class="literal-block">
    11201127$(int-mod dividend, divisor)
    11211128</pre>
    1122 <p>Returns the bitwise two-complement of argument <a class="footnote-reference" href="#id82" id="id35" name="id35">[1]</a>:</p>
     1129<p>Returns the bitwise two-complement of argument <a class="footnote-reference" href="#id83" id="id36" name="id36">[1]</a>:</p>
    11231130<pre class="literal-block">
    11241131$(int-not val)
    11251132</pre>
    1126 <p>Returns the result of a bitwise AND of the arguments <a class="footnote-reference" href="#id82" id="id36" name="id36">[1]</a>:</p>
     1133<p>Returns the result of a bitwise AND of the arguments <a class="footnote-reference" href="#id83" id="id37" name="id37">[1]</a>:</p>
    11271134<pre class="literal-block">
    11281135$(int-and val1, val2[, valN])
    11291136</pre>
    1130 <p>Returns the result of a bitwise OR of the arguments <a class="footnote-reference" href="#id82" id="id37" name="id37">[1]</a>:</p>
     1137<p>Returns the result of a bitwise OR of the arguments <a class="footnote-reference" href="#id83" id="id38" name="id38">[1]</a>:</p>
    11311138<pre class="literal-block">
    11321139$(int-or val1, val2[, valN])
    11331140</pre>
    1134 <p>Returns the result of a bitwise XOR of the arguments <a class="footnote-reference" href="#id82" id="id38" name="id38">[1]</a>:</p>
     1141<p>Returns the result of a bitwise XOR of the arguments <a class="footnote-reference" href="#id83" id="id39" name="id39">[1]</a>:</p>
    11351142<pre class="literal-block">
    11361143$(int-xor val1, val2[, valN])
    11371144</pre>
    11381145<p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true = non-empty, false = empty) result
    1139 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="#id82" id="id39" name="id39">[1]</a>:</p>
     1146of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">==</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id83" id="id40" name="id40">[1]</a>:</p>
    11401147<pre class="literal-block">
    11411148$(int-eq val1, val2)
    11421149</pre>
    1143 <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="#id82" id="id40" name="id40">[1]</a>:</p>
     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="#id83" id="id41" name="id41">[1]</a>:</p>
    11441151<pre class="literal-block">
    11451152$(int-ne val1, val2)
    11461153</pre>
    1147 <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">&gt;</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id82" id="id41" name="id41">[1]</a>:</p>
     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">&gt;</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id83" id="id42" name="id42">[1]</a>:</p>
    11481155<pre class="literal-block">
    11491156$(int-gt val1, val2)
    11501157</pre>
    1151 <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">&gt;=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id82" id="id42" name="id42">[1]</a>:</p>
     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">&gt;=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id83" id="id43" name="id43">[1]</a>:</p>
    11521159<pre class="literal-block">
    11531160$(int-ge val1, val2)
    11541161</pre>
    1155 <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">&lt;</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id82" id="id43" name="id43">[1]</a>:</p>
     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">&lt;</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id83" id="id44" name="id44">[1]</a>:</p>
    11561163<pre class="literal-block">
    11571164$(int-lt val1, val2)
    11581165</pre>
    1159 <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">&lt;=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id82" id="id44" name="id44">[1]</a>:</p>
     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">&lt;=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id83" id="id45" name="id45">[1]</a>:</p>
    11601167<pre class="literal-block">
    11611168$(int-le val1, val2)
     
    11811188</pre>
    11821189<p>Test if the two strings are identical, returning <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true =
    1183 non-empty, false = empty) <a class="footnote-reference" href="#id83" id="id45" name="id45">[2]</a>:</p>
     1190non-empty, false = empty) <a class="footnote-reference" href="#id84" id="id46" name="id46">[2]</a>:</p>
    11841191<pre class="literal-block">
    11851192$(eq str1, str2)
    11861193</pre>
    1187 <p>Invert a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id83" id="id46" name="id46">[2]</a>:</p>
     1194<p>Invert a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id84" id="id47" name="id47">[2]</a>:</p>
    11881195<pre class="literal-block">
    11891196$(not val)
    11901197</pre>
    1191 <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="#id82" id="id47" name="id47">[1]</a>:</p>
     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="#id83" id="id48" name="id48">[1]</a>:</p>
    11921199<pre class="literal-block">
    11931200$(defined variable)
    11941201</pre>
    11951202<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
    1196 value <a class="footnote-reference" href="#id82" id="id48" name="id48">[1]</a>:</p>
     1203value <a class="footnote-reference" href="#id83" id="id49" name="id49">[1]</a>:</p>
    11971204<pre class="literal-block">
    11981205$(intersects set-a, set-b)
    11991206</pre>
    1200 <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="#id82" id="id49" name="id49">[1]</a>:</p>
     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="#id83" id="id50" name="id50">[1]</a>:</p>
    12011208<pre class="literal-block">
    12021209$(if-expr kmk-expression,true-part[,false-part])
     
    12041211<p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) and expand the
    12051212following body. Special condition strings <tt class="docutils literal"><span class="pre">default</span></tt> and
    1206 <tt class="docutils literal"><span class="pre">otherwise</span></tt> <a class="footnote-reference" href="#id82" id="id50" name="id50">[1]</a>:</p>
     1213<tt class="docutils literal"><span class="pre">otherwise</span></tt> <a class="footnote-reference" href="#id83" id="id51" name="id51">[1]</a>:</p>
    12071214<pre class="literal-block">
    12081215$(select when1-cond, when1-body[, whenN-cond, whenN-body])
    12091216</pre>
    12101217<p>Evalutate the <tt class="docutils literal"><span class="pre">kmk-expression</span></tt> returning what it evalues as. This is
    1211 the preferred way of doing arithmentic now <a class="footnote-reference" href="#id82" id="id51" name="id51">[1]</a>:</p>
     1218the preferred way of doing arithmentic now <a class="footnote-reference" href="#id83" id="id52" name="id52">[1]</a>:</p>
    12121219<pre class="literal-block">
    12131220$(expr kmk-expression)
     
    12161223<p>Stack Fuctions:</p>
    12171224<blockquote>
    1218 <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="#id82" id="id52" name="id52">[1]</a>:</p>
     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="#id83" id="id53" name="id53">[1]</a>:</p>
    12191226<pre class="literal-block">
    12201227$(stack-push stack-var, item)
    12211228</pre>
    1222 <p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt> <a class="footnote-reference" href="#id82" id="id53" name="id53">[1]</a>:</p>
     1229<p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt> <a class="footnote-reference" href="#id83" id="id54" name="id54">[1]</a>:</p>
    12231230<pre class="literal-block">
    12241231$(stack-pop stack-var)
    12251232</pre>
    1226 <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="#id82" id="id54" name="id54">[1]</a>:</p>
     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="#id83" id="id55" name="id55">[1]</a>:</p>
    12271234<pre class="literal-block">
    12281235$(stack-popv stack-var)
    12291236</pre>
    1230 <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="#id82" id="id55" name="id55">[1]</a>:</p>
     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="#id83" id="id56" name="id56">[1]</a>:</p>
    12311238<pre class="literal-block">
    12321239$(stack-top stack-var)
     
    12481255first 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,
    12491256then expand <tt class="docutils literal"><span class="pre">body</span></tt> concatenating the result to the previous iterations
    1250 (spaced), and finally evaluate <tt class="docutils literal"><span class="pre">next</span></tt> <a class="footnote-reference" href="#id82" id="id56" name="id56">[1]</a>:</p>
     1257(spaced), and finally evaluate <tt class="docutils literal"><span class="pre">next</span></tt> <a class="footnote-reference" href="#id83" id="id57" name="id57">[1]</a>:</p>
    12511258<pre class="literal-block">
    12521259$(for init,conditions,next,body)
     
    12541261<p>C-style while-loop. Each iteration will check whether the <tt class="docutils literal"><span class="pre">condition</span></tt>
    12551262(<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
    1256 result to the previous iterations <a class="footnote-reference" href="#id82" id="id57" name="id57">[1]</a>:</p>
     1263result to the previous iterations <a class="footnote-reference" href="#id83" id="id58" name="id58">[1]</a>:</p>
    12571264<pre class="literal-block">
    12581265$(while conditions,body)
     
    12691276</pre>
    12701277<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
    1271 own variable context <a class="footnote-reference" href="#id82" id="id58" name="id58">[1]</a>:</p>
     1278own variable context <a class="footnote-reference" href="#id83" id="id59" name="id59">[1]</a>:</p>
    12721279<pre class="literal-block">
    12731280$(evalctx text)
    12741281</pre>
    1275 <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="#id82" id="id59" name="id59">[1]</a>:</p>
     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="#id83" id="id60" name="id60">[1]</a>:</p>
    12761283<pre class="literal-block">
    12771284$(evalval var)
    12781285</pre>
    1279 <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="#id82" id="id60" name="id60">[1]</a>:</p>
     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="#id83" id="id61" name="id61">[1]</a>:</p>
    12801287<pre class="literal-block">
    12811288$(evalvalctx var)
    12821289</pre>
    1283 <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="#id82" id="id61" name="id61">[1]</a>:</p>
     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="#id83" id="id62" name="id62">[1]</a>:</p>
    12841291<pre class="literal-block">
    12851292$(evalcall var)
    12861293</pre>
    1287 <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="#id82" id="id62" name="id62">[1]</a>:</p>
     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="#id83" id="id63" name="id63">[1]</a>:</p>
    12881295<pre class="literal-block">
    12891296$(evalcall var)
    12901297</pre>
    12911298<p>Remove comments and blank lines from the variable <tt class="docutils literal"><span class="pre">var</span></tt>. Expands to
    1292 the empty string <a class="footnote-reference" href="#id82" id="id63" name="id63">[1]</a>:</p>
     1299the empty string <a class="footnote-reference" href="#id83" id="id64" name="id64">[1]</a>:</p>
    12931300<pre class="literal-block">
    12941301$(eval-opt-var var)
    12951302</pre>
    12961303<p>Returns accessing <tt class="docutils literal"><span class="pre">$&lt;</span></tt> of <tt class="docutils literal"><span class="pre">target</span></tt>, either retriving the whole thing
    1297 or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id82" id="id64" name="id64">[1]</a>:</p>
     1304or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id83" id="id65" name="id65">[1]</a>:</p>
    12981305<pre class="literal-block">
    12991306$(deps target[, pos])
    13001307</pre>
    13011308<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
    1302 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="#id82" id="id65" name="id65">[1]</a>:</p>
     1309retriving the whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id83" id="id66" name="id66">[1]</a>:</p>
    13031310<pre class="literal-block">
    13041311$(deps-all target[, pos])
    13051312</pre>
    13061313<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
    1307 thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id82" id="id66" name="id66">[1]</a>:</p>
     1314thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id83" id="id67" name="id67">[1]</a>:</p>
    13081315<pre class="literal-block">
    13091316$(deps-newer target[, pos])
    13101317</pre>
    13111318<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
    1312 whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id82" id="id67" name="id67">[1]</a>:</p>
     1319whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id83" id="id68" name="id68">[1]</a>:</p>
    13131320<pre class="literal-block">
    13141321$(deps-oo target[, pos])
     
    13181325<blockquote>
    13191326<p>Create one or more command lines avoiding the max argument
    1320 length restriction of the host OS <a class="footnote-reference" href="#id82" id="id68" name="id68">[1]</a>:</p>
     1327length restriction of the host OS <a class="footnote-reference" href="#id83" id="id69" name="id69">[1]</a>:</p>
    13211328<pre class="literal-block">
    13221329$(xargs ar cas mylib.a,$(objects))
     
    13251332<p>Returns the commands for the specified target separated by new-line, space,
    13261333or a user defined string. Note that this might not produce the 100% correct
    1327 result if any of the prerequisite automatic variables are used <a class="footnote-reference" href="#id82" id="id69" name="id69">[1]</a>:</p>
     1334result if any of the prerequisite automatic variables are used <a class="footnote-reference" href="#id83" id="id70" name="id70">[1]</a>:</p>
    13281335<pre class="literal-block">
    13291336$(commands target)
     
    13341341argument 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
    13351342line by line is stripped of leading spaces, command prefixes and
    1336 trailing spaces before comparing <a class="footnote-reference" href="#id82" id="id70" name="id70">[1]</a>:</p>
     1343trailing spaces before comparing <a class="footnote-reference" href="#id83" id="id71" name="id71">[1]</a>:</p>
    13371344<pre class="literal-block">
    13381345$(comp-cmds cmds-var1, cmds-var2, ne)
     
    13411348<p>Compares the values of the two variables returning the empty string if
    13421349equal and the 3rd argument if not. Leading and trailing spaces is
    1343 ignored <a class="footnote-reference" href="#id82" id="id71" name="id71">[1]</a>:</p>
     1350ignored <a class="footnote-reference" href="#id83" id="id72" name="id72">[1]</a>:</p>
    13441351<pre class="literal-block">
    13451352$(comp-var var1, var2, ne)
     
    13771384<p>Returns the current local time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt>
    13781385style 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
    1379 not specified <a class="footnote-reference" href="#id82" id="id72" name="id72">[1]</a>:</p>
     1386not specified <a class="footnote-reference" href="#id83" id="id73" name="id73">[1]</a>:</p>
    13801387<pre class="literal-block">
    13811388$(date fmt)
     
    13831390<p>Returns the current UTC time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt>
    13841391style 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
    1385 not specified <a class="footnote-reference" href="#id82" id="id73" name="id73">[1]</a>:</p>
     1392not specified <a class="footnote-reference" href="#id83" id="id74" name="id74">[1]</a>:</p>
    13861393<pre class="literal-block">
    13871394$(date-utc fmt)
     
    13891396<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
    13901397to <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
    1391 <tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> if not specified <a class="footnote-reference" href="#id82" id="id74" name="id74">[1]</a>:</p>
     1398<tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> if not specified <a class="footnote-reference" href="#id83" id="id75" name="id75">[1]</a>:</p>
    13921399<pre class="literal-block">
    13931400$(date-utc fmt,time,in-fmt)
    13941401</pre>
    1395 <p>Returns the current nanosecond timestamp (monotonic when possible) <a class="footnote-reference" href="#id82" id="id75" name="id75">[1]</a>:</p>
     1402<p>Returns the current nanosecond timestamp (monotonic when possible) <a class="footnote-reference" href="#id83" id="id76" name="id76">[1]</a>:</p>
    13961403<pre class="literal-block">
    13971404$(nanots )
    13981405</pre>
    13991406<p>Returns the size of the specified file, or -1 if the size could not
    1400 be obtained. This can be used to check if a file exist or not <a class="footnote-reference" href="#id82" id="id76" name="id76">[1]</a>:</p>
     1407be obtained. This can be used to check if a file exist or not <a class="footnote-reference" href="#id83" id="id77" name="id77">[1]</a>:</p>
    14011408<pre class="literal-block">
    14021409$(file-size file)
    14031410</pre>
    1404 <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="#id82" id="id77" name="id77">[1]</a>:</p>
     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="#id83" id="id78" name="id78">[1]</a>:</p>
    14051412<pre class="literal-block">
    14061413$(which files...)
    14071414</pre>
    1408 <p>OS/2: Returns the specified LIBPATH variable value <a class="footnote-reference" href="#id82" id="id78" name="id78">[1]</a>:</p>
     1415<p>OS/2: Returns the specified LIBPATH variable value <a class="footnote-reference" href="#id83" id="id79" name="id79">[1]</a>:</p>
    14091416<pre class="literal-block">
    14101417$(libpath var)
    14111418</pre>
    14121419<p>OS/2: Sets the specified LIBPATH variable value, returning the empty
    1413 string <a class="footnote-reference" href="#id82" id="id79" name="id79">[1]</a>:</p>
     1420string <a class="footnote-reference" href="#id83" id="id80" name="id80">[1]</a>:</p>
    14141421<pre class="literal-block">
    14151422$(libpath var,value)
     
    14191426<blockquote>
    14201427<p>Returns various make statistics, if no item is specified a default
    1421 selection is returned <a class="footnote-reference" href="#id82" id="id80" name="id80">[1]</a>:</p>
     1428selection is returned <a class="footnote-reference" href="#id83" id="id81" name="id81">[1]</a>:</p>
    14221429<pre class="literal-block">
    14231430$(make-stats item[,itemN])
    14241431</pre>
    14251432<p>Raise a debug breakpoint. Used for debugging <tt class="docutils literal"><span class="pre">kmk</span></tt> makefile
    1426 parsing <a class="footnote-reference" href="#id82" id="id81" name="id81">[1]</a>:</p>
     1433parsing <a class="footnote-reference" href="#id83" id="id82" name="id82">[1]</a>:</p>
    14271434<pre class="literal-block">
    14281435$(breakpoint )
     
    14301437</blockquote>
    14311438<hr class="docutils" />
    1432 <table class="docutils footnote" frame="void" id="id82" rules="none">
    1433 <colgroup><col class="label" /><col /></colgroup>
    1434 <tbody valign="top">
    1435 <tr><td class="label"><a name="id82">[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="#id47">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>)</em> <tt class="docutils literal"><span class="pre">kmk</span></tt> only feature.</td></tr>
    1436 </tbody>
    1437 </table>
    14381439<table class="docutils footnote" frame="void" id="id83" rules="none">
    14391440<colgroup><col class="label" /><col /></colgroup>
    14401441<tbody valign="top">
    1441 <tr><td class="label"><a name="id83">[2]</a></td><td><em>(<a class="fn-backref" href="#id45">1</a>, <a class="fn-backref" href="#id46">2</a>)</em> Experimental GNU <tt class="docutils literal"><span class="pre">make</span></tt> feature that is not enabled by default.</td></tr>
     1442<tr><td class="label"><a name="id83">[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>)</em> <tt class="docutils literal"><span class="pre">kmk</span></tt> only feature.</td></tr>
     1443</tbody>
     1444</table>
     1445<table class="docutils footnote" frame="void" id="id84" rules="none">
     1446<colgroup><col class="label" /><col /></colgroup>
     1447<tbody valign="top">
     1448<tr><td class="label"><a name="id84">[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>
    14421449</tbody>
    14431450</table>
  • trunk/kBuild/doc/QuickReference-kmk.txt

    r2171 r2172  
    605605        $(basename names...)
    606606
     607    Extract the root specification of each file name (a bit complicated on
     608    Windows & OS/2) [1]_::
     609
     610        $(root names...)
     611
    607612    Append ``suffix`` to each word in ``names``::
    608613
  • trunk/src/kmk/Makefile.am

    r2161 r2172  
    145145        -DCONFIG_WITH_STRING_FUNCTIONS \
    146146        -DCONFIG_WITH_LOOP_FUNCTIONS \
     147        -DCONFIG_WITH_ROOT_FUNC \
    147148        -DCONFIG_PRETTY_COMMAND_PRINTING \
    148149        -DCONFIG_WITH_PRINT_STATS_SWITCH \
  • trunk/src/kmk/Makefile.kmk

    r2161 r2172  
    171171        CONFIG_WITH_STRING_FUNCTIONS \
    172172        CONFIG_WITH_LOOP_FUNCTIONS \
     173        CONFIG_WITH_ROOT_FUNC \
    173174        CONFIG_PRETTY_COMMAND_PRINTING \
    174175        CONFIG_WITH_PRINT_STATS_SWITCH \
  • trunk/src/kmk/function.c

    r2163 r2172  
    808808}
    809809
     810#ifdef CONFIG_WITH_ROOT_FUNC
     811/*
     812 $(root path)
     813
     814 This is mainly for dealing with drive letters and UNC paths on Windows
     815 and OS/2.
     816 */
     817static char *
     818func_root (char *o, char **argv, const char *funcname UNUSED)
     819{
     820  const char  *paths = argv[0] ? argv[0] : "";
     821  int          doneany = 0;
     822  const char  *p;
     823  unsigned int len;
     824
     825  while ((p = find_next_token (&paths, &len)) != 0)
     826    {
     827      const char *p2 = p;
     828
     829#ifdef HAVE_DOS_PATHS
     830      if (   len >= 2
     831          && p2[1] == ':'
     832          && (   (p2[0] >= 'A' && p2[0] <= 'Z')
     833              || (p2[0] >= 'a' && p2[0] <= 'z')))
     834        {
     835          p2 += 2;
     836          len -= 2;
     837        }
     838      else if (len >= 4 && IS_PATHSEP(p2[0]) && IS_PATHSEP(p2[1])
     839               && !IS_PATHSEP(p2[2]))
     840        {
     841          /* Min recognized UNC: "//./" - find the next slash
     842             Typical root: "//srv/shr/" */
     843          /* XXX: Check if //./ needs special handling. */
     844
     845          p2 += 3;
     846          len -= 3;
     847          while (len > 0 && !IS_PATHSEP(*p2))
     848            p2++, len--;
     849
     850          if (len && IS_PATHSEP(p2[0]) && (len == 1 || !IS_PATHSEP(p2[1])))
     851            {
     852              p2++;
     853              len--;
     854
     855              if (len) /* optional share */
     856                while (len > 0 && !IS_PATHSEP(*p2))
     857                  p2++, len--;
     858            }
     859          else
     860            p2 = NULL;
     861        }
     862      else if (IS_PATHSEP(*p2))
     863        {
     864          p2++;
     865          len--;
     866        }
     867      else
     868        p2 = NULL;
     869
     870#elif defined (VMS) || defined (AMGIA)
     871      /* XXX: VMS and AMGIA */
     872      fatal (NILF, _("$(root ) is not implemented on this platform"));
     873#else
     874      if (IS_PATHSEP(*p2))
     875        {
     876          p2++;
     877          len--;
     878        }
     879      else
     880        p2 = NULL;
     881#endif
     882      if (p2 != NULL)
     883        {
     884          /* Include all subsequent path seperators. */
     885
     886          while (len > 0 && IS_PATHSEP(*p2))
     887            p2++, len--;
     888          o = variable_buffer_output (o, p, p2 - p);
     889          o = variable_buffer_output (o, " ", 1);
     890          doneany = 1;
     891        }
     892    }
     893
     894  if (doneany)
     895    /* Kill last space.  */
     896    --o;
     897
     898  return o;
     899}
     900#endif /* CONFIG_WITH_ROOT_FUNC */
     901
    810902static char *
    811903func_addsuffix_addprefix (char *o, char **argv, const char *funcname)
     
    49715063  { STRING_SIZE_TUPLE("dir"),           0,  1,  1,  func_basename_dir},
    49725064  { STRING_SIZE_TUPLE("notdir"),        0,  1,  1,  func_notdir_suffix},
     5065#ifdef CONFIG_WITH_ROOT_FUNC
     5066  { STRING_SIZE_TUPLE("root"),          0,  1,  1,  func_root},
     5067#endif
    49735068  { STRING_SIZE_TUPLE("subst"),         3,  3,  1,  func_subst},
    49745069  { STRING_SIZE_TUPLE("suffix"),        0,  1,  1,  func_notdir_suffix},
  • trunk/src/kmk/variable.c

    r2164 r2172  
    12071207  && defined (CONFIG_WITH_PRINTF) \
    12081208  && defined (CONFIG_WITH_LOOP_FUNCTIONS) \
     1209  && defined (CONFIG_WITH_ROOT_FUNC) \
    12091210  && defined (CONFIG_WITH_STRING_FUNCTIONS) \
    12101211  && defined (KMK_HELPERS)
     
    12321233                          " printf"
    12331234                          " for while"
     1235                          " root"
    12341236                          " length insert pos lastpos substr translate"
    12351237                          " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one kb-exp-tmpl "
     
    13011303  strcat (buf, " for while");
    13021304#  endif
     1305#  if defined (CONFIG_WITH_ROOT_FUNC)
     1306  strcat (buf, " root");
     1307#  endif
    13031308#  if defined (CONFIG_WITH_STRING_FUNCTIONS)
    13041309  strcat (buf, " length insert pos lastpos substr translate");
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette