Changeset 2170 in kBuild
- Timestamp:
- Dec 30, 2008 8:39:35 PM (16 years ago)
- Location:
- trunk/kBuild/doc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/doc/QuickReference-kmk.html
r2169 r2170 297 297 Since <em>all</em> the features are included, the quickness of this reference can be 298 298 disputed. ;-)</p> 299 <p>Features that are</p>300 299 <div class="section"> 301 300 <h1><a id="directives" name="directives">Directives</a></h1> … … 329 328 sinclude file 330 329 </pre> 331 <p>Include another dependency file <a class="footnote-reference" href="#id 15" id="id1" name="id1">[1]</a>:</p>330 <p>Include another dependency file <a class="footnote-reference" href="#id80" id="id1" name="id1">[1]</a>:</p> 332 331 <pre class="literal-block"> 333 332 includedep file … … 359 358 unexport variable 360 359 </pre> 361 <p>Define a variable in the local context instead of the global one <a class="footnote-reference" href="#id 15" 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="#id80" id="id2" name="id2">[1]</a>:</p> 362 361 <pre class="literal-block"> 363 362 local variable = value … … 510 509 <tt class="docutils literal"><span class="pre">KBUILD_KMK_REVISION</span></tt></td> 511 510 <td>The kBuild version string and the break down 512 into individual components. <a class="footnote-reference" href="#id 15" id="id3" name="id3">[1]</a></td>513 </tr> 514 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST</span></tt> <a class="footnote-reference" href="#id 15" id="id4" name="id4">[1]</a></td>511 into individual components. <a class="footnote-reference" href="#id80" 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="#id80" id="id4" name="id4">[1]</a></td> 515 514 <td>The host operating system.</td> 516 515 </tr> 517 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_ARCH</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id5" name="id5">[1]</a></td> 518 517 <td>The host architecture.</td> 519 518 </tr> 520 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_CPU</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id6" name="id6">[1]</a></td> 521 520 <td>The host CPU <tt class="docutils literal"><span class="pre">kmk</span></tt> is built for, set to 522 521 <tt class="docutils literal"><span class="pre">blend</span></tt> if not any particular CPU.</td> 523 522 </tr> 524 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_PATH</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id7" name="id7">[1]</a></td> 525 524 <td>Where the kBuild scripts are.</td> 526 525 </tr> 527 <tr><td><tt class="docutils literal"><span class="pre">KBUILD_BIN_PATH</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id8" name="id8">[1]</a></td> 528 527 <td>Where the host specific kBuild binaries are.</td> 529 528 </tr> 530 <tr><td><tt class="docutils literal"><span class="pre">KMK</span></tt> <a class="footnote-reference" href="#id 15" id="id9" name="id9">[1]</a>,529 <tr><td><tt class="docutils literal"><span class="pre">KMK</span></tt> <a class="footnote-reference" href="#id80" id="id9" name="id9">[1]</a>, 531 530 <tt class="docutils literal"><span class="pre">MAKE</span></tt></td> 532 531 <td>The name with which <tt class="docutils literal"><span class="pre">kmk</span></tt> was invoked. Using 533 532 this variable in recipes has special meaning.</td> 534 533 </tr> 535 <tr><td><tt class="docutils literal"><span class="pre">KMK_BUILTIN</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id10" name="id10">[1]</a></td> 536 535 <td>List of built-in commands.</td> 537 536 </tr> 538 <tr><td><tt class="docutils literal"><span class="pre">KMK_FEATURES</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id11" name="id11">[1]</a></td> 539 538 <td>List of <tt class="docutils literal"><span class="pre">kmk</span></tt> specific features.</td> 540 539 </tr> 541 <tr><td><tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id12" name="id12">[1]</a></td> 542 541 <td><p class="first">The flags given to <tt class="docutils literal"><span class="pre">kmk</span></tt>. You can set this in 543 542 the environment or a makefile to set flags.</p> … … 549 548 </td> 550 549 </tr> 551 <tr><td><tt class="docutils literal"><span class="pre">KMK_LEVEL</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id13" name="id13">[1]</a></td> 552 551 <td>The number of levels of recursion (sub-makes).</td> 553 552 </tr> 554 <tr><td><tt class="docutils literal"><span class="pre">KMK_VERSION</span></tt> <a class="footnote-reference" href="#id 15" 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="#id80" id="id14" name="id14">[1]</a></td> 555 554 <td>The GNU <tt class="docutils literal"><span class="pre">make</span></tt> version number.</td> 556 555 </tr> … … 588 587 </tbody> 589 588 </table> 590 <p>The following variables reflects <tt class="docutils literal"><span class="pre">kmk</span></tt> options. Do not set these. </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="#id80" id="id15" name="id15">[1]</a></p> 591 590 <table border="1" class="docutils"> 592 591 <colgroup> … … 633 632 <div class="section"> 634 633 <h1><a id="commands" name="commands">Commands</a></h1> 635 <p>Builtin commands all start with <tt class="docutils literal"><span class="pre">kmk_builtin_</span></tt>, so in order to save space636 this prefix has been omitted in the table below. All commands comes in an634 <p>Builtin commands <a class="footnote-reference" href="#id80" id="id16" name="id16">[1]</a> all start with <tt class="docutils literal"><span class="pre">kmk_builtin_</span></tt>, so in order to save 635 space this prefix has been omitted in the table below. All commands comes in an 637 636 external edition that can be used by/in the shell, these are prefixed <tt class="docutils literal"><span class="pre">kmk_</span></tt>.</p> 638 637 <table border="1" class="docutils"> … … 744 743 <div class="section"> 745 744 <h1><a id="kmk-expression" name="kmk-expression">kmk-expression</a></h1> 746 <p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions are related to the C/C++ preprocessor in some ways as well 747 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 because of 748 the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function library, so, 749 strings can be turned into boolean by taking any non-empty string as true.</p> 745 <p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions <a class="footnote-reference" href="#id80" id="id17" name="id17">[1]</a> are related to the C/C++ preprocessor in some ways as 746 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 747 because of the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function 748 library, so, strings can be turned into boolean by taking any non-empty string 749 as true.</p> 750 750 <p>Quoting using single quotes results in hard strings, while double quotes and 751 751 unquoted string results in soft strings that can be converted to number or … … 897 897 </pre> 898 898 <p>Sort the words in <tt class="docutils literal"><span class="pre">list</span></tt> lexicographically in reserve order, removing 899 duplicates :</p>899 duplicates <a class="footnote-reference" href="#id80" id="id18" name="id18">[1]</a>:</p> 900 900 <pre class="literal-block"> 901 901 $(rsort list) … … 925 925 $(join list1,list2) 926 926 </pre> 927 <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to upper case :</p>927 <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to upper case <a class="footnote-reference" href="#id80" id="id19" name="id19">[1]</a>:</p> 928 928 <pre class="literal-block"> 929 929 $(toupper text) 930 930 </pre> 931 <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to lower case :</p>931 <p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to lower case <a class="footnote-reference" href="#id80" id="id20" name="id20">[1]</a>:</p> 932 932 <pre class="literal-block"> 933 933 $(tolower text) 934 934 </pre> 935 <p>String formatting a la the unix <tt class="docutils literal"><span class="pre">printf</span></tt> command :</p>935 <p>String formatting a la the unix <tt class="docutils literal"><span class="pre">printf</span></tt> command <a class="footnote-reference" href="#id80" id="id21" name="id21">[1]</a>:</p> 936 936 <pre class="literal-block"> 937 937 $(printf fmt, arg...) 938 938 </pre> 939 <p>Return the length of a string or a (unexpanded) variable :</p>939 <p>Return the length of a string or a (unexpanded) variable <a class="footnote-reference" href="#id80" id="id22" name="id22">[1]</a>:</p> 940 940 <pre class="literal-block"> 941 941 $(length string) … … 944 944 <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. 945 945 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 946 positive ones are one based :</p>946 positive ones are one based <a class="footnote-reference" href="#id80" id="id23" name="id23">[1]</a>:</p> 947 947 <pre class="literal-block"> 948 948 $(pos needle, haystack[, start]) … … 951 951 <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>. 952 952 If the substring is partially outside the <tt class="docutils literal"><span class="pre">string</span></tt> the result will be 953 padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present :</p>953 padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present <a class="footnote-reference" href="#id80" id="id24" name="id24">[1]</a>:</p> 954 954 <pre class="literal-block"> 955 955 $(substr string, start[, length[, pad]]) 956 956 </pre> 957 957 <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 958 <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 :</p>958 <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="#id80" id="id25" name="id25">[1]</a>:</p> 959 959 <pre class="literal-block"> 960 960 $(insert in, str[, n[, length[, pad]]]) … … 962 962 <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>, 963 963 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 964 <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 :</p>964 <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="#id80" id="id26" name="id26">[1]</a>:</p> 965 965 <pre class="literal-block"> 966 966 $(translate string, from-set[, to-set[, pad-char]]) … … 1010 1010 </pre> 1011 1011 <p>Same as <tt class="docutils literal"><span class="pre">$(abspath</span> <span class="pre">)</span></tt> except that the current directory can be 1012 specified as <tt class="docutils literal"><span class="pre">curdir</span></tt> :</p>1012 specified as <tt class="docutils literal"><span class="pre">curdir</span></tt> <a class="footnote-reference" href="#id80" id="id27" name="id27">[1]</a>:</p> 1013 1013 <pre class="literal-block"> 1014 1014 $(abspathex names...[, curdir]) … … 1017 1017 <p>Arithmetic Functions:</p> 1018 1018 <blockquote> 1019 <p>Returns the sum of the arguments :</p>1019 <p>Returns the sum of the arguments <a class="footnote-reference" href="#id80" id="id28" name="id28">[1]</a>:</p> 1020 1020 <pre class="literal-block"> 1021 1021 $(int-add addend1, addend2[, addendN]) 1022 1022 </pre> 1023 <p>Returns the difference between the first argument and the sum of the rest:</p> 1023 <p>Returns the difference between the first argument and the sum of the 1024 rest <a class="footnote-reference" href="#id80" id="id29" name="id29">[1]</a>:</p> 1024 1025 <pre class="literal-block"> 1025 1026 $(int-sub minuend, subtrahend[, subtrahendN]) 1026 1027 </pre> 1027 <p>Returns the product of the arguments :</p>1028 <p>Returns the product of the arguments <a class="footnote-reference" href="#id80" id="id30" name="id30">[1]</a>:</p> 1028 1029 <pre class="literal-block"> 1029 1030 $(int-mul factor1, factor2[, factorN]) 1030 1031 </pre> 1031 <p>Returns the quotient of first argument and the rest :</p>1032 <p>Returns the quotient of first argument and the rest <a class="footnote-reference" href="#id80" id="id31" name="id31">[1]</a>:</p> 1032 1033 <pre class="literal-block"> 1033 1034 $(int-div dividend, divisor[, divisorN]) 1034 1035 </pre> 1035 <p>Returns the modulus of the two arguments :</p>1036 <p>Returns the modulus of the two arguments <a class="footnote-reference" href="#id80" id="id32" name="id32">[1]</a>:</p> 1036 1037 <pre class="literal-block"> 1037 1038 $(int-mod dividend, divisor) 1038 1039 </pre> 1039 <p>Returns the bitwise two-complement of argument :</p>1040 <p>Returns the bitwise two-complement of argument <a class="footnote-reference" href="#id80" id="id33" name="id33">[1]</a>:</p> 1040 1041 <pre class="literal-block"> 1041 1042 $(int-not val) 1042 1043 </pre> 1043 <p>Returns the result of a bitwise AND of the arguments :</p>1044 <p>Returns the result of a bitwise AND of the arguments <a class="footnote-reference" href="#id80" id="id34" name="id34">[1]</a>:</p> 1044 1045 <pre class="literal-block"> 1045 1046 $(int-and val1, val2[, valN]) 1046 1047 </pre> 1047 <p>Returns the result of a bitwise OR of the arguments :</p>1048 <p>Returns the result of a bitwise OR of the arguments <a class="footnote-reference" href="#id80" id="id35" name="id35">[1]</a>:</p> 1048 1049 <pre class="literal-block"> 1049 1050 $(int-or val1, val2[, valN]) 1050 1051 </pre> 1051 <p>Returns the result of a bitwise XOR of the arguments :</p>1052 <p>Returns the result of a bitwise XOR of the arguments <a class="footnote-reference" href="#id80" id="id36" name="id36">[1]</a>:</p> 1052 1053 <pre class="literal-block"> 1053 1054 $(int-xor val1, val2[, valN]) 1054 1055 </pre> 1055 1056 <p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true = non-empty, false = empty) result 1056 of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">==</span> <span class="pre">val2</span></tt> :</p>1057 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="#id80" id="id37" name="id37">[1]</a>:</p> 1057 1058 <pre class="literal-block"> 1058 1059 $(int-eq val1, val2) 1059 1060 </pre> 1060 <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> :</p>1061 <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="#id80" id="id38" name="id38">[1]</a>:</p> 1061 1062 <pre class="literal-block"> 1062 1063 $(int-ne val1, val2) 1063 1064 </pre> 1064 <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> :</p>1065 <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="#id80" id="id39" name="id39">[1]</a>:</p> 1065 1066 <pre class="literal-block"> 1066 1067 $(int-gt val1, val2) 1067 1068 </pre> 1068 <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> :</p>1069 <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="#id80" id="id40" name="id40">[1]</a>:</p> 1069 1070 <pre class="literal-block"> 1070 1071 $(int-ge val1, val2) 1071 1072 </pre> 1072 <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> :</p>1073 <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="#id80" id="id41" name="id41">[1]</a>:</p> 1073 1074 <pre class="literal-block"> 1074 1075 $(int-lt val1, val2) 1075 1076 </pre> 1076 <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> :</p>1077 <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="#id80" id="id42" name="id42">[1]</a>:</p> 1077 1078 <pre class="literal-block"> 1078 1079 $(int-le val1, val2) … … 1098 1099 </pre> 1099 1100 <p>Test if the two strings are identical, returning <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true = 1100 non-empty, false = empty) :</p>1101 non-empty, false = empty) <a class="footnote-reference" href="#id81" id="id43" name="id43">[2]</a>:</p> 1101 1102 <pre class="literal-block"> 1102 1103 $(eq str1, str2) 1103 1104 </pre> 1104 <p>Invert a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value :</p>1105 <p>Invert a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id81" id="id44" name="id44">[2]</a>:</p> 1105 1106 <pre class="literal-block"> 1106 1107 $(not val) 1107 1108 </pre> 1108 <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 :</p>1109 <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="#id80" id="id45" name="id45">[1]</a>:</p> 1109 1110 <pre class="literal-block"> 1110 1111 $(defined variable) 1111 1112 </pre> 1112 1113 <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 1113 value :</p>1114 value <a class="footnote-reference" href="#id80" id="id46" name="id46">[1]</a>:</p> 1114 1115 <pre class="literal-block"> 1115 1116 $(intersects set-a, set-b) 1116 1117 </pre> 1117 <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 :</p>1118 <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="#id80" id="id47" name="id47">[1]</a>:</p> 1118 1119 <pre class="literal-block"> 1119 1120 $(if-expr kmk-expression,true-part[,false-part]) 1120 1121 </pre> 1121 1122 <p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) and expand the 1122 following body. Special condition strings <tt class="docutils literal"><span class="pre">default</span></tt> and <tt class="docutils literal"><span class="pre">otherwise</span></tt>:</p> 1123 following body. Special condition strings <tt class="docutils literal"><span class="pre">default</span></tt> and 1124 <tt class="docutils literal"><span class="pre">otherwise</span></tt> <a class="footnote-reference" href="#id80" id="id48" name="id48">[1]</a>:</p> 1123 1125 <pre class="literal-block"> 1124 1126 $(select when1-cond, when1-body[, whenN-cond, whenN-body]) 1125 1127 </pre> 1126 1128 <p>Evalutate the <tt class="docutils literal"><span class="pre">kmk-expression</span></tt> returning what it evalues as. This is 1127 the preferred way of doing arithmentic now :</p>1129 the preferred way of doing arithmentic now <a class="footnote-reference" href="#id80" id="id49" name="id49">[1]</a>:</p> 1128 1130 <pre class="literal-block"> 1129 1131 $(expr kmk-expression) … … 1132 1134 <p>Stack Fuctions:</p> 1133 1135 <blockquote> 1134 <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 :</p>1136 <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="#id80" id="id50" name="id50">[1]</a>:</p> 1135 1137 <pre class="literal-block"> 1136 1138 $(stack-push stack-var, item) 1137 1139 </pre> 1138 <p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt> :</p>1140 <p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt> <a class="footnote-reference" href="#id80" id="id51" name="id51">[1]</a>:</p> 1139 1141 <pre class="literal-block"> 1140 1142 $(stack-pop stack-var) 1141 1143 </pre> 1142 <p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string :</p>1144 <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="#id80" id="id52" name="id52">[1]</a>:</p> 1143 1145 <pre class="literal-block"> 1144 1146 $(stack-popv stack-var) 1145 1147 </pre> 1146 <p>Get the top item of the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string :</p>1148 <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="#id80" id="id53" name="id53">[1]</a>:</p> 1147 1149 <pre class="literal-block"> 1148 1150 $(stack-top stack-var) … … 1164 1166 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, 1165 1167 then expand <tt class="docutils literal"><span class="pre">body</span></tt> concatenating the result to the previous iterations 1166 (spaced), and finally evaluate <tt class="docutils literal"><span class="pre">next</span></tt> :</p>1168 (spaced), and finally evaluate <tt class="docutils literal"><span class="pre">next</span></tt> <a class="footnote-reference" href="#id80" id="id54" name="id54">[1]</a>:</p> 1167 1169 <pre class="literal-block"> 1168 1170 $(for init,conditions,next,body) … … 1170 1172 <p>C-style while-loop. Each iteration will check whether the <tt class="docutils literal"><span class="pre">condition</span></tt> 1171 1173 (<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 1172 result to the previous iterations :</p>1174 result to the previous iterations <a class="footnote-reference" href="#id80" id="id55" name="id55">[1]</a>:</p> 1173 1175 <pre class="literal-block"> 1174 1176 $(while conditions,body) … … 1185 1187 </pre> 1186 1188 <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 1187 own variable context :</p>1189 own variable context <a class="footnote-reference" href="#id80" id="id56" name="id56">[1]</a>:</p> 1188 1190 <pre class="literal-block"> 1189 1191 $(evalctx text) 1190 1192 </pre> 1191 <p>Same as <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">$(value</span> <span class="pre">var))</span></tt> :</p>1193 <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="#id80" id="id57" name="id57">[1]</a>:</p> 1192 1194 <pre class="literal-block"> 1193 1195 $(evalval var) 1194 1196 </pre> 1195 <p>Same as <tt class="docutils literal"><span class="pre">$(evalctx</span> <span class="pre">$(value</span> <span class="pre">var))</span></tt> :</p>1197 <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="#id80" id="id58" name="id58">[1]</a>:</p> 1196 1198 <pre class="literal-block"> 1197 1199 $(evalvalctx var) 1198 1200 </pre> 1199 <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> :</p>1201 <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="#id80" id="id59" name="id59">[1]</a>:</p> 1200 1202 <pre class="literal-block"> 1201 1203 $(evalcall var) 1202 1204 </pre> 1203 <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> :</p>1205 <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="#id80" id="id60" name="id60">[1]</a>:</p> 1204 1206 <pre class="literal-block"> 1205 1207 $(evalcall var) 1206 1208 </pre> 1207 1209 <p>Remove comments and blank lines from the variable <tt class="docutils literal"><span class="pre">var</span></tt>. Expands to 1208 the empty string :</p>1210 the empty string <a class="footnote-reference" href="#id80" id="id61" name="id61">[1]</a>:</p> 1209 1211 <pre class="literal-block"> 1210 1212 $(eval-opt-var var) 1211 1213 </pre> 1212 1214 <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 1213 or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) :</p>1215 or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id80" id="id62" name="id62">[1]</a>:</p> 1214 1216 <pre class="literal-block"> 1215 1217 $(deps target[, pos]) 1216 1218 </pre> 1217 1219 <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 1218 retriving the whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) :</p>1220 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="#id80" id="id63" name="id63">[1]</a>:</p> 1219 1221 <pre class="literal-block"> 1220 1222 $(deps-all target[, pos]) 1221 1223 </pre> 1222 1224 <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 1223 thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) :</p>1225 thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id80" id="id64" name="id64">[1]</a>:</p> 1224 1226 <pre class="literal-block"> 1225 1227 $(deps-newer target[, pos]) 1226 1228 </pre> 1227 1229 <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 1228 whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) :</p>1230 whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id80" id="id65" name="id65">[1]</a>:</p> 1229 1231 <pre class="literal-block"> 1230 1232 $(deps-oo target[, pos]) … … 1234 1236 <blockquote> 1235 1237 <p>Create one or more command lines avoiding the max argument 1236 length restriction of the host OS :</p>1238 length restriction of the host OS <a class="footnote-reference" href="#id80" id="id66" name="id66">[1]</a>:</p> 1237 1239 <pre class="literal-block"> 1238 1240 $(xargs ar cas mylib.a,$(objects)) … … 1241 1243 <p>Returns the commands for the specified target separated by new-line, space, 1242 1244 or a user defined string. Note that this might not produce the 100% correct 1243 result if any of the prerequisite automatic variables are used :</p>1245 result if any of the prerequisite automatic variables are used <a class="footnote-reference" href="#id80" id="id67" name="id67">[1]</a>:</p> 1244 1246 <pre class="literal-block"> 1245 1247 $(commands target) … … 1250 1252 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 1251 1253 line by line is stripped of leading spaces, command prefixes and 1252 trailing spaces before comparing :</p>1254 trailing spaces before comparing <a class="footnote-reference" href="#id80" id="id68" name="id68">[1]</a>:</p> 1253 1255 <pre class="literal-block"> 1254 1256 $(comp-cmds cmds-var1, cmds-var2, ne) … … 1256 1258 </pre> 1257 1259 <p>Compares the values of the two variables returning the empty string if 1258 equal and the 3rd argument if not. Leading and trailing spaces is ignored:</p> 1260 equal and the 3rd argument if not. Leading and trailing spaces is 1261 ignored <a class="footnote-reference" href="#id80" id="id69" name="id69">[1]</a>:</p> 1259 1262 <pre class="literal-block"> 1260 1263 $(comp-var var1, var2, ne) … … 1292 1295 <p>Returns the current local time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt> 1293 1296 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 1294 not specified :</p>1297 not specified <a class="footnote-reference" href="#id80" id="id70" name="id70">[1]</a>:</p> 1295 1298 <pre class="literal-block"> 1296 1299 $(date fmt) … … 1298 1301 <p>Returns the current UTC time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt> 1299 1302 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 1300 not specified :</p>1303 not specified <a class="footnote-reference" href="#id80" id="id71" name="id71">[1]</a>:</p> 1301 1304 <pre class="literal-block"> 1302 1305 $(date-utc fmt) … … 1304 1307 <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 1305 1308 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 1306 <tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> if not specified :</p>1309 <tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> if not specified <a class="footnote-reference" href="#id80" id="id72" name="id72">[1]</a>:</p> 1307 1310 <pre class="literal-block"> 1308 1311 $(date-utc fmt,time,in-fmt) 1309 1312 </pre> 1310 <p>Returns the current nanosecond timestamp (monotonic when possible) :</p>1313 <p>Returns the current nanosecond timestamp (monotonic when possible) <a class="footnote-reference" href="#id80" id="id73" name="id73">[1]</a>:</p> 1311 1314 <pre class="literal-block"> 1312 1315 $(nanots ) 1313 1316 </pre> 1314 1317 <p>Returns the size of the specified file, or -1 if the size could not 1315 be obtained. This can be used to check if a file exist or not :</p>1318 be obtained. This can be used to check if a file exist or not <a class="footnote-reference" href="#id80" id="id74" name="id74">[1]</a>:</p> 1316 1319 <pre class="literal-block"> 1317 1320 $(file-size file) 1318 1321 </pre> 1319 <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> :</p>1322 <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="#id80" id="id75" name="id75">[1]</a>:</p> 1320 1323 <pre class="literal-block"> 1321 1324 $(which files...) 1322 1325 </pre> 1323 <p>OS/2: Returns the specified LIBPATH variable value :</p>1326 <p>OS/2: Returns the specified LIBPATH variable value <a class="footnote-reference" href="#id80" id="id76" name="id76">[1]</a>:</p> 1324 1327 <pre class="literal-block"> 1325 1328 $(libpath var) 1326 1329 </pre> 1327 <p>OS/2: Sets the specified LIBPATH variable value, returning the empty string:</p> 1330 <p>OS/2: Sets the specified LIBPATH variable value, returning the empty 1331 string <a class="footnote-reference" href="#id80" id="id77" name="id77">[1]</a>:</p> 1328 1332 <pre class="literal-block"> 1329 1333 $(libpath var,value) … … 1333 1337 <blockquote> 1334 1338 <p>Returns various make statistics, if no item is specified a default 1335 selection is returned :</p>1339 selection is returned <a class="footnote-reference" href="#id80" id="id78" name="id78">[1]</a>:</p> 1336 1340 <pre class="literal-block"> 1337 1341 $(make-stats item[,itemN]) 1338 1342 </pre> 1339 <p>Raise a debug breakpoint. Used for debugging <tt class="docutils literal"><span class="pre">kmk</span></tt> makefile parsing:</p> 1343 <p>Raise a debug breakpoint. Used for debugging <tt class="docutils literal"><span class="pre">kmk</span></tt> makefile 1344 parsing <a class="footnote-reference" href="#id80" id="id79" name="id79">[1]</a>:</p> 1340 1345 <pre class="literal-block"> 1341 1346 $(breakpoint ) … … 1343 1348 </blockquote> 1344 1349 <hr class="docutils" /> 1345 <table class="docutils footnote" frame="void" id="id 15" rules="none">1350 <table class="docutils footnote" frame="void" id="id80" rules="none"> 1346 1351 <colgroup><col class="label" /><col /></colgroup> 1347 1352 <tbody valign="top"> 1348 <tr><td class="label"><a name="id15">[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>)</em> <tt class="docutils literal"><span class="pre">kmk</span></tt> only feature.</td></tr> 1353 <tr><td class="label"><a name="id80">[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="#id45">43</a>, <a class="fn-backref" href="#id46">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>)</em> <tt class="docutils literal"><span class="pre">kmk</span></tt> only feature.</td></tr> 1354 </tbody> 1355 </table> 1356 <table class="docutils footnote" frame="void" id="id81" rules="none"> 1357 <colgroup><col class="label" /><col /></colgroup> 1358 <tbody valign="top"> 1359 <tr><td class="label"><a name="id81">[2]</a></td><td><em>(<a class="fn-backref" href="#id43">1</a>, <a class="fn-backref" href="#id44">2</a>)</em> Experimental GNU <tt class="docutils literal"><span class="pre">make</span></tt> feature that is not enabled by default.</td></tr> 1349 1360 </tbody> 1350 1361 </table> -
trunk/kBuild/doc/QuickReference-kmk.txt
r2169 r2170 8 8 disputed. ;-) 9 9 10 Features that are 10 11 11 12 12 Directives … … 241 241 242 242 243 The following variables reflects ``kmk`` options. Do not set these. 243 The following variables reflects ``kmk`` options. Do not set these. [1]_ 244 244 245 245 +-------------------------------------+---------------------------------------+ … … 275 275 -------- 276 276 277 Builtin commands all start with ``kmk_builtin_``, so in order to save space278 this prefix has been omitted in the table below. All commands comes in an277 Builtin commands [1]_ all start with ``kmk_builtin_``, so in order to save 278 space this prefix has been omitted in the table below. All commands comes in an 279 279 external edition that can be used by/in the shell, these are prefixed ``kmk_``. 280 280 … … 347 347 -------------- 348 348 349 ``kmk``-expressions are related to the C/C++ preprocessor in some ways as well 350 as ``nmake`` and BSD ``make``. There are however some peculiarities because of 351 the way GNU ``make`` choose to represent booleans in its function library, so, 352 strings can be turned into boolean by taking any non-empty string as true. 349 ``kmk``-expressions [1]_ are related to the C/C++ preprocessor in some ways as 350 well as ``nmake`` and BSD ``make``. There are however some peculiarities 351 because of the way GNU ``make`` choose to represent booleans in its function 352 library, so, strings can be turned into boolean by taking any non-empty string 353 as true. 353 354 354 355 Quoting using single quotes results in hard strings, while double quotes and … … 455 456 456 457 Sort the words in ``list`` lexicographically in reserve order, removing 457 duplicates ::458 duplicates [1]_:: 458 459 459 460 $(rsort list) … … 483 484 $(join list1,list2) 484 485 485 Fold ``text`` to upper case ::486 Fold ``text`` to upper case [1]_:: 486 487 487 488 $(toupper text) 488 489 489 Fold ``text`` to lower case ::490 Fold ``text`` to lower case [1]_:: 490 491 491 492 $(tolower text) 492 493 493 String formatting a la the unix ``printf`` command ::494 String formatting a la the unix ``printf`` command [1]_:: 494 495 495 496 $(printf fmt, arg...) 496 497 497 Return the length of a string or a (unexpanded) variable ::498 Return the length of a string or a (unexpanded) variable [1]_:: 498 499 499 500 $(length string) … … 502 503 Find the position of ``needle`` in ``haystack``, returns 0 if not found. 503 504 Negative ``start`` indices are relative to the end of ``haystack``, while 504 positive ones are one based ::505 positive ones are one based [1]_:: 505 506 506 507 $(pos needle, haystack[, start]) … … 509 510 Returns the specified substring. The ``start`` works like with ``$(pos )``. 510 511 If the substring is partially outside the ``string`` the result will be 511 padded with ``pad`` if present ::512 padded with ``pad`` if present [1]_:: 512 513 513 514 $(substr string, start[, length[, pad]]) 514 515 515 516 Insert ``in`` into ``str`` at the specified position. ``n`` works like with 516 ``$(pos )``, except that ``0`` is the end of the string ::517 ``$(pos )``, except that ``0`` is the end of the string [1]_:: 517 518 518 519 $(insert in, str[, n[, length[, pad]]]) … … 520 521 Translate ``string`` exchanging characters in ``from-set`` with ``to-set``, 521 522 optionally completing ``to-set`` with ``pad-char`` if specified. If no 522 ``pad-char`` characters absent in ``to-set`` will be deleted ::523 ``pad-char`` characters absent in ``to-set`` will be deleted [1]_:: 523 524 524 525 $(translate string, from-set[, to-set[, pad-char]]) … … 568 569 569 570 Same as ``$(abspath )`` except that the current directory can be 570 specified as ``curdir`` ::571 specified as ``curdir`` [1]_:: 571 572 572 573 $(abspathex names...[, curdir]) … … 575 576 Arithmetic Functions: 576 577 577 Returns the sum of the arguments ::578 Returns the sum of the arguments [1]_:: 578 579 579 580 $(int-add addend1, addend2[, addendN]) 580 581 581 Returns the difference between the first argument and the sum of the rest:: 582 Returns the difference between the first argument and the sum of the 583 rest [1]_:: 582 584 583 585 $(int-sub minuend, subtrahend[, subtrahendN]) 584 586 585 Returns the product of the arguments ::587 Returns the product of the arguments [1]_:: 586 588 587 589 $(int-mul factor1, factor2[, factorN]) 588 590 589 Returns the quotient of first argument and the rest ::591 Returns the quotient of first argument and the rest [1]_:: 590 592 591 593 $(int-div dividend, divisor[, divisorN]) 592 594 593 Returns the modulus of the two arguments ::595 Returns the modulus of the two arguments [1]_:: 594 596 595 597 $(int-mod dividend, divisor) 596 598 597 Returns the bitwise two-complement of argument ::599 Returns the bitwise two-complement of argument [1]_:: 598 600 599 601 $(int-not val) 600 602 601 Returns the result of a bitwise AND of the arguments ::603 Returns the result of a bitwise AND of the arguments [1]_:: 602 604 603 605 $(int-and val1, val2[, valN]) 604 606 605 Returns the result of a bitwise OR of the arguments ::607 Returns the result of a bitwise OR of the arguments [1]_:: 606 608 607 609 $(int-or val1, val2[, valN]) 608 610 609 Returns the result of a bitwise XOR of the arguments ::611 Returns the result of a bitwise XOR of the arguments [1]_:: 610 612 611 613 $(int-xor val1, val2[, valN]) 612 614 613 615 Returns the ``kmk`` boolean (true = non-empty, false = empty) result 614 of ``val1 == val2`` ::616 of ``val1 == val2`` [1]_:: 615 617 616 618 $(int-eq val1, val2) 617 619 618 Returns the ``kmk`` boolean result of ``val1 != val2`` ::620 Returns the ``kmk`` boolean result of ``val1 != val2`` [1]_:: 619 621 620 622 $(int-ne val1, val2) 621 623 622 Returns the ``kmk`` boolean result of ``val1 > val2`` ::624 Returns the ``kmk`` boolean result of ``val1 > val2`` [1]_:: 623 625 624 626 $(int-gt val1, val2) 625 627 626 Returns the ``kmk`` boolean result of ``val1 >= val2`` ::628 Returns the ``kmk`` boolean result of ``val1 >= val2`` [1]_:: 627 629 628 630 $(int-ge val1, val2) 629 631 630 Returns the ``kmk`` boolean result of ``val1 < val2`` ::632 Returns the ``kmk`` boolean result of ``val1 < val2`` [1]_:: 631 633 632 634 $(int-lt val1, val2) 633 635 634 Returns the ``kmk`` boolean result of ``val1 <= val2`` ::636 Returns the ``kmk`` boolean result of ``val1 <= val2`` [1]_:: 635 637 636 638 $(int-le val1, val2) … … 657 659 658 660 Test if the two strings are identical, returning ``kmk`` boolean (true = 659 non-empty, false = empty) ::661 non-empty, false = empty) [2]_:: 660 662 661 663 $(eq str1, str2) 662 664 663 Invert a ``kmk`` boolean value ::665 Invert a ``kmk`` boolean value [2]_:: 664 666 665 667 $(not val) 666 668 667 Test if ``variable`` is defined, returning a ``kmk`` boolean value ::669 Test if ``variable`` is defined, returning a ``kmk`` boolean value [1]_:: 668 670 669 671 $(defined variable) 670 672 671 673 Test if ``set-a`` and ``set-b`` intersects, returning a ``kmk`` boolean 672 value ::674 value [1]_:: 673 675 674 676 $(intersects set-a, set-b) 675 677 676 Same as ``$(if )`` execpt that the condition is a ``kmk``-expression ::678 Same as ``$(if )`` execpt that the condition is a ``kmk``-expression [1]_:: 677 679 678 680 $(if-expr kmk-expression,true-part[,false-part]) 679 681 680 682 Select the first true condition (``kmk``-expression) and expand the 681 following body. Special condition strings ``default`` and ``otherwise``:: 683 following body. Special condition strings ``default`` and 684 ``otherwise`` [1]_:: 682 685 683 686 $(select when1-cond, when1-body[, whenN-cond, whenN-body]) 684 687 685 688 Evalutate the ``kmk-expression`` returning what it evalues as. This is 686 the preferred way of doing arithmentic now ::689 the preferred way of doing arithmentic now [1]_:: 687 690 688 691 $(expr kmk-expression) … … 691 694 Stack Fuctions: 692 695 693 Push ``item`` onto the ``stack-var``, returning the empty string ::696 Push ``item`` onto the ``stack-var``, returning the empty string [1]_:: 694 697 695 698 $(stack-push stack-var, item) 696 699 697 Pop the top item off the ``stack-var`` ::700 Pop the top item off the ``stack-var`` [1]_:: 698 701 699 702 $(stack-pop stack-var) 700 703 701 Pop the top item off the ``stack-var``, returning the empty string ::704 Pop the top item off the ``stack-var``, returning the empty string [1]_:: 702 705 703 706 $(stack-popv stack-var) 704 707 705 Get the top item of the ``stack-var``, returning the empty string ::708 Get the top item of the ``stack-var``, returning the empty string [1]_:: 706 709 707 710 $(stack-top stack-var) … … 723 726 first check whether the ``condition`` (``kmk``-expression) is true, 724 727 then expand ``body`` concatenating the result to the previous iterations 725 (spaced), and finally evaluate ``next`` ::728 (spaced), and finally evaluate ``next`` [1]_:: 726 729 727 730 $(for init,conditions,next,body) … … 729 732 C-style while-loop. Each iteration will check whether the ``condition`` 730 733 (``kmk``-expression) is true, then expand ``body`` concatenating the 731 result to the previous iterations ::734 result to the previous iterations [1]_:: 732 735 733 736 $(while conditions,body) … … 744 747 745 748 Same as ``$(eval text)`` except that the ``text`` is expanded in its 746 own variable context ::749 own variable context [1]_:: 747 750 748 751 $(evalctx text) 749 752 750 Same as ``$(eval $(value var))`` ::753 Same as ``$(eval $(value var))`` [1]_:: 751 754 752 755 $(evalval var) 753 756 754 Same as ``$(evalctx $(value var))`` ::757 Same as ``$(evalctx $(value var))`` [1]_:: 755 758 756 759 $(evalvalctx var) 757 760 758 A combination of ``$(eval )``, ``$(call )`` and ``$(value )`` ::761 A combination of ``$(eval )``, ``$(call )`` and ``$(value )`` [1]_:: 759 762 760 763 $(evalcall var) 761 764 762 A combination of ``$(eval )`` and ``$(call )`` ::765 A combination of ``$(eval )`` and ``$(call )`` [1]_:: 763 766 764 767 $(evalcall var) 765 768 766 769 Remove comments and blank lines from the variable ``var``. Expands to 767 the empty string ::770 the empty string [1]_:: 768 771 769 772 $(eval-opt-var var) 770 773 771 774 Returns accessing ``$<`` of ``target``, either retriving the whole thing 772 or the file at ``pos`` (one-origin) ::775 or the file at ``pos`` (one-origin) [1]_:: 773 776 774 777 $(deps target[, pos]) 775 778 776 779 Returns accessing ``$+`` (order + duplicates) of ``target``, either 777 retriving the whole thing or the file at ``pos`` (one-origin) ::780 retriving the whole thing or the file at ``pos`` (one-origin) [1]_:: 778 781 779 782 $(deps-all target[, pos]) 780 783 781 784 Returns accessing ``$?`` of ``target``, either retriving the whole 782 thing or the file at ``pos`` (one-origin) ::785 thing or the file at ``pos`` (one-origin) [1]_:: 783 786 784 787 $(deps-newer target[, pos]) 785 788 786 789 Returns accessing ``$|`` (order only) of ``target``, either retriving the 787 whole thing or the file at ``pos`` (one-origin) ::790 whole thing or the file at ``pos`` (one-origin) [1]_:: 788 791 789 792 $(deps-oo target[, pos]) … … 793 796 794 797 Create one or more command lines avoiding the max argument 795 length restriction of the host OS ::798 length restriction of the host OS [1]_:: 796 799 797 800 $(xargs ar cas mylib.a,$(objects)) … … 801 804 Returns the commands for the specified target separated by new-line, space, 802 805 or a user defined string. Note that this might not produce the 100% correct 803 result if any of the prerequisite automatic variables are used ::806 result if any of the prerequisite automatic variables are used [1]_:: 804 807 805 808 $(commands target) … … 810 813 argument if not. This differs from ``$(comp-vars v1,v2,ne)`` in that 811 814 line by line is stripped of leading spaces, command prefixes and 812 trailing spaces before comparing ::815 trailing spaces before comparing [1]_:: 813 816 814 817 $(comp-cmds cmds-var1, cmds-var2, ne) … … 817 820 818 821 Compares the values of the two variables returning the empty string if 819 equal and the 3rd argument if not. Leading and trailing spaces is ignored:: 822 equal and the 3rd argument if not. Leading and trailing spaces is 823 ignored [1]_:: 820 824 821 825 $(comp-var var1, var2, ne) … … 853 857 Returns the current local time and date formatted in the ``strftime`` 854 858 style specifier ``fmt``. ``fmt`` defaults to ``%Y-%m-%dT%H:%M:%S`` when 855 not specified ::859 not specified [1]_:: 856 860 857 861 $(date fmt) … … 859 863 Returns the current UTC time and date formatted in the ``strftime`` 860 864 style specifier ``fmt``. ``fmt`` defaults to ``%Y-%m-%dT%H:%M:%SZ`` when 861 not specified ::865 not specified [1]_:: 862 866 863 867 $(date-utc fmt) … … 865 869 Reformats the ``in`` time and date using ``fmt``. The ``in-fmt`` defaults 866 870 to ``fmt`` if not specified. While ``fmt`` defaults to 867 ``%Y-%m-%dT%H:%M:%SZ`` if not specified ::871 ``%Y-%m-%dT%H:%M:%SZ`` if not specified [1]_:: 868 872 869 873 $(date-utc fmt,time,in-fmt) 870 874 871 Returns the current nanosecond timestamp (monotonic when possible) ::875 Returns the current nanosecond timestamp (monotonic when possible) [1]_:: 872 876 873 877 $(nanots ) 874 878 875 879 Returns the size of the specified file, or -1 if the size could not 876 be obtained. This can be used to check if a file exist or not ::880 be obtained. This can be used to check if a file exist or not [1]_:: 877 881 878 882 $(file-size file) 879 883 880 Searches the ``PATH`` ``kmk`` variable for the specified ``files`` ::884 Searches the ``PATH`` ``kmk`` variable for the specified ``files`` [1]_:: 881 885 882 886 $(which files...) 883 887 884 OS/2: Returns the specified LIBPATH variable value ::888 OS/2: Returns the specified LIBPATH variable value [1]_:: 885 889 886 890 $(libpath var) 887 891 888 OS/2: Sets the specified LIBPATH variable value, returning the empty string:: 892 OS/2: Sets the specified LIBPATH variable value, returning the empty 893 string [1]_:: 889 894 890 895 $(libpath var,value) … … 894 899 895 900 Returns various make statistics, if no item is specified a default 896 selection is returned ::901 selection is returned [1]_:: 897 902 898 903 $(make-stats item[,itemN]) 899 904 900 Raise a debug breakpoint. Used for debugging ``kmk`` makefile parsing:: 905 Raise a debug breakpoint. Used for debugging ``kmk`` makefile 906 parsing [1]_:: 901 907 902 908 $(breakpoint ) … … 906 912 907 913 .. [1] ``kmk`` only feature. 914 .. [2] Experimental GNU ``make`` feature that is not enabled by default. 908 915 909 916 -----
Note:
See TracChangeset
for help on using the changeset viewer.