summaryrefslogtreecommitdiffstats
path: root/kBuild
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:21:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:21:29 +0000
commit29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc (patch)
tree63ef546b10a81d461e5cf5ed9e98a68cd7dee1aa /kBuild
parentInitial commit. (diff)
downloadkbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.tar.xz
kbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.zip
Adding upstream version 1:0.1.9998svn3589+dfsg.upstream/1%0.1.9998svn3589+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'kBuild')
-rw-r--r--kBuild/COPYING339
-rw-r--r--kBuild/darwin-common.kmk108
-rw-r--r--kBuild/doc/COPYING-FDL-1.3451
-rw-r--r--kBuild/doc/Makefile.kmk63
-rw-r--r--kBuild/doc/QuickReference-kBuild.txt276
-rw-r--r--kBuild/doc/QuickReference-kmk.html1512
-rw-r--r--kBuild/doc/QuickReference-kmk.txt1054
-rw-r--r--kBuild/doc/example1/Config.kmk25
-rw-r--r--kBuild/doc/example1/Makefile.kmk43
-rw-r--r--kBuild/doc/example1/hello.c21
-rw-r--r--kBuild/doc/example1/hellolib.c20
-rw-r--r--kBuild/doc/example1/libhello/Makefile.kmk30
-rw-r--r--kBuild/doc/example1/libhello/libhello.c24
-rwxr-xr-xkBuild/env.sh648
-rw-r--r--kBuild/envos2.cmd801
-rw-r--r--kBuild/envwin.cmd725
-rw-r--r--kBuild/footer-inherit-uses-tools.kmk1059
-rw-r--r--kBuild/footer-misc.kmk134
-rw-r--r--kBuild/footer-pass1.kmk463
-rw-r--r--kBuild/footer-pass2-compiling-targets.kmk1227
-rw-r--r--kBuild/footer-pass2-fetches.kmk434
-rw-r--r--kBuild/footer-pass2-installs.kmk641
-rw-r--r--kBuild/footer-pass2-patches.kmk55
-rw-r--r--kBuild/footer-passes.kmk255
-rw-r--r--kBuild/footer.kmk451
-rw-r--r--kBuild/header.kmk1785
-rw-r--r--kBuild/msgstyles/brief.kmk123
-rw-r--r--kBuild/msgstyles/brief2.kmk127
-rw-r--r--kBuild/rules.kmk44
-rw-r--r--kBuild/sdks/DXSDK.kmk67
-rw-r--r--kBuild/sdks/DXSDKAMD64.kmk61
-rw-r--r--kBuild/sdks/DXSDKX86.kmk62
-rw-r--r--kBuild/sdks/LIBSDL.kmk168
-rw-r--r--kBuild/sdks/LIBSDL2.kmk154
-rw-r--r--kBuild/sdks/MACOSX1010.kmk62
-rw-r--r--kBuild/sdks/MACOSX1013.kmk62
-rw-r--r--kBuild/sdks/MACOSX1013INCS.kmk49
-rw-r--r--kBuild/sdks/MACOSX1014.kmk62
-rw-r--r--kBuild/sdks/MACOSX1014INCS.kmk49
-rw-r--r--kBuild/sdks/MACOSX1015.kmk62
-rw-r--r--kBuild/sdks/MACOSX1015INCS.kmk49
-rw-r--r--kBuild/sdks/MACOSX104.kmk52
-rw-r--r--kBuild/sdks/MACOSX104INCS.kmk50
-rw-r--r--kBuild/sdks/MACOSX105.kmk52
-rw-r--r--kBuild/sdks/MACOSX105INCS.kmk50
-rw-r--r--kBuild/sdks/MACOSX110.kmk62
-rw-r--r--kBuild/sdks/MACOSX110INCS.kmk49
-rw-r--r--kBuild/sdks/NT4DDK.kmk59
-rw-r--r--kBuild/sdks/OS2DDKBASE32.kmk59
-rw-r--r--kBuild/sdks/ReorderCompilerIncs.kmk63
-rw-r--r--kBuild/sdks/W2K3DDK.kmk81
-rw-r--r--kBuild/sdks/W2K3DDKAMD64.kmk71
-rw-r--r--kBuild/sdks/W2K3DDKX86.kmk74
-rw-r--r--kBuild/sdks/W32API.kmk58
-rw-r--r--kBuild/sdks/WIN32SDK.kmk93
-rw-r--r--kBuild/sdks/WIN32SDK2002.kmk90
-rw-r--r--kBuild/sdks/WIN64SDK.kmk99
-rw-r--r--kBuild/sdks/WINDDK.kmk133
-rw-r--r--kBuild/sdks/WINDDK71.kmk107
-rw-r--r--kBuild/sdks/WINDDK71WLH.kmk47
-rw-r--r--kBuild/sdks/WINDDK71WNET.kmk47
-rw-r--r--kBuild/sdks/WINDDK71WXP.kmk43
-rw-r--r--kBuild/sdks/WINDDK80.kmk98
-rw-r--r--kBuild/sdks/WINDDK80W8.kmk46
-rw-r--r--kBuild/sdks/WINDDKW2K.kmk43
-rw-r--r--kBuild/sdks/WINDDKWLH.kmk47
-rw-r--r--kBuild/sdks/WINDDKWNET.kmk47
-rw-r--r--kBuild/sdks/WINDDKWXP.kmk43
-rw-r--r--kBuild/sdks/WINPSDK.kmk161
-rw-r--r--kBuild/sdks/WINPSDK71.kmk161
-rw-r--r--kBuild/sdks/WINPSDK71INCS.kmk90
-rw-r--r--kBuild/sdks/WINPSDKINCS.kmk93
-rw-r--r--kBuild/sdks/WINSDK10-KM-W7.kmk51
-rw-r--r--kBuild/sdks/WINSDK10-KM-W8.kmk51
-rw-r--r--kBuild/sdks/WINSDK10-KM-W81.kmk51
-rw-r--r--kBuild/sdks/WINSDK10-KM.kmk59
-rw-r--r--kBuild/sdks/WINSDK10-UCRT-INCS.kmk40
-rw-r--r--kBuild/sdks/WINSDK10-UCRT-STATIC.kmk56
-rw-r--r--kBuild/sdks/WINSDK10-UCRT.kmk56
-rw-r--r--kBuild/sdks/WINSDK10-UM-INCS.kmk42
-rw-r--r--kBuild/sdks/WINSDK10-UM.kmk69
-rw-r--r--kBuild/sdks/WINSDK10.kmk256
-rw-r--r--kBuild/subfooter.kmk75
-rw-r--r--kBuild/subheader.kmk85
-rw-r--r--kBuild/templates/DUMMY.kmk35
-rw-r--r--kBuild/tools/7ZIP.kmk75
-rw-r--r--kBuild/tools/ALP.kmk78
-rw-r--r--kBuild/tools/BISON.kmk48
-rw-r--r--kBuild/tools/CLANGCCMACHO.kmk501
-rw-r--r--kBuild/tools/CLANGXXMACHO.kmk501
-rw-r--r--kBuild/tools/FLEX.kmk46
-rw-r--r--kBuild/tools/GCC.kmk239
-rw-r--r--kBuild/tools/GCC3.kmk357
-rw-r--r--kBuild/tools/GCC32.kmk355
-rw-r--r--kBuild/tools/GCC3OMF.kmk348
-rw-r--r--kBuild/tools/GCC3PLAIN.kmk324
-rw-r--r--kBuild/tools/GCC42MACHO.kmk461
-rw-r--r--kBuild/tools/GCC4MACHO.kmk461
-rw-r--r--kBuild/tools/GCC64.kmk346
-rw-r--r--kBuild/tools/GXX.kmk281
-rw-r--r--kBuild/tools/GXX3.kmk386
-rw-r--r--kBuild/tools/GXX32.kmk381
-rw-r--r--kBuild/tools/GXX3OMF.kmk381
-rw-r--r--kBuild/tools/GXX3PLAIN.kmk352
-rw-r--r--kBuild/tools/GXX42MACHO.kmk489
-rw-r--r--kBuild/tools/GXX4MACHO.kmk445
-rw-r--r--kBuild/tools/GXX64.kmk374
-rw-r--r--kBuild/tools/JWASM.kmk63
-rw-r--r--kBuild/tools/LLVMGCC42MACHO.kmk461
-rw-r--r--kBuild/tools/LLVMGXX42MACHO.kmk490
-rw-r--r--kBuild/tools/MASM510.kmk97
-rw-r--r--kBuild/tools/MASM600.kmk77
-rw-r--r--kBuild/tools/MASM610.kmk66
-rw-r--r--kBuild/tools/MASM6PLUS.kmk75
-rw-r--r--kBuild/tools/MASM710.kmk69
-rw-r--r--kBuild/tools/MINGW32.kmk273
-rw-r--r--kBuild/tools/MINGWW64.kmk273
-rw-r--r--kBuild/tools/MSLINK510.kmk104
-rw-r--r--kBuild/tools/NASM.kmk97
-rw-r--r--kBuild/tools/OPENWATCOM-16.kmk208
-rw-r--r--kBuild/tools/OPENWATCOM-WL.kmk83
-rw-r--r--kBuild/tools/OPENWATCOM.kmk387
-rw-r--r--kBuild/tools/StandardDTrace.kmk54
-rw-r--r--kBuild/tools/TAR.kmk75
-rw-r--r--kBuild/tools/TARBZ2.kmk37
-rw-r--r--kBuild/tools/TARGZ.kmk37
-rw-r--r--kBuild/tools/VAC308.kmk206
-rw-r--r--kBuild/tools/VCC100.kmk431
-rw-r--r--kBuild/tools/VCC100AMD64.kmk456
-rw-r--r--kBuild/tools/VCC100X86.kmk448
-rw-r--r--kBuild/tools/VCC120.kmk432
-rw-r--r--kBuild/tools/VCC120AMD64.kmk465
-rw-r--r--kBuild/tools/VCC120X86.kmk465
-rw-r--r--kBuild/tools/VCC140.kmk555
-rw-r--r--kBuild/tools/VCC140AMD64.kmk458
-rw-r--r--kBuild/tools/VCC140X86.kmk458
-rw-r--r--kBuild/tools/VCC141.kmk557
-rw-r--r--kBuild/tools/VCC141AMD64.kmk459
-rw-r--r--kBuild/tools/VCC141X86.kmk459
-rw-r--r--kBuild/tools/VCC142.kmk561
-rw-r--r--kBuild/tools/VCC142AMD64.kmk463
-rw-r--r--kBuild/tools/VCC142X86.kmk463
-rw-r--r--kBuild/tools/VCC70.kmk366
-rw-r--r--kBuild/tools/VCC80.kmk361
-rw-r--r--kBuild/tools/VCC80AMD64.kmk338
-rw-r--r--kBuild/tools/VCC80X86.kmk340
-rw-r--r--kBuild/tools/WATCOMC11C-16.kmk150
-rw-r--r--kBuild/tools/WATCOMC11C-WL.kmk79
-rw-r--r--kBuild/tools/WATCOMC11C.kmk265
-rw-r--r--kBuild/tools/WGET.kmk66
-rw-r--r--kBuild/tools/XGCCAMD64LINUX.kmk283
-rw-r--r--kBuild/tools/YACC.kmk50
-rw-r--r--kBuild/tools/YASM.kmk119
-rw-r--r--kBuild/tools/ZIP.kmk89
-rwxr-xr-xkBuild/tools/update-c-versions.sh6
-rw-r--r--kBuild/units/dtrace.kmk252
-rw-r--r--kBuild/units/gccprecomp.kmk67
-rw-r--r--kBuild/units/lex.kmk153
-rw-r--r--kBuild/units/qt-Q_OBJECT.sed36
-rw-r--r--kBuild/units/qt3.kmk947
-rw-r--r--kBuild/units/qt4.kmk1107
-rw-r--r--kBuild/units/qt5.kmk1214
-rw-r--r--kBuild/units/qt6.kmk1244
-rw-r--r--kBuild/units/vccprecomp.kmk66
-rw-r--r--kBuild/units/yacc.kmk198
-rw-r--r--kBuild/up.kmk68
-rw-r--r--kBuild/win-common.kmk61
167 files changed, 42555 insertions, 0 deletions
diff --git a/kBuild/COPYING b/kBuild/COPYING
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/kBuild/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/kBuild/darwin-common.kmk b/kBuild/darwin-common.kmk
new file mode 100644
index 0000000..00f2b3d
--- /dev/null
+++ b/kBuild/darwin-common.kmk
@@ -0,0 +1,108 @@
+# $Id: darwin-common.kmk 3488 2020-09-22 09:47:02Z bird $
+## @file
+# kBuild Common Darwin (macOS) Definitions - Used by tools and SDKs.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+INCLUDED_DARWIN_COMMON_KMK := 1
+
+### @def DARWINCMN_XCODE_APP_DEVELOPER_DIRS
+# List 'Developer' directories inside 'Xcode.app' directories.
+# The idea was to use this as a basis for DARWINCMN_TOOLCHAIN_DIRS and
+# DARWINCMN_MACOSX_SDKS_DIRS, but that didn't pan out.
+#
+# Users can alter this by setting DARWINCMN_XCODE_APP_DIRS_PREFERRED,
+# DARWINCMN_XCODE_APP_DIRS_FALLBACK and DARWINCMN_XCODE_APP_DIRS_IGNORE_DEVTOOLS.
+#
+DARWINCMN_XCODE_APP_DEVELOPER_DIRS = $(DARWINCMN_XCODE_APP_DEVELOPER_DIRS_PREFERRED) \
+ $(if-expr defined(DARWINCMN_XCODE_APP_DIRS_IGNORE_DEVTOOLS),, \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/xcode/v*/*.app/Contents/Developer)) \
+ $(if $(KBUILD_DEVTOOLS_HST_ALT),$(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/xcode/v*/*.app/Contents/Developer))) ) \
+ /Applications/Xcode.app/Contents/Developer \
+ $(DARWINCMN_XCODE_APP_DIRS_FALLBACK)
+
+## @def DARWINCMN_TOOLCHAIN_DIRS
+# List of toolchain directories containing compilers and stuff in a usr/bin subdir.
+#
+# Users can alter this by setting DARWINCMN_TOOLCHAIN_DIRS_PREFERRED and DARWINCMN_TOOLCHAIN_DIRS_FALLBACK.
+#
+# @note Would love to use DARWINCMN_XCODE_APP_DEVELOPER_DIRS here, but that doesn't really fly wrt directory priority.
+# Also, prefer avoiding using the longer Xcode.app paths when command line tools are installed.
+DARWINCMN_TOOLCHAIN_DIRS = $(DARWINCMN_TOOLCHAIN_DIRS_PREFERRED) \
+ $(if-expr defined(DARWINCMN_TOOLCHAIN_DIRS_IGNORE_DEVTOOLS),, \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/CommandLineTools/v*)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/xcode/v*/*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain)) \
+ $(if-expr "$(KBUILD_DEVTOOLS_HST_ALT)" != "", \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/CommandLineTools/v*)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/xcode/v*/*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain)) ,) \
+ ) \
+ /Library/Developer/CommandLineTools \
+ $(qwildcard ,/Applications/Xcode*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain) \
+ /. \
+ $(DARWINCMN_TOOLCHAIN_DIRS_FALLBACK)
+
+
+## @def DARWINCMN_MACOSX_SDKS_DIRS
+# List of 'SDKs' directories containing MacOSX (macOS) platform SDKs.
+# Users can alter this by setting DARWINCMN_MACOSX_SDKS_DIRS_PREFERRED and DARWINCMN_MACOSX_SDKS_DIRS_FALLBACK.
+DARWINCMN_MACOSX_SDKS_DIRS = $(DARWINCMN_MACOSX_SDKS_DIRS_PREFERRED) \
+ $(if-expr defined(DARWINCMN_MACOSX_SDKS_DIRS_IGNORE_DEVTOOLS),, \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TRG_NOARCH)/SDKs)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TRG)/SDKs)) \
+ $(if-expr "$(KBUILD_DEVTOOLS_TRG_ALT)" != "", \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TRG_ALT)/SDKs)) ,) \
+ $(if-expr "$(KBUILD_DEVTOOLS_TRG_NOARCH)" != "$(KBUILD_DEVTOOLS_HST_NOARCH)", \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_NOARCH)/SDKs)),) \
+ $(if-expr "$(KBUILD_DEVTOOLS_HST)" != "$(KBUILD_DEVTOOLS_TRG)", \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/SDKs)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/CommandLineTools/v*/SDKs)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/xcode/v*/*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)) \
+ $(if-expr "$(KBUILD_DEVTOOLS_HST_ALT)" != "", \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/CommandLineTools/v*)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/xcode/v*/*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)) ,) \
+ ) \
+ ) \
+ /Library/Developer/CommandLineTools/SDKs \
+ $(qwildcard ,/Applications/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs) \
+ /Developer/SDKs \
+ $(DARWINCMN_MACOSX_SDKS_DIRS_FALLBACK)
+
+## @def DARWINCMN_FN_FIND_MACOSX_SDK
+# Locate a given SDK.
+# @param 1 SDK name directory (e.g. MacOSX10.15.sdk).
+DARWINCMN_FN_FIND_MACOSX_SDK = $(firstfile $(qwildcard ,$(qaddsuffix ,/$(1),$(DARWINCMN_MACOSX_SDKS_DIRS))))
+## @def DARWINCMN_FN_ERROR_MACOSX_SDK
+# Generate complaint text about SDK that DARWINCMN_FN_FIND_MACOSX_SDK failed to locate.
+# @param 1 SDK name directory (e.g. MacOSX10.15.sdk).
+define DARWINCMN_FN_ERROR_MACOSX_SDK
+Failed to locate the MacOSX SDK '$(1)' directory after checking: $(foreachfile file,$(qaddsuffix ,/$(1),$(DARWINCMN_MACOSX_SDKS_DIRS)),$(NLTAB)$(file))
+Available SDKs: $(rversortfiles $(qnotdir ,$(qwildcard ,$(qaddsuffix ,/Mac*sdk,$(DARWINCMN_MACOSX_SDKS_DIRS)))))
+endef
+
diff --git a/kBuild/doc/COPYING-FDL-1.3 b/kBuild/doc/COPYING-FDL-1.3
new file mode 100644
index 0000000..2f7e03c
--- /dev/null
+++ b/kBuild/doc/COPYING-FDL-1.3
@@ -0,0 +1,451 @@
+
+ GNU Free Documentation License
+ Version 1.3, 3 November 2008
+
+
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+ <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The "Document", below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as "you". You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML, PostScript or PDF designed for human modification. Examples of
+transparent image formats include PNG, XCF and JPG. Opaque formats
+include proprietary formats that can be read and edited only by
+proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML, PostScript or PDF produced by some word
+processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+The "publisher" means any person or entity that distributes copies of
+the Document to the public.
+
+A section "Entitled XYZ" means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as "Acknowledgements",
+"Dedications", "Endorsements", or "History".) To "Preserve the Title"
+of such a section when you modify the Document means that it remains a
+section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no
+other conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to
+give them a chance to provide you with an updated version of the
+Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions
+ (which should, if there were any, be listed in the History section
+ of the Document). You may use the same title as a previous version
+ if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has fewer than five),
+ unless they release you from this requirement.
+C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section Entitled "History", Preserve its Title, and add
+ to it an item stating at least the title, year, new authors, and
+ publisher of the Modified Version as given on the Title Page. If
+ there is no section Entitled "History" in the Document, create one
+ stating the title, year, authors, and publisher of the Document as
+ given on its Title Page, then add an item describing the Modified
+ Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise
+ the network locations given in the Document for previous versions
+ it was based on. These may be placed in the "History" section.
+ You may omit a network location for a work that was published at
+ least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
+K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section all
+ the substance and tone of each of the contributor acknowledgements
+ and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section titles.
+M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+N. Do not retitle any existing section to be Entitled "Endorsements"
+ or to conflict in title with any Invariant Section.
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History"
+in the various original documents, forming one section Entitled
+"History"; likewise combine any sections Entitled "Acknowledgements",
+and any sections Entitled "Dedications". You must delete all sections
+Entitled "Endorsements".
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other
+documents released under this License, and replace the individual
+copies of this License in the various documents with a single copy
+that is included in the collection, provided that you follow the rules
+of this License for verbatim copying of each of the documents in all
+other respects.
+
+You may extract a single document from such a collection, and
+distribute it individually under this License, provided you insert a
+copy of this License into the extracted document, and follow this
+License in all other respects regarding verbatim copying of that
+document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements",
+"Dedications", or "History", the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions of the
+GNU Free Documentation License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in
+detail to address new problems or concerns. See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
+11. RELICENSING
+
+"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+"Massive Multiauthor Collaboration" (or "MMC") contained in the site
+means any set of copyrightable works thus published on the MMC site.
+
+"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+"Incorporate" means to publish or republish a Document, in whole or in
+part, as part of another Document.
+
+An MMC is "eligible for relicensing" if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole or
+in part into the MMC, (1) had no cover texts or invariant sections, and
+(2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+ Copyright (c) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+ A copy of the license is included in the section entitled "GNU
+ Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with the
+ Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
diff --git a/kBuild/doc/Makefile.kmk b/kBuild/doc/Makefile.kmk
new file mode 100644
index 0000000..17730b1
--- /dev/null
+++ b/kBuild/doc/Makefile.kmk
@@ -0,0 +1,63 @@
+DEPTH = ../..
+include ../header.kmk
+
+TXTFILES = \
+ QuickReference-kmk.txt \
+ QuickReference-kBuild.txt
+
+define genrule
+all: $(name).html
+clean::
+ kmk_rm -f $(name).html
+$(name).html: $(name).txt
+ LC_ALL=C rst2html.py --no-generator $$< $$@
+$(name).o: $(name).html
+.PHONY: $(name).o
+endef
+
+$(foreach name, $(basename $(TXTFILES)), $(eval $(genrule)))
+
+
+#
+# For generating the basis for the target properties table.
+#
+my_tp.1 = BLDPROGS PROGRAMS
+my_tp.2 = LIBRARIES
+my_tp.3 = IMPORT_LIBS DLLS
+my_tp.4 = DLLS
+my_tp.5 = PROGRAMS
+my_tp.6 = SYSMODS
+my_tp.7 = MISCBINS
+my_tp.8 = INSTALLS
+my_tp.9 = FETCHES
+my_tp.a = OTHERS
+my_tp = 1 2 3 4 5 6 7 8 9 a
+tpc := $(translate $(my_tp),$(SP))
+
+define def_target_prop_rule
+target-properties::
+ @$$(PRINTF) '|%-2s| %-18s| %-6s|%$(expr 79-33)s|\n' "$(kind)" "``$(prop)``" "$(my_tmp_which)" ""
+ @$$(ECHO) '+--+-------------------+-------+----------------------------------------------+'
+endef
+define def_target_prop_doit
+my_tmp_which := $(foreach x,$(my_tp),$(if $(intersects \
+ $(prop),\
+ $(foreach nm,$(my_tp.$(x)),$(foreach suff,SINGLE DEFERRED ACCUMULATE_R ACCUMULATE_L,$(PROPS_$(nm)_$(suff)))))\
+ ,$(x),))
+my_tmp_which := $(translate $(my_tmp_which),$(SP))
+$(for local i = 1, $i < 10, local i := $(expr $i + 1),$(for local l = $(expr 10 - $i + 1), $l > 3, local l := $(expr $l - 1), \
+ $(eval my_tmp_which:=$(subst $(substr $(tpc), $i, $l),$i-$(substr $(tpc),$(expr $i + $l - 1),1),$(my_tmp_which)))\
+) )
+$(eval $(def_target_prop_rule))
+endef
+kind := S
+$(foreach prop,$(sort $(PROPS_SINGLE)),$(evalcall def_target_prop_doit))
+kind := D
+$(foreach prop,$(sort $(PROPS_DEFERRED)),$(evalcall def_target_prop_doit))
+kind := Ar
+$(foreach prop,$(sort $(PROPS_ACCUMULATE_R)),$(evalcall def_target_prop_doit))
+kind := Al
+$(foreach prop,$(sort $(PROPS_ACCUMULATE_L)),$(evalcall def_target_prop_doit))
+#kind := To
+#$(foreach prop,$(sort $(PROPS_TOOLS_ONLY)),$(evalcall def_target_prop_doit))
+
diff --git a/kBuild/doc/QuickReference-kBuild.txt b/kBuild/doc/QuickReference-kBuild.txt
new file mode 100644
index 0000000..70079c1
--- /dev/null
+++ b/kBuild/doc/QuickReference-kBuild.txt
@@ -0,0 +1,276 @@
+
+kBuild Quick Reference
+======================
+
+This is an attempt at summarizing the magic of kBuild makefiles.
+
+
+The anatomy of a kBuild Makefile
+--------------------------------
+
+A typical makefile::
+
+ # $Id: QuickReference-kBuild.txt 2345 2009-04-19 23:47:42Z bird $
+ ## @file
+ # Makefile description.
+ #
+
+ #
+ # Copyright (c) year name
+ # License, disclaimer and other legal text.
+ #
+
+ SUB_DEPTH = ../..
+ include $(KBUILD_PATH)/subheader.kmk
+
+ #
+ # Include sub-makefiles.
+ #
+ include $(PATH_CURRENT)/subdir1/Makefile.kmk
+ include $(PATH_CURRENT)/subdir2/Makefile.kmk
+
+ #
+ # Global variables.
+ #
+ MYPREFIX_SOMETHING = or another
+
+ #
+ # Target lists.
+ #
+ DLLS += mydll
+ PROGRAMS += myprogs
+
+ #
+ # mydll - description.
+ #
+ mydll_TEMPLATE = MYDLL
+ mydll_SOURCES = mydll.c
+ mydll_SOURCES.win = $(mydll_0_OUTDIR)/mydll.def
+
+ #
+ # myprog - description.
+ #
+ myprog_TEMPLATE = MYPROG
+ myprog_SOURCES = myprog.c
+
+ #
+ # Custom rules (optional of course).
+ #
+ $$(mydll_0_OUTDIR)/mydll.def:
+ $(APPEND) -t $@ LIBRARY mydll.dll
+ $(APPEND) $@ EXPORTS
+ $(APPEND) $@ ' myfunction'
+
+ include $(FILE_KBUILD_SUB_FOOTER)
+
+
+Target lists
+------------
+
++-+-------------------+-------------------------------------------------------+
+|#| Name | Description |
++=+===================+=======================================================+
+|1| ``BLDPROGS`` | Build programs, targets the host platform. |
++-+-------------------+-------------------------------------------------------+
+|2| ``LIBRARIES`` | Libraries (not shared). |
++-+-------------------+-------------------------------------------------------+
+|3| ``IMPORT_LIBS`` | Import libraries or stub shared libraries. |
++-+-------------------+-------------------------------------------------------+
+|4| ``DLLS`` | DLLs, Shared Libraries, DYLIBs, etc. |
++-+-------------------+-------------------------------------------------------+
+|5| ``PROGRAMS`` | Executable programs. |
++-+-------------------+-------------------------------------------------------+
+|6| ``SYSMODS`` | System modules (kexts, kernel modules, drivers, etc). |
++-+-------------------+-------------------------------------------------------+
+|7| ``MISCBINS`` | Miscellanceous binaries like BIOS images and such. |
++-+-------------------+-------------------------------------------------------+
+|8| ``INSTALLS`` | Things to install. [1]_ |
++-+-------------------+-------------------------------------------------------+
+|9| ``FETCHES`` | Things to fetch. [1]_ |
++-+-------------------+-------------------------------------------------------+
+|a| ``OTHERS`` | List of targets made during the others pass. |
++-+-------------------+-------------------------------------------------------+
+
+
+Target properties
+-----------------
+
+The first column indicates the kind of property, S=Single, D=Deferred,
+Ar=Accumlate-Right and Al=Accumulate-Left.
+
+The third column should be cross referenced with the first column in the
+target list table above.
+
++--+-------------------+-------+----------------------------------------------+
+|K | Name | Which | Description |
++==+===================+=======+==============================================+
+|S | ``ARLIBSUFF`` | 2 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``ARTOOL`` | 2 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``ASOBJSUFF`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``ASTOOL`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``BINSUFF`` | 7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``BLD_TRG`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``BLD_TRG_ARCH`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``BLD_TRG_CPU`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``BLD_TYPE`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``COBJSUFF`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``CTOOL`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``CXXOBJSUFF`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``CXXTOOL`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``DLLSUFF`` | 34 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``EXESUFF`` | 15 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``FETCHDIR`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``FETCHTOOL`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``GID`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``INST`` | 1-9 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``LDTOOL`` | 13-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``LIBSUFF`` | 234 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``MODE`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``NOINST`` | 1-8 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``OBJCOBJSUFF`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``OBJCTOOL`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``OBJSUFF`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``PATCHTOOL`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``RCOBJSUFF`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``RCTOOL`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``SYSSUFF`` | 6 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``TEMPLATE`` | 1-9 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``TOOL`` | 1-9 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``UID`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|S | ``UNPACKTOOL`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|D | ``INSTALLER`` | 1-8 | |
++--+-------------------+-------+----------------------------------------------+
+|D | ``INSTFUN`` | 1-8 | |
++--+-------------------+-------+----------------------------------------------+
+|D | ``NAME`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|D | ``POST_CMDS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|D | ``PRE_CMDS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|D | ``SONAME`` | 13-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``ARFLAGS`` | 2 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``ASDEFS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``ASFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``CDEFS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``CFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``CXXDEFS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``CXXFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``DEFS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``DEPS`` | 1-8 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``FETCHFLAGS`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``IDFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``IFDLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``ISFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``LDFLAGS`` | 13-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``LNK_DEPS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``LNK_ORDERDEPS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``OBJCDEFS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``OBJCFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``ORDERDEPS`` | 1-8 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``PATCHFLAGS`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``RCDEFS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``RCFLAGS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Ar| ``UNPACKFLAGS`` | 9 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``ASINCS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``BLDDIRS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``CINCS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``CLEAN`` | 1-9 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``CXXINCS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``DIRS`` | 8 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``INCS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``INTERMEDIATES`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``LIBPATH`` | 13-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``LIBS`` | 13-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``OBJCINCS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``RCINCS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``SDKS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``SOURCES`` | 1-9 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``SRC_HANDLERS`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+|Al| ``USES`` | 1-7 | |
++--+-------------------+-------+----------------------------------------------+
+
+
+-----
+
+.. [1] Normally not one of the default passes.
+
+-----
+
+:Status: $Id: QuickReference-kBuild.txt 2345 2009-04-19 23:47:42Z bird $
+:Copyright: Copyright (c) 2009 knut st. osmundsen
+
+
diff --git a/kBuild/doc/QuickReference-kmk.html b/kBuild/doc/QuickReference-kmk.html
new file mode 100644
index 0000000..e7529a6
--- /dev/null
+++ b/kBuild/doc/QuickReference-kmk.html
@@ -0,0 +1,1512 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
+<title>kmk Quick Reference</title>
+<style type="text/css">
+
+/*
+:Author: David Goodger
+:Contact: goodger@users.sourceforge.net
+:Date: $Date: 2009-04-18 14:05:47 +0200 (sab, 18 apr 2009) $
+:Revision: $Revision: 2340 $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+ border: 0 }
+
+table.borderless td, table.borderless th {
+ /* Override padding for "table.docutils td" with "! important".
+ The right padding separates the table cells. */
+ padding: 0 0.5em 0 0 ! important }
+
+.first {
+ /* Override more specific margin styles with "! important". */
+ margin-top: 0 ! important }
+
+.last, .with-subtitle {
+ margin-bottom: 0 ! important }
+
+.hidden {
+ display: none }
+
+a.toc-backref {
+ text-decoration: none ;
+ color: black }
+
+blockquote.epigraph {
+ margin: 2em 5em ; }
+
+dl.docutils dd {
+ margin-bottom: 0.5em }
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+ font-weight: bold }
+*/
+
+div.abstract {
+ margin: 2em 5em }
+
+div.abstract p.topic-title {
+ font-weight: bold ;
+ text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+ margin: 2em ;
+ border: medium outset ;
+ padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+ font-weight: bold ;
+ font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+ color: red ;
+ font-weight: bold ;
+ font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+ compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+ margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+ margin-top: 0.5em }
+*/
+
+div.dedication {
+ margin: 2em 5em ;
+ text-align: center ;
+ font-style: italic }
+
+div.dedication p.topic-title {
+ font-weight: bold ;
+ font-style: normal }
+
+div.figure {
+ margin-left: 2em ;
+ margin-right: 2em }
+
+div.footer, div.header {
+ clear: both;
+ font-size: smaller }
+
+div.line-block {
+ display: block ;
+ margin-top: 1em ;
+ margin-bottom: 1em }
+
+div.line-block div.line-block {
+ margin-top: 0 ;
+ margin-bottom: 0 ;
+ margin-left: 1.5em }
+
+div.sidebar {
+ margin-left: 1em ;
+ border: medium outset ;
+ padding: 1em ;
+ background-color: #ffffee ;
+ width: 40% ;
+ float: right ;
+ clear: right }
+
+div.sidebar p.rubric {
+ font-family: sans-serif ;
+ font-size: medium }
+
+div.system-messages {
+ margin: 5em }
+
+div.system-messages h1 {
+ color: red }
+
+div.system-message {
+ border: medium outset ;
+ padding: 1em }
+
+div.system-message p.system-message-title {
+ color: red ;
+ font-weight: bold }
+
+div.topic {
+ margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+ margin-top: 0.4em }
+
+h1.title {
+ text-align: center }
+
+h2.subtitle {
+ text-align: center }
+
+hr.docutils {
+ width: 75% }
+
+img.align-left {
+ clear: left }
+
+img.align-right {
+ clear: right }
+
+ol.simple, ul.simple {
+ margin-bottom: 1em }
+
+ol.arabic {
+ list-style: decimal }
+
+ol.loweralpha {
+ list-style: lower-alpha }
+
+ol.upperalpha {
+ list-style: upper-alpha }
+
+ol.lowerroman {
+ list-style: lower-roman }
+
+ol.upperroman {
+ list-style: upper-roman }
+
+p.attribution {
+ text-align: right ;
+ margin-left: 50% }
+
+p.caption {
+ font-style: italic }
+
+p.credits {
+ font-style: italic ;
+ font-size: smaller }
+
+p.label {
+ white-space: nowrap }
+
+p.rubric {
+ font-weight: bold ;
+ font-size: larger ;
+ color: maroon ;
+ text-align: center }
+
+p.sidebar-title {
+ font-family: sans-serif ;
+ font-weight: bold ;
+ font-size: larger }
+
+p.sidebar-subtitle {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+p.topic-title {
+ font-weight: bold }
+
+pre.address {
+ margin-bottom: 0 ;
+ margin-top: 0 ;
+ font-family: serif ;
+ font-size: 100% }
+
+pre.literal-block, pre.doctest-block {
+ margin-left: 2em ;
+ margin-right: 2em ;
+ background-color: #eeeeee }
+
+span.classifier {
+ font-family: sans-serif ;
+ font-style: oblique }
+
+span.classifier-delimiter {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+span.interpreted {
+ font-family: sans-serif }
+
+span.option {
+ white-space: nowrap }
+
+span.pre {
+ white-space: pre }
+
+span.problematic {
+ color: red }
+
+span.section-subtitle {
+ /* font-size relative to parent (h1..h6 element) */
+ font-size: 80% }
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px }
+
+table.docinfo {
+ margin: 2em 4em }
+
+table.docutils {
+ margin-top: 0.5em ;
+ margin-bottom: 0.5em }
+
+table.footnote {
+ border-left: solid 1px black;
+ margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+ padding-left: 0.5em ;
+ padding-right: 0.5em ;
+ vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+ font-weight: bold ;
+ text-align: left ;
+ white-space: nowrap ;
+ padding-left: 0 }
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+ font-size: 100% }
+
+tt.docutils {
+ background-color: #eeeeee }
+
+ul.auto-toc {
+ list-style-type: none }
+
+</style>
+</head>
+<body>
+<div class="document" id="kmk-quick-reference">
+<h1 class="title">kmk Quick Reference</h1>
+<p>This is an attempt at summarizing all directives, functions, special variables,
+special targets, built-in commands, external commands, and <tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions.
+Since <em>all</em> the features are included, the quickness of this reference can be
+disputed. ;-)</p>
+<div class="section">
+<h1><a id="directives" name="directives">Directives</a></h1>
+<p>Here is a summary of the directives <tt class="docutils literal"><span class="pre">kmk</span></tt> recognizes:</p>
+<blockquote>
+<p>Define a multi-line, recursively-expanded variable:</p>
+<pre class="literal-block">
+define variable
+endef
+</pre>
+<p>Conditionally evaluate part of the makefile:</p>
+<pre class="literal-block">
+ifdef variable
+ifndef variable
+ifeq (a,b)
+ifeq &quot;a&quot; &quot;b&quot;
+ifeq 'a' 'b'
+ifneq (a,b)
+ifneq &quot;a&quot; &quot;b&quot;
+ifneq 'a' 'b'
+if1of (set-a,set-b) [1]
+ifn1of (set-a,set-b) [1]
+if expression [1]
+else
+endif
+</pre>
+<p>Include another makefile:</p>
+<pre class="literal-block">
+include file
+-include file
+sinclude file
+</pre>
+<p>Include another dependency file <a class="footnote-reference" href="#id84" id="id1" name="id1">[1]</a>:</p>
+<pre class="literal-block">
+includedep file
+</pre>
+<p>Define a variable, overriding any previous definition, even one from the
+command line:</p>
+<pre class="literal-block">
+override variable = value
+override variable := value
+override variable += value
+override variable &lt;= value [1]
+override variable ?= value
+override define variable
+endef
+</pre>
+<p>Tell <tt class="docutils literal"><span class="pre">kmk</span></tt> to export all variables to child processes by default:</p>
+<pre class="literal-block">
+export
+</pre>
+<p>Tell <tt class="docutils literal"><span class="pre">kmk</span></tt> whether or not to export a particular variable to child
+processes:</p>
+<pre class="literal-block">
+export variable
+export variable = value
+export variable := value
+export variable += value
+export variable &lt;= value [1]
+export variable ?= value
+unexport variable
+</pre>
+<p>Define a variable in the local context instead of the global one <a class="footnote-reference" href="#id84" id="id2" name="id2">[1]</a>:</p>
+<pre class="literal-block">
+local variable = value
+local variable := value
+local variable += value
+local variable &lt;= value
+local variable ?= value
+local define variable
+endef
+</pre>
+<p>Specify a search path for files matching a <tt class="docutils literal"><span class="pre">%</span></tt> pattern:</p>
+<pre class="literal-block">
+vpath pattern path
+</pre>
+<p>Remove all search paths previously specified for pattern:</p>
+<pre class="literal-block">
+vpath pattern
+</pre>
+<p>Remove all search paths previously specified in any vpath directive:</p>
+<pre class="literal-block">
+vpath
+</pre>
+</blockquote>
+</div>
+<div class="section">
+<h1><a id="automatic-variables" name="automatic-variables">Automatic variables</a></h1>
+<p>Here is a summary of the automatic variables.</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="14%" />
+<col width="86%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Variable</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">$&#64;</span></tt></td>
+<td>The file name of the target.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$&lt;</span></tt></td>
+<td>The name of the first prerequisite.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$?</span></tt></td>
+<td>The names of all the prerequisites that are newer than the
+target, with spaces between them.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$^</span></tt></td>
+<td>The names of all the prerequisites, duplicates omitted.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$+</span></tt></td>
+<td>The names of all the prerequisites, duplicates and order
+preserved</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$*</span></tt></td>
+<td>The stem with which an implicit rule matches.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$|</span></tt></td>
+<td>The name of all the order only prerequisites.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(&#64;D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">$&#64;</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(&lt;D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">$&lt;</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(?D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">$?</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(^D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">%^</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(+D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">$+</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(*D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">$*</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(|D)</span></tt></td>
+<td>The directory part of <tt class="docutils literal"><span class="pre">$|</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(&#64;F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$&#64;</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(&lt;F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$&lt;</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(?F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$?</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(^F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$^</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(+F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$+</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(*F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$*</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">$(|F)</span></tt></td>
+<td>The file-within-directory part of <tt class="docutils literal"><span class="pre">$|</span></tt>.</td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="section">
+<h1><a id="special-variables" name="special-variables">Special variables</a></h1>
+<p>All variables starting with a <tt class="docutils literal"><span class="pre">.</span></tt> is reserved by <tt class="docutils literal"><span class="pre">kmk</span></tt>. The following
+variables are specially used or/and defined by <tt class="docutils literal"><span class="pre">kmk</span></tt>:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="34%" />
+<col width="66%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Variable</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">.DEFAULT_GOAL</span></tt></td>
+<td>The makefile default goal. You can set this in
+the makefile, if you don't it will default to
+the first target that is encountered.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.FEATURES</span></tt></td>
+<td>List of GNU <tt class="docutils literal"><span class="pre">make</span></tt> features. Do not set this.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.INCLUDE_DIRS</span></tt></td>
+<td>List of include directories, <tt class="docutils literal"><span class="pre">-I</span></tt> arguments
+and defaults. Do not set this.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.RECIPEPREFIX</span></tt></td>
+<td>Recipe prefix, defaults to tab.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.VARIABLES</span></tt></td>
+<td>Special variable which exands to the list of
+variable. Do not set this.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">CURDIR</span></tt></td>
+<td>Set to the pathname of the current working
+directory (after all <tt class="docutils literal"><span class="pre">-C</span></tt> options are
+processed, if any). Do not set this.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KBUILD_VERSION</span></tt>,
+<tt class="docutils literal"><span class="pre">KBUILD_VERSION_MAJOR</span></tt>,
+<tt class="docutils literal"><span class="pre">KBUILD_VERSION_MINOR</span></tt>,
+<tt class="docutils literal"><span class="pre">KBUILD_VERSION_PATCH</span></tt>,
+<tt class="docutils literal"><span class="pre">KBUILD_KMK_REVISION</span></tt></td>
+<td>The kBuild version string and the break down
+into individual components. <a class="footnote-reference" href="#id84" id="id3" name="id3">[1]</a></td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST</span></tt> <a class="footnote-reference" href="#id84" id="id4" name="id4">[1]</a></td>
+<td>The host operating system.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_ARCH</span></tt> <a class="footnote-reference" href="#id84" id="id5" name="id5">[1]</a></td>
+<td>The host architecture.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KBUILD_HOST_CPU</span></tt> <a class="footnote-reference" href="#id84" id="id6" name="id6">[1]</a></td>
+<td>The host CPU <tt class="docutils literal"><span class="pre">kmk</span></tt> is built for, set to
+<tt class="docutils literal"><span class="pre">blend</span></tt> if not any particular CPU.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KBUILD_PATH</span></tt> <a class="footnote-reference" href="#id84" id="id7" name="id7">[1]</a></td>
+<td>Where the kBuild scripts are.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KBUILD_BIN_PATH</span></tt> <a class="footnote-reference" href="#id84" id="id8" name="id8">[1]</a></td>
+<td>Where the host specific kBuild binaries are.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK</span></tt> <a class="footnote-reference" href="#id84" id="id9" name="id9">[1]</a>,
+<tt class="docutils literal"><span class="pre">MAKE</span></tt></td>
+<td>The name with which <tt class="docutils literal"><span class="pre">kmk</span></tt> was invoked. Using
+this variable in recipes has special meaning.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_BUILTIN</span></tt> <a class="footnote-reference" href="#id84" id="id10" name="id10">[1]</a></td>
+<td>List of built-in commands.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_FEATURES</span></tt> <a class="footnote-reference" href="#id84" id="id11" name="id11">[1]</a></td>
+<td>List of <tt class="docutils literal"><span class="pre">kmk</span></tt> specific features.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt> <a class="footnote-reference" href="#id84" id="id12" name="id12">[1]</a></td>
+<td><p class="first">The flags given to <tt class="docutils literal"><span class="pre">kmk</span></tt>. You can set this in
+the environment or a makefile to set flags.</p>
+<p class="last">It is never appropriate to use <tt class="docutils literal"><span class="pre">KMK_FLAGS</span></tt>
+directly in a recipe line: its contents may not
+be quoted correctly for use in the shell. Always
+allow recursive <tt class="docutils literal"><span class="pre">kmk</span></tt>'s to obtain these values
+through the environment from its parent.</p>
+</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_LEVEL</span></tt> <a class="footnote-reference" href="#id84" id="id13" name="id13">[1]</a></td>
+<td>The number of levels of recursion (sub-makes).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_VERSION</span></tt> <a class="footnote-reference" href="#id84" id="id14" name="id14">[1]</a></td>
+<td>The GNU <tt class="docutils literal"><span class="pre">make</span></tt> version number.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">MAKECMDGOALS</span></tt></td>
+<td>The targets given to <tt class="docutils literal"><span class="pre">kmk</span></tt> on the command line.
+Do not set this.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">MAKEFILES</span></tt></td>
+<td>Makefiles to be read on every invocation of
+<tt class="docutils literal"><span class="pre">kmk</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">MAKEFILE_LIST</span></tt></td>
+<td>List of the makefiles that <tt class="docutils literal"><span class="pre">kmk</span></tt> has opened.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">MAKESHELL</span></tt></td>
+<td>OS/2 and MS-DOS only, the name of the command
+interpreter that is to be used by <tt class="docutils literal"><span class="pre">kmk</span></tt>. This
+value takes precedence over the value of SHELL.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">SHELL</span></tt></td>
+<td>The name of the default command interpreter,
+kmk_ash. You can set SHELL in the makefile to
+change the shell used to run recipes. The SHELL
+variable is handled specially when importing
+from and exporting to the environment.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">SUFFIXES</span></tt></td>
+<td>The default list of suffixes before <tt class="docutils literal"><span class="pre">kmk</span></tt>
+reads any makefiles (always empty).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">VPATH</span></tt></td>
+<td>Directory search path for files not found in the
+current directory.</td>
+</tr>
+</tbody>
+</table>
+<p>The following variables reflects <tt class="docutils literal"><span class="pre">kmk</span></tt> options. Do not set these. <a class="footnote-reference" href="#id84" id="id15" name="id15">[1]</a></p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="49%" />
+<col width="51%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Variable</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_JOBS</span></tt></td>
+<td>-j slots, <tt class="docutils literal"><span class="pre">0</span></tt> if not given.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_KEEP_GOING</span></tt></td>
+<td>-k indictor (<tt class="docutils literal"><span class="pre">0</span></tt>/<tt class="docutils literal"><span class="pre">1</span></tt>).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_JUST_PRINT</span></tt></td>
+<td>-n indicator (<tt class="docutils literal"><span class="pre">0</span></tt>/<tt class="docutils literal"><span class="pre">1</span></tt>).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_PRORITY</span></tt></td>
+<td>--priority level, <tt class="docutils literal"><span class="pre">0</span></tt> if not given.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_AFFINITY</span></tt></td>
+<td>--affinity mask, <tt class="docutils literal"><span class="pre">0</span></tt> if not given.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_STATISTICS</span></tt></td>
+<td>--statistics indicator (<tt class="docutils literal"><span class="pre">0</span></tt>/<tt class="docutils literal"><span class="pre">1</span></tt>).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_PRINT_TIME</span></tt></td>
+<td>The --print-time value.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">KMK_OPTS_PRETTY_COMMAND_PRINTING</span></tt></td>
+<td>--pretty-command-printing indicator.</td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="section">
+<h1><a id="special-targets" name="special-targets">Special Targets</a></h1>
+<p>Certain names have special meanings if they appear as targets.</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="41%" />
+<col width="59%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Target</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">.DEFAULT</span></tt></td>
+<td>The recipe is used for any target for which
+no rules are found.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.DELETE_ON_ERROR</span></tt></td>
+<td>If mentioned, <tt class="docutils literal"><span class="pre">kmk</span></tt> will delete the
+targets of a rule if it has changed and its
+recipe fails or is interrupted.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.EXPORT_ALL_VARIABLES</span></tt></td>
+<td>If mentioned, all variables will by default
+be exported to child processes.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.IGNORE</span></tt></td>
+<td>Ignore errors in the execution of the recipe
+for the targets <tt class="docutils literal"><span class="pre">.IGNORE</span></tt> depends on, if
+no prequisites all targets are affected.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.INTERMEDIATE</span></tt></td>
+<td>The prerequisites are treated as
+intermediate files (implicite rules).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.LOW_RESOLUTION_TIME</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">kmk</span></tt> will assume prerequisite files are
+created with low resolution time stamps.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.NOTPARALLEL</span></tt></td>
+<td>If mentioned without any prerequisites,
+<tt class="docutils literal"><span class="pre">kmk</span></tt> will run serially as if -j1 was
+given. If it has prerequisites <tt class="docutils literal"><span class="pre">kmk</span></tt> <a class="footnote-reference" href="#id84" id="id16" name="id16">[1]</a>
+will only do this for the targets among
+them.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.PHONY</span></tt></td>
+<td>The prerequisites are considered phony and
+will be rebuilt unconditionally.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt></td>
+<td>The targets which <tt class="docutils literal"><span class="pre">.PRECIOUS</span></tt> depends
+will to be deleted if <tt class="docutils literal"><span class="pre">kmk</span></tt> is killed or
+interrupted while their building.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.SECONDARY</span></tt></td>
+<td>The prerequisites are treated as
+intermediate files, except that they are
+never automatically deleted. If used with
+no prerequisites all targets gets this
+treatement.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.SECONDEXPANSION</span></tt></td>
+<td>If mentioned, all prerequisite lists after
+it will be expanded a second time after all
+makefiles have been read.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.SECONDTARGETEXPANSION</span></tt>
+<a class="footnote-reference" href="#id84" id="id17" name="id17">[1]</a></td>
+<td>If mentioned, all targets after it will be
+expanded a second time after all makefiles
+have been read.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.SILENT</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">kmk</span></tt> will not print the recipe for
+targets listed as prerequisites, if none
+then it applies to all targets.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">.SUFFIXES</span></tt></td>
+<td>The prerequisites are the list of suffixes
+used in checking for suffix rules. If it
+appears without prerequisites it the suffix
+will be cleared.</td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="section">
+<h1><a id="commands" name="commands">Commands</a></h1>
+<p>Builtin commands <a class="footnote-reference" href="#id84" id="id18" name="id18">[1]</a> all start with <tt class="docutils literal"><span class="pre">kmk_builtin_</span></tt>, so in order to save
+space this prefix has been omitted in the table below. All commands comes in an
+external edition that can be used by/in the shell, these are prefixed <tt class="docutils literal"><span class="pre">kmk_</span></tt>.</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="20%" />
+<col width="80%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Command</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">append</span></tt></td>
+<td>Append text to a file. The builtin version can output the
+value of a variable or the commands of a target.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">cat</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">cat</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">chmod</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">chmod</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">cmp</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">cmp</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">cp</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">cp</span></tt> command with some twaking.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">echo</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">echo</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">expr</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">expr</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">install</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">install</span></tt> command with some tweaking.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">kDepIDB</span></tt></td>
+<td>Extract dependencies from a Visual C++ .IDB file.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">ln</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">ln</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">md5sum</span></tt></td>
+<td>Typical MD5 sum program, custom kBuild version.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">mkdir</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">mkdir</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">mv</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">mv</span></tt> command with some tweaking.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">printf</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">printf</span></tt> command.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">rm</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">rm</span></tt> command with some tweaking.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">rmdir</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">rmdir</span></tt> command with some tweaking.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">sleep</span></tt></td>
+<td>Typical <tt class="docutils literal"><span class="pre">sleep</span></tt> program, custom kBuild version.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">test</span></tt></td>
+<td>The BSD <tt class="docutils literal"><span class="pre">test</span></tt> program with some tweaking.</td>
+</tr>
+</tbody>
+</table>
+<p>Some additional external commands are available in the <tt class="docutils literal"><span class="pre">kmk</span></tt> / <tt class="docutils literal"><span class="pre">kBuild</span></tt>
+environment (<tt class="docutils literal"><span class="pre">kSomething</span></tt> command are not prefixed with <tt class="docutils literal"><span class="pre">kmk_</span></tt>):</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="20%" />
+<col width="80%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Command</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">kDepPre</span></tt></td>
+<td>Extract dependencies from the C/C++ preprocessor output.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">kObjCache</span></tt></td>
+<td>Simple object file cache program.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">ash</span></tt></td>
+<td>Almquist's shell (NetBSD variant).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">gmake</span></tt></td>
+<td>Vanilla GNU <tt class="docutils literal"><span class="pre">make</span></tt> from same sources as <tt class="docutils literal"><span class="pre">kmk</span></tt>.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">redirect</span></tt></td>
+<td>Shell avoidance tool. Sets up file descriptors, environment
+variables and current directory before kicking of program.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">sed</span></tt></td>
+<td>GNU <tt class="docutils literal"><span class="pre">sed</span></tt> with some tweaks to avoid involving the shell.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">time</span></tt></td>
+<td>Stopwatch utility for measuring program execution time(s).</td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="section">
+<h1><a id="kmk-expression" name="kmk-expression">kmk-expression</a></h1>
+<p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions <a class="footnote-reference" href="#id84" id="id19" name="id19">[1]</a> are related to the C/C++ preprocessor in some ways as
+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
+because of the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function
+library, so, strings can be turned into boolean by taking any non-empty string
+as true.</p>
+<p>Quoting using single quotes results in hard strings, while double quotes and
+unquoted string results in soft strings that can be converted to number or
+boolean to fit the situation.</p>
+<p>Here's the operator table in decending precedence order:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="20%" />
+<col width="11%" />
+<col width="70%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Operator</th>
+<th class="head">Type</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td><tt class="docutils literal"><span class="pre">defined</span></tt></td>
+<td rowspan="6">Unary</td>
+<td>Checks if the following variable exists.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">exists</span></tt></td>
+<td>Checks if the following file exists.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">target</span></tt></td>
+<td>Checks if the following target exists.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">bool</span></tt></td>
+<td>Casts the following value to boolean.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">num</span></tt></td>
+<td>Casts the following value to a number.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">str</span></tt></td>
+<td>Casts the following value to a string.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">!</span></tt></td>
+<td rowspan="4">Unary</td>
+<td>Logical NOT.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">+</span></tt></td>
+<td>Pluss prefix.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
+<td>Minus prefix.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">~</span></tt></td>
+<td>Bitwise one's complement.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">*</span></tt></td>
+<td rowspan="3">Binary</td>
+<td>Multiplication (product).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">/</span></tt></td>
+<td>Division (quotient).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">%</span></tt></td>
+<td>Modulus (remainder).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">+</span></tt></td>
+<td rowspan="2">Binary</td>
+<td>Addition (sum).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
+<td>Subtraction (difference).</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&lt;&lt;</span></tt></td>
+<td rowspan="2">Binary</td>
+<td>Bitwise left shift.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&gt;&gt;</span></tt></td>
+<td>Bitwise right shift.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&lt;=</span></tt></td>
+<td rowspan="4">Binary</td>
+<td>Less or equal than.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&lt;</span></tt></td>
+<td>Less than.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&gt;=</span></tt></td>
+<td>Greater or equal than.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&gt;</span></tt></td>
+<td>Greater than.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">==</span></tt></td>
+<td rowspan="2">Binary</td>
+<td>Equal to.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">!=</span></tt></td>
+<td>Not equal to.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&amp;</span></tt></td>
+<td>Binary</td>
+<td>Bitwise AND.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">^</span></tt></td>
+<td>Binary</td>
+<td>Bitwise XOR.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">|</span></tt></td>
+<td>Binary</td>
+<td>Bitwise OR.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">&amp;&amp;</span></tt></td>
+<td>Binary</td>
+<td>Logical AND.</td>
+</tr>
+<tr><td><tt class="docutils literal"><span class="pre">||</span></tt></td>
+<td>Binary</td>
+<td>Logical OR.</td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="section">
+<h1><a id="built-in-functions" name="built-in-functions">Built-in functions</a></h1>
+<p>String Manipulation Functions:</p>
+<blockquote>
+<p>Replace <tt class="docutils literal"><span class="pre">from</span></tt> with <tt class="docutils literal"><span class="pre">to</span></tt> in <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(subst from,to,text)
+</pre>
+<p>Replace words matching <tt class="docutils literal"><span class="pre">pattern</span></tt> with <tt class="docutils literal"><span class="pre">replacement</span></tt> in <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(patsubst pattern,replacement,text)
+</pre>
+<p>Remove excess whitespace characters from <tt class="docutils literal"><span class="pre">string</span></tt>:</p>
+<pre class="literal-block">
+$(strip string)
+</pre>
+<p>Locate <tt class="docutils literal"><span class="pre">find</span></tt> in <tt class="docutils literal"><span class="pre">text</span></tt>, returning <tt class="docutils literal"><span class="pre">find</span></tt> if found:</p>
+<pre class="literal-block">
+$(findstring find,text)
+</pre>
+<p>Select words in <tt class="docutils literal"><span class="pre">text</span></tt> that match one of the <tt class="docutils literal"><span class="pre">pattern</span></tt> words:</p>
+<pre class="literal-block">
+$(filter pattern...,text)
+</pre>
+<p>Select words in <tt class="docutils literal"><span class="pre">text</span></tt> that do not match any of the <tt class="docutils literal"><span class="pre">pattern</span></tt> words:</p>
+<pre class="literal-block">
+$(filter-out pattern...,text)
+</pre>
+<p>Sort the words in <tt class="docutils literal"><span class="pre">list</span></tt> lexicographically, removing duplicates:</p>
+<pre class="literal-block">
+$(sort list)
+</pre>
+<p>Sort the words in <tt class="docutils literal"><span class="pre">list</span></tt> lexicographically in reserve order, removing
+duplicates <a class="footnote-reference" href="#id84" id="id20" name="id20">[1]</a>:</p>
+<pre class="literal-block">
+$(rsort list)
+</pre>
+<p>Count the number of words in <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(words text)
+</pre>
+<p>Extract the <tt class="docutils literal"><span class="pre">n</span></tt>th word (one-origin) of <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(word n,text)
+</pre>
+<p>Returns the list of words in <tt class="docutils literal"><span class="pre">text</span></tt> from <tt class="docutils literal"><span class="pre">s</span></tt> to <tt class="docutils literal"><span class="pre">e</span></tt> (one-origin):</p>
+<pre class="literal-block">
+$(wordlist s,e,text)
+</pre>
+<p>Extract the first word of <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
+<pre class="literal-block">
+$(firstword names...)
+</pre>
+<p>Extract the last word of <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
+<pre class="literal-block">
+$(lastword names...)
+</pre>
+<p>Join two parallel lists of words:</p>
+<pre class="literal-block">
+$(join list1,list2)
+</pre>
+<p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to upper case <a class="footnote-reference" href="#id84" id="id21" name="id21">[1]</a>:</p>
+<pre class="literal-block">
+$(toupper text)
+</pre>
+<p>Fold <tt class="docutils literal"><span class="pre">text</span></tt> to lower case <a class="footnote-reference" href="#id84" id="id22" name="id22">[1]</a>:</p>
+<pre class="literal-block">
+$(tolower text)
+</pre>
+<p>String formatting a la the unix <tt class="docutils literal"><span class="pre">printf</span></tt> command <a class="footnote-reference" href="#id84" id="id23" name="id23">[1]</a>:</p>
+<pre class="literal-block">
+$(printf fmt, arg...)
+</pre>
+<p>Return the length of a string or a (unexpanded) variable <a class="footnote-reference" href="#id84" id="id24" name="id24">[1]</a>:</p>
+<pre class="literal-block">
+$(length string)
+$(length-var var)
+</pre>
+<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.
+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
+positive ones are one based <a class="footnote-reference" href="#id84" id="id25" name="id25">[1]</a>:</p>
+<pre class="literal-block">
+$(pos needle, haystack[, start])
+$(lastpos needle, haystack[, start])
+</pre>
+<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>.
+If the substring is partially outside the <tt class="docutils literal"><span class="pre">string</span></tt> the result will be
+padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present <a class="footnote-reference" href="#id84" id="id26" name="id26">[1]</a>:</p>
+<pre class="literal-block">
+$(substr string, start[, length[, pad]])
+</pre>
+<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
+<tt class="docutils literal"><span class="pre">$(pos</span> <span class="pre">)</span></tt>, except that <tt class="docutils literal"><span class="pre">0</span></tt> is the end of the string <a class="footnote-reference" href="#id84" id="id27" name="id27">[1]</a>:</p>
+<pre class="literal-block">
+$(insert in, str[, n[, length[, pad]]])
+</pre>
+<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>,
+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
+<tt class="docutils literal"><span class="pre">pad-char</span></tt> characters absent in <tt class="docutils literal"><span class="pre">to-set</span></tt> will be deleted <a class="footnote-reference" href="#id84" id="id28" name="id28">[1]</a>:</p>
+<pre class="literal-block">
+$(translate string, from-set[, to-set[, pad-char]])
+</pre>
+</blockquote>
+<p>Functions for file names:</p>
+<blockquote>
+<p>Extract the directory part of each file <tt class="docutils literal"><span class="pre">name</span></tt>:</p>
+<pre class="literal-block">
+$(dir names...)
+</pre>
+<p>Extract the non-directory part of each file <tt class="docutils literal"><span class="pre">name</span></tt>:</p>
+<pre class="literal-block">
+$(notdir names...)
+</pre>
+<p>Extract the suffix (the last <tt class="docutils literal"><span class="pre">.</span></tt> and following characters) of each file
+<tt class="docutils literal"><span class="pre">name</span></tt>:</p>
+<pre class="literal-block">
+$(suffix names...)
+</pre>
+<p>Extract the base name (name without suffix) of each file name:</p>
+<pre class="literal-block">
+$(basename names...)
+</pre>
+<p>Extract the root specification of each file name (a bit complicated on
+Windows &amp; OS/2) <a class="footnote-reference" href="#id84" id="id29" name="id29">[1]</a>:</p>
+<pre class="literal-block">
+$(root names...)
+</pre>
+<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>
+<pre class="literal-block">
+$(addsuffix suffix,names...)
+</pre>
+<p>Prepend <tt class="docutils literal"><span class="pre">prefix</span></tt> to each word in <tt class="docutils literal"><span class="pre">names</span></tt>:</p>
+<pre class="literal-block">
+$(addprefix prefix,names...)
+</pre>
+<p>Find file names matching a shell file name <tt class="docutils literal"><span class="pre">pattern</span></tt> (not a <tt class="docutils literal"><span class="pre">%</span></tt>
+pattern):</p>
+<pre class="literal-block">
+$(wildcard pattern...)
+</pre>
+<p>For each file name in <tt class="docutils literal"><span class="pre">names</span></tt>, expand to an absolute name that does not
+contain any <tt class="docutils literal"><span class="pre">.</span></tt>, <tt class="docutils literal"><span class="pre">..</span></tt>, nor symlinks:</p>
+<pre class="literal-block">
+$(realpath names...)
+</pre>
+<p>For each file name in <tt class="docutils literal"><span class="pre">names</span></tt>, expand to an absolute name that does not
+contain any <tt class="docutils literal"><span class="pre">.</span></tt> or <tt class="docutils literal"><span class="pre">..</span></tt> components, but preserves symlinks:</p>
+<pre class="literal-block">
+$(abspath names...)
+</pre>
+<p>Same as <tt class="docutils literal"><span class="pre">$(abspath</span> <span class="pre">)</span></tt> except that the current directory can be
+specified as <tt class="docutils literal"><span class="pre">curdir</span></tt> <a class="footnote-reference" href="#id84" id="id30" name="id30">[1]</a>:</p>
+<pre class="literal-block">
+$(abspathex names...[, curdir])
+</pre>
+</blockquote>
+<p>Arithmetic Functions:</p>
+<blockquote>
+<p>Returns the sum of the arguments <a class="footnote-reference" href="#id84" id="id31" name="id31">[1]</a>:</p>
+<pre class="literal-block">
+$(int-add addend1, addend2[, addendN])
+</pre>
+<p>Returns the difference between the first argument and the sum of the
+rest <a class="footnote-reference" href="#id84" id="id32" name="id32">[1]</a>:</p>
+<pre class="literal-block">
+$(int-sub minuend, subtrahend[, subtrahendN])
+</pre>
+<p>Returns the product of the arguments <a class="footnote-reference" href="#id84" id="id33" name="id33">[1]</a>:</p>
+<pre class="literal-block">
+$(int-mul factor1, factor2[, factorN])
+</pre>
+<p>Returns the quotient of first argument and the rest <a class="footnote-reference" href="#id84" id="id34" name="id34">[1]</a>:</p>
+<pre class="literal-block">
+$(int-div dividend, divisor[, divisorN])
+</pre>
+<p>Returns the modulus of the two arguments <a class="footnote-reference" href="#id84" id="id35" name="id35">[1]</a>:</p>
+<pre class="literal-block">
+$(int-mod dividend, divisor)
+</pre>
+<p>Returns the bitwise two-complement of argument <a class="footnote-reference" href="#id84" id="id36" name="id36">[1]</a>:</p>
+<pre class="literal-block">
+$(int-not val)
+</pre>
+<p>Returns the result of a bitwise AND of the arguments <a class="footnote-reference" href="#id84" id="id37" name="id37">[1]</a>:</p>
+<pre class="literal-block">
+$(int-and val1, val2[, valN])
+</pre>
+<p>Returns the result of a bitwise OR of the arguments <a class="footnote-reference" href="#id84" id="id38" name="id38">[1]</a>:</p>
+<pre class="literal-block">
+$(int-or val1, val2[, valN])
+</pre>
+<p>Returns the result of a bitwise XOR of the arguments <a class="footnote-reference" href="#id84" id="id39" name="id39">[1]</a>:</p>
+<pre class="literal-block">
+$(int-xor val1, val2[, valN])
+</pre>
+<p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true = non-empty, false = empty) result
+of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">==</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id40" name="id40">[1]</a>:</p>
+<pre class="literal-block">
+$(int-eq val1, val2)
+</pre>
+<p>Returns the <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean result of <tt class="docutils literal"><span class="pre">val1</span> <span class="pre">!=</span> <span class="pre">val2</span></tt> <a class="footnote-reference" href="#id84" id="id41" name="id41">[1]</a>:</p>
+<pre class="literal-block">
+$(int-ne val1, val2)
+</pre>
+<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="#id84" id="id42" name="id42">[1]</a>:</p>
+<pre class="literal-block">
+$(int-gt val1, val2)
+</pre>
+<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="#id84" id="id43" name="id43">[1]</a>:</p>
+<pre class="literal-block">
+$(int-ge val1, val2)
+</pre>
+<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="#id84" id="id44" name="id44">[1]</a>:</p>
+<pre class="literal-block">
+$(int-lt val1, val2)
+</pre>
+<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="#id84" id="id45" name="id45">[1]</a>:</p>
+<pre class="literal-block">
+$(int-le val1, val2)
+</pre>
+</blockquote>
+<p>Boolean and Conditional Functions:</p>
+<blockquote>
+<p>Condition is false if the <tt class="docutils literal"><span class="pre">condition</span></tt> evaluates to an empty string
+(stripped). Evaluate the <tt class="docutils literal"><span class="pre">true-part</span></tt> if the condition is true, otherwise
+the <tt class="docutils literal"><span class="pre">false-part</span></tt>:</p>
+<pre class="literal-block">
+$(if condition,true-part[,false-part])
+</pre>
+<p>Test if any of the conditions evalues to non-empty string, returning the
+first one:</p>
+<pre class="literal-block">
+$(or condition1[,condition2[,condition3[...]]])
+</pre>
+<p>Test if all of the conditions evaluates to non-empty strings, returning the
+last one:</p>
+<pre class="literal-block">
+$(and condition1[,condition2[,condition3[...]]])
+</pre>
+<p>Test if the two strings are identical, returning <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean (true =
+non-empty, false = empty) <a class="footnote-reference" href="#id85" id="id46" name="id46">[2]</a>:</p>
+<pre class="literal-block">
+$(eq str1, str2)
+</pre>
+<p>Invert a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id85" id="id47" name="id47">[2]</a>:</p>
+<pre class="literal-block">
+$(not val)
+</pre>
+<p>Test if <tt class="docutils literal"><span class="pre">variable</span></tt> is defined, returning a <tt class="docutils literal"><span class="pre">kmk</span></tt> boolean value <a class="footnote-reference" href="#id84" id="id48" name="id48">[1]</a>:</p>
+<pre class="literal-block">
+$(defined variable)
+</pre>
+<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
+value <a class="footnote-reference" href="#id84" id="id49" name="id49">[1]</a>:</p>
+<pre class="literal-block">
+$(intersects set-a, set-b)
+</pre>
+<p>Same as <tt class="docutils literal"><span class="pre">$(if</span> <span class="pre">)</span></tt> execpt that the condition is a <tt class="docutils literal"><span class="pre">kmk</span></tt>-expression <a class="footnote-reference" href="#id84" id="id50" name="id50">[1]</a>:</p>
+<pre class="literal-block">
+$(if-expr kmk-expression,true-part[,false-part])
+</pre>
+<p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) and expand the
+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> <a class="footnote-reference" href="#id84" id="id51" name="id51">[1]</a>:</p>
+<pre class="literal-block">
+$(select when1-cond, when1-body[, whenN-cond, whenN-body])
+</pre>
+<p>Evalutate the <tt class="docutils literal"><span class="pre">kmk-expression</span></tt> returning what it evalues as. This is
+the preferred way of doing arithmentic now <a class="footnote-reference" href="#id84" id="id52" name="id52">[1]</a>:</p>
+<pre class="literal-block">
+$(expr kmk-expression)
+</pre>
+</blockquote>
+<p>Stack Fuctions:</p>
+<blockquote>
+<p>Push <tt class="docutils literal"><span class="pre">item</span></tt> onto the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string <a class="footnote-reference" href="#id84" id="id53" name="id53">[1]</a>:</p>
+<pre class="literal-block">
+$(stack-push stack-var, item)
+</pre>
+<p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt> <a class="footnote-reference" href="#id84" id="id54" name="id54">[1]</a>:</p>
+<pre class="literal-block">
+$(stack-pop stack-var)
+</pre>
+<p>Pop the top item off the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string <a class="footnote-reference" href="#id84" id="id55" name="id55">[1]</a>:</p>
+<pre class="literal-block">
+$(stack-popv stack-var)
+</pre>
+<p>Get the top item of the <tt class="docutils literal"><span class="pre">stack-var</span></tt>, returning the empty string <a class="footnote-reference" href="#id84" id="id56" name="id56">[1]</a>:</p>
+<pre class="literal-block">
+$(stack-top stack-var)
+</pre>
+</blockquote>
+<p>Advanced Functions:</p>
+<blockquote>
+<p>Evaluates to the contents of the variable <tt class="docutils literal"><span class="pre">var</span></tt>, with no expansion
+performed on it:</p>
+<pre class="literal-block">
+$(value var)
+</pre>
+<p>Evaluate <tt class="docutils literal"><span class="pre">body</span></tt> with <tt class="docutils literal"><span class="pre">var</span></tt> bound to each word in <tt class="docutils literal"><span class="pre">words</span></tt>, and
+concatenate the results (spaced):</p>
+<pre class="literal-block">
+$(foreach var,words,body)
+</pre>
+<p>C-style for-loop. Start by evaluating <tt class="docutils literal"><span class="pre">init</span></tt>. Each iteration will
+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,
+then expand <tt class="docutils literal"><span class="pre">body</span></tt> concatenating the result to the previous iterations
+(spaced), and finally evaluate <tt class="docutils literal"><span class="pre">next</span></tt> <a class="footnote-reference" href="#id84" id="id57" name="id57">[1]</a>:</p>
+<pre class="literal-block">
+$(for init,conditions,next,body)
+</pre>
+<p>C-style while-loop. Each iteration will 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, then expand <tt class="docutils literal"><span class="pre">body</span></tt> concatenating the
+result to the previous iterations <a class="footnote-reference" href="#id84" id="id58" name="id58">[1]</a>:</p>
+<pre class="literal-block">
+$(while conditions,body)
+</pre>
+<p>Evaluate the variable <tt class="docutils literal"><span class="pre">var</span></tt> replacing any references to <tt class="docutils literal"><span class="pre">$(1)</span></tt>,
+<tt class="docutils literal"><span class="pre">$(2)</span></tt> with the first, second, etc. <tt class="docutils literal"><span class="pre">param</span></tt> values:</p>
+<pre class="literal-block">
+$(call var,param,...)
+</pre>
+<p>Evaluate <tt class="docutils literal"><span class="pre">text</span></tt> then read the results as makefile commands. Expands
+to the empty string:</p>
+<pre class="literal-block">
+$(eval text)
+</pre>
+<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
+own variable context <a class="footnote-reference" href="#id84" id="id59" name="id59">[1]</a>:</p>
+<pre class="literal-block">
+$(evalctx text)
+</pre>
+<p>Same as <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">$(value</span> <span class="pre">var))</span></tt> <a class="footnote-reference" href="#id84" id="id60" name="id60">[1]</a>:</p>
+<pre class="literal-block">
+$(evalval var)
+</pre>
+<p>Same as <tt class="docutils literal"><span class="pre">$(evalctx</span> <span class="pre">$(value</span> <span class="pre">var))</span></tt> <a class="footnote-reference" href="#id84" id="id61" name="id61">[1]</a>:</p>
+<pre class="literal-block">
+$(evalvalctx var)
+</pre>
+<p>A combination of <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">)</span></tt>, <tt class="docutils literal"><span class="pre">$(call</span> <span class="pre">)</span></tt> and <tt class="docutils literal"><span class="pre">$(value</span> <span class="pre">)</span></tt> <a class="footnote-reference" href="#id84" id="id62" name="id62">[1]</a>:</p>
+<pre class="literal-block">
+$(evalcall var)
+</pre>
+<p>A combination of <tt class="docutils literal"><span class="pre">$(eval</span> <span class="pre">)</span></tt> and <tt class="docutils literal"><span class="pre">$(call</span> <span class="pre">)</span></tt> <a class="footnote-reference" href="#id84" id="id63" name="id63">[1]</a>:</p>
+<pre class="literal-block">
+$(evalcall var)
+</pre>
+<p>Remove comments and blank lines from the variable <tt class="docutils literal"><span class="pre">var</span></tt>. Expands to
+the empty string <a class="footnote-reference" href="#id84" id="id64" name="id64">[1]</a>:</p>
+<pre class="literal-block">
+$(eval-opt-var var)
+</pre>
+<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
+or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id65" name="id65">[1]</a>:</p>
+<pre class="literal-block">
+$(deps target[, pos])
+</pre>
+<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
+retriving the whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id66" name="id66">[1]</a>:</p>
+<pre class="literal-block">
+$(deps-all target[, pos])
+</pre>
+<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 or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id67" name="id67">[1]</a>:</p>
+<pre class="literal-block">
+$(deps-newer target[, pos])
+</pre>
+<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
+whole thing or the file at <tt class="docutils literal"><span class="pre">pos</span></tt> (one-origin) <a class="footnote-reference" href="#id84" id="id68" name="id68">[1]</a>:</p>
+<pre class="literal-block">
+$(deps-oo target[, pos])
+</pre>
+</blockquote>
+<p>Command Functions:</p>
+<blockquote>
+<p>Create one or more command lines avoiding the max argument
+length restriction of the host OS <a class="footnote-reference" href="#id84" id="id69" name="id69">[1]</a>:</p>
+<pre class="literal-block">
+$(xargs ar cas mylib.a,$(objects))
+$(xargs ar cas mylib.a,ar as mylib.a,$(objects))
+</pre>
+<p>Returns the commands for the specified target separated by new-line, space,
+or a user defined string. Note that this might not produce the 100% correct
+result if any of the prerequisite automatic variables are used <a class="footnote-reference" href="#id84" id="id70" name="id70">[1]</a>:</p>
+<pre class="literal-block">
+$(commands target)
+$(commands-sc target)
+$(commands-usr target,sep)
+</pre>
+<p>Compares two commands returning the empty string if equal and the 3rd
+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
+line by line is stripped of leading spaces, command prefixes and
+trailing spaces before comparing <a class="footnote-reference" href="#id84" id="id71" name="id71">[1]</a>:</p>
+<pre class="literal-block">
+$(comp-cmds cmds-var1, cmds-var2, ne)
+$(comp-cmds-ex cmds1, cmd2, ne)
+</pre>
+<p>Compares the values of the two variables returning the empty string if
+equal and the 3rd argument if not. Leading and trailing spaces is
+ignored <a class="footnote-reference" href="#id84" id="id72" name="id72">[1]</a>:</p>
+<pre class="literal-block">
+$(comp-var var1, var2, ne)
+</pre>
+</blockquote>
+<p>Utility functions:</p>
+<blockquote>
+<p>When this function is evaluated, <tt class="docutils literal"><span class="pre">kmk</span></tt> generates a fatal error with the
+message <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(error text...)
+</pre>
+<p>When this function is evaluated, <tt class="docutils literal"><span class="pre">kmk</span></tt> generates a warning with the
+message <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(warning text...)
+</pre>
+<p>When this function is evaluated, <tt class="docutils literal"><span class="pre">kmk</span></tt> generates a info with the
+message <tt class="docutils literal"><span class="pre">text</span></tt>:</p>
+<pre class="literal-block">
+$(info text...)
+</pre>
+<p>Execute a shell <tt class="docutils literal"><span class="pre">command</span></tt> and return its output:</p>
+<pre class="literal-block">
+$(shell command)
+</pre>
+<p>Return a string describing how the <tt class="docutils literal"><span class="pre">kmk</span></tt> variable <tt class="docutils literal"><span class="pre">variable</span></tt> was defined:</p>
+<pre class="literal-block">
+$(origin variable)
+</pre>
+<p>Return a string describing the flavor of the <tt class="docutils literal"><span class="pre">kmk</span></tt> variable <tt class="docutils literal"><span class="pre">variable</span></tt>:</p>
+<pre class="literal-block">
+$(flavor variable)
+</pre>
+<p>Returns the current local time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt>
+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
+not specified <a class="footnote-reference" href="#id84" id="id73" name="id73">[1]</a>:</p>
+<pre class="literal-block">
+$(date fmt)
+</pre>
+<p>Returns the current UTC time and date formatted in the <tt class="docutils literal"><span class="pre">strftime</span></tt>
+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
+not specified <a class="footnote-reference" href="#id84" id="id74" name="id74">[1]</a>:</p>
+<pre class="literal-block">
+$(date-utc fmt)
+</pre>
+<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
+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
+<tt class="docutils literal"><span class="pre">%Y-%m-%dT%H:%M:%SZ</span></tt> if not specified <a class="footnote-reference" href="#id84" id="id75" name="id75">[1]</a>:</p>
+<pre class="literal-block">
+$(date-utc fmt,time,in-fmt)
+</pre>
+<p>Returns the current nanosecond timestamp (monotonic when possible) <a class="footnote-reference" href="#id84" id="id76" name="id76">[1]</a>:</p>
+<pre class="literal-block">
+$(nanots )
+</pre>
+<p>Returns the size of the specified file, or -1 if the size could not
+be obtained. This can be used to check if a file exist or not <a class="footnote-reference" href="#id84" id="id77" name="id77">[1]</a>:</p>
+<pre class="literal-block">
+$(file-size file)
+</pre>
+<p>Searches the <tt class="docutils literal"><span class="pre">PATH</span></tt> <tt class="docutils literal"><span class="pre">kmk</span></tt> variable for the specified <tt class="docutils literal"><span class="pre">files</span></tt> <a class="footnote-reference" href="#id84" id="id78" name="id78">[1]</a>:</p>
+<pre class="literal-block">
+$(which files...)
+</pre>
+<p>OS/2: Returns the specified LIBPATH variable value <a class="footnote-reference" href="#id84" id="id79" name="id79">[1]</a>:</p>
+<pre class="literal-block">
+$(libpath var)
+</pre>
+<p>OS/2: Sets the specified LIBPATH variable value, returning the empty
+string <a class="footnote-reference" href="#id84" id="id80" name="id80">[1]</a>:</p>
+<pre class="literal-block">
+$(libpath var,value)
+</pre>
+</blockquote>
+<p>Debugging Functions:</p>
+<blockquote>
+<p>Returns various make statistics, if no item is specified a default
+selection is returned <a class="footnote-reference" href="#id84" id="id81" name="id81">[1]</a>:</p>
+<pre class="literal-block">
+$(make-stats item[,itemN])
+</pre>
+<p>Raise a debug breakpoint. Used for debugging <tt class="docutils literal"><span class="pre">kmk</span></tt> makefile
+parsing <a class="footnote-reference" href="#id84" id="id82" name="id82">[1]</a>:</p>
+<pre class="literal-block">
+$(breakpoint )
+</pre>
+</blockquote>
+</div>
+<div class="section">
+<h1><a id="recipes" name="recipes">Recipes</a></h1>
+<blockquote>
+<p>A typical recipe takes one of the two following forms:</p>
+<pre class="literal-block">
+targets : normal-prerequisites | order-only-prerequisites
+ command
+ ...
+
+targets : normal-prerequisites | order-only-prerequisites ; command
+ command
+ ...
+</pre>
+<p>Specifying more than one file in the <tt class="docutils literal"><span class="pre">targets</span></tt> lists is the same as
+repeating the recipe for each of the files.</p>
+<p>Use <tt class="docutils literal"><span class="pre">+</span></tt> and <tt class="docutils literal"><span class="pre">+|</span></tt> in the list of <tt class="docutils literal"><span class="pre">targets</span></tt> to tell <tt class="docutils literal"><span class="pre">kmk</span></tt> that the
+recipe has more than one output. <a class="footnote-reference" href="#id84" id="id83" name="id83">[1]</a> The files after a <tt class="docutils literal"><span class="pre">+</span></tt> will
+always be remade, while the files after a <tt class="docutils literal"><span class="pre">+|</span></tt> don't have to be remade.
+The latter is frequently employed to update files which prerequisites
+change wihtout the output files necessarily changing. See also
+<tt class="docutils literal"><span class="pre">kmk_cp</span> <span class="pre">--changed</span></tt>.</p>
+</blockquote>
+<p>Double colon recipes</p>
+<blockquote>
+Double colon recipes are written with <tt class="docutils literal"><span class="pre">::</span></tt> instead of <tt class="docutils literal"><span class="pre">:</span></tt> and are
+handled differently from ordinary recipes if the target appears in more
+than one recipe. First, all the recipes must be of the double colon type.
+Second, the recipes are executed individually and may be omitted depending
+on the state of their prerequisites. Double colon recipes without any
+prerequisites will always be executed.</blockquote>
+<p>Pattern rules</p>
+<blockquote>
+<p>A couple of examples:</p>
+<pre class="literal-block">
+%.o : %.c
+ gcc -o $&#64; $&lt;
+%.tab.c %.tab.h : %.y
+ bison -d $&lt;
+</pre>
+<p>The latter has two outputs.</p>
+</blockquote>
+<hr class="docutils" />
+<table class="docutils footnote" frame="void" id="id84" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a name="id84">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id2">2</a>, <a class="fn-backref" href="#id3">3</a>, <a class="fn-backref" href="#id4">4</a>, <a class="fn-backref" href="#id5">5</a>, <a class="fn-backref" href="#id6">6</a>, <a class="fn-backref" href="#id7">7</a>, <a class="fn-backref" href="#id8">8</a>, <a class="fn-backref" href="#id9">9</a>, <a class="fn-backref" href="#id10">10</a>, <a class="fn-backref" href="#id11">11</a>, <a class="fn-backref" href="#id12">12</a>, <a class="fn-backref" href="#id13">13</a>, <a class="fn-backref" href="#id14">14</a>, <a class="fn-backref" href="#id15">15</a>, <a class="fn-backref" href="#id16">16</a>, <a class="fn-backref" href="#id17">17</a>, <a class="fn-backref" href="#id18">18</a>, <a class="fn-backref" href="#id19">19</a>, <a class="fn-backref" href="#id20">20</a>, <a class="fn-backref" href="#id21">21</a>, <a class="fn-backref" href="#id22">22</a>, <a class="fn-backref" href="#id23">23</a>, <a class="fn-backref" href="#id24">24</a>, <a class="fn-backref" href="#id25">25</a>, <a class="fn-backref" href="#id26">26</a>, <a class="fn-backref" href="#id27">27</a>, <a class="fn-backref" href="#id28">28</a>, <a class="fn-backref" href="#id29">29</a>, <a class="fn-backref" href="#id30">30</a>, <a class="fn-backref" href="#id31">31</a>, <a class="fn-backref" href="#id32">32</a>, <a class="fn-backref" href="#id33">33</a>, <a class="fn-backref" href="#id34">34</a>, <a class="fn-backref" href="#id35">35</a>, <a class="fn-backref" href="#id36">36</a>, <a class="fn-backref" href="#id37">37</a>, <a class="fn-backref" href="#id38">38</a>, <a class="fn-backref" href="#id39">39</a>, <a class="fn-backref" href="#id40">40</a>, <a class="fn-backref" href="#id41">41</a>, <a class="fn-backref" href="#id42">42</a>, <a class="fn-backref" href="#id43">43</a>, <a class="fn-backref" href="#id44">44</a>, <a class="fn-backref" href="#id45">45</a>, <a class="fn-backref" href="#id48">46</a>, <a class="fn-backref" href="#id49">47</a>, <a class="fn-backref" href="#id50">48</a>, <a class="fn-backref" href="#id51">49</a>, <a class="fn-backref" href="#id52">50</a>, <a class="fn-backref" href="#id53">51</a>, <a class="fn-backref" href="#id54">52</a>, <a class="fn-backref" href="#id55">53</a>, <a class="fn-backref" href="#id56">54</a>, <a class="fn-backref" href="#id57">55</a>, <a class="fn-backref" href="#id58">56</a>, <a class="fn-backref" href="#id59">57</a>, <a class="fn-backref" href="#id60">58</a>, <a class="fn-backref" href="#id61">59</a>, <a class="fn-backref" href="#id62">60</a>, <a class="fn-backref" href="#id63">61</a>, <a class="fn-backref" href="#id64">62</a>, <a class="fn-backref" href="#id65">63</a>, <a class="fn-backref" href="#id66">64</a>, <a class="fn-backref" href="#id67">65</a>, <a class="fn-backref" href="#id68">66</a>, <a class="fn-backref" href="#id69">67</a>, <a class="fn-backref" href="#id70">68</a>, <a class="fn-backref" href="#id71">69</a>, <a class="fn-backref" href="#id72">70</a>, <a class="fn-backref" href="#id73">71</a>, <a class="fn-backref" href="#id74">72</a>, <a class="fn-backref" href="#id75">73</a>, <a class="fn-backref" href="#id76">74</a>, <a class="fn-backref" href="#id77">75</a>, <a class="fn-backref" href="#id78">76</a>, <a class="fn-backref" href="#id79">77</a>, <a class="fn-backref" href="#id80">78</a>, <a class="fn-backref" href="#id81">79</a>, <a class="fn-backref" href="#id82">80</a>, <a class="fn-backref" href="#id83">81</a>)</em> <tt class="docutils literal"><span class="pre">kmk</span></tt> only feature.</td></tr>
+</tbody>
+</table>
+<table class="docutils footnote" frame="void" id="id85" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a name="id85">[2]</a></td><td><em>(<a class="fn-backref" href="#id46">1</a>, <a class="fn-backref" href="#id47">2</a>)</em> Experimental GNU <tt class="docutils literal"><span class="pre">make</span></tt> feature that is not enabled by default.</td></tr>
+</tbody>
+</table>
+<hr class="docutils" />
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field"><th class="field-name">Status:</th><td class="field-body"><p class="first">$Id: QuickReference-kmk.html 2340 2009-04-18 12:05:47Z bird $</p>
+</td>
+</tr>
+<tr class="field"><th class="field-name">Copyright:</th><td class="field-body"><p class="first">Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+2007 Free Software Foundation, Inc.</p>
+<p class="last">Copyright (c) 2008-2009 knut st. osmundsen</p>
+</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+</body>
+</html>
diff --git a/kBuild/doc/QuickReference-kmk.txt b/kBuild/doc/QuickReference-kmk.txt
new file mode 100644
index 0000000..cab3a58
--- /dev/null
+++ b/kBuild/doc/QuickReference-kmk.txt
@@ -0,0 +1,1054 @@
+
+kmk Quick Reference
+===================
+
+This is an attempt at summarizing all directives, functions, special variables,
+special targets, built-in commands, external commands, and ``kmk``-expressions.
+Since *all* the features are included, the quickness of this reference can be
+disputed. ;-)
+
+
+
+Directives
+----------
+
+Here is a summary of the directives ``kmk`` recognizes:
+
+ Define a multi-line, recursively-expanded variable::
+
+ define variable
+ endef
+
+ Conditionally evaluate part of the makefile::
+
+ ifdef variable
+ ifndef variable
+ ifeq (a,b)
+ ifeq "a" "b"
+ ifeq 'a' 'b'
+ ifneq (a,b)
+ ifneq "a" "b"
+ ifneq 'a' 'b'
+ if1of (set-a,set-b) [1]
+ ifn1of (set-a,set-b) [1]
+ if expression [1]
+ else
+ endif
+
+ Include another makefile::
+
+ include file
+ -include file
+ sinclude file
+
+ Include another dependency file [1]_::
+
+ includedep file
+
+ Define a variable, overriding any previous definition, even one from the
+ command line::
+
+ override variable = value
+ override variable := value
+ override variable += value
+ override variable <= value [1]
+ override variable ?= value
+ override define variable
+ endef
+
+ Tell ``kmk`` to export all variables to child processes by default::
+
+ export
+
+ Tell ``kmk`` whether or not to export a particular variable to child
+ processes::
+
+ export variable
+ export variable = value
+ export variable := value
+ export variable += value
+ export variable <= value [1]
+ export variable ?= value
+ unexport variable
+
+ Define a variable in the local context instead of the global one [1]_::
+
+ local variable = value
+ local variable := value
+ local variable += value
+ local variable <= value
+ local variable ?= value
+ local define variable
+ endef
+
+ Specify a search path for files matching a ``%`` pattern::
+
+ vpath pattern path
+
+ Remove all search paths previously specified for pattern::
+
+ vpath pattern
+
+ Remove all search paths previously specified in any vpath directive::
+
+ vpath
+
+
+
+Automatic variables
+-------------------
+
+Here is a summary of the automatic variables.
+
++-----------+-----------------------------------------------------------------+
+| Variable | Description |
++===========+=================================================================+
+| ``$@`` | The file name of the target. |
++-----------+-----------------------------------------------------------------+
+| ``$<`` | The name of the first prerequisite. |
++-----------+-----------------------------------------------------------------+
+| ``$?`` | The names of all the prerequisites that are newer than the |
+| | target, with spaces between them. |
++-----------+-----------------------------------------------------------------+
+| ``$^`` | The names of all the prerequisites, duplicates omitted. |
++-----------+-----------------------------------------------------------------+
+| ``$+`` | The names of all the prerequisites, duplicates and order |
+| | preserved |
++-----------+-----------------------------------------------------------------+
+| ``$*`` | The stem with which an implicit rule matches. |
++-----------+-----------------------------------------------------------------+
+| ``$|`` | The name of all the order only prerequisites. |
++-----------+-----------------------------------------------------------------+
+| ``$(@D)`` | The directory part of ``$@``. |
++-----------+-----------------------------------------------------------------+
+| ``$(<D)`` | The directory part of ``$<``. |
++-----------+-----------------------------------------------------------------+
+| ``$(?D)`` | The directory part of ``$?``. |
++-----------+-----------------------------------------------------------------+
+| ``$(^D)`` | The directory part of ``%^``. |
++-----------+-----------------------------------------------------------------+
+| ``$(+D)`` | The directory part of ``$+``. |
++-----------+-----------------------------------------------------------------+
+| ``$(*D)`` | The directory part of ``$*``. |
++-----------+-----------------------------------------------------------------+
+| ``$(|D)`` | The directory part of ``$|``. |
++-----------+-----------------------------------------------------------------+
+| ``$(@F)`` | The file-within-directory part of ``$@``. |
++-----------+-----------------------------------------------------------------+
+| ``$(<F)`` | The file-within-directory part of ``$<``. |
++-----------+-----------------------------------------------------------------+
+| ``$(?F)`` | The file-within-directory part of ``$?``. |
++-----------+-----------------------------------------------------------------+
+| ``$(^F)`` | The file-within-directory part of ``$^``. |
++-----------+-----------------------------------------------------------------+
+| ``$(+F)`` | The file-within-directory part of ``$+``. |
++-----------+-----------------------------------------------------------------+
+| ``$(*F)`` | The file-within-directory part of ``$*``. |
++-----------+-----------------------------------------------------------------+
+| ``$(|F)`` | The file-within-directory part of ``$|``. |
++-----------+-----------------------------------------------------------------+
+
+
+
+Special variables
+-----------------
+
+All variables starting with a ``.`` is reserved by ``kmk``. The following
+variables are specially used or/and defined by ``kmk``:
+
++--------------------------+--------------------------------------------------+
+| Variable | Description |
++==========================+==================================================+
+| ``.DEFAULT_GOAL`` | The makefile default goal. You can set this in |
+| | the makefile, if you don't it will default to |
+| | the first target that is encountered. |
++--------------------------+--------------------------------------------------+
+| ``.FEATURES`` | List of GNU ``make`` features. Do not set this. |
++--------------------------+--------------------------------------------------+
+| ``.INCLUDE_DIRS`` | List of include directories, ``-I`` arguments |
+| | and defaults. Do not set this. |
++--------------------------+--------------------------------------------------+
+| ``.RECIPEPREFIX`` | Recipe prefix, defaults to tab. |
++--------------------------+--------------------------------------------------+
+| ``.VARIABLES`` | Special variable which exands to the list of |
+| | variable. Do not set this. |
++--------------------------+--------------------------------------------------+
+| ``CURDIR`` | Set to the pathname of the current working |
+| | directory (after all ``-C`` options are |
+| | processed, if any). Do not set this. |
++--------------------------+--------------------------------------------------+
+| ``KBUILD_VERSION``, | The kBuild version string and the break down |
+| ``KBUILD_VERSION_MAJOR``,| into individual components. [1]_ |
+| ``KBUILD_VERSION_MINOR``,| |
+| ``KBUILD_VERSION_PATCH``,| |
+| ``KBUILD_KMK_REVISION`` | |
++--------------------------+--------------------------------------------------+
+| ``KBUILD_HOST`` [1]_ | The host operating system. |
++--------------------------+--------------------------------------------------+
+| ``KBUILD_HOST_ARCH`` [1]_| The host architecture. |
++--------------------------+--------------------------------------------------+
+| ``KBUILD_HOST_CPU`` [1]_ | The host CPU ``kmk`` is built for, set to |
+| | ``blend`` if not any particular CPU. |
++--------------------------+--------------------------------------------------+
+| ``KBUILD_PATH`` [1]_ | Where the kBuild scripts are. |
++--------------------------+--------------------------------------------------+
+| ``KBUILD_BIN_PATH`` [1]_ | Where the host specific kBuild binaries are. |
++--------------------------+--------------------------------------------------+
+| ``KMK`` [1]_, | The name with which ``kmk`` was invoked. Using |
+| ``MAKE`` | this variable in recipes has special meaning. |
++--------------------------+--------------------------------------------------+
+| ``KMK_BUILTIN`` [1]_ | List of built-in commands. |
++--------------------------+--------------------------------------------------+
+| ``KMK_FEATURES`` [1]_ | List of ``kmk`` specific features. |
++--------------------------+--------------------------------------------------+
+| ``KMK_FLAGS`` [1]_ | The flags given to ``kmk``. You can set this in |
+| | the environment or a makefile to set flags. |
+| | |
+| | It is never appropriate to use ``KMK_FLAGS`` |
+| | directly in a recipe line: its contents may not |
+| | be quoted correctly for use in the shell. Always |
+| | allow recursive ``kmk``'s to obtain these values |
+| | through the environment from its parent. |
++--------------------------+--------------------------------------------------+
+| ``KMK_LEVEL`` [1]_ | The number of levels of recursion (sub-makes). |
++--------------------------+--------------------------------------------------+
+| ``KMK_VERSION`` [1]_ | The GNU ``make`` version number. |
++--------------------------+--------------------------------------------------+
+| ``MAKECMDGOALS`` | The targets given to ``kmk`` on the command line.|
+| | Do not set this. |
++--------------------------+--------------------------------------------------+
+| ``MAKEFILES`` | Makefiles to be read on every invocation of |
+| | ``kmk``. |
++--------------------------+--------------------------------------------------+
+| ``MAKEFILE_LIST`` | List of the makefiles that ``kmk`` has opened. |
++--------------------------+--------------------------------------------------+
+| ``MAKESHELL`` | OS/2 and MS-DOS only, the name of the command |
+| | interpreter that is to be used by ``kmk``. This |
+| | value takes precedence over the value of SHELL. |
++--------------------------+--------------------------------------------------+
+| ``SHELL`` | The name of the default command interpreter, |
+| | kmk_ash. You can set SHELL in the makefile to |
+| | change the shell used to run recipes. The SHELL |
+| | variable is handled specially when importing |
+| | from and exporting to the environment. |
++--------------------------+--------------------------------------------------+
+| ``SUFFIXES`` | The default list of suffixes before ``kmk`` |
+| | reads any makefiles (always empty). |
++--------------------------+--------------------------------------------------+
+| ``VPATH`` | Directory search path for files not found in the |
+| | current directory. |
++--------------------------+--------------------------------------------------+
+
+
+The following variables reflects ``kmk`` options. Do not set these. [1]_
+
++-------------------------------------+---------------------------------------+
+| Variable | Description |
++=====================================+=======================================+
+| ``KMK_OPTS_JOBS`` | -j slots, ``0`` if not given. |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_KEEP_GOING`` | -k indictor (``0``/``1``). |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_JUST_PRINT`` | -n indicator (``0``/``1``). |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_PRORITY`` | --priority level, ``0`` if not given. |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_AFFINITY`` | --affinity mask, ``0`` if not given. |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_STATISTICS`` | --statistics indicator (``0``/``1``). |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_PRINT_TIME`` | The --print-time value. |
++-------------------------------------+---------------------------------------+
+| ``KMK_OPTS_PRETTY_COMMAND_PRINTING``| --pretty-command-printing indicator. |
++-------------------------------------+---------------------------------------+
+
+
+
+Special Targets
+---------------
+
+Certain names have special meanings if they appear as targets.
+
++-------------------------------+---------------------------------------------+
+| Target | Description |
++===============================+=============================================+
+| ``.DEFAULT`` | The recipe is used for any target for which |
+| | no rules are found. |
++-------------------------------+---------------------------------------------+
+| ``.DELETE_ON_ERROR`` | If mentioned, ``kmk`` will delete the |
+| | targets of a rule if it has changed and its |
+| | recipe fails or is interrupted. |
++-------------------------------+---------------------------------------------+
+| ``.EXPORT_ALL_VARIABLES`` | If mentioned, all variables will by default |
+| | be exported to child processes. |
++-------------------------------+---------------------------------------------+
+| ``.IGNORE`` | Ignore errors in the execution of the recipe|
+| | for the targets ``.IGNORE`` depends on, if |
+| | no prequisites all targets are affected. |
++-------------------------------+---------------------------------------------+
+| ``.INTERMEDIATE`` | The prerequisites are treated as |
+| | intermediate files (implicite rules). |
++-------------------------------+---------------------------------------------+
+| ``.LOW_RESOLUTION_TIME`` | ``kmk`` will assume prerequisite files are |
+| | created with low resolution time stamps. |
++-------------------------------+---------------------------------------------+
+| ``.NOTPARALLEL`` | If mentioned without any prerequisites, |
+| | ``kmk`` will run serially as if -j1 was |
+| | given. If it has prerequisites ``kmk`` [1]_ |
+| | will only do this for the targets among |
+| | them. |
++-------------------------------+---------------------------------------------+
+| ``.PHONY`` | The prerequisites are considered phony and |
+| | will be rebuilt unconditionally. |
++-------------------------------+---------------------------------------------+
+| ``.PRECIOUS`` | The targets which ``.PRECIOUS`` depends |
+| | will to be deleted if ``kmk`` is killed or |
+| | interrupted while their building. |
++-------------------------------+---------------------------------------------+
+| ``.SECONDARY`` | The prerequisites are treated as |
+| | intermediate files, except that they are |
+| | never automatically deleted. If used with |
+| | no prerequisites all targets gets this |
+| | treatement. |
++-------------------------------+---------------------------------------------+
+| ``.SECONDEXPANSION`` | If mentioned, all prerequisite lists after |
+| | it will be expanded a second time after all |
+| | makefiles have been read. |
++-------------------------------+---------------------------------------------+
+| ``.SECONDTARGETEXPANSION`` | If mentioned, all targets after it will be |
+| [1]_ | expanded a second time after all makefiles |
+| | have been read. |
++-------------------------------+---------------------------------------------+
+| ``.SILENT`` | ``kmk`` will not print the recipe for |
+| | targets listed as prerequisites, if none |
+| | then it applies to all targets. |
++-------------------------------+---------------------------------------------+
+| ``.SUFFIXES`` | The prerequisites are the list of suffixes |
+| | used in checking for suffix rules. If it |
+| | appears without prerequisites it the suffix |
+| | will be cleared. |
++-------------------------------+---------------------------------------------+
+
+
+
+Commands
+--------
+
+Builtin commands [1]_ all start with ``kmk_builtin_``, so in order to save
+space this prefix has been omitted in the table below. All commands comes in an
+external edition that can be used by/in the shell, these are prefixed ``kmk_``.
+
++---------------+-------------------------------------------------------------+
+| Command | Description |
++===============+=============================================================+
+| ``append`` | Append text to a file. The builtin version can output the |
+| | value of a variable or the commands of a target. |
++---------------+-------------------------------------------------------------+
+| ``cat`` | The BSD ``cat`` command. |
++---------------+-------------------------------------------------------------+
+| ``chmod`` | The BSD ``chmod`` command. |
++---------------+-------------------------------------------------------------+
+| ``cmp`` | The BSD ``cmp`` command. |
++---------------+-------------------------------------------------------------+
+| ``cp`` | The BSD ``cp`` command with some twaking. |
++---------------+-------------------------------------------------------------+
+| ``echo`` | The BSD ``echo`` command. |
++---------------+-------------------------------------------------------------+
+| ``expr`` | The BSD ``expr`` command. |
++---------------+-------------------------------------------------------------+
+| ``install`` | The BSD ``install`` command with some tweaking. |
++---------------+-------------------------------------------------------------+
+| ``kDepIDB`` | Extract dependencies from a Visual C++ .IDB file. |
++---------------+-------------------------------------------------------------+
+| ``ln`` | The BSD ``ln`` command. |
++---------------+-------------------------------------------------------------+
+| ``md5sum`` | Typical MD5 sum program, custom kBuild version. |
++---------------+-------------------------------------------------------------+
+| ``mkdir`` | The BSD ``mkdir`` command. |
++---------------+-------------------------------------------------------------+
+| ``mv`` | The BSD ``mv`` command with some tweaking. |
++---------------+-------------------------------------------------------------+
+| ``printf`` | The BSD ``printf`` command. |
++---------------+-------------------------------------------------------------+
+| ``rm`` | The BSD ``rm`` command with some tweaking. |
++---------------+-------------------------------------------------------------+
+| ``rmdir`` | The BSD ``rmdir`` command with some tweaking. |
++---------------+-------------------------------------------------------------+
+| ``sleep`` | Typical ``sleep`` program, custom kBuild version. |
++---------------+-------------------------------------------------------------+
+| ``test`` | The BSD ``test`` program with some tweaking. |
++---------------+-------------------------------------------------------------+
+
+Some additional external commands are available in the ``kmk`` / ``kBuild``
+environment (``kSomething`` command are not prefixed with ``kmk_``):
+
++---------------+-------------------------------------------------------------+
+| Command | Description |
++===============+=============================================================+
+| ``kDepPre`` | Extract dependencies from the C/C++ preprocessor output. |
++---------------+-------------------------------------------------------------+
+| ``kObjCache`` | Simple object file cache program. |
++---------------+-------------------------------------------------------------+
+| ``ash`` | Almquist's shell (NetBSD variant). |
++---------------+-------------------------------------------------------------+
+| ``gmake`` | Vanilla GNU ``make`` from same sources as ``kmk``. |
++---------------+-------------------------------------------------------------+
+| ``redirect`` | Shell avoidance tool. Sets up file descriptors, environment |
+| | variables and current directory before kicking of program. |
++---------------+-------------------------------------------------------------+
+| ``sed`` | GNU ``sed`` with some tweaks to avoid involving the shell. |
++---------------+-------------------------------------------------------------+
+| ``time`` | Stopwatch utility for measuring program execution time(s). |
++---------------+-------------------------------------------------------------+
+
+
+
+kmk-expression
+--------------
+
+``kmk``-expressions [1]_ are related to the C/C++ preprocessor in some ways as
+well as ``nmake`` and BSD ``make``. There are however some peculiarities
+because of the way GNU ``make`` choose to represent booleans in its function
+library, so, strings can be turned into boolean by taking any non-empty string
+as true.
+
+Quoting using single quotes results in hard strings, while double quotes and
+unquoted string results in soft strings that can be converted to number or
+boolean to fit the situation.
+
+Here's the operator table in decending precedence order:
+
++---------------+--------+-----------------------------------------------------+
+| Operator | Type | Description |
++===============+========+=====================================================+
+| ``defined`` | Unary | Checks if the following variable exists. |
++---------------+ +-----------------------------------------------------+
+| ``exists`` | | Checks if the following file exists. |
++---------------+ +-----------------------------------------------------+
+| ``target`` | | Checks if the following target exists. |
++---------------+ +-----------------------------------------------------+
+| ``bool`` | | Casts the following value to boolean. |
++---------------+ +-----------------------------------------------------+
+| ``num`` | | Casts the following value to a number. |
++---------------+ +-----------------------------------------------------+
+| ``str`` | | Casts the following value to a string. |
++---------------+--------+-----------------------------------------------------+
+| ``!`` | Unary | Logical NOT. |
++---------------+ +-----------------------------------------------------+
+| ``+`` | | Pluss prefix. |
++---------------+ +-----------------------------------------------------+
+| ``-`` | | Minus prefix. |
++---------------+ +-----------------------------------------------------+
+| ``~`` | | Bitwise one's complement. |
++---------------+--------+-----------------------------------------------------+
+| ``*`` | Binary | Multiplication (product). |
++---------------+ +-----------------------------------------------------+
+| ``/`` | | Division (quotient). |
++---------------+ +-----------------------------------------------------+
+| ``%`` | | Modulus (remainder). |
++---------------+--------+-----------------------------------------------------+
+| ``+`` | Binary | Addition (sum). |
++---------------+ +-----------------------------------------------------+
+| ``-`` | | Subtraction (difference). |
++---------------+--------+-----------------------------------------------------+
+| ``<<`` | Binary | Bitwise left shift. |
++---------------+ +-----------------------------------------------------+
+| ``>>`` | | Bitwise right shift. |
++---------------+--------+-----------------------------------------------------+
+| ``<=`` | Binary | Less or equal than. |
++---------------+ +-----------------------------------------------------+
+| ``<`` | | Less than. |
++---------------+ +-----------------------------------------------------+
+| ``>=`` | | Greater or equal than. |
++---------------+ +-----------------------------------------------------+
+| ``>`` | | Greater than. |
++---------------+--------+-----------------------------------------------------+
+| ``==`` | Binary | Equal to. |
++---------------+ +-----------------------------------------------------+
+| ``!=`` | | Not equal to. |
++---------------+--------+-----------------------------------------------------+
+| ``&`` | Binary | Bitwise AND. |
++---------------+--------+-----------------------------------------------------+
+| ``^`` | Binary | Bitwise XOR. |
++---------------+--------+-----------------------------------------------------+
+| ``|`` | Binary | Bitwise OR. |
++---------------+--------+-----------------------------------------------------+
+| ``&&`` | Binary | Logical AND. |
++---------------+--------+-----------------------------------------------------+
+| ``||`` | Binary | Logical OR. |
++---------------+--------+-----------------------------------------------------+
+
+
+
+Built-in functions
+------------------
+
+
+String Manipulation Functions:
+
+ Replace ``from`` with ``to`` in ``text``::
+
+ $(subst from,to,text)
+
+ Replace words matching ``pattern`` with ``replacement`` in ``text``::
+
+ $(patsubst pattern,replacement,text)
+
+ Remove excess whitespace characters from ``string``::
+
+ $(strip string)
+
+ Locate ``find`` in ``text``, returning ``find`` if found::
+
+ $(findstring find,text)
+
+ Select words in ``text`` that match one of the ``pattern`` words::
+
+ $(filter pattern...,text)
+
+ Select words in ``text`` that do not match any of the ``pattern`` words::
+
+ $(filter-out pattern...,text)
+
+ Sort the words in ``list`` lexicographically, removing duplicates::
+
+ $(sort list)
+
+ Sort the words in ``list`` lexicographically in reserve order, removing
+ duplicates [1]_::
+
+ $(rsort list)
+
+ Count the number of words in ``text``::
+
+ $(words text)
+
+ Extract the ``n``\th word (one-origin) of ``text``::
+
+ $(word n,text)
+
+ Returns the list of words in ``text`` from ``s`` to ``e`` (one-origin)::
+
+ $(wordlist s,e,text)
+
+ Extract the first word of ``names``::
+
+ $(firstword names...)
+
+ Extract the last word of ``names``::
+
+ $(lastword names...)
+
+ Join two parallel lists of words::
+
+ $(join list1,list2)
+
+ Extract the first defined variable from ``variables``, returning its name
+ (default) or value::
+
+ $(firstdefined variables[, name|value])
+
+ Extract the last defined variable from ``variables``, returning its name
+ (default) or value::
+
+ $(lastdefined variables[, name|value])
+
+ Fold ``text`` to upper case [1]_::
+
+ $(toupper text)
+
+ Fold ``text`` to lower case [1]_::
+
+ $(tolower text)
+
+ String formatting a la the unix ``printf`` command [1]_::
+
+ $(printf fmt, arg...)
+
+ Return the length of a string or a (unexpanded) variable [1]_::
+
+ $(length string)
+ $(length-var var)
+
+ Find the position of ``needle`` in ``haystack``, returns 0 if not found.
+ Negative ``start`` indices are relative to the end of ``haystack``, while
+ positive ones are one based [1]_::
+
+ $(pos needle, haystack[, start])
+ $(lastpos needle, haystack[, start])
+
+ Returns the specified substring. The ``start`` works like with ``$(pos )``.
+ If the substring is partially outside the ``string`` the result will be
+ padded with ``pad`` if present [1]_::
+
+ $(substr string, start[, length[, pad]])
+
+ Insert ``in`` into ``str`` at the specified position. ``n`` works like with
+ ``$(pos )``, except that ``0`` is the end of the string [1]_::
+
+ $(insert in, str[, n[, length[, pad]]])
+
+ Translate ``string`` exchanging characters in ``from-set`` with ``to-set``,
+ optionally completing ``to-set`` with ``pad-char`` if specified. If no
+ ``pad-char`` characters absent in ``to-set`` will be deleted [1]_::
+
+ $(translate string, from-set[, to-set[, pad-char]])
+
+
+Functions for file names:
+
+ Extract the directory part of each file ``name``::
+
+ $(dir names...)
+
+ Extract the non-directory part of each file ``name``::
+
+ $(notdir names...)
+
+ Extract the suffix (the last ``.`` and following characters) of each file
+ ``name``::
+
+ $(suffix names...)
+
+ Extract the base name (name without suffix) of each file name::
+
+ $(basename names...)
+
+ Extract the root specification of each file name (a bit complicated on
+ Windows & OS/2) [1]_::
+
+ $(root names...)
+
+ Extract the non-root part of each file name (a bit complicated on
+ Windows & OS/2) [1]_::
+
+ $(notroot names...)
+
+ Append ``suffix`` to each word in ``names``::
+
+ $(addsuffix suffix,names...)
+
+ Prepend ``prefix`` to each word in ``names``::
+
+ $(addprefix prefix,names...)
+
+ Find file names matching a shell file name ``pattern`` (not a ``%``
+ pattern)::
+
+ $(wildcard pattern...)
+
+ For each file name in ``names``, expand to an absolute name that does not
+ contain any ``.``, ``..``, nor symlinks::
+
+ $(realpath names...)
+
+ For each file name in ``names``, expand to an absolute name that does not
+ contain any ``.`` or ``..`` components, but preserves symlinks::
+
+ $(abspath names...)
+
+ Same as ``$(abspath )`` except that the current directory can be
+ specified as ``curdir`` [1]_::
+
+ $(abspathex names...[, curdir])
+
+
+Arithmetic Functions:
+
+ Returns the sum of the arguments [1]_::
+
+ $(int-add addend1, addend2[, addendN])
+
+ Returns the difference between the first argument and the sum of the
+ rest [1]_::
+
+ $(int-sub minuend, subtrahend[, subtrahendN])
+
+ Returns the product of the arguments [1]_::
+
+ $(int-mul factor1, factor2[, factorN])
+
+ Returns the quotient of first argument and the rest [1]_::
+
+ $(int-div dividend, divisor[, divisorN])
+
+ Returns the modulus of the two arguments [1]_::
+
+ $(int-mod dividend, divisor)
+
+ Returns the bitwise two-complement of argument [1]_::
+
+ $(int-not val)
+
+ Returns the result of a bitwise AND of the arguments [1]_::
+
+ $(int-and val1, val2[, valN])
+
+ Returns the result of a bitwise OR of the arguments [1]_::
+
+ $(int-or val1, val2[, valN])
+
+ Returns the result of a bitwise XOR of the arguments [1]_::
+
+ $(int-xor val1, val2[, valN])
+
+ Returns the ``kmk`` boolean (true = non-empty, false = empty) result
+ of ``val1 == val2`` [1]_::
+
+ $(int-eq val1, val2)
+
+ Returns the ``kmk`` boolean result of ``val1 != val2`` [1]_::
+
+ $(int-ne val1, val2)
+
+ Returns the ``kmk`` boolean result of ``val1 > val2`` [1]_::
+
+ $(int-gt val1, val2)
+
+ Returns the ``kmk`` boolean result of ``val1 >= val2`` [1]_::
+
+ $(int-ge val1, val2)
+
+ Returns the ``kmk`` boolean result of ``val1 < val2`` [1]_::
+
+ $(int-lt val1, val2)
+
+ Returns the ``kmk`` boolean result of ``val1 <= val2`` [1]_::
+
+ $(int-le val1, val2)
+
+
+Boolean and Conditional Functions:
+
+ Condition is false if the ``condition`` evaluates to an empty string
+ (stripped). Evaluate the ``true-part`` if the condition is true, otherwise
+ the ``false-part``::
+
+ $(if condition,true-part[,false-part])
+
+ Test if any of the conditions evalues to non-empty string, returning the
+ first one::
+
+ $(or condition1[,condition2[,condition3[...]]])
+
+ Test if all of the conditions evaluates to non-empty strings, returning the
+ last one::
+
+ $(and condition1[,condition2[,condition3[...]]])
+
+
+ Test if the two strings are identical, returning ``kmk`` boolean (true =
+ non-empty, false = empty) [2]_::
+
+ $(eq str1, str2)
+
+ Invert a ``kmk`` boolean value [2]_::
+
+ $(not val)
+
+ Test if ``variable`` is defined, returning a ``kmk`` boolean value [1]_::
+
+ $(defined variable)
+
+ Test if ``set-a`` and ``set-b`` intersects, returning a ``kmk`` boolean
+ value [1]_::
+
+ $(intersects set-a, set-b)
+
+ Same as ``$(if )`` execpt that the condition is a ``kmk``-expression [1]_::
+
+ $(if-expr kmk-expression,true-part[,false-part])
+
+ Select the first true condition (``kmk``-expression) and expand the
+ following body. Special condition strings ``default`` and
+ ``otherwise`` [1]_::
+
+ $(select when1-cond, when1-body[, whenN-cond, whenN-body])
+
+ Evalutate the ``kmk-expression`` returning what it evalues as. This is
+ the preferred way of doing arithmentic now [1]_::
+
+ $(expr kmk-expression)
+
+
+Stack Fuctions:
+
+ Push ``item`` onto the ``stack-var``, returning the empty string [1]_::
+
+ $(stack-push stack-var, item)
+
+ Pop the top item off the ``stack-var`` [1]_::
+
+ $(stack-pop stack-var)
+
+ Pop the top item off the ``stack-var``, returning the empty string [1]_::
+
+ $(stack-popv stack-var)
+
+ Get the top item of the ``stack-var``, returning the empty string [1]_::
+
+ $(stack-top stack-var)
+
+
+Advanced Functions:
+
+ Evaluates to the contents of the variable ``var``, with no expansion
+ performed on it::
+
+ $(value var)
+
+ Evaluate ``body`` with ``var`` bound to each word in ``words``, and
+ concatenate the results (spaced)::
+
+ $(foreach var,words,body)
+
+ C-style for-loop. Start by evaluating ``init``. Each iteration will
+ first check whether the ``condition`` (``kmk``-expression) is true,
+ then expand ``body`` concatenating the result to the previous iterations
+ (spaced), and finally evaluate ``next`` [1]_::
+
+ $(for init,conditions,next,body)
+
+ C-style while-loop. Each iteration will check whether the ``condition``
+ (``kmk``-expression) is true, then expand ``body`` concatenating the
+ result to the previous iterations [1]_::
+
+ $(while conditions,body)
+
+ Evaluate the variable ``var`` replacing any references to ``$(1)``,
+ ``$(2)`` with the first, second, etc. ``param`` values::
+
+ $(call var,param,...)
+
+ Evaluate ``text`` then read the results as makefile commands. Expands
+ to the empty string::
+
+ $(eval text)
+
+ Same as ``$(eval text)`` except that the ``text`` is expanded in its
+ own variable context [1]_::
+
+ $(evalctx text)
+
+ Same as ``$(eval $(value var))`` [1]_::
+
+ $(evalval var)
+
+ Same as ``$(evalctx $(value var))`` [1]_::
+
+ $(evalvalctx var)
+
+ A combination of ``$(eval )``, ``$(call )`` and ``$(value )`` [1]_::
+
+ $(evalcall var)
+
+ A combination of ``$(eval )`` and ``$(call )`` [1]_::
+
+ $(evalcall2 var)
+
+ Remove comments and blank lines from the variable ``var``. Expands to
+ the empty string [1]_::
+
+ $(eval-opt-var var)
+
+ Returns accessing ``$<`` of ``target``, either retriving the whole thing
+ or the file at ``pos`` (one-origin) [1]_::
+
+ $(deps target[, pos])
+
+ Returns accessing ``$+`` (order + duplicates) of ``target``, either
+ retriving the whole thing or the file at ``pos`` (one-origin) [1]_::
+
+ $(deps-all target[, pos])
+
+ Returns accessing ``$?`` of ``target``, either retriving the whole
+ thing or the file at ``pos`` (one-origin) [1]_::
+
+ $(deps-newer target[, pos])
+
+ Returns accessing ``$|`` (order only) of ``target``, either retriving the
+ whole thing or the file at ``pos`` (one-origin) [1]_::
+
+ $(deps-oo target[, pos])
+
+
+Command Functions:
+
+ Create one or more command lines avoiding the max argument
+ length restriction of the host OS [1]_::
+
+ $(xargs ar cas mylib.a,$(objects))
+ $(xargs ar cas mylib.a,ar as mylib.a,$(objects))
+
+
+ Returns the commands for the specified target separated by new-line, space,
+ or a user defined string. Note that this might not produce the 100% correct
+ result if any of the prerequisite automatic variables are used [1]_::
+
+ $(commands target)
+ $(commands-sc target)
+ $(commands-usr target,sep)
+
+ Compares two commands returning the empty string if equal and the 3rd
+ argument if not. This differs from ``$(comp-vars v1,v2,ne)`` in that
+ line by line is stripped of leading spaces, command prefixes and
+ trailing spaces before comparing [1]_::
+
+ $(comp-cmds cmds-var1, cmds-var2, ne)
+ $(comp-cmds-ex cmds1, cmd2, ne)
+
+
+ Compares the values of the two variables returning the empty string if
+ equal and the 3rd argument if not. Leading and trailing spaces is
+ ignored [1]_::
+
+ $(comp-var var1, var2, ne)
+
+
+Utility functions:
+
+ When this function is evaluated, ``kmk`` generates a fatal error with the
+ message ``text``::
+
+ $(error text...)
+
+ When this function is evaluated, ``kmk`` generates a warning with the
+ message ``text``::
+
+ $(warning text...)
+
+ When this function is evaluated, ``kmk`` generates a info with the
+ message ``text``::
+
+ $(info text...)
+
+ Execute a shell ``command`` and return its output::
+
+ $(shell command)
+
+ Return a string with the location where the ``kmk`` variable ``variable``
+ was defined::
+
+ $(where variable)
+
+ Return a string describing how the ``kmk`` variable ``variable`` was defined::
+
+ $(origin variable)
+
+ Return a string describing the flavor of the ``kmk`` variable ``variable``::
+
+ $(flavor variable)
+
+ Returns the current local time and date formatted in the ``strftime``
+ style specifier ``fmt``. ``fmt`` defaults to ``%Y-%m-%dT%H:%M:%S`` when
+ not specified [1]_::
+
+ $(date fmt)
+
+ Returns the current UTC time and date formatted in the ``strftime``
+ style specifier ``fmt``. ``fmt`` defaults to ``%Y-%m-%dT%H:%M:%SZ`` when
+ not specified [1]_::
+
+ $(date-utc fmt)
+
+ Reformats the ``in`` time and date using ``fmt``. The ``in-fmt`` defaults
+ to ``fmt`` if not specified. While ``fmt`` defaults to
+ ``%Y-%m-%dT%H:%M:%SZ`` if not specified [1]_::
+
+ $(date-utc fmt,time,in-fmt)
+
+ Returns the current nanosecond timestamp (monotonic when possible) [1]_::
+
+ $(nanots )
+
+ Returns the size of the specified file, or -1 if the size could not
+ be obtained. This can be used to check if a file exist or not [1]_::
+
+ $(file-size file)
+
+ Searches the ``PATH`` ``kmk`` variable for the specified ``files`` [1]_::
+
+ $(which files...)
+
+ OS/2: Returns the specified LIBPATH variable value [1]_::
+
+ $(libpath var)
+
+ OS/2: Sets the specified LIBPATH variable value, returning the empty
+ string [1]_::
+
+ $(libpath var,value)
+
+
+Debugging Functions:
+
+ Returns various make statistics, if no item is specified a default
+ selection is returned [1]_::
+
+ $(make-stats item[,itemN])
+
+ Raise a debug breakpoint. Used for debugging ``kmk`` makefile
+ parsing [1]_::
+
+ $(breakpoint )
+
+
+Recipes
+-------
+
+ A typical recipe takes one of the two following forms::
+
+ targets : normal-prerequisites | order-only-prerequisites
+ command
+ ...
+
+ targets : normal-prerequisites | order-only-prerequisites ; command
+ command
+ ...
+
+ Specifying more than one file in the ``targets`` lists is the same as
+ repeating the recipe for each of the files.
+
+ Use ``+`` and ``+|`` in the list of ``targets`` to tell ``kmk`` that the
+ recipe has more than one output. [1]_ The files after a ``+`` will
+ always be remade, while the files after a ``+|`` don't have to be remade.
+ The latter is frequently employed to update files which prerequisites
+ change wihtout the output files necessarily changing. See also
+ ``kmk_cp --changed``.
+
+
+Double colon recipes
+
+ Double colon recipes are written with ``::`` instead of ``:`` and are
+ handled differently from ordinary recipes if the target appears in more
+ than one recipe. First, all the recipes must be of the double colon type.
+ Second, the recipes are executed individually and may be omitted depending
+ on the state of their prerequisites. Double colon recipes without any
+ prerequisites will always be executed.
+
+
+Pattern rules
+
+ A couple of examples::
+
+ %.o : %.c
+ gcc -o $@ $<
+ %.tab.c %.tab.h : %.y
+ bison -d $<
+
+ The latter has two outputs.
+
+
+-----
+
+.. [1] ``kmk`` only feature.
+.. [2] Experimental GNU ``make`` feature that is not enabled by default.
+
+-----
+
+:Status: $Id: QuickReference-kmk.txt 2532 2011-08-02 13:05:37Z bird $
+:Copyright: Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
+
+ Copyright (c) 2008-2009 knut st. osmundsen
diff --git a/kBuild/doc/example1/Config.kmk b/kBuild/doc/example1/Config.kmk
new file mode 100644
index 0000000..31eeb84
--- /dev/null
+++ b/kBuild/doc/example1/Config.kmk
@@ -0,0 +1,25 @@
+# $Id: Config.kmk 2343 2009-04-19 21:44:50Z bird $
+## @file
+# kBuild Example no. 1 - Config.kmk - The global configuration file.
+#
+
+#
+# The author disclaims copyright to this example script and places
+# it in the public domain.
+#
+# include full-legal-disclaimer.kmk
+#
+
+#
+# Some templates.
+#
+TEMPLATE_ExampleNo1Exe = For creating a program or static library for linking into a program.
+TEMPLATE_ExampleNo1Exe_TOOL = GCC
+TEMPLATE_ExampleNo1Exe_DEFS = MY_DEFINE=42 MY_OTHER_DEFINE
+
+TEMPLATE_ExampleNo1Dll = For creating a DLL/SO/DYLIB or static library for linking into a DLL/SO/DYLIB
+TEMPLATE_ExampleNo1Dll_EXTENDS = ExampleNo1Exe
+TEMPLATE_ExampleNo1Dll_EXTENDS_BY = appending
+TEMPLATE_ExampleNo1Dll_DEFS = MY_DLL_INDICATOR
+
+
diff --git a/kBuild/doc/example1/Makefile.kmk b/kBuild/doc/example1/Makefile.kmk
new file mode 100644
index 0000000..ecb9350
--- /dev/null
+++ b/kBuild/doc/example1/Makefile.kmk
@@ -0,0 +1,43 @@
+# $Id: Makefile.kmk 2343 2009-04-19 21:44:50Z bird $
+## @file
+# kBuild Example no. 1 - Makefile.kmk - The top-level makefile.
+#
+
+#
+# The author disclaims copyright to this example script and places
+# it in the public domain.
+#
+# include full-legal-disclaimer.kmk
+#
+
+SUB_DEPTH = .
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# Include sub-makefiles.
+#
+include $(PATH_CURRENT)/libhello/Makefile.kmk
+
+#
+# The targets.
+#
+PROGRAMS += \
+ hello \
+ hellolib
+
+#
+# Hello world program.
+#
+hello_TEMPLATE = ExampleNo1Exe
+hello_SOURCES = hello.c
+
+#
+# A hello world variant that has some of the code in the libhello directory,
+# i.e. linking with a library built by the sub-makefile included above.
+#
+hellolib_TEMPLATE = ExampleNo1Exe
+hellolib_SOURCES = hellolib.c
+hellolib_LIBS = $(libhello_1_TARGET)
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/kBuild/doc/example1/hello.c b/kBuild/doc/example1/hello.c
new file mode 100644
index 0000000..71f37fe
--- /dev/null
+++ b/kBuild/doc/example1/hello.c
@@ -0,0 +1,21 @@
+/* $Id: hello.c 2343 2009-04-19 21:44:50Z bird $ */
+/** @file
+ * Example no. 1 - hello.c - Hello world program.
+ */
+
+/*
+ * The author disclaims copyright to this example code and places
+ * it in the public domain.
+ *
+ * #include <full-legal-disclaimer.h>
+ *
+ */
+
+#include <stdio.h>
+
+int main()
+{
+ printf("Hello world!\n");
+ return 0;
+}
+
diff --git a/kBuild/doc/example1/hellolib.c b/kBuild/doc/example1/hellolib.c
new file mode 100644
index 0000000..feff4c6
--- /dev/null
+++ b/kBuild/doc/example1/hellolib.c
@@ -0,0 +1,20 @@
+/* $Id: hellolib.c 2343 2009-04-19 21:44:50Z bird $ */
+/** @file
+ * Example no. 1 - hellolib.c - Hello world program w/ lib.
+ */
+
+/*
+ * The author disclaims copyright to this example code and places
+ * it in the public domain.
+ *
+ * #include <full-legal-disclaimer.h>
+ *
+ */
+
+extern int print_hello_world(void);
+
+int main()
+{
+ return print_hello_world();
+}
+
diff --git a/kBuild/doc/example1/libhello/Makefile.kmk b/kBuild/doc/example1/libhello/Makefile.kmk
new file mode 100644
index 0000000..674c8b3
--- /dev/null
+++ b/kBuild/doc/example1/libhello/Makefile.kmk
@@ -0,0 +1,30 @@
+# $Id: Makefile.kmk 2343 2009-04-19 21:44:50Z bird $
+## @file
+# kBuild Example no. 1 - libhello/Makefile.kmk - The libhello sub-makefile.
+#
+
+#
+# The author disclaims copyright to this example script and places
+# it in the public domain.
+#
+# include full-legal-disclaimer.kmk
+#
+
+SUB_DEPTH = ..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# The targets.
+#
+LIBRARIES += libhello
+
+#
+# The hello world library.
+#
+libhello_TEMPLATE = ExampleNo1Exe
+libhello_SOURCES = libhello.c
+
+## @todo Create a DLL variant.
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/kBuild/doc/example1/libhello/libhello.c b/kBuild/doc/example1/libhello/libhello.c
new file mode 100644
index 0000000..5a9024d
--- /dev/null
+++ b/kBuild/doc/example1/libhello/libhello.c
@@ -0,0 +1,24 @@
+/* $Id: libhello.c 2343 2009-04-19 21:44:50Z bird $ */
+/** @file
+ * Example no. 1 - libhello.c - Hello world library.
+ */
+
+/*
+ * The author disclaims copyright to this example code and places
+ * it in the public domain.
+ *
+ * #include <full-legal-disclaimer.h>
+ *
+ */
+
+#include <stdio.h>
+
+extern int print_hello_world(void);
+
+int print_hello_world(void)
+{
+ printf("Hello library world!\n");
+ return 0;
+}
+
+
diff --git a/kBuild/env.sh b/kBuild/env.sh
new file mode 100755
index 0000000..e70573e
--- /dev/null
+++ b/kBuild/env.sh
@@ -0,0 +1,648 @@
+#!/bin/sh
+# $Id: env.sh 3556 2022-02-18 02:02:07Z bird $
+## @file
+# Environment setup script.
+#
+
+#
+# Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+#set -x
+
+#
+# Check if we're in eval mode or not.
+#
+ERR_REDIR=1
+DBG_REDIR=1
+EVAL_OPT=
+EVAL_EXPORT="export "
+DBG_OPT=
+QUIET_OPT=
+FULL_OPT=
+FULL_WITH_BIN_OPT=
+LEGACY_OPT=
+VAR_OPT=
+VALUE_ONLY_OPT=
+EXP_TYPE_OPT=
+while test $# -gt 0;
+do
+ case "$1" in
+ "--debug-script")
+ DBG_OPT="true"
+ ;;
+ "--no-debug-script")
+ DBG_OPT=
+ ;;
+ "--quiet")
+ QUIET_OPT="true"
+ ;;
+ "--verbose")
+ QUIET_OPT=
+ ;;
+ "--full")
+ FULL_OPT="true"
+ ;;
+ "--full-with-bin")
+ FULL_OPT="true"
+ FULL_WITH_BIN_OPT="true"
+ ;;
+ "--normal")
+ FULL_OPT=
+ ;;
+ "--legacy")
+ LEGACY_OPT="true"
+ ;;
+ "--no-legacy")
+ LEGACY_OPT=
+ ;;
+ "--eval")
+ EVAL_OPT="true"
+ ERR_REDIR=2
+ DBG_REDIR=2
+ ;;
+ "--set")
+ EVAL_OPT="true"
+ EVAL_EXPORT=""
+ ERR_REDIR=2
+ DBG_REDIR=2
+ ;;
+ "--var")
+ shift
+ VAR_OPT="${VAR_OPT} $1"
+ ERR_REDIR=2
+ DBG_REDIR=2
+ ;;
+ "--value-only")
+ VALUE_ONLY_OPT="true"
+ ;;
+ "--name-and-value")
+ VALUE_ONLY_OPT=
+ ;;
+ "--release")
+ EXP_TYPE_OPT=1
+ KBUILD_TYPE=release
+ BUILD_TYPE=
+ ;;
+ "--debug")
+ EXP_TYPE_OPT=1
+ KBUILD_TYPE=debug
+ BUILD_TYPE=
+ ;;
+ "--profile")
+ EXP_TYPE_OPT=1
+ KBUILD_TYPE=profile
+ BUILD_TYPE=
+ ;;
+
+ "--help")
+ echo "kBuild Environment Setup Script, v0.2.0-pre"
+ echo ""
+ echo "syntax: $0 [options] [command [args]]"
+ echo " or: $0 [options] --var <varname>"
+ echo " or: $0 [options] --eval"
+ echo " or: $0 [options] --eval --var <varname>"
+ echo ""
+ echo "The first form will execute the command, or if no command is given start"
+ echo "an interactive shell."
+ echo "The second form will print the specfified variable(s)."
+ echo "The third form will print all exported variables suitable for bourne shell"
+ echo "evaluation."
+ echo "The forth form will only print the specified variable(s)."
+ echo ""
+ echo "Options:"
+ echo " --debug, --release, --profile"
+ echo " Alternative way of specifying KBUILD_TYPE."
+ echo " --debug-script, --no-debug-script"
+ echo " Controls debug output. Default: --no-debug-script"
+ echo " --quiet, --verbose"
+ echo " Controls informational output. Default: --verbose"
+ echo " --full, --full-with-bin, --normal"
+ echo " Controls the variable set. Default: --normal"
+ echo " --legacy, --no-legacy"
+ echo " Include legacy variables in result. Default: --no-legacy"
+ echo " --value-only, --name-and-value"
+ echo " Controls what the result of a --var query. Default: --name-and-value"
+ echo " --set, --export"
+ echo " Whether --eval explicitly export the variables. --set is useful for"
+ echo " getting a list of environment vars for a commandline, while --eval"
+ echo ' is useful for eval `env.sh`. Default: --export'
+ echo ""
+ exit 1
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+
+#
+# Deal with legacy environment variables.
+#
+if test -n "$PATH_KBUILD"; then
+ if test -n "$KBUILD_PATH" -a "$KBUILD_PATH" != "$PATH_KBUILD"; then
+ echo "$0: error: KBUILD_PATH ($KBUILD_PATH) and PATH_KBUILD ($PATH_KBUILD) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_PATH=$PATH_KBUILD
+fi
+if test -n "$PATH_KBUILD_BIN"; then
+ if test -n "$KBUILD_BIN_PATH" -a "$KBUILD_BIN_PATH" != "$PATH_KBUILD_BIN"; then
+ echo "$0: error: KBUILD_BIN_PATH ($KBUILD_BIN_PATH) and PATH_KBUILD_BIN ($PATH_KBUILD_BIN) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_BIN_PATH=$PATH_KBUILD_BIN
+fi
+
+if test -n "$BUILD_TYPE"; then
+ if test -n "$KBUILD_TYPE" -a "$KBUILD_TYPE" != "$BUILD_TYPE"; then
+ echo "$0: error: KBUILD_TYPE ($KBUILD_TYPE) and BUILD_TYPE ($BUILD_TYPE) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_TYPE=$BUILD_TYPE
+fi
+
+if test -n "$BUILD_PLATFORM"; then
+ if test -n "$KBUILD_HOST" -a "$KBUILD_HOST" != "$BUILD_PLATFORM"; then
+ echo "$0: error: KBUILD_HOST ($KBUILD_HOST) and BUILD_PLATFORM ($BUILD_PLATFORM) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_HOST=$BUILD_PLATFORM
+fi
+if test -n "$BUILD_PLATFORM_ARCH"; then
+ if test -n "$KBUILD_HOST_ARCH" -a "$KBUILD_HOST_ARCH" != "$BUILD_PLATFORM_ARCH"; then
+ echo "$0: error: KBUILD_HOST_ARCH ($KBUILD_HOST_ARCH) and BUILD_PLATFORM_ARCH ($BUILD_PLATFORM_ARCH) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_HOST_ARCH=$BUILD_PLATFORM_ARCH
+fi
+if test -n "$BUILD_PLATFORM_CPU"; then
+ if test -n "$KBUILD_HOST_CPU" -a "$KBUILD_HOST_CPU" != "$BUILD_PLATFORM_CPU"; then
+ echo "$0: error: KBUILD_HOST_CPU ($KBUILD_HOST_CPU) and BUILD_PLATFORM_CPU ($BUILD_PLATFORM_CPU) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_HOST_CPU=$BUILD_PLATFORM_CPU
+fi
+
+if test -n "$BUILD_TARGET"; then
+ if test -n "$KBUILD_TARGET" -a "$KBUILD_TARGET" != "$BUILD_TARGET"; then
+ echo "$0: error: KBUILD_TARGET ($KBUILD_TARGET) and BUILD_TARGET ($BUILD_TARGET) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_TARGET=$BUILD_TARGET
+fi
+if test -n "$BUILD_TARGET_ARCH"; then
+ if test -n "$KBUILD_TARGET_ARCH" -a "$KBUILD_TARGET_ARCH" != "$BUILD_TARGET_ARCH"; then
+ echo "$0: error: KBUILD_TARGET_ARCH ($KBUILD_TARGET_ARCH) and BUILD_TARGET_ARCH ($BUILD_TARGET_ARCH) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_TARGET_ARCH=$BUILD_TARGET_ARCH
+fi
+if test -n "$BUILD_TARGET_CPU"; then
+ if test -n "$KBUILD_TARGET_CPU" -a "$KBUILD_TARGET_CPU" != "$BUILD_TARGET_CPU"; then
+ echo "$0: error: KBUILD_TARGET_CPU ($KBUILD_TARGET_CPU) and BUILD_TARGET_CPU ($BUILD_TARGET_CPU) disagree." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ fi
+ KBUILD_TARGET_CPU=$BUILD_TARGET_CPU
+fi
+
+
+#
+# Set default build type.
+#
+if test -z "$KBUILD_TYPE"; then
+ KBUILD_TYPE=release
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_TYPE=$KBUILD_TYPE" 1>&${DBG_REDIR}
+
+#
+# Determin the host platform.
+#
+# The CPU isn't important, only the other two are. But, since the cpu,
+# arch and platform (and build type) share a common key space, try make
+# sure any new additions are unique. (See header.kmk, KBUILD_OSES/ARCHES.)
+#
+if test -z "$KBUILD_HOST"; then
+ KBUILD_HOST=`uname`
+ case "$KBUILD_HOST" in
+ Darwin|darwin)
+ KBUILD_HOST=darwin
+ ;;
+
+ DragonFly)
+ KBUILD_HOST=dragonfly
+ ;;
+
+ freebsd|FreeBSD|FREEBSD)
+ KBUILD_HOST=freebsd
+ ;;
+
+ GNU)
+ KBUILD_HOST=gnuhurd
+ ;;
+
+ GNU/kFreeBSD)
+ KBUILD_HOST=gnukfbsd
+ ;;
+
+ GNU/kNetBSD|GNU/NetBSD)
+ KBUILD_HOST=gnuknbsd
+ ;;
+
+ Haiku)
+ KBUILD_HOST=haiku
+ ;;
+
+ linux|Linux|GNU/Linux|LINUX)
+ KBUILD_HOST=linux
+ ;;
+
+ netbsd|NetBSD|NETBSD)
+ KBUILD_HOST=netbsd
+ ;;
+
+ openbsd|OpenBSD|OPENBSD)
+ KBUILD_HOST=openbsd
+ ;;
+
+ os2|OS/2|OS2)
+ KBUILD_HOST=os2
+ ;;
+
+ SunOS)
+ KBUILD_HOST=solaris
+ ;;
+
+ WindowsNT|CYGWIN_NT-*)
+ KBUILD_HOST=win
+ ;;
+
+ *)
+ echo "$0: unknown os $KBUILD_HOST" 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ ;;
+ esac
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_HOST=$KBUILD_HOST" 1>&${DBG_REDIR}
+
+if test -z "$KBUILD_HOST_ARCH"; then
+ # Try deduce it from the cpu if given.
+ if test -n "$KBUILD_HOST_CPU"; then
+ case "$KBUILD_HOST_CPU" in
+ i[3456789]86)
+ KBUILD_HOST_ARCH='x86'
+ ;;
+ k8|k8l|k9|k10)
+ KBUILD_HOST_ARCH='amd64'
+ ;;
+ esac
+ fi
+fi
+if test -z "$KBUILD_HOST_ARCH"; then
+ # Use uname -m or isainfo (lots of guesses here, please help clean this up...)
+ if test "$KBUILD_HOST" = "solaris"; then
+ KBUILD_HOST_ARCH=`isainfo | cut -f 1 -d ' '`
+
+ else
+ KBUILD_HOST_ARCH=`uname -m`
+ fi
+ case "$KBUILD_HOST_ARCH" in
+ x86_64|AMD64|amd64|k8|k8l|k9|k10)
+ KBUILD_HOST_ARCH='amd64'
+ # Try detect debian x32.
+ if test "$KBUILD_HOST" = "linux"; then
+ if test -z "${DEB_HOST_ARCH}"; then
+ DEB_HOST_ARCH=`dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null`;
+ if test -z "${DEB_HOST_ARCH}"; then
+ DEB_HOST_ARCH=`dpkg --print-architecture 2> /dev/null`;
+ fi
+ fi
+ case "${DEB_HOST_ARCH}" in
+ "x32")
+ KBUILD_HOST_ARCH=x32
+ ;;
+ "") case "`uname -v`" in
+ *Debian*+x32+*) KBUILD_HOST_ARCH=x32 ;;
+ esac
+ ;;
+ esac
+ fi
+ ;;
+ x86|i86pc|ia32|i[3456789]86|BePC|i[3456789]86-AT[3456789]86)
+ KBUILD_HOST_ARCH='x86'
+ ;;
+ alpha)
+ KBUILD_HOST_ARCH='alpha'
+ ;;
+ aarch32|arm|arm1|arm2|arm3|arm6|armv1|armv2|armv3*|armv4*|armv5*|armv6*|armv7*|armv8*)
+ KBUILD_HOST_ARCH='arm32'
+ ;;
+ aarch64*|arm64) # (Apple M1 is arm64.)
+ KBUILD_HOST_ARCH='arm64'
+ ;;
+ hppa32|parisc32|parisc)
+ KBUILD_HOST_ARCH='hppa32'
+ ;;
+ hppa64|parisc64)
+ KBUILD_HOST_ARCH='hppa64'
+ ;;
+ ia64)
+ KBUILD_HOST_ARCH='ia64'
+ ;;
+ m68k)
+ KBUILD_HOST_ARCH='m68k'
+ ;;
+ mips32|mips)
+ KBUILD_HOST_ARCH='mips32'
+ ;;
+ mips64)
+ KBUILD_HOST_ARCH='mips64'
+ ;;
+ ppc32|ppc|powerpc)
+ KBUILD_HOST_ARCH='ppc32'
+ ;;
+ ppc64|ppc64le|powerpc64|powerpc64le)
+ KBUILD_HOST_ARCH='ppc64'
+ ;;
+ riscv64*)
+ KBUILD_HOST_ARCH='riscv64'
+ ;;
+ riscv32*|riscv)
+ KBUILD_HOST_ARCH='riscv32'
+ ;;
+ s390)
+ KBUILD_HOST_ARCH='s390'
+ ;;
+ s390x)
+ KBUILD_HOST_ARCH='s390x'
+ ;;
+ sh|sh2|sh2a|sh3|sh3|sh4|sh4a|sh4al|sh4al-dsp|shmedia)
+ KBUILD_HOST_ARCH='sh32'
+ ;;
+ sh64)
+ KBUILD_HOST_ARCH='sh64'
+ ;;
+ sparc32|sparc|sparcv8|sparcv7|sparcv8e)
+ KBUILD_HOST_ARCH='sparc32'
+ ;;
+ sparc64|sparcv9)
+ KBUILD_HOST_ARCH='sparc64'
+ ;;
+
+ *) echo "$0: unknown cpu/arch - $KBUILD_HOST_ARCH" 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ ;;
+ esac
+
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_HOST_ARCH=$KBUILD_HOST_ARCH" 1>&${DBG_REDIR}
+
+if test -z "$KBUILD_HOST_CPU"; then
+ KBUILD_HOST_CPU="blend"
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_HOST_CPU=$KBUILD_HOST_CPU" 1>&${DBG_REDIR}
+
+#
+# The target platform.
+# Defaults to the host when not specified.
+#
+if test -z "$KBUILD_TARGET"; then
+ KBUILD_TARGET="$KBUILD_HOST"
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_TARGET=$KBUILD_TARGET" 1>&${DBG_REDIR}
+
+if test -z "$KBUILD_TARGET_ARCH"; then
+ KBUILD_TARGET_ARCH="$KBUILD_HOST_ARCH"
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_TARGET_ARCH=$KBUILD_TARGET_ARCH" 1>&${DBG_REDIR}
+
+if test -z "$KBUILD_TARGET_CPU"; then
+ if test "$KBUILD_TARGET_ARCH" = "$KBUILD_HOST_ARCH"; then
+ KBUILD_TARGET_CPU="$KBUILD_HOST_CPU"
+ else
+ KBUILD_TARGET_CPU="blend"
+ fi
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_TARGET_CPU=$KBUILD_TARGET_CPU" 1>&${DBG_REDIR}
+
+#
+# Determin executable extension and path separator.
+#
+_SUFF_EXE=
+_PATH_SEP=":"
+case "$KBUILD_HOST" in
+ os2|win|nt)
+ _SUFF_EXE=".exe"
+ _PATH_SEP=";"
+ ;;
+esac
+
+#
+# Determin KBUILD_PATH from the script location and calc KBUILD_BIN_PATH from there.
+#
+if test -z "$KBUILD_PATH"; then
+ KBUILD_PATH=`dirname "$0"`
+ KBUILD_PATH=`cd "$KBUILD_PATH" ; /bin/pwd`
+fi
+if test ! -f "$KBUILD_PATH/footer.kmk" -o ! -f "$KBUILD_PATH/header.kmk" -o ! -f "$KBUILD_PATH/rules.kmk"; then
+ echo "$0: error: KBUILD_PATH ($KBUILD_PATH) is not pointing to a popluated kBuild directory." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_PATH=$KBUILD_PATH" 1>&${DBG_REDIR}
+
+if test -z "$KBUILD_BIN_PATH"; then
+ KBUILD_BIN_PATH="${KBUILD_PATH}/bin/${KBUILD_HOST}.${KBUILD_HOST_ARCH}"
+fi
+test -n "$DBG_OPT" && echo "dbg: KBUILD_BIN_PATH=${KBUILD_BIN_PATH}" 1>&${DBG_REDIR}
+
+#
+# Add the bin/x.y/ directory to the PATH.
+# NOTE! Once bootstrapped this is the only thing that is actually necessary.
+#
+PATH="${KBUILD_BIN_PATH}${_PATH_SEP}$PATH"
+test -n "$DBG_OPT" && echo "dbg: PATH=$PATH" 1>&${DBG_REDIR}
+
+#
+# Sanity and x bits.
+#
+if test ! -d "${KBUILD_BIN_PATH}/"; then
+ echo "$0: warning: The bin directory for this platform doesn't exist. (${KBUILD_BIN_PATH}/)" 1>&${ERR_REDIR}
+else
+ for prog in kmk kDepPre kDepIDB kmk_append kmk_ash kmk_cat kmk_cp kmk_echo kmk_install kmk_ln kmk_mkdir kmk_mv kmk_rm kmk_rmdir kmk_sed;
+ do
+ chmod a+x ${KBUILD_BIN_PATH}/${prog} > /dev/null 2>&1
+ if test ! -f "${KBUILD_BIN_PATH}/${prog}${_SUFF_EXE}"; then
+ echo "$0: warning: The ${prog} program doesn't exist for this platform. (${KBUILD_BIN_PATH}/${prog}${_SUFF_EXE})" 1>&${ERR_REDIR}
+ fi
+ done
+fi
+
+#
+# The environment is in place, now take the requested action.
+#
+MY_RC=0
+if test -n "${VAR_OPT}"; then
+ # Echo variable values or variable export statements.
+ for var in ${VAR_OPT};
+ do
+ val=
+ case "$var" in
+ PATH)
+ val=$PATH
+ ;;
+ KBUILD_PATH)
+ val=$KBUILD_PATH
+ ;;
+ KBUILD_BIN_PATH)
+ val=$KBUILD_BIN_PATH
+ ;;
+ KBUILD_HOST)
+ val=$KBUILD_HOST
+ ;;
+ KBUILD_HOST_ARCH)
+ val=$KBUILD_HOST_ARCH
+ ;;
+ KBUILD_HOST_CPU)
+ val=$KBUILD_HOST_CPU
+ ;;
+ KBUILD_TARGET)
+ val=$KBUILD_TARGET
+ ;;
+ KBUILD_TARGET_ARCH)
+ val=$KBUILD_TARGET_ARCH
+ ;;
+ KBUILD_TARGET_CPU)
+ val=$KBUILD_TARGET_CPU
+ ;;
+ KBUILD_TYPE)
+ val=$KBUILD_TYPE
+ ;;
+ *)
+ echo "$0: error: Unknown variable $var specified in --var request." 1>&${ERR_REDIR}
+ sleep 1
+ exit 1
+ ;;
+ esac
+
+ if test -n "$EVAL_OPT"; then
+ echo "${EVAL_EXPORT} $var=$val"
+ else
+ if test -n "$VALUE_ONLY_OPT"; then
+ echo "$val"
+ else
+ echo "$var=$val"
+ fi
+ fi
+ done
+else
+ if test -n "$EVAL_OPT"; then
+ # Echo statements for the shell to evaluate.
+ test -n "$DBG_OPT" && echo "dbg: echoing exported variables" 1>&${DBG_REDIR}
+ echo "${EVAL_EXPORT} PATH=${PATH}"
+ test -n "${FULL_OPT}" -o "${EXP_TYPE_OPT}" && echo "${EVAL_EXPORT} KBUILD_TYPE=${KBUILD_TYPE}"
+ if test -n "${FULL_OPT}"; then
+ echo "${EVAL_EXPORT} KBUILD_PATH=${KBUILD_PATH}"
+ if test -n "{FULL_WITH_BIN_OPT}"; then
+ echo "${EVAL_EXPORT} KBUILD_BIN_PATH=${KBUILD_BIN_PATH}"
+ fi
+ echo "${EVAL_EXPORT} KBUILD_HOST=${KBUILD_HOST}"
+ echo "${EVAL_EXPORT} KBUILD_HOST_ARCH=${KBUILD_HOST_ARCH}"
+ echo "${EVAL_EXPORT} KBUILD_HOST_CPU=${KBUILD_HOST_CPU}"
+ echo "${EVAL_EXPORT} KBUILD_TARGET=${KBUILD_TARGET}"
+ echo "${EVAL_EXPORT} KBUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
+ echo "${EVAL_EXPORT} KBUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
+
+ if test -n "${LEGACY_OPT}"; then
+ echo "${EVAL_EXPORT} PATH_KBUILD=${KBUILD_PATH}"
+ if test -n "${FULL_WITH_BIN_OPT}"; then
+ echo "${EVAL_EXPORT} PATH_KBUILD_BIN=${KBUILD_PATH_BIN}"
+ fi
+ echo "${EVAL_EXPORT} BUILD_TYPE=${KBUILD_TYPE}"
+ echo "${EVAL_EXPORT} BUILD_PLATFORM=${KBUILD_HOST}"
+ echo "${EVAL_EXPORT} BUILD_PLATFORM_ARCH=${KBUILD_HOST_ARCH}"
+ echo "${EVAL_EXPORT} BUILD_PLATFORM_CPU=${KBUILD_HOST_CPU}"
+ echo "${EVAL_EXPORT} BUILD_TARGET=${KBUILD_TARGET}"
+ echo "${EVAL_EXPORT} BUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
+ echo "${EVAL_EXPORT} BUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
+ fi
+ fi
+ else
+ # Export variables.
+ export PATH
+ test -n "${FULL_OPT}" -o "${EXP_TYPE_OPT}" && export KBUILD_TYPE
+ if test -n "${FULL_OPT}"; then
+ export KBUILD_PATH
+ if test -n "${FULL_WITH_BIN_OPT}"; then
+ export KBUILD_BIN_PATH
+ fi
+ export KBUILD_HOST
+ export KBUILD_HOST_ARCH
+ export KBUILD_HOST_CPU
+ export KBUILD_TARGET
+ export KBUILD_TARGET_ARCH
+ export KBUILD_TARGET_CPU
+
+ if test -n "${LEGACY_OPT}"; then
+ export PATH_KBUILD=$KBUILD_PATH
+ if test -n "${FULL_WITH_BIN_OPT}"; then
+ export PATH_KBUILD_BIN=$KBUILD_BIN_PATH
+ fi
+ export BUILD_TYPE=$KBUILD_TYPE
+ export BUILD_PLATFORM=$KBUILD_HOST
+ export BUILD_PLATFORM_ARCH=$KBUILD_HOST_ARCH
+ export BUILD_PLATFORM_CPU=$KBUILD_HOST_CPU
+ export BUILD_TARGET=$KBUILD_TARGET
+ export BUILD_TARGET_ARCH=$KBUILD_TARGET_ARCH
+ export BUILD_TARGET_CPU=$KBUILD_TARGET_CPU
+ fi
+ fi
+
+ # Execute command or spawn shell.
+ if test $# -eq 0; then
+ test -z "${QUIET_OPT}" && echo "$0: info: Spawning work shell..." 1>&${ERR_REDIR}
+ if test "$TERM" != 'dumb' -a -n "$BASH"; then
+ export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
+ fi
+ $SHELL -i
+ MY_RC=$?
+ else
+ test -z "${QUIET_OPT}" && echo "$0: info: Executing command: $*" 1>&${ERR_REDIR}
+ $*
+ MY_RC=$?
+ test -z "${QUIET_OPT}" -a "$MY_RC" -ne 0 && echo "$0: info: rc=$MY_RC: $*" 1>&${ERR_REDIR}
+ fi
+ fi
+fi
+test -n "$DBG_OPT" && echo "dbg: finished (rc=$MY_RC)" 1>&${DBG_REDIR}
+exit $MY_RC
+
diff --git a/kBuild/envos2.cmd b/kBuild/envos2.cmd
new file mode 100644
index 0000000..4ce849c
--- /dev/null
+++ b/kBuild/envos2.cmd
@@ -0,0 +1,801 @@
+/*
+echo this is a rexx script!
+cancel & quit & exit
+*/
+/* $Id: envos2.cmd 2413 2010-09-11 17:43:04Z bird $ */
+/** @file
+ * Environment setup script for OS/2.
+ */
+
+/*
+ *
+ * Copyright (c) 1999-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+ *
+ * This file is part of kBuild.
+ *
+ * kBuild is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * kBuild is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with kBuild; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+/*
+ * Setup the usual suspects.
+ */
+Address CMD '@echo off';
+signal on novalue name NoValueHandler
+if (RxFuncQuery('SysLoadFuncs') = 1) then
+do
+ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
+ call SysLoadFuncs;
+end
+
+/*
+ * Apply the CMD.EXE workaround.
+ */
+call FixCMDEnv;
+
+/*
+ * Globals
+ */
+skBuildPath = EnvGet("KBUILD_PATH");
+skBuildBinPath = EnvGet("KBUILD_BIN_PATH");
+skBuildType = EnvGet("KBUILD_TYPE");
+skBuildTarget = EnvGet("KBUILD_TARGET");
+skBuildTargetArch = EnvGet("KBUILD_TARGET_ARCH");
+skBuildTargetCpu = EnvGet("KBUILD_TARGET_CPU");
+skBuildHost = EnvGet("KBUILD_HOST");
+skBuildHostArch = EnvGet("KBUILD_HOST_ARCH");
+skBuildHostCpu = EnvGet("KBUILD_HOST_CPU");
+
+/*
+ * Process arguments.
+ */
+fOptFull = 0
+fOptLegacy = 0
+fOptDbg = 0
+fOptQuiet = 0
+sOptVars = ""
+fOptValueOnly = 0
+sShowVarPrefix = "";
+fOptOverrideAll = 0
+fOptOverrideType = 0;
+fSetType = 0;
+fOptOverrideTarget = 0;
+fOptOverrideTargetArch = 0;
+fOptDefault = 0;
+
+parse arg sArgs
+do while (sArgs <> '')
+ parse value sArgs with sArg sRest
+ say 'sArgs='sArgs';'
+ say ' sArg='sArg';'
+ say 'sRest='sRest';'
+
+ select
+ when (sArg = "--debug-script") then do
+ fOptDbg = 1;
+ end
+ when (sArg = "--no-debug-script") then do
+ fOptDbg = 0;
+ end
+ when (sArg = "--quiet") then do
+ fOptQuiet = 1;
+ end
+ when (sArg = "--verbose") then do
+ fOptQuiet = 0;
+ end
+ when (sArg = "--full") then do
+ fOptFull = 1;
+ end
+ when (sArg = "--normal") then do
+ fOptFull = 0;
+ end
+ when (sArg = "--legacy") then do
+ fOptLegacy = 1;
+ end
+ when (sArg = "--no-legacy") then do
+ fOptLegacy = 0;
+ end
+ when (sArg = "--eval") then do
+ say "error: --eval is not supported on OS/2."
+ end
+ when (sArg = "--var") then do
+ parse value sRest with sVar sRest2
+ sRest = sRest2;
+ if (sVar = '') then do
+ say "syntax error: --var is missing the variable name";
+ call SysSleep 1
+ exit 1;
+ end
+ if (sVar = "all" | sOptVars = "all") then
+ sOptVars = "all";
+ else
+ sOptVars = sOptVars || " " || sVar;
+ end
+ when (sArg = "--set") then do
+ sShowVarPrefix = "SET ";
+ end
+ when (sArg = "--no-set") then do
+ sShowVarPrefix = "";
+ end
+ when (sArg = "--value-only") then do
+ fOptValueOnly = 1;
+ end
+ when (sArg = "--name-and-value") then do
+ fOptValueOnly = 0;
+ end
+ when (sArg = "--release") then do
+ fOptOverrideType = 1;
+ fSetType = 1;
+ skBuildType = 'release';
+ end
+ when (sArg = "--debug") then do
+ fOptOverrideType = 1;
+ fSetType = 1;
+ skBuildType = 'debug';
+ end
+ when (sArg = "--profile") then do
+ fOptOverrideType = 1;
+ fSetType = 1;
+ skBuildType = 'profile';
+ end
+ when (sArg = "--defaults") then do
+ fOptOverrideAll = 1;
+ skBuildType = "";
+ skBuildTarget = "";
+ skBuildTargetArch = "";
+ skBuildTargetCpu = "";
+ skBuildHost = "";
+ skBuildHostArch = "";
+ skBuildHostCpu = "";
+ skBuildPath = "";
+ skBuildBinPath = "";
+ end
+
+ when (sArg = "--help" | sArg = "-h" | sArg = "-?" | sArg = "/?" | sArg = "/h") then do
+ say "kBuild Environment Setup Script, v0.1.4"
+ say ""
+ say "syntax: envos2.cmd [options] [command [args]]"
+ say " or: envos2.cmd [options] --var <varname>"
+ say ""
+ say "The first form will execute the command, or if no command is given"
+ say "modify the current invoking shell."
+ say "The second form will print the specfified variable(s)."
+ say ""
+ say "Options:"
+ say " --debug, --release, --profile"
+ say " Alternative way of specifying KBUILD_TYPE."
+ say " --defaults"
+ say " Enforce defaults for all the KBUILD_* values."
+ say " --debug-script, --no-debug-script"
+ say " Controls debug output. Default: --no-debug-script"
+ say " --quiet, --verbose"
+ say " Controls informational output. Default: --verbose"
+ say " --full, --normal"
+ say " Controls the variable set. Default: --normal"
+ say " --legacy, --no-legacy"
+ say " Include legacy variables in result. Default: --no-legacy"
+ say " --value-only, --name-and-value"
+ say " Controls what the result of a --var query. Default: --name-and-value"
+ say " --set, --no-set"
+ say " Whether to prefix the variable output with 'SET'."
+ say " Default: --no-set"
+ say ""
+ exit 1
+ end
+
+ when (sArg = "--") then do
+ sArgs = sRest;
+ leave;
+ end
+
+ when (left(sArg, 2) = '--') then do
+ say 'syntax error: unknown option: '||sArg
+ call SysSleep 1
+ exit 1
+ end
+
+ otherwise do
+ leave
+ end
+ end
+ sArgs = sRest;
+end
+sCommand = strip(sArgs);
+
+/*
+ * Deal with legacy environment variables.
+ */
+if (\fOptOverrideAll) then do
+ if (EnvGet("PATH_KBUILD") <> '') then do
+ if (skBuildPath <> '' & skBuildPath <> EnvGet("PATH_KBUILD")) then do
+ say "error: KBUILD_PATH ("||skBuildPath||") and PATH_KBUILD ("||EnvGet("PATH_KBUILD")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildPath = EnvGet("PATH_KBUILD");
+ end
+
+ if (EnvGet("PATH_KBUILD_BIN") <> '') then do
+ if (skBuildPath <> '' & skBuildBinPath <> EnvGet("PATH_KBUILD_BIN")) then do
+ say "error: KBUILD_BIN_PATH ("||skBuildBinPath||") and PATH_KBUILD_BIN ("||EnvGet("PATH_KBUILD_BIN")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildBinPath = EnvGet("PATH_KBUILD_BIN");
+ end
+
+ if (EnvGet("BUILD_TYPE") <> '') then do
+ if (skBuildType <> '' & skBuildType <> EnvGet("BUILD_TYPE")) then do
+ say "error: KBUILD_TYPE ("||skBuildType||") and BUILD_TYPE ("||EnvGet("BUILD_TYPE")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildType = EnvGet("BUILD_TYPE");
+ end
+
+ if (EnvGet("BUILD_TARGET") <> '') then do
+ if (skBuildTarget <> '' & skBuildTarget <> EnvGet("BUILD_TARGET")) then do
+ say "error: KBUILD_TARGET ("||skBuildTarget||") and BUILD_TARGET ("||EnvGet("BUILD_TARGET")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildTarget = EnvGet("BUILD_TARGET");
+ end
+
+ if (EnvGet("BUILD_TARGET_ARCH") <> '') then do
+ if (skBuildTargetArch <> '' & skBuildTargetArch <> EnvGet("BUILD_TARGET_ARCH")) then do
+ say "error: KBUILD_TARGET_ARCH ("||skBuildTargetArch ||") and BUILD_TARGET_ARCH ("||EnvGet("BUILD_TARGET_ARCH")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildTargetArch = EnvGet("BUILD_TARGET_ARCH");
+ end
+
+ if (EnvGet("BUILD_TARGET_CPU") <> '') then do
+ if (skBuildTargetCpu <> '' & skBuildTargetCpu <> EnvGet("BUILD_TARGET_CPU")) then do
+ say "error: KBUILD_TARGET_CPU ("||skBuildTargetCpu ||") and BUILD_TARGET_CPU ("||EnvGet("BUILD_TARGET_CPU")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildTargetCpu = EnvGet("BUILD_TARGET_CPU");
+ end
+
+ if (EnvGet("BUILD_PLATFORM") <> '') then do
+ if (skBuildHost <> '' & skBuildHost <> EnvGet("BUILD_PLATFORM")) then do
+ say "error: KBUILD_HOST ("||skBuildHost||") and BUILD_PLATFORM ("||EnvGet("BUILD_PLATFORM")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ if (skBuildHost = '' & EnvGet("BUILD_PLATFORM") = "OS2") then do
+ say "error: BUILD_PLATFORM=OS2! Please unset it or change it to 'os2'."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildHost = EnvGet("BUILD_PLATFORM");
+ end
+
+ if (EnvGet("BUILD_PLATFORM_ARCH") <> '') then do
+ if (skBuildHostArch <> '' & skBuildHostArch <> EnvGet("BUILD_PLATFORM_ARCH")) then do
+ say "error: KBUILD_HOST_ARCH ("||skBuildHostArch ||") and BUILD_PLATFORM_ARCH ("||EnvGet("BUILD_PLATFORM_ARCH")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildHostArch = EnvGet("BUILD_PLATFORM_ARCH");
+ end
+
+ if (EnvGet("BUILD_PLATFORM_CPU") <> '') then do
+ if (skBuildHostCpu <> '' & skBuildHostCpu <> EnvGet("BUILD_PLATFORM_CPU")) then do
+ say "error: KBUILD_HOST_CPU ("||skBuildHostCpu ||") and BUILD_PLATFORM_CPU ("||EnvGet("BUILD_PLATFORM_CPU")||") disagree."
+ call SysSleep 1;
+ exit 1;
+ end
+ skBuildHostCpu = EnvGet("BUILD_PLATFORM_CPU");
+ end
+end
+
+/*
+ * Set default build type.
+ */
+if (skBuildType = '') then
+ skBuildType = 'release';
+if (fOptDbg <> 0) then say "dbg: KBUILD_TYPE="||skBuildType
+
+/*
+ * Determin the host platform (OS/2)
+ */
+if (skBuildHost = '') then
+ skBuildHost = 'os2';
+if (fOptDbg <> 0) then say "dbg: KBUILD_HOST="||skBuildHost
+
+if (skBuildHostArch = '') then do
+ select
+ when (skBuildHostCpu = 'i386',
+ | skBuildHostCpu = 'i486',
+ | skBuildHostCpu = 'i586',
+ | skBuildHostCpu = 'i686',
+ | skBuildHostCpu = 'i786',
+ | skBuildHostCpu = 'i886',
+ | skBuildHostCpu = 'i986') then do
+ skBuildHostArch = "x86";
+ end
+ otherwise do
+ skBuildHostArch = "x86";
+ end
+ end
+end
+if (fOptDbg <> 0) then say "dbg: KBUILD_HOST_ARCH="||skBuildHostArch
+
+if (skBuildHostCpu = '') then
+ skBuildHostCpu = 'blend';
+if (fOptDbg <> 0) then say "dbg: KBUILD_HOST_CPU="||skBuildHostCpu
+
+
+/*
+ * The target platform.
+ * Defaults to the host when not specified.
+ */
+if (skBuildTarget = '') then
+ skBuildTarget = skBuildHost;
+if (fOptDbg <> 0) then say "dbg: KBUILD_TARGET="||skBuildTarget
+
+if (skBuildTargetArch = '') then
+ skBuildTargetArch = skBuildHostArch;
+if (fOptDbg <> 0) then say "dbg: KBUILD_TARGET_ARCH="||skBuildTargetArch
+
+if (skBuildTargetCpu = '') then do
+ if (skBuildTargetArch = skBuildHostArch) then
+ skBuildTargetCpu = skBuildHostCpu;
+ else
+ skBuildTargetCpu = "blend";
+end
+if (fOptDbg <> 0) then say "dbg: KBUILD_TARGET_CPU="||skBuildTargetCpu
+
+
+/*
+ * Determin KBUILD_PATH from the script location and calc KBUILD_BIN_PATH from there.
+ */
+if (skBuildPath = '') then do
+ skBuildPath = GetScriptDir()
+end
+skBuildPath = translate(skBuildPath, '/', '\')
+if ( FileExists(skBuildPath||"/footer.kmk") = 0,
+ | FileExists(skBuildPath||"/header.kmk") = 0,
+ | FileExists(skBuildPath||"/rules.kmk") = 0) then do
+ say "error: KBUILD_PATH ("skBuildPath||") is not pointing to a popluated kBuild directory."
+ call SysSleep 1
+ exit 1
+end
+if (fOptDbg <> 0) then say "dbg: KBUILD_PATH="||skBuildPath;
+
+if (skBuildBinPath = '') then do
+ skBuildBinPath = skBuildPath||'/bin/'||skBuildHost||'.'||skBuildHostArch;
+end
+skBuildBinPath = translate(skBuildBinPath, '/', '\')
+if (fOptDbg <> 0) then say "dbg: KBUILD_BIN_PATH="||skBuildBinPath;
+
+/*
+ * Add the bin/x.y/ directory to the PATH and BEGINLIBPATH.
+ * NOTE! Once bootstrapped this is the only thing that is actually necessary.
+ */
+sOldPath = EnvGet("PATH");
+call EnvAddFront 0, "PATH", translate(skBuildBinPath, '\', '/');
+sNewPath = EnvGet("PATH");
+call EnvSet 0, "PATH", sOldPath;
+if (fOptDbg <> 0) then say "dbg: PATH="||sNewPath;
+
+sOldBeginLibPath = EnvGet("BEGINLIBPATH");
+call EnvAddFront 0, "BEGINLIBPATH", translate(skBuildBinPath, '\', '/');
+sNewBeginLibPath = EnvGet("BEGINLIBPATH");
+call EnvSet 0, "BEGINLIBPATH", sOldBeginLibPath;
+if (fOptDbg <> 0) then say "dbg: BEGINLIBPATH="||sNewBeginLibPath;
+
+/*
+ * Sanity check
+ */
+if (DirExists(skBuildBinPath) = 0) then
+ say "warning: The bin directory for the build platform doesn't exist. ("||skBuildBinPath||")";
+else
+do
+ sPrograms = "kmk kDepPre kDepIDB kmk_append kmk_ash kmk_cat kmk_cp kmk_echo kmk_install kmk_ln kmk_mkdir kmk_mv kmk_redirect kmk_rm kmk_rmdir kmk_sed";
+ do i = 1 to words(sPrograms)
+ sProgram = word(sPrograms, i);
+ if (FileExists(skBuildBinPath||"\"||sProgram||".exe") = 0) then
+ say "warning: The "||sProgram||" program doesn't exit for this platform. ("||skBuildBinPath||")";
+ end
+end
+
+
+/*
+ * The environment is in place, now take the requested action.
+ */
+iRc = 0;
+if (sOptVars <> '') then
+do
+ if (sOptVars = "all") then
+ sOptVars = "KBUILD_PATH KBUILD_BIN_PATH KBUILD_TYPE ",
+ || "KBUILD_TARGET KBUILD_TARGET_ARCH KBUILD_TARGET_CPU ",
+ || "KBUILD_HOST KBUILD_HOST_ARCH KBUILD_HOST_CPU ";
+
+ /* Echo variable values or variable export statements. */
+ do i = 1 to words(sOptVars)
+ sVar = word(sOptVars, i)
+ sVal = '';
+ select
+ when (sVar = "PATH") then sVal = sNewPath;
+ when (sVar = "BEGINLIBPATH") then sVal = sNewBeginLibPath;
+ when (sVar = "KBUILD_PATH") then sVal = skBuildPath;
+ when (sVar = "KBUILD_BIN_PATH") then sVal = skBuildBinPath;
+ when (sVar = "KBUILD_TYPE") then sVal = skBuildType;
+ when (sVar = "KBUILD_HOST") then sVal = skBuildHost;
+ when (sVar = "KBUILD_HOST_ARCH") then sVal = skBuildHostArch;
+ when (sVar = "KBUILD_HOST_CPU") then sVal = skBuildHostCpu;
+ when (sVar = "KBUILD_TARGET") then sVal = skBuildTarget;
+ when (sVar = "KBUILD_TARGET_ARCH") then sVal = skBuildTargetArch;
+ when (sVar = "KBUILD_TARGET_CPU") then sVal = skBuildTargetCpu;
+ otherwise do
+ say "error: Unknown variable "||sVar||" specified in --var request."
+ call SysSleep 1
+ exit 1
+ end
+
+ end
+ if (fOptValueOnly <> 0) then
+ say sVal
+ else
+ say sShowVarPrefix||sVar||"="||sVal;
+ end
+end
+else
+do
+ /* Wipe out all variables - legacy included - with --default. */
+ if (fOptOverrideAll <> 0) then do
+ call EnvSet 0, KBUILD_PATH, ''
+ call EnvSet 0, KBUILD_BIN_PATH, ''
+ call EnvSet 0, KBUILD_HOST, ''
+ call EnvSet 0, KBUILD_HOST_ARCH, ''
+ call EnvSet 0, KBUILD_HOST_CPU, ''
+ call EnvSet 0, KBUILD_TARGET, ''
+ call EnvSet 0, KBUILD_TARGET_ARCH, ''
+ call EnvSet 0, KBUILD_TARGET_CPU, ''
+
+ call EnvSet 0, PATH_KBUILD, ''
+ call EnvSet 0, PATH_KBUILD_BIN, ''
+ call EnvSet 0, BUILD_PLATFORM, ''
+ call EnvSet 0, BUILD_PLATFORM_ARCH, ''
+ call EnvSet 0, BUILD_PLATFORM_CPU, ''
+ call EnvSet 0, BUILD_TARGET, ''
+ call EnvSet 0, BUILD_TARGET_ARCH, ''
+ call EnvSet 0, BUILD_TARGET_CPU, ''
+ end
+
+ /* Export the variables. */
+ call EnvSet 0, "PATH", sNewPath
+ call EnvSet 0, "BEGINLIBPATH", sNewBeginLibPath
+ if (fOptOverrideType <> 0) then call EnvSet 0, "KBUILD_TYPE", skBuildType
+ if (fOptFull <> 0) then do
+ call EnvSet 0, KBUILD_PATH, skBuildPath
+ call EnvSet 0, KBUILD_HOST, skBuildHost
+ call EnvSet 0, KBUILD_HOST_ARCH, skBuildHostArch
+ call EnvSet 0, KBUILD_HOST_CPU, skBuildHostCpu
+ call EnvSet 0, KBUILD_TARGET, skBuildTarget
+ call EnvSet 0, KBUILD_TARGET_ARCH, skBuildTargetArch
+ call EnvSet 0, KBUILD_TARGET_CPU, skBuildTargetCpu
+
+ if (fOptLegacy <> 0) then do
+ call EnvSet 0, PATH_KBUILD, skBuildPath
+ call EnvSet 0, BUILD_PLATFORM, skBuildHost
+ call EnvSet 0, BUILD_PLATFORM_ARCH, skBuildHostArch
+ call EnvSet 0, BUILD_PLATFORM_CPU, skBuildHostCpu
+ call EnvSet 0, BUILD_TARGET, skBuildTarget
+ call EnvSet 0, BUILD_TARGET_ARCH, skBuildTargetArch
+ call EnvSet 0, BUILD_TARGET_CPU, skBuildTargetCpu
+ end
+ end
+
+ /*
+ * Execute left over arguments.
+ */
+ if (strip(sCommand) <> '') then do
+ if (fOptQuiet <> 0) then say "info: Executing command: "|| sCommand
+ address CMD sCommand
+ iRc = rc;
+ if (fOptQuiet <> 0 & iRc <> 0) then say "info: rc="||iRc||": "|| sCommand
+ end
+end
+if (fOptDbg <> 0) then say "dbg: finished (rc="||rc||")"
+exit (iRc);
+
+
+/*******************************************************************************
+* Procedure Section *
+*******************************************************************************/
+
+/**
+ * Give the script syntax
+ */
+syntax: procedure
+ say 'syntax: envos2.cmd [command to be executed and its arguments]'
+ say ''
+return 0;
+
+
+/**
+ * No value handler
+ */
+NoValueHandler:
+ say 'NoValueHandler: line 'SIGL;
+exit(16);
+
+
+
+/**
+ * Add sToAdd in front of sEnvVar.
+ * Note: sToAdd now is allowed to be alist!
+ *
+ * Known features: Don't remove sToAdd from original value if sToAdd
+ * is at the end and don't end with a ';'.
+ */
+EnvAddFront: procedure
+ parse arg fRM, sEnvVar, sToAdd, sSeparator
+
+ /* sets default separator if not specified. */
+ if (sSeparator = '') then sSeparator = ';';
+
+ /* checks that sToAdd ends with an ';'. Adds one if not. */
+ if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
+ sToAdd = sToAdd || sSeparator;
+
+ /* check and evt. remove ';' at start of sToAdd */
+ if (substr(sToAdd, 1, 1) = ';') then
+ sToAdd = substr(sToAdd, 2);
+
+ /* loop thru sToAdd */
+ rc = 0;
+ i = length(sToAdd);
+ do while i > 1 & rc = 0
+ j = lastpos(sSeparator, sToAdd, i-1);
+ rc = EnvAddFront2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
+ i = j;
+ end
+
+return rc;
+
+/**
+ * Add sToAdd in front of sEnvVar.
+ *
+ * Known features: Don't remove sToAdd from original value if sToAdd
+ * is at the end and don't end with a ';'.
+ */
+EnvAddFront2: procedure
+ parse arg fRM, sEnvVar, sToAdd, sSeparator
+
+ /* sets default separator if not specified. */
+ if (sSeparator = '') then sSeparator = ';';
+
+ /* checks that sToAdd ends with a separator. Adds one if not. */
+ if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
+ sToAdd = sToAdd || sSeparator;
+
+ /* check and evt. remove the separator at start of sToAdd */
+ if (substr(sToAdd, 1, 1) = sSeparator) then
+ sToAdd = substr(sToAdd, 2);
+
+ /* Get original variable value */
+ sOrgEnvVar = EnvGet(sEnvVar);
+
+ /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
+ i = pos(translate(sToAdd), translate(sOrgEnvVar));
+ if (i > 0) then
+ sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
+
+ /* set environment */
+ if (fRM) then
+ return EnvSet(0, sEnvVar, sOrgEnvVar);
+return EnvSet(0, sEnvVar, sToAdd||sOrgEnvVar);
+
+
+/**
+ * Add sToAdd as the end of sEnvVar.
+ * Note: sToAdd now is allowed to be alist!
+ *
+ * Known features: Don't remove sToAdd from original value if sToAdd
+ * is at the end and don't end with a ';'.
+ */
+EnvAddEnd: procedure
+ parse arg fRM, sEnvVar, sToAdd, sSeparator
+
+ /* sets default separator if not specified. */
+ if (sSeparator = '') then sSeparator = ';';
+
+ /* checks that sToAdd ends with a separator. Adds one if not. */
+ if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
+ sToAdd = sToAdd || sSeparator;
+
+ /* check and evt. remove ';' at start of sToAdd */
+ if (substr(sToAdd, 1, 1) = sSeparator) then
+ sToAdd = substr(sToAdd, 2);
+
+ /* loop thru sToAdd */
+ rc = 0;
+ i = length(sToAdd);
+ do while i > 1 & rc = 0
+ j = lastpos(sSeparator, sToAdd, i-1);
+ rc = EnvAddEnd2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
+ i = j;
+ end
+
+return rc;
+
+
+/**
+ * Add sToAdd as the end of sEnvVar.
+ *
+ * Known features: Don't remove sToAdd from original value if sToAdd
+ * is at the end and don't end with a ';'.
+ */
+EnvAddEnd2: procedure
+ parse arg fRM, sEnvVar, sToAdd, sSeparator
+
+ /* sets default separator if not specified. */
+ if (sSeparator = '') then sSeparator = ';';
+
+ /* checks that sToAdd ends with a separator. Adds one if not. */
+ if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
+ sToAdd = sToAdd || sSeparator;
+
+ /* check and evt. remove separator at start of sToAdd */
+ if (substr(sToAdd, 1, 1) = sSeparator) then
+ sToAdd = substr(sToAdd, 2);
+
+ /* Get original variable value */
+ sOrgEnvVar = EnvGet(sEnvVar);
+
+ if (sOrgEnvVar <> '') then
+ do
+ /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
+ i = pos(translate(sToAdd), translate(sOrgEnvVar));
+ if (i > 0) then
+ sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
+
+ /* checks that sOrgEnvVar ends with a separator. Adds one if not. */
+ if (sOrgEnvVar = '') then
+ if (right(sOrgEnvVar,1) <> sSeparator) then
+ sOrgEnvVar = sOrgEnvVar || sSeparator;
+ end
+
+ /* set environment */
+ if (fRM) then return EnvSet(0, sEnvVar, sOrgEnvVar);
+return EnvSet(0, sEnvVar, sOrgEnvVar||sToAdd);
+
+
+/**
+ * Sets sEnvVar to sValue.
+ */
+EnvSet: procedure
+ parse arg fRM, sEnvVar, sValue
+
+ /* if we're to remove this, make valuestring empty! */
+ if (fRM) then
+ sValue = '';
+ sEnvVar = translate(sEnvVar);
+
+ /*
+ * Begin/EndLibpath fix:
+ * We'll have to set internal these using both commandline 'SET'
+ * and internal VALUE in order to export it and to be able to
+ * get it (with EnvGet) again.
+ */
+ if ((sEnvVar = 'BEGINLIBPATH') | (sEnvVar = 'ENDLIBPATH')) then
+ do
+ if (length(sValue) >= 1024) then
+ say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
+ return SysSetExtLibPath(sValue, substr(sEnvVar, 1, 1));
+ end
+
+ if (length(sValue) >= 1024) then
+ do
+ say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
+ say ' This may make CMD.EXE unstable after a SET operation to print the environment.';
+ end
+ sRc = VALUE(sEnvVar, sValue, 'OS2ENVIRONMENT');
+return 0;
+
+
+/**
+ * Gets the value of sEnvVar.
+ */
+EnvGet: procedure
+ parse arg sEnvVar
+ if ((translate(sEnvVar) = 'BEGINLIBPATH') | (translate(sEnvVar) = 'ENDLIBPATH')) then
+ return SysQueryExtLibPath(substr(sEnvVar, 1, 1));
+return value(sEnvVar,, 'OS2ENVIRONMENT');
+
+
+/**
+ * Checks if a file exists.
+ * @param sFile Name of the file to look for.
+ * @param sComplain Complaint text. Complain if non empty and not found.
+ * @returns TRUE if file exists.
+ * FALSE if file doesn't exists.
+ */
+FileExists: procedure
+ parse arg sFile, sComplain
+ rc = stream(sFile, 'c', 'query exist');
+ if ((rc = '') & (sComplain <> '')) then
+ say sComplain ''''sFile'''.';
+return rc <> '';
+
+
+/**
+ * Checks if a directory exists.
+ * @param sDir Name of the directory to look for.
+ * @param sComplain Complaint text. Complain if non empty and not found.
+ * @returns TRUE if file exists.
+ * FALSE if file doesn't exists.
+ */
+DirExists: procedure
+ parse arg sDir, sComplain
+ rc = SysFileTree(sDir, 'sDirs', 'DO');
+ if (rc = 0 & sDirs.0 = 1) then
+ return 1;
+ if (sComplain <> '') then
+ say sComplain ''''sDir'''.';
+return 0;
+
+
+/**
+ * Workaround for bug in CMD.EXE.
+ * It messes up when REXX have expanded the environment.
+ */
+FixCMDEnv: procedure
+/* do this anyway
+ /* check for 4OS2 first */
+ Address CMD 'set 4os2test_env=%@eval[2 + 2]';
+ if (value('4os2test_env',, 'OS2ENVIRONMENT') = '4') then
+ return 0;
+*/
+
+ /* force environment expansion by setting a lot of variables and freeing them.
+ * ~6600 (bytes) */
+ do i = 1 to 100
+ Address CMD '@set dummyenvvar'||i'=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ end
+ do i = 1 to 100
+ Address CMD '@set dummyenvvar'||i'=';
+ end
+return 0;
+
+
+/**
+ * Translate a string to lower case.
+ */
+ToLower: procedure
+ parse arg sString
+return translate(sString, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
+
+
+/**
+ * Gets the script directory.
+ */
+GetScriptDir: procedure
+ /*
+ * Assuming this script is in the root directory, we can determing
+ * the abs path to it by using the 'parse source' feature in rexx.
+ */
+ parse source . . sScript
+ sScriptDir = filespec('drive', sScript) || strip(filespec('path', sScript), 'T', '\');
+return ToLower(sScriptDir);
+
diff --git a/kBuild/envwin.cmd b/kBuild/envwin.cmd
new file mode 100644
index 0000000..b66b6b6
--- /dev/null
+++ b/kBuild/envwin.cmd
@@ -0,0 +1,725 @@
+@echo off
+REM $Id: envwin.cmd 3113 2017-10-29 17:16:03Z bird $
+REM REM @file
+REM Environment setup script.
+REM
+
+REM
+REM Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+REM
+REM This file is part of kBuild.
+REM
+REM kBuild is free software; you can redistribute it and/or modify
+REM it under the terms of the GNU General Public License as published by
+REM the Free Software Foundation; either version 2 of the License, or
+REM (at your option) any later version.
+REM
+REM kBuild is distributed in the hope that it will be useful,
+REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+REM GNU General Public License for more details.
+REM
+REM You should have received a copy of the GNU General Public License
+REM along with kBuild; if not, write to the Free Software
+REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+REM
+
+REM
+REM Globals
+REM
+set _KBUILD_CURDIR=%CD%
+for /f "tokens=*" %%d in ('cd') do set _KBUILD_CURDIR=%%d
+
+set _KBUILD_PATH=%KBUILD_PATH%
+set _KBUILD_BIN_PATH=%KBUILD_BIN_PATH%
+set _KBUILD_TYPE=%KBUILD_TYPE%
+set _KBUILD_TARGET=%KBUILD_TARGET%
+set _KBUILD_TARGET_ARCH=%KBUILD_TARGET_ARCH%
+set _KBUILD_TARGET_CPU=%KBUILD_TARGET_CPU%
+set _KBUILD_HOST=%KBUILD_HOST%
+set _KBUILD_HOST_ARCH=%KBUILD_HOST_ARCH%
+set _KBUILD_HOST_CPU=%KBUILD_HOST_CPU%
+
+set _KBUILD_OVERRIDE_TYPE=0
+set _KBUILD_OVERRIDE_TARGET=0
+set _KBUILD_OVERRIDE_TARGET_ARCH=0
+
+REM
+REM Parse the arguments.
+REM
+REM Note: The 0 argument must be saved as it is also shifted.
+REM
+set _KBUILD_SELF=%0
+set _KBUILD_OPT_FULL=0
+set _KBUILD_OPT_LEGACY=0
+set _KBUILD_OPT_VAR=
+set _KBUILD_OPT_VALUE_ONLY=0
+set _KBUILD_SHOW_VAR_PREFIX=
+set _KBUILD_OPT_DBG=1
+set _KBUILD_OPT_OVERRIDE_ALL=0
+
+:argument_loop
+if ".%1" == ".-h" goto do_help
+if ".%1" == "./h" goto do_help
+if ".%1" == "./H" goto do_help
+if ".%1" == ".-h" goto do_help
+if ".%1" == ".-help" goto do_help
+if ".%1" == ".--help" goto do_help
+
+if ".%1" == ".--win" goto want_win
+if ".%1" == ".-win" goto want_win
+if ".%1" == ".--win32" goto want_win32_bit
+if ".%1" == ".-win32" goto want_win32_bit
+if ".%1" == ".-win64" goto want_win64_bit
+if ".%1" == ".--win64" goto want_win64_bit
+if ".%1" == ".--nt" goto want_nt
+if ".%1" == ".-nt" goto want_nt
+if ".%1" == ".--nt32" goto want_nt32_bit
+if ".%1" == ".-nt32" goto want_nt32_bit
+if ".%1" == ".--nt64" goto want_nt64_bit
+if ".%1" == ".-nt64" goto want_nt64_bit
+
+if ".%1" == ".--release" goto want_release
+if ".%1" == ".--profile" goto want_profile
+if ".%1" == ".--debug" goto want_debug
+
+if ".%1" == ".--full" goto opt_full
+if ".%1" == ".--normal" goto opt_normal
+if ".%1" == ".--legacy" goto opt_legacy
+if ".%1" == ".--no-legacy" goto opt_no_legacy
+if ".%1" == ".--debug-script" goto opt_debug_script
+if ".%1" == ".--no-debug-script" goto opt_no_debug_script
+if ".%1" == ".--var" goto opt_var
+if ".%1" == ".--value-only" goto opt_value_only
+if ".%1" == ".--name-and-value" goto opt_name_and_value
+if ".%1" == ".--set" goto opt_set
+if ".%1" == ".--no-set" goto opt_no_set
+
+goto done_arguments
+
+:want_win
+shift
+set _KBUILD_TARGET=win
+set _KBUILD_OVERRIDE_TARGET=1
+goto argument_loop
+
+:want_win32_bit
+shift
+set _KBUILD_TARGET=win
+set _KBUILD_TARGET_ARCH=x86
+set _KBUILD_OVERRIDE_TARGET=1
+set _KBUILD_OVERRIDE_TARGET_ARCH=1
+goto argument_loop
+
+:want_win64_bit
+shift
+set _KBUILD_TARGET=win
+set _KBUILD_TARGET_ARCH=amd64
+set _KBUILD_OVERRIDE_TARGET=1
+set _KBUILD_OVERRIDE_TARGET_ARCH=1
+goto argument_loop
+
+:want_nt
+shift
+set _KBUILD_TARGET=nt
+set _KBUILD_OVERRIDE_TARGET=1
+goto argument_loop
+
+:want_nt32_bit
+shift
+set _KBUILD_TARGET=nt
+set _KBUILD_TARGET_ARCH=x86
+set _KBUILD_OVERRIDE_TARGET=1
+set _KBUILD_OVERRIDE_TARGET_ARCH=1
+goto argument_loop
+
+:want_nt64_bit
+shift
+set _KBUILD_TARGET=nt
+set _KBUILD_TARGET_ARCH=amd64
+set _KBUILD_OVERRIDE_TARGET=1
+set _KBUILD_OVERRIDE_TARGET_ARCH=1
+goto argument_loop
+
+:want_release
+shift
+set _KBUILD_TYPE=release
+set _KBUILD_OVERRIDE_TYPE=1
+goto argument_loop
+
+:want_profile
+shift
+set _KBUILD_TYPE=profile
+set _KBUILD_OVERRIDE_TYPE=1
+goto argument_loop
+
+:want_debug
+shift
+set _KBUILD_TYPE=debug
+set _KBUILD_OVERRIDE_TYPE=1
+goto argument_loop
+
+:opt_full
+shift
+set _KBUILD_OPT_FULL=1
+goto argument_loop
+
+:opt_normal
+shift
+set _KBUILD_OPT_FULL=0
+goto argument_loop
+
+:opt_legacy
+shift
+set _KBUILD_OPT_LEGACY=1
+goto argument_loop
+
+:opt_no_legacy
+shift
+set _KBUILD_OPT_LEGACY=0
+goto argument_loop
+
+:opt_debug_script
+shift
+set _KBUILD_OPT_DBG=1
+goto argument_loop
+
+:opt_no_debug_script
+shift
+set _KBUILD_OPT_DBG=0
+goto argument_loop
+
+:opt_var
+shift
+if ".%1" == "." echo syntax error: --var is missing it's variable name.
+if ".%1" == "." goto failure
+set _KBUILD_OPT_VAR=%_KBUILD_OPT_VAR% %1
+shift
+goto argument_loop
+
+:opt_value_only
+shift
+set _KBUILD_OPT_VALUE_ONLY=1
+goto argument_loop
+
+:opt_name_and_value
+shift
+set _KBUILD_OPT_VALUE_ONLY=0
+goto argument_loop
+
+:opt_set
+shift
+set _KBUILD_SHOW_VAR_PREFIX=SET %_KBUILD_NON_EXISTING_VAR%
+goto argument_loop
+
+:opt_no_set
+shift
+set _KBUILD_SHOW_VAR_PREFIX=
+goto argument_loop
+
+
+REM #
+REM # Syntax
+REM #
+:do_help
+echo kBuild environment setup script for Windows NT.
+echo Syntax: envwin.cmd [options] [command to be executed]
+echo or: envwin.cmd [options] --var varname
+echo .
+echo Options:
+echo --win
+echo Force windows target and host platform.
+echo --win32
+echo Force x86 32-bit windows target platform.
+echo --win64
+echo Force AMD64 64-bit windows target platform.
+echo --nt
+echo Force NT target and host platform.
+echo --nt32
+echo Force x86 32-bit NT target platform.
+echo --nt64
+echo Force AMD64 64-bit NT target platform.
+echo --debug, --release, --profile
+echo Alternative way of specifying KBUILD_TYPE.
+echo --full, --normal
+echo Controls the variable set. Default: --normal
+echo --legacy, --no-legacy
+echo Include legacy variables in result. Default: --legacy
+echo --value-only, --name-and-value
+echo Controls what the result of a --var query. Default: --name-and-value
+echo --set, --no-set
+echo Whether to prefix the variable output with 'SET' or not.
+echo Default: --no-set
+
+goto end
+
+:done_arguments
+
+REM
+REM Convert legacy variable names.
+REM
+if ".%_KBUILD_OPT_OVERRIDE_ALL%" == ".1" goto legacy_convertion_done
+
+set _KBUILD_VARS=KBUILD_HOST (%_KBUILD_HOST%) and BUILD_PLATFORM (%BUILD_PLATFORM%)
+if not ".%BUILD_PLATFORM%" == "." if not ".%_KBUILD_HOST%" == "." if ".%_KBUILD_HOST%" == ".%BUILD_PLATFORM%" goto legacy_mismatch
+if not ".%BUILD_PLATFORM%" == "." set _KBUILD_HOST=%BUILD_PLATFORM%
+
+set _KBUILD_VARS=KBUILD_HOST_ARCH (%_KBUILD_HOST_ARCH%) and BUILD_PLATFORM_ARCH (%BUILD_PLATFORM_ARCH%)
+if not ".%BUILD_PLATFORM_ARCH%" == "." if not ".%_KBUILD_HOST_ARCH%" == "." if ".%_KBUILD_HOST_ARCH%" == ".%BUILD_PLATFORM_ARCH%" goto legacy_mismatch
+if not ".%BUILD_PLATFORM_ARCH%" == "." set _KBUILD_HOST_ARCH=%BUILD_PLATFORM_ARCH%
+
+set _KBUILD_VARS=KBUILD_HOST_CPU (%_KBUILD_HOST_CPU%) and BUILD_PLATFORM_CPU (%BUILD_PLATFORM_CPU%)
+if not ".%BUILD_PLATFORM_CPU%" == "." if not ".%_KBUILD_HOST_CPU%" == "." if ".%_KBUILD_HOST_CPU%" == ".%BUILD_PLATFORM_CPU%" goto legacy_mismatch
+if not ".%BUILD_PLATFORM_CPU%" == "." set _KBUILD_HOST_CPU=%BUILD_PLATFORM_CPU%
+
+if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_target
+set _KBUILD_VARS=KBUILD_TARGET (%_KBUILD_TARGET%) and BUILD_TARGET (%BUILD_TARGET%)
+if not ".%BUILD_TARGET%" == "." if not ".%_KBUILD_TARGET%" == "." if ".%_KBUILD_TARGET%" == ".%BUILD_TARGET%" goto legacy_mismatch
+if not ".%BUILD_TARGET%" == "." set _KBUILD_TARGET=%BUILD_TARGET%
+:legacy_skip_target
+
+if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_target_arch
+set _KBUILD_VARS=KBUILD_TARGET_ARCH (%_KBUILD_TARGET_ARCH%) and BUILD_TARGET_ARCH (%BUILD_TARGET_ARCH%)
+if not ".%BUILD_TARGET_ARCH%" == "." if not ".%_KBUILD_TARGET_ARCH%" == "." if ".%_KBUILD_TARGET_ARCH%" == ".%BUILD_TARGET_ARCH%" goto legacy_mismatch
+if not ".%BUILD_TARGET_ARCH%" == "." set _KBUILD_TARGET_ARCH=%BUILD_TARGET_ARCH%
+:legacy_skip_target_arch
+
+if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_target_cpu
+set _KBUILD_VARS=KBUILD_TARGET_CPU (%_KBUILD_TARGET_CPU%) and BUILD_TARGET_CPU (%BUILD_TARGET_CPU%)
+if not ".%BUILD_TARGET_CPU%" == "." if not ".%_KBUILD_TARGET_CPU%" == "." if ".%_KBUILD_TARGET_CPU%" == ".%BUILD_TARGET_CPU%" goto legacy_mismatch
+if not ".%BUILD_TARGET_CPU%" == "." set _KBUILD_TARGET_CPU=%BUILD_TARGET_CPU%
+:legacy_skip_target_cpu
+
+if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_type
+set _KBUILD_VARS=KBUILD_TYPE (%_KBUILD_TYPE%) and BUILD_TYPE (%BUILD_TYPE%)
+if not ".%BUILD_TYPE%" == "." if not ".%_KBUILD_TYPE%" == "." if ".%_KBUILD_TYPE%" == ".%BUILD_TYPE%" goto legacy_mismatch
+if not ".%BUILD_TYPE%" == "." set _KBUILD_TYPE=%BUILD_TYPE%
+:legacy_skip_type
+
+set _KBUILD_VARS=KBUILD_PATH (%_KBUILD_PATH%) and PATH_KBUILD (%PATH_KBUILD%)
+if not ".%PATH_KBUILD%" == "." if not ".%_KBUILD_PATH%" == "." if ".%_KBUILD_PATH%" == ".%PATH_KBUILD%" goto legacy_mismatch
+if not ".%PATH_KBUILD%" == "." set _KBUILD_PATH=%PATH_KBUILD%
+goto legacy_convertion_done
+
+:legacy_mismatch
+echo error: %_KBUILD_VARS% disagree.
+goto failed
+
+:legacy_convertion_done
+
+
+REM
+REM Check for illegal target/platforms.
+REM
+:target_and_platform
+if "%_KBUILD_TARGET" == "win32" goto illegal_target
+if "%_KBUILD_TARGET" == "win64" goto illegal_target
+if "%_KBUILD_HOST" == "win32" goto illegal_host
+if "%_KBUILD_HOST" == "win64" goto illegal_host
+goto target_and_platform_ok
+
+:illegal_target
+echo error: KBUILD_TARGET=%KBUILD_TARGET% is no longer valid.
+echo Only 'win' and 'nt' are permitted for targeting microsoft windows.
+goto failed
+
+:illegal_host
+echo error: KBUILD_HOST=%KBUILD_HOST is no longer valid.
+echo Only 'win' and 'nt' are permitted for building on microsoft windows.
+goto failed
+
+:target_and_platform_ok
+
+REM
+REM Find kBuild.
+REM
+REM We'll try determin the location of this script first and use that
+REM as a starting point for guessing the kBuild directory.
+REM
+
+REM Check if set via KBUILD_PATH.
+if not ".%_KBUILD_PATH%" == "." if exist %_KBUILD_PATH%\footer.kmk goto found_kbuild
+
+REM Determin a correct self - by %0
+if exist "%_KBUILD_SELF%" goto found_self
+set _KBUILD_SELF=%_KBUILD_SELF%.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+
+REM Determin a correct self - by the PATH
+REM This is very verbose because nested for loops didn't work out.
+for /f "tokens=1 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=2 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=3 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=4 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=5 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=6 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=7 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=8 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=9 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=10 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=11 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=12 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=13 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=14 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=15 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=16 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=17 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=18 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=19 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+for /f "tokens=20 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
+if exist "%_KBUILD_SELF%" goto found_self
+goto try_by_pwd
+
+:found_self
+cd "%_KBUILD_SELF%\.."
+for /f "tokens=*" %%d in ('cd') do set _KBUILD_PATH=%%d
+cd "%_KBUILD_CURDIR%"
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+
+REM Try relative to the current directory.
+:try_by_pwd
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+set _KBUILD_PATH=%_KBUILD_CURDIR%
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+set _KBUILD_PATH=%_KBUILD_CURDIR%\kBuild
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+set _KBUILD_PATH=%_KBUILD_CURDIR%\..\kBuild
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+set _KBUILD_PATH=%_KBUILD_CURDIR%\..\..\kBuild
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+set _KBUILD_PATH=%_KBUILD_CURDIR%\..\..\..\kBuild
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+set _KBUILD_PATH=%_KBUILD_CURDIR%\..\..\..\..\kBuild
+if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
+echo kBuild: Can't find the kBuild directory!
+set CURDIR=
+goto failed
+
+:found_kbuild
+cd "%_KBUILD_PATH%"
+for /f "tokens=*" %%d in ('cd') do set _KBUILD_PATH=%%d
+cd "%_KBUILD_CURDIR%"
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_PATH=%_KBUILD_PATH%
+
+
+REM
+REM Type - release is the default.
+REM
+if not ".%_KBUILD_TYPE%" == "." goto have_type
+set _KBUILD_TYPE=release
+:have_type
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TYPE=%_KBUILD_TYPE%
+
+
+REM
+REM Host platform - windows
+REM
+if not ".%_KBUILD_HOST%" == "." goto have_host
+set _KBUILD_HOST=win
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_HOST=%_KBUILD_HOST%
+:have_host
+
+if not ".%_KBUILD_HOST_ARCH%" == "." goto have_host_arch
+REM try guess from _KBUILD_HOST_CPU
+if ".%KBUILD_HOST_CPU%" == ".i386" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".i486" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".i586" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".i686" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".i786" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".i886" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".i986" set _KBUILD_HOST_ARCH=x86
+if ".%KBUILD_HOST_CPU%" == ".k8" set _KBUILD_HOST_ARCH=amd64
+if ".%KBUILD_HOST_CPU%" == ".k9" set _KBUILD_HOST_ARCH=amd64
+if ".%KBUILD_HOST_CPU%" == ".k10" set _KBUILD_HOST_ARCH=amd64
+if not ".%_KBUILD_HOST_ARCH%" == "." goto have_host_arch
+REM try guess from PROCESSOR_ARCHITEW6432 and PROCESSOR_ARCHITECTURE
+set _KBUILD_TMP=%PROCESSOR_ARCHITECTURE%
+if not ".%PROCESSOR_ARCHITEW6432%" == "." set _KBUILD_TMP=%PROCESSOR_ARCHITEW6432%
+if "%_KBUILD_TMP%" == "x86" set _KBUILD_HOST_ARCH=x86
+if "%_KBUILD_TMP%" == "X86" set _KBUILD_HOST_ARCH=x86
+if "%_KBUILD_TMP%" == "amd64" set _KBUILD_HOST_ARCH=amd64
+if "%_KBUILD_TMP%" == "Amd64" set _KBUILD_HOST_ARCH=amd64
+if "%_KBUILD_TMP%" == "AMD64" set _KBUILD_HOST_ARCH=amd64
+if "%_KBUILD_TMP%" == "x64" set _KBUILD_HOST_ARCH=amd64
+if "%_KBUILD_TMP%" == "X64" set _KBUILD_HOST_ARCH=amd64
+if not ".%_KBUILD_HOST_ARCH%" == "." goto have_host_arch
+echo error: Cannot figure KBUILD_HOST_ARCH!
+goto failed
+:have_host_arch
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_HOST_ARCH=%_KBUILD_HOST_ARCH%
+
+if not ".%_KBUILD_HOST_CPU%" == "." goto have_host_cpu
+set _KBUILD_HOST_CPU=blend
+:have_host_cpu
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_HOST_CPU=%_KBUILD_HOST_CPU%
+
+REM
+REM The target platform.
+REM Defaults to the host when not specified.
+REM
+if not ".%_KBUILD_TARGET%" == "." goto have_target
+set _KBUILD_TARGET=%_KBUILD_HOST%
+:have_target
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TARGET=%_KBUILD_TARGET%
+
+if not ".%_KBUILD_TARGET_ARCH%" == "." goto have_target_arch
+set _KBUILD_TARGET_ARCH=%_KBUILD_HOST_ARCH%
+:have_target_arch
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
+
+if not ".%_KBUILD_TARGET_CPU%" == "." goto have_target_cpu
+if ".%_KBUILD_TARGET_ARCH%" == ".%_KBUILD_HOST_ARCH%" set _KBUILD_TARGET_CPU=%_KBUILD_HOST_CPU%
+if not ".%_KBUILD_TARGET_CPU%" == "." goto have_target_cpu
+set _KBUILD_TARGET_CPU=%_KBUILD_HOST_CPU%
+:have_target_cpu
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
+
+REM
+REM Calc KBUILD_BIN_PATH and the new PATH value.
+REM
+if not ".%_KBUILD_BIN_PATH%" == "." goto have_kbuild_bin_path
+set _KBUILD_BIN_PATH=%_KBUILD_PATH%\bin\win.%_KBUILD_HOST_ARCH%
+:have_kbuild_bin_path
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_BIN_PATH=%_KBUILD_BIN_PATH%
+
+set _KBUILD_NEW_PATH=%_KBUILD_BIN_PATH%;%PATH%
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_NEW_PATH=%_KBUILD_NEW_PATH%
+
+REM
+REM Sanity check.
+REM
+if not exist "%_KBUILD_BIN_PATH%" goto missing_bin_path
+if not exist "%_KBUILD_BIN_PATH%" goto done_chekcing_for_tools
+set _KBUILD_TMP=kmk kDepPre kDepIDB kmk_append kmk_ash kmk_cat kmk_cp kmk_echo kmk_install kmk_ln kmk_mkdir kmk_mv kmk_rm kmk_rmdir kmk_sed
+for %%i in ( %_KBUILD_TMP% ) do if not exist "%_KBUILD_BIN_PATH%\%%i.exe" echo warning: The %%i program doesn't exist for this platform. (%_KBUILD_BIN_PATH%\%%i.exe)"
+goto done_chekcing_for_tools
+
+:missing_bin_path
+echo warning: The bin directory for this platform doesn't exist. (%_KBUILD_BIN_PATH%)
+:done_chekcing_for_tools
+
+REM
+REM The environment is in place, now take the requested action.
+REM
+if ".%_KBUILD_OPT_VAR%" == "." goto exec_or_setup_env
+goto show_variable
+
+REM
+REM Show a set of variables.
+REM
+REM Note: 4nt doesn't grok the setlocal delayed expansion option.
+REM So, we'll have to identify which shell we're running.
+REM
+:show_variable
+for %%i in ( %_KBUILD_OPT_VAR% ) do if "%%i" == "all" goto show_all_variables
+
+if not ".%_4VER%" == "." goto 4nt
+setlocal ENABLEDELAYEDEXPANSION
+if errorlevel 1 goto no_delay_expansion
+
+for %%i in ( %_KBUILD_OPT_VAR% ) do (
+ set _KBUILD_VAR=%%i
+ set _KBUILD_TMP=
+ if "%%i" == "KBUILD_PATH" set _KBUILD_TMP=%_KBUILD_PATH%
+ if "%%i" == "KBUILD_BIN_PATH" set _KBUILD_TMP=%_KBUILD_BIN_PATH%
+ if "%%i" == "KBUILD_TYPE" set _KBUILD_TMP=%_KBUILD_TYPE%
+ if "%%i" == "KBUILD_HOST" set _KBUILD_TMP=%_KBUILD_HOST%
+ if "%%i" == "KBUILD_HOST_ARCH" set _KBUILD_TMP=%_KBUILD_HOST_ARCH%
+ if "%%i" == "KBUILD_HOST_CPU" set _KBUILD_TMP=%_KBUILD_HOST_CPU%
+ if "%%i" == "KBUILD_TARGET" set _KBUILD_TMP=%_KBUILD_TARGET%
+ if "%%i" == "KBUILD_TARGET_ARCH" set _KBUILD_TMP=%_KBUILD_TARGET_ARCH%
+ if "%%i" == "KBUILD_TARGET_CPU" set _KBUILD_TMP=%_KBUILD_TARGET_CPU%
+ if ".!_KBUILD_TMP!" == "." goto varible_not_found
+ if not ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo %_KBUILD_SHOW_VAR_PREFIX%%%i=!_KBUILD_TMP!
+ if ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo !_KBUILD_TMP!
+)
+
+endlocal
+goto end
+
+:no_delay_expansion
+echo error: Unable to enable delayed expansion in the shell.
+
+:4nt
+for %%i in ( %_KBUILD_OPT_VAR% ) do (
+ set _KBUILD_VAR=%%i
+ set _KBUILD_TMP=
+ if "%%i" == "KBUILD_PATH" set _KBUILD_TMP=%_KBUILD_PATH%
+ if "%%i" == "KBUILD_BIN_PATH" set _KBUILD_TMP=%_KBUILD_BIN_PATH%
+ if "%%i" == "KBUILD_TYPE" set _KBUILD_TMP=%_KBUILD_TYPE%
+ if "%%i" == "KBUILD_HOST" set _KBUILD_TMP=%_KBUILD_HOST%
+ if "%%i" == "KBUILD_HOST_ARCH" set _KBUILD_TMP=%_KBUILD_HOST_ARCH%
+ if "%%i" == "KBUILD_HOST_CPU" set _KBUILD_TMP=%_KBUILD_HOST_CPU%
+ if "%%i" == "KBUILD_TARGET" set _KBUILD_TMP=%_KBUILD_TARGET%
+ if "%%i" == "KBUILD_TARGET_ARCH" set _KBUILD_TMP=%_KBUILD_TARGET_ARCH%
+ if "%%i" == "KBUILD_TARGET_CPU" set _KBUILD_TMP=%_KBUILD_TARGET_CPU%
+ if ".%_KBUILD_TMP%" == "." goto varible_not_found
+ if not ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo %_KBUILD_SHOW_VAR_PREFIX%%i=%_KBUILD_TMP%
+ if ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo %_KBUILD_TMP%
+)
+goto end
+
+:varible_not_found
+echo error: Unknown variable %_KBUILD_VAR% specified in --var request.
+goto failed
+
+:show_all_variables
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_PATH=%_KBUILD_PATH%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_BIN_PATH=%_KBUILD_BIN_PATH%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TYPE=%_KBUILD_TYPE%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_HOST=%_KBUILD_HOST%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_HOST_ARCH=%_KBUILD_HOST_ARCH%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_HOST_CPU=%_KBUILD_HOST_CPU%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TARGET=%_KBUILD_TARGET%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
+echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
+goto end
+
+REM
+REM Setup environment for the current shell or execute a command.
+REM
+REM Note: We use setlocal if we're going to execute a command as we
+REM don't want the environment of the invoking shell to be changed.
+REM
+:exec_or_setup_env
+if not ".%1" == "." setlocal
+
+REM The PATH is always set.
+set PATH=%_KBUILD_NEW_PATH%
+
+REM Clear up anything that should be overridden.
+if not "%_KBUILD_OPT_OVERRIDE_ALL%" == "1" goto skip_override_all
+set KBUILD_TYPE=
+set KBUILD_HOST=
+set KBUILD_HOST_ARCH=
+set KBUILD_HOST_CPU=
+set KBUILD_TARGET=
+set KBUILD_TARGET_ARCH=
+set KBUILD_TARGET_CPU=
+set KBUILD_PATH=
+set KBUILD_BIN_PATH=
+if not "%_KBUILD_OPT_LEGACY%" == "1" goto skip_override_all
+set BUILD_TYPE=
+set BUILD_PLATFORM=
+set BUILD_PLATFORM_ARCH=
+set BUILD_PLATFORM_CPU=
+set BUILD_TARGET=
+set BUILD_TARGET_ARCH=
+set BUILD_TARGET_CPU=
+set PATH_KBUILD=
+set PATH_KBUILD_BIN=
+:skip_override_all
+
+REM Specific overrides, these implicitly deletes the legacy variable.
+if "%_KBUILD_OVERRIDE_TARGET%" == "1" set KBUILD_TARGET=%_KBUILD_TARGET%
+if "%_KBUILD_OVERRIDE_TARGET%" == "1" set BUILD_TARGET=
+if "%_KBUILD_OVERRIDE_TARGET_ARCH%" == "1" set KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
+if "%_KBUILD_OVERRIDE_TARGET_ARCH%" == "1" set BUILD_TARGET_ARCH=
+if "%_KBUILD_OVERRIDE_TYPE%" == "1" set KBUILD_TYPE=%_KBUILD_TYPE%
+if "%_KBUILD_OVERRIDE_TYPE%" == "1" set BUILD_TYPE=
+
+if not "%_KBUILD_OPT_FULL%" == "1" goto env_setup_done
+set KBUILD_PATH=%_KBUILD_PATH%
+set KBUILD_BIN_PATH=%_KBUILD_BIN_PATH%
+set KBUILD_TYPE=%_KBUILD_TYPE%
+set KBUILD_HOST=%_KBUILD_HOST%
+set KBUILD_HOST_ARCH=%_KBUILD_HOST_ARCH%
+set KBUILD_HOST_CPU=%_KBUILD_HOST_CPU%
+set KBUILD_TARGET=%_KBUILD_TARGET%
+set KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
+set KBUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
+
+if not "%_KBUILD_OPT_LEGACY%" == "1" goto env_setup_done
+set PATH_KBUILD=%_KBUILD_PATH%
+set PATH_KBUILD_BIN=%_KBUILD_BIN_PATH%
+set BUILD_TYPE=%_KBUILD_TYPE%
+set BUILD_PLATFORM=%_KBUILD_HOST%
+set BUILD_PLATFORM_ARCH=%_KBUILD_HOST_ARCH%
+set BUILD_PLATFORM_CPU=%_KBUILD_HOST_CPU%
+set BUILD_TARGET=%_KBUILD_TARGET%
+set BUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
+set BUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
+
+:env_setup_done
+if ".%1" == "." goto end
+
+REM Execute the specified command
+if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: Executing: %1 %2 %3 %4 %5 %6 %7 %8 %9
+set _KBUILD_CLEAN_GOTO=exec_command & goto cleanup
+:exec_command
+SET _KBUILD_CLEAN_GOTO=
+%1 %2 %3 %4 %5 %6 %7 %8 %9
+endlocal
+goto end_no_exit
+
+
+
+REM
+REM All exit paths leads to 'end' or 'failed' depending on
+REM which exit code is desire. This is required as we're manually
+REM performing environment cleanup (setlocal/endlocal is crap).
+REM
+:cleanup
+set _KBUILD_CURDIR=
+set _KBUILD_PATH=
+set _KBUILD_BIN_PATH=
+set _KBUILD_NEW_PATH=
+set _KBUILD_TYPE=
+set _KBUILD_TARGET=
+set _KBUILD_TARGET_ARCH=
+set _KBUILD_TARGET_CPU=
+set _KBUILD_HOST=
+set _KBUILD_HOST_ARCH=
+set _KBUILD_HOST_CPU=
+set _KBUILD_OPT_OVERRIDE_ALL=
+set _KBUILD_OVERRIDE_TYPE=
+set _KBUILD_OVERRIDE_TARGET=
+set _KBUILD_OVERRIDE_TARGET_ARCH=
+
+set _KBUILD_SELF=
+set _KBUILD_OPT_FULL=
+set _KBUILD_OPT_LEGACY=
+set _KBUILD_OPT_VAR=
+set _KBUILD_OPT_VALUE_ONLY=
+set _KBUILD_SHOW_VAR_PREFIX=
+set _KBUILD_OPT_DBG=
+set _KBUILD_OPT_OVERRIDE_ALL=
+
+set _KBUILD_TMP=
+set _KBUILD_VAR=
+set _KBUILD_VARS=
+goto %_KBUILD_CLEAN_GOTO%
+
+:failed
+set _KBUILD_CLEAN_GOTO=failed_done & goto cleanup
+:failed_done
+set _KBUILD_CLEAN_GOTO=
+exit /b 1
+
+:end
+set _KBUILD_CLEAN_GOTO=end_done & goto cleanup
+:end_done
+set _KBUILD_CLEAN_GOTO=
+exit /b 0
+
+:end_no_exit
+
diff --git a/kBuild/footer-inherit-uses-tools.kmk b/kBuild/footer-inherit-uses-tools.kmk
new file mode 100644
index 0000000..85d2512
--- /dev/null
+++ b/kBuild/footer-inherit-uses-tools.kmk
@@ -0,0 +1,1059 @@
+# $Id: footer-inherit-uses-tools.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Template & Target Inheritance, Uses and Tools.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+## Converts a variable from simple to recursive flavor.
+# This is used by def_inherit_template_one_accumulate_l and def_inherit_template_one_accumulate_r.
+# @param $1 The variable name.
+define def_simple_2_recursive
+$1_DEFERRED := $$($1)
+$1 = $$($1_DEFERRED)
+endef
+
+
+## Inherit one keyword in a non-accumulative manner.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+define def_inherit_one_keyword
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) = $($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+
+# EXPAND_BY = overriding
+
+## Inherit one keyword in a non-accumulative manner.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+define def_inherit_one_keyword_overriding_now_l
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+## @copydoc def_inherit_one_overriding_now_l
+define def_inherit_one_keyword_overriding_now_r
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+## Inherit one keyword in a non-accumulative manner, deferred expansion.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+# @remark This define relies on double evaluation
+define def_inherit_one_keyword_overriding_deferred
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+## @copydoc def_inherit_one_overriding_deferred
+define def_inherit_one_keyword_overriding_deferred_l
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+## @copydoc def_inherit_one_overriding_deferred
+define def_inherit_one_keyword_overriding_deferred_r
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+
+# EXPAND_BY = prepending
+
+## Inherit one keyword in a prepending manner.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+define def_inherit_one_keyword_prepending_now_l
+ifdef $(trg)_$(prop).$(src_key)
+ $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key)) $($(trg)_$(prop).$(trg_key))
+endif
+endef
+
+## @copydoc def_inherit_one_prepending_now_l
+define def_inherit_one_keyword_prepending_now_r
+ifdef $(trg)_$(prop).$(src_key)
+ $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(trg_key)) $($(trg)_$(prop).$(src_key))
+endif
+endef
+
+## Inherit one keyword in a non-accumulative manner, deferred expansion.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+# @remark This define relies on double evaluation
+define def_inherit_one_keyword_prepending_deferred
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+## Inherit one keyword in a prepending manner, deferred expansion.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+define def_inherit_one_keyword_prepending_deferred_l
+ifdef $(trg)_$(prop).$(src_key)
+ ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
+ endif
+ $(trg)_$(prop).$(trg_key) <= $$($(trg)_$(prop).$(src_key))
+endif
+endef
+
+## @copydoc def_inherit_one_prepending_deferred_l
+define def_inherit_one_keyword_prepending_deferred_r
+ifdef $(trg)_$(prop).$(src_key)
+ ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
+ endif
+ $(trg)_$(prop).$(trg_key) += $$($(trg)_$(prop).$(src_key))
+endif
+endef
+
+
+# EXPAND_BY = appending
+
+## Inherit one keyword in an appending manner.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+define def_inherit_one_keyword_appending_now_l
+ifdef $(trg)_$(prop).$(src_key)
+ $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(trg_key)) $($(trg)_$(prop).$(src_key))
+endif
+endef
+
+## @copydoc def_inherit_one_appending_now_l
+define def_inherit_one_keyword_appending_now_r
+ifdef $(trg)_$(prop).$(src_key)
+ $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key)) $($(trg)_$(prop).$(trg_key))
+endif
+endef
+
+## Inherit one keyword in a non-accumulative manner, deferred expansion.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+# @remark This define relies on double evaluation
+define def_inherit_one_keyword_appending_deferred
+ifdef $(trg)_$(prop).$(src_key)
+ ifndef $(trg)_$(prop).$(trg_key)
+ $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
+ endif
+endif
+endef
+
+## Inherit one keyword in an appending manner, deferred expansion.
+# @param $(trg) Target object.
+# @param $(prop) The property.
+# @param $(src_key) Source keyword.
+# @param $(trg_key) Target keyword.
+define def_inherit_one_keyword_appending_deferred_l
+ifdef $(trg)_$(prop).$(src_key)
+ ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
+ endif
+ $(trg)_$(prop).$(trg_key) += $$($(trg)_$(prop).$(src_key))
+endif
+endef
+
+## @copydoc def_inherit_one_appending_deferred_l
+define def_inherit_one_keyword_appending_deferred_r
+ifdef $(trg)_$(prop).$(src_key)
+ ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
+ endif
+ $(trg)_$(prop).$(trg_key) <= $$($(trg)_$(prop).$(src_key))
+endif
+endef
+
+
+## Worker for def_inherit that deals with one keyword that makes
+# use of inheritance.
+# @param prefix_keyword key_prefix:keyword. The cool join/split game as usual.
+# @param trg Object to consider for inheriting.
+# @param properties List of the properties with straight expansion.
+# @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
+# @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
+# @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
+# @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
+# @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
+define def_inherit_keyword
+local prefix := $(word 1,$(subst :, ,$(prefix_keyword)))
+local trg_key := $(word 2,$(subst :, ,$(prefix_keyword)))
+local src_key := $($(prefix)_$(trg_key)_EXTENDS)
+local by := $($(prefix)_$(trg_key)_EXTENDS_BY)
+
+# Inherit the properties.
+$(foreach prop, $(properties), $(eval $(def_inherit_one_keyword)))
+$(foreach prop, $(properties_now_l), $(eval $(def_inherit_one_keyword_$(by)_now_l)))
+$(foreach prop, $(properties_now_r), $(eval $(def_inherit_one_keyword_$(by)_now_r)))
+$(foreach prop, $(properties_deferred), $(eval $(def_inherit_one_keyword_$(by)_deferred)))
+$(foreach prop, $(properties_deferred_l), $(eval $(def_inherit_one_keyword_$(by)_deferred_l)))
+$(foreach prop, $(properties_deferred_r), $(eval $(def_inherit_one_keyword_$(by)_deferred_r)))
+
+endef # def_inherit_keyword
+
+
+## Inherit one template property in a non-accumulative manner.
+# @param $(prop) Property name
+# @param $(src) Source (parent) object.
+# @param $(trg) Target (child) object.
+define def_inherit_one
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) = $($(src)_$(prop))
+ endif
+endif
+endef
+
+
+# EXPAND_BY = overriding
+
+## Inherit one template property in a non-accumulative manner.
+# @param $(prop) Property name
+# @param $(src) Source (parent) object.
+# @param $(trg) Target (child) object.
+define def_inherit_one_overriding_now_l
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) := $($(src)_$(prop))
+ endif
+endif
+endef
+
+## @copydoc def_inherit_one_overriding_now_l
+define def_inherit_one_overriding_now_r
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) := $($(src)_$(prop))
+ endif
+endif
+endef
+
+## Inherit one template property in a non-accumulative manner, deferred expansion.
+# @param $(prop) Property name
+# @param $(src) Source
+# @param $(trg) Target
+# @remark This define relies on double evaluation
+define def_inherit_one_overriding_deferred
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) = $$($(src)_$(prop))
+ endif
+endif
+endef
+
+## @copydoc def_inherit_one_overriding_deferred
+define def_inherit_one_overriding_deferred_l
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) = $$($(src)_$(prop))
+ endif
+endif
+endef
+
+## @copydoc def_inherit_one_overriding_deferred
+define def_inherit_one_overriding_deferred_r
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) = $$($(src)_$(prop))
+ endif
+endif
+endef
+
+
+# EXPAND_BY = prepending
+
+## Inherit one template property in a prepending manner.
+# @param $(prop) Property name
+# @param $(src) Source (parent) object.
+# @param $(trg) Target (child) object.
+define def_inherit_one_prepending_now_l
+ifdef $(src)_$(prop)
+ $(trg)_$(prop) := $($(src)_$(prop)) $($(trg)_$(prop))
+endif
+endef
+
+## @copydoc def_inherit_one_prepending_now_l
+define def_inherit_one_prepending_now_r
+ifdef $(src)_$(prop)
+ $(trg)_$(prop) := $($(trg)_$(prop)) $($(src)_$(prop))
+endif
+endef
+
+## Inherit one template property in a non-accumulative manner, deferred expansion.
+# @param $(prop) Property name
+# @param $(src) Source
+# @param $(trg) Target
+# @remark This define relies on double evaluation
+define def_inherit_one_prepending_deferred
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) = $$($(src)_$(prop))
+ endif
+endif
+endef
+
+## Inherit one template property in a prepending manner, deferred expansion.
+# @param $(prop) Property name
+# @param $(src) Source (parent) object.
+# @param $(trg) Target (child) object.
+define def_inherit_one_prepending_deferred_l
+ifdef $(src)_$(prop)
+ ifeq ($$(flavor $(trg)_$(prop)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
+ endif
+ $(trg)_$(prop) <= $$($(src)_$(prop))
+endif
+endef
+
+## @copydoc def_inherit_one_prepending_deferred_l
+define def_inherit_one_prepending_deferred_r
+ifdef $(src)_$(prop)
+ ifeq ($$(flavor $(trg)_$(prop)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
+ endif
+ $(trg)_$(prop) += $$($(src)_$(prop))
+endif
+endef
+
+
+# EXPAND_BY = appending
+
+## Inherit one template property in an appending manner.
+# @param $(prop) Property name
+# @param $(src) Source (parent) object.
+# @param $(trg) Target (child) object.
+define def_inherit_one_appending_now_l
+ifdef $(src)_$(prop)
+ $(trg)_$(prop) := $($(trg)_$(prop)) $($(src)_$(prop))
+endif
+endef
+
+## @copydoc def_inherit_one_appending_now_l
+define def_inherit_one_appending_now_r
+ifdef $(src)_$(prop)
+ $(trg)_$(prop) := $($(src)_$(prop)) $($(trg)_$(prop))
+endif
+endef
+
+## Inherit one template property in a non-accumulative manner, deferred expansion.
+# @param $(prop) Property name
+# @param $(src) Source
+# @param $(trg) Target
+# @remark This define relies on double evaluation
+define def_inherit_one_appending_deferred
+ifdef $(src)_$(prop)
+ ifndef $(trg)_$(prop)
+ $(trg)_$(prop) = $$($(src)_$(prop))
+ endif
+endif
+endef
+
+## Inherit one template property in an appending manner, deferred expansion.
+# @param $(prop) Property name
+# @param $(src) Source (parent) object.
+# @param $(trg) Target (child) object.
+define def_inherit_one_appending_deferred_l
+ifdef $(src)_$(prop)
+ ifeq ($$(flavor $(trg)_$(prop)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
+ endif
+ $(trg)_$(prop) += $$($(src)_$(prop))
+endif
+endef
+
+## @copydoc def_inherit_one_appending_deferred_l
+define def_inherit_one_appending_deferred_r
+ifdef $(src)_$(prop)
+ ifeq ($$(flavor $(trg)_$(prop)),simple)
+ $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
+ endif
+ $(trg)_$(prop) <= $$($(src)_$(prop))
+endif
+endef
+
+
+## combines the specified properties $(1) with the $(_KEYWORDS) list.
+_INHERIT_JOIN_KEYWORDS = $(1) $(foreach keyword,$(_KEYWORDS), $(addsuffix .$(keyword), $(1)))
+
+
+## Generic inheritance for use with targets templates and tools.
+# @param trg Object to consider for inheriting.
+# @param src_prefix What to prefix the value found in EXTENDS with to get the object.
+# @param load_function Load function for stuff that needs
+# @param properties List of the properties with straight expansion.
+# @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
+# @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
+# @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
+# @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
+# @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
+define def_inherit
+
+# Load it - loading is a mess, fix.
+ifneq ($(load_function),)
+ local loading := $(patsubst $(src_prefix)%,%,$(trg))
+ $(evalvalctx $(load_function))
+endif
+
+local src := $(strip $($(trg)_EXTENDS))
+ifneq ($(src),)
+ ifndef $(trg)_EXTENDS_STATUS_
+ $(trg)_EXTENDS_STATUS_ := 0
+
+ # Load the source.
+ ifneq ($(load_function),)
+ local loading := $(src)
+ $(evalvalctx $(load_function))
+ endif
+
+ # less typing.
+ local src := $(src_prefix)$(src)
+
+ # Recursivly process the parent (src) if it's inherting from somebody too.
+ ifdef $(src)_EXTENDS
+ ifneq ($($(src)_EXTENDS_STATUS_),42)
+ # 'foreach' will create 'trg' in a new variable context hiding
+ # out current variable. 'src' OTOH will be overwritten.
+ $(foreach trg, $(src), $(evalval def_inherit))
+ local src := $(src_prefix)$(strip $($(trg)_EXTENDS))
+ endif
+ endif
+
+ # Get & check EXTENDS_BY.
+ local by = $(strip $($(trg)_EXTENDS_BY))
+ ifeq ($(by),)
+ local by = overriding
+ else ifn1of ($(by), overriding appending prepending)
+ $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(trg)'!)
+ endif
+
+ # Inherit the properties.
+ $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties)), $(eval $(def_inherit_one)))
+ $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_now_l)), $(eval $(def_inherit_one_$(by)_now_l)))
+ $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_now_r)), $(eval $(def_inherit_one_$(by)_now_r)))
+ $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_deferred)), $(eval $(def_inherit_one_$(by)_deferred)))
+ $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_deferred_l)), $(eval $(def_inherit_one_$(by)_deferred_l)))
+ $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_deferred_r)), $(eval $(def_inherit_one_$(by)_deferred_r)))
+
+ # Mark the target as done.
+ $(trg)_EXTENDS_STATUS_ := 42
+ else
+ # Check for inheritance loops.
+ ifneq ($($(trg)_EXTENDS_STATUS_),42)
+ $(error kBuild: Target inheritance loop! target=$(trg) $(trg)_EXTENDS_STATUS_=$($(trg)_EXTENDS_STATUS_))
+ endif
+ endif
+endif
+
+# Keyword inheritance.
+$(foreach prefix_keyword, $(join $(_KEYWORDS_PREFIX), $(addprefix :,$(_KEYWORDS_EXTENDS))), $(evalval def_inherit_keyword))
+
+endef # def_inherit
+
+
+#
+# Load global units before doing any inheriting so they can add new properties.
+#
+# This only applies to the guys listed in the global USES since there is
+# no reliable way to deal with things on a target level without first
+# applying templates. So, to avoid having USES mess up all targets,
+# we'll make the global and per-target USES property work differently:
+# The global USES does not apply to targets, just globally.
+#
+
+## Unit load function.
+# @param loading The unit name
+define def_unit_load_function
+ifndef UNIT_$(loading)
+ UNIT_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ ifeq ($(UNIT_$(loading)_KMK_FILE),)
+ $(error kBuild: Cannot find include file for the unit '$(loading)'! Searched: $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS))
+ endif
+ include $(UNIT_$(loading)_KMK_FILE)
+ ifndef UNIT_$(loading)
+ $(warning kBuild: UNIT_$(loading) was not defined by $(UNIT_$(loading)_KMK_FILE)!)
+ endif
+endif
+endef # def_unit_load_function
+
+$(foreach loading, \
+ $(USES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(USES.$(KBUILD_TARGET_CPU)) \
+ $(USES.$(KBUILD_TARGET_ARCH)) \
+ $(USES.$(KBUILD_TARGET)) \
+ $(USES.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
+ $(USES.$(KBUILD_HOST_CPU)) \
+ $(USES.$(KBUILD_HOST_ARCH)) \
+ $(USES.$(KBUILD_TARGET)) \
+ $(USES.$(KBUILD_TYPE)) \
+ $(USES),$(evalval def_unit_load_function))
+
+
+#
+# Determin all the templates that is being used and make
+# sure they are present before we try collect keywords.
+#
+_TEMPLATES := $(TEMPLATE)
+define def_templates
+ifdef $(target)_TEMPLATE
+ ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
+ $$(error kBuild: The template name of target '$(target)' contains tabs ($($(target)_TEMPLATE))). Please remove them)
+ endif
+ _TEMPLATES += $($(target)_TEMPLATE)
+endif
+endef # def_templates
+$(foreach target, $(_ALL_TARGETS), $(eval $(def_templates)))
+_TEMPLATES := $(sort $(_TEMPLATES))
+
+## Template load function.
+# @param loading The template name. This is prefixed.
+define def_templates_load_function
+ifndef TEMPLATE_$(loading)
+ TEMPLATE_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TEMPLATE_PATHS) $(KBUILD_PATH)/templates $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ ifeq ($(TEMPLATE_$(loading)_KMK_FILE),)
+ $(error kBuild: Cannot find include file for the template '$(loading)'! Searched: $(KBUILD_TEMPLATE_PATHS) $(KBUILD_PATH)/templates $(KBUILD_DEFAULT_PATHS))
+ endif
+ include $(TEMPLATE_$(loading)_KMK_FILE)
+ ifndef TEMPLATE_$(loading)
+ $(warning kBuild: TEMPLATE_$(loading) was not defined by $(TEMPLATE_$(loading)_KMK_FILE)!)
+ endif
+endif
+endef # def_templates_load_function
+$(foreach loading, $(_TEMPLATES), $(evalval def_templates_load_function))
+
+
+#
+# Determin the keywords required for correct inherting and setup keyword inheritance.
+#
+# This means walking all the lists of immediate template and targets and
+# pick up all the BLD_T* keywords. Since templates that are referenced
+# indirectly in the inheritance hierarchy, the result from this exercise
+# might not be 100% accurate... :-/
+#
+_BLD_TYPES := $(KBUILD_TYPE)
+_BLD_TARGETS := $(KBUILD_TARGET) $(KBUILD_HOSTS)
+_BLD_ARCHES := $(KBUILD_TARGET_ARCH) $(KBUILD_HOST_ARCH)
+_BLD_CPUS := $(KBUILD_TARGET_CPU) $(KBUILD_HOST_CPU)
+
+define def_collect_bld_xyz
+ifdef $(src)_BLD_TYPE
+ ifn1of ($($(src)_BLD_TYPE), $(KBUILD_BLD_TYPES))
+ $(error kBuild: $(src)_BLD_TYPE=$($(src)_BLD_TYPE) not in KBUILD_BLD_TYPES={$(KBUILD_BLD_TYPES)}!)
+ endif
+ _BLD_TYPES += $($(src)_BLD_TYPE)
+endif
+ifdef $(src)_BLD_TRG
+ ifn1of ($($(src)_BLD_TRG), $(KBUILD_OSES))
+ $(error kBuild: $(src)_BLD_TRG=$($(src)_BLD_TRG) not in KBUILD_OSES={$(KBUILD_OSES)}!)
+ endif
+ _BLD_TARGETS += $($(src)_BLD_TRG)
+endif
+ifdef $(src)_BLD_TRG_ARCH
+ ifn1of ($($(src)_BLD_TRG_ARCH), $(KBUILD_ARCHES))
+ $(error kBuild: $(src)_BLD_TRG_ARCH=$($(src)_BLD_TRG_ARCH) not in KBUILD_ARCHES={$(KBUILD_ARCHES)}!)
+ endif
+ _BLD_ARCHES += $($(src)_BLD_TRG_ARCH)
+endif
+ifdef $(src)_BLD_TRG_CPU
+ if1of ($($(src)_BLD_CPU), $(KBUILD_ARCHES) $(KBUILD_OSES) $(KBUILD_BLD_TYPES))
+ $(error kBuild: $(src)_BLD_TRG_CPU=$($(src)_BLD_TRG_CPU) found in KBUILD_ARCHES, KBUILD_OSES or KBUILD_BLD_TYPES!)
+ endif
+ _BLD_CPUS += $($(src)_BLD_TRG_CPU)
+endif
+endef # def_collect_bld_xyz
+$(foreach src, $(addprefix TEMPLATE_, $(_TEMPLATES)) $(_ALL_TARGETS) \
+ ,$(evalval def_collect_bld_xyz))
+
+# Drop duplicate values.
+# WARNING! These list might not include keywords only involved in inheritance.
+_BLD_TYPES := $(sort $(_BLD_TYPES))
+_BLD_TARGETS := $(sort $(_BLD_TARGETS))
+_BLD_ARCHES := $(sort $(_BLD_ARCHES))
+_BLD_CPUS := $(sort $(_BLD_CPUS))
+
+## Look for keywords which extends others and order them.
+# @param keyword
+# @param prefix
+# @param valid
+define def_keyword_ordering
+# Check for EXTENDS, fix and validate it if found.
+local src := $(strip $($(prefix)_$(keyword)_EXTENDS))
+ifneq ($(src),)
+ ifndef $(prefix)_$(keyword)_EXTENDS_STATUS_
+ ifn1of ($(src), $(valid))
+ $(error kBuild: $(keyword) tries to extend unknown keyword '$(src)'! (known = $(valid)))
+ endif
+
+ # Recursivly process the parent (src).
+ ifneq ($($(prefix)_$(src)_EXTENDS_STATUS_),42)
+ $(prefix)_$(keyword)_EXTENDS_STATUS_ := 0
+ # 'foreach' will create 'keyword' in a new variable context hiding
+ # out current variable. 'src' OTOH will be overwritten.
+ $(foreach keyword, $(src), $(evalval def_keyword_ordering))
+ local src := $(strip $($(prefix)_$(keyword)_EXTENDS))
+ endif
+
+ # Check and strip EXTENDS_BY.
+ local by = $(strip $($(prefix)_$(keyword)_EXTENDS_BY))
+ ifeq ($(by),)
+ local by = overriding
+ else ifn1of ($(by), overriding appending prepending)
+ $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(keyword)'!)
+ endif
+
+ # Update the attributes with stripped
+ $(prefix)_$(keyword)_EXTENDS_BY := $(by)
+ $(prefix)_$(keyword)_EXTENDS := $(src)
+
+ # Add it to the list and mark it as done.
+ _KEYWORDS_EXTENDS += $(keyword)
+ _KEYWORDS_PREFIX += $(prefix)
+ $(prefix)_$(keyword)_EXTENDS_STATUS_ := 42
+ else
+ # Check for inheritance loops.
+ ifneq ($($(trg)_EXTENDS_STATUS_),42)
+ $(error kBuild: Keyword inheritance loop! keyword=$(keyword) $(prefix)_$(keyword)_EXTENDS_STATUS_=$($(prefix)_$(keyword)_EXTENDS_STATUS_))
+ endif
+ endif
+else
+ # Add it to the ordered list and mark it as done.
+ _KEYWORDS_ORDERED += $(keyword)
+ $(prefix)_$(src)_EXTENDS_STATUS_ := 42
+endif
+endef # def_keyword_ordering
+$(eval-opt-var def_keyword_ordering)
+
+# Look for keywords which extends others and their parents, and from this
+# construct two lists.
+_KEYWORDS_ORDERED :=
+_KEYWORDS_EXTENDS :=
+_KEYWORDS_PREFIX :=
+
+prefix := BLD_TYPE
+valid := $(KBUILD_BLD_TYPES)
+$(foreach keyword, $(_BLD_TYPES) , $(evalval def_keyword_ordering))
+
+prefix := BLD_TRG
+valid := $(KBUILD_OSES)
+$(foreach keyword, $(_BLD_TARGETS), $(evalval def_keyword_ordering))
+
+prefix := BLD_ARCH
+valid := $(KBUILD_ARCHES)
+$(foreach keyword, $(_BLD_ARCHES) , $(evalval def_keyword_ordering))
+
+prefix := BLD_CPU
+valid := $(KBUILD_CPUS)
+$(foreach keyword, $(_BLD_CPUS) , $(evalval def_keyword_ordering))
+
+## @todo Inherit bld_trg.bld_arch for too?
+
+# Construct all the possible keywords.
+_KEYWORDS := $(_KEYWORDS_ORDERED) $(_KEYWORDS_EXTENDS) \
+ $(foreach bld_trg,$(_BLD_TARGETS),$(addprefix $(bld_trg).,$(_BLD_ARCHES)))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done keywords)
+endif
+
+
+#
+# Target inheritance.
+#
+# This has to be done on a per target list basis as to avoid adding
+# incorrect properties that will wast memory, time, and may confuse
+# later strictness checks. This also has to be done *before* templates
+# are applied to the targets. Since we're doing that part rather
+# early on, the target inheritance feature is a bit restricted at
+# the moment. However, this will be addressed in a little(?) while.
+#
+
+src_prefix :=
+load_function :=
+properties_deferred_l :=
+properties_deferred_r :=
+
+# Fetches.
+properties := $(PROPS_FETCHES_SINGLE)
+properties_now_l := $(PROPS_FETCHES_ACCUMULATE_L)
+properties_now_r := $(PROPS_FETCHES_ACCUMULATE_R)
+properties_deferred := $(PROPS_FETCHES_DEFERRED)
+$(foreach trg, $(_ALL_FETCHES),$(evalval def_inherit))
+
+## Patches. - not implemented yet.
+#properties := $(PROPS_PATCHES_SINGLE)
+#properties_now_l := $(PROPS_PATCHES_ACCUMULATE_L)
+#properties_now_r := $(PROPS_PATCHES_ACCUMULATE_R)
+#properties_deferred := $(PROPS_PATCHES_DEFERRED)
+#$(foreach trg, $(_ALL_PATCHES),$(evalval def_inherit))
+
+# Programs and build programs.
+properties := $(PROPS_PROGRAMS_SINGLE)
+properties_now_l := $(PROPS_PROGRAMS_ACCUMULATE_L)
+properties_now_r := $(PROPS_PROGRAMS_ACCUMULATE_R)
+properties_deferred := $(PROPS_PROGRAMS_DEFERRED)
+$(foreach trg, $(_ALL_BLDPROGS) $(_ALL_PROGRAMS),$(evalval def_inherit))
+
+# Libraries and import libraries.
+properties := $(PROPS_LIBRARIES_SINGLE)
+properties_now_l := $(PROPS_LIBRARIES_ACCUMULATE_L)
+properties_now_r := $(PROPS_LIBRARIES_ACCUMULATE_R)
+properties_deferred := $(PROPS_LIBRARIES_DEFERRED)
+if1of ($(KBUILD_TARGET), nt os2 win)
+ $(foreach trg, $(_ALL_LIBRARIES) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
+else
+ $(foreach trg, $(_ALL_LIBRARIES),$(evalval def_inherit))
+endif
+
+# DLLs.
+properties := $(PROPS_DLLS_SINGLE)
+properties_now_l := $(PROPS_DLLS_ACCUMULATE_L)
+properties_now_r := $(PROPS_DLLS_ACCUMULATE_R)
+properties_deferred := $(PROPS_DLLS_DEFERRED)
+if1of ($(KBUILD_TARGET), nt os2 win)
+ $(foreach trg, $(_ALL_DLLS),$(evalval def_inherit))
+else
+ $(foreach trg, $(_ALL_DLLS) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
+endif
+
+# System modules.
+properties := $(PROPS_SYSMODS_SINGLE)
+properties_now_l := $(PROPS_SYSMODS_ACCUMULATE_L)
+properties_now_r := $(PROPS_SYSMODS_ACCUMULATE_R)
+properties_deferred := $(PROPS_SYSMODS_DEFERRED)
+$(foreach trg, $(_ALL_SYSMODS),$(evalval def_inherit))
+
+# Misc binaries.
+properties := $(PROPS_MISCBINS_SINGLE)
+properties_now_l := $(PROPS_MISCBINS_ACCUMULATE_L)
+properties_now_r := $(PROPS_MISCBINS_ACCUMULATE_R)
+properties_deferred := $(PROPS_MISCBINS_DEFERRED)
+$(foreach trg, $(_ALL_MISCBINS),$(evalval def_inherit))
+
+# Installs.
+properties := $(PROPS_INSTALLS_SINGLE)
+properties_now_l := $(PROPS_INSTALLS_ACCUMULATE_L)
+properties_now_r := $(PROPS_INSTALLS_ACCUMULATE_R)
+properties_deferred := $(PROPS_INSTALLS_DEFERRED)
+$(foreach trg, $(_ALL_INSTALLS),$(evalval def_inherit))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done target inheritance)
+endif
+
+
+#
+# Template Inheritance.
+#
+# This is much the same as with target inheritance, except we cannot
+# restrict the properties involved since we haven't got a clue which
+# target platforms/archs are using them. But, we can drop the instance
+# expansion we're doing for targets since there won't be any more
+# changes to either the source nor the target templates beyond this
+# exercise.
+#
+
+src_prefix := TEMPLATE_
+load_function := def_templates_load_function
+properties :=
+properties_now_l :=
+properties_now_r :=
+properties_deferred := $(PROPS_SINGLE) $(PROPS_DEFERRED)
+properties_deferred_l := $(PROPS_ACCUMULATE_L)
+properties_deferred_r := $(PROPS_ACCUMULATE_R)
+$(foreach trg, $(addprefix TEMPLATE_,$(_TEMPLATES)),$(evalval def_inherit))
+
+# done inheriting.
+src_prefix :=
+load_function :=
+properties :=
+properties_now_l :=
+properties_now_r :=
+properties_deferred :=
+properties_deferred_l :=
+properties_deferred_r :=
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done template inheritance)
+endif
+
+
+
+
+#
+# Template/Target Expansion.
+#
+# Extend all targets with the values from the template. Doing this up front
+# allows more generic code and less mess down in the pass 2 target handling.
+# However it does eat a good deal of memory.
+#
+
+define def_inherit_template_workaround_target
+local _tmpl := $(firstword $($(target)_TEMPLATE) $(TEMPLATE))
+local _bld_type := $(firstword $($(target)_BLD_TYPE) $(TEMPLATE_$(_tmpl)_BLD_TYPE) $(KBUILD_TYPE))
+local _bld_trg := $(firstword $($(target)_BLD_TRG) $(TEMPLATE_$(_tmpl)_BLD_TRG) $(KBUILD_TARGET))
+local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(TEMPLATE_$(_tmpl)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(TEMPLATE_$(_tmpl)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
+$(kb-exp-tmpl 1,$(target),$(_bld_trg),$(_bld_trg_arch),$(_bld_trg_cpu),$(_bld_type))
+endef # def_inherit_template_workaround_target
+#$(kb-exp-tmpl 1,$(_ALL_TARGET_TARGETS),$(KBUILD_TARGET),$(KBUILD_TARGET_ARCH),$(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
+$(foreach target,$(_ALL_TARGET_TARGETS),$(evalval def_inherit_template_workaround_target))
+
+define def_inherit_template_workaround_host
+local _tmpl := $(firstword $($(target)_TEMPLATE) $(TEMPLATE))
+local _bld_type := $(firstword $($(target)_BLD_TYPE) $(TEMPLATE_$(_tmpl)_BLD_TYPE) $(KBUILD_TYPE))
+local _bld_trg := $(firstword $($(target)_BLD_TRG) $(TEMPLATE_$(_tmpl)_BLD_TRG) $(KBUILD_HOST))
+local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(TEMPLATE_$(_tmpl)_BLD_TRG_ARCH) $(KBUILD_HOST_ARCH))
+local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(TEMPLATE_$(_tmpl)_BLD_TRG_CPU) $(KBUILD_HOST_CPU))
+$(kb-exp-tmpl 1,$(target),$(_bld_trg),$(_bld_trg_arch),$(_bld_trg_cpu),$(_bld_type))
+endef # def_inherit_template_workaround_target
+#$(kb-exp-tmpl 1,$(_ALL_HOST_TARGETS),$(KBUILD_HOST),$(KBUILD_HOST_ARCH),$(KBUILD_HOST_CPU),$(KBUILD_TYPE))
+$(foreach target,$(_ALL_HOST_TARGETS),$(evalval def_inherit_template_workaround_host))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done template/target expansion)
+endif
+
+
+#
+# Include tools, sdks and units.
+#
+# The first part of this exercise is to figure out which TOOLS and SDKS
+# that should be included.
+#
+_TOOLS := $(TOOL.$(KBUILD_TARGET)) $(TOOL.$(KBUILD_TARGET_ARCH)) $(TOOL.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(TOOL.$(KBUILD_HOST)) $(TOOL.$(KBUILD_HOST_ARCH)) $(TOOL.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
+ $(TOOL)
+_SDKS := $(SDKS.$(KBUILD_TARGET)) $(SDKS.$(KBUILD_TARGET_ARCH)) $(SDKS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(SDKS.$(KBUILD_HOST)) $(SDKS.$(KBUILD_HOST_ARCH)) $(SDKS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
+ $(SDKS.$(KBUILD_TYPE)) \
+ $(SDKS)
+_USES := $(USES.$(KBUILD_TARGET)) $(USES.$(KBUILD_TARGET_ARCH)) $(USES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(USES.$(KBUILD_HOST)) $(USES.$(KBUILD_HOST_ARCH)) $(USES.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
+ $(USES.$(KBUILD_TYPE)) \
+ $(USES)
+define def_tools_sdks_target_source
+$(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
+ $($(source)_$(prop).$(_bld_trg)) \
+ $($(target)_$(source)_$(prop).$(_bld_trg)) \
+ $($(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_$(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
+ $($(source)_$(prop).$(_bld_trg_arch)) \
+ $($(target)_$(source)_$(prop).$(_bld_trg_arch)) \
+ $($(source)_$(prop)) \
+ $($(target)_$(source)_$(prop))))
+$(eval _SDKS += \
+ $($(source)_SDKS.$(_bld_trg)) \
+ $($(target)_$(source)_SDKS.$(_bld_trg)) \
+ $($(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_$(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(source)_SDKS.$(_bld_trg_arch)) \
+ $($(target)_$(source)_SDKS.$(_bld_trg_arch)) \
+ $($(source)_SDKS.$(KBUILD_TYPE)) \
+ $($(target)_$(source)_SDKS.$(KBUILD_TYPE)) \
+ $($(source)_SDKS) \
+ $($(target)_$(source)_SDKS))
+$(eval _USES += \
+ $($(source)_USES.$(_bld_trg)) \
+ $($(target)_$(source)_USES.$(_bld_trg)) \
+ $($(source)_USES.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_$(source)_USES.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(source)_USES.$(_bld_trg_arch)) \
+ $($(target)_$(source)_USES.$(_bld_trg_arch)) \
+ $($(source)_USES.$(KBUILD_TYPE)) \
+ $($(target)_$(source)_USES.$(KBUILD_TYPE)) \
+ $($(source)_USES) \
+ $($(target)_$(source)_USES))
+endef # def_tools_sdks_target_source
+$(eval-opt-var def_tools_sdks_target_source)
+
+define def_tools_sdks_target
+local _bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
+local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
+local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
+
+$(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
+ $($(target)_$(prop).$(_bld_trg)) \
+ $($(target)_$(prop).$(_bld_trg_arch)) \
+ $($(target)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_$(prop))))
+$(eval _SDKS += \
+ $($(target)_SDKS.$(_bld_trg)) \
+ $($(target)_SDKS.$(_bld_trg_arch)) \
+ $($(target)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_SDKS))
+$(eval _USES += \
+ $($(target)_USES.$(_bld_trg)) \
+ $($(target)_USES.$(_bld_trg_arch)) \
+ $($(target)_USES.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_USES))
+$(foreach source, \
+ $($(target)_SOURCES.$(_bld_trg)) \
+ $($(target)_SOURCES.$(_bld_trg_arch)) \
+ $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_SOURCES.$(_bld_trg_cpu)) \
+ $($(target)_SOURCES.$(_bld_type)) \
+ $($(target)_SOURCES) \
+ , $(evalval def_tools_sdks_target_source))
+endef # def_tools_sdks_target
+$(eval-opt-var def_tools_sdks_target)
+
+define def_tools_srcname_target
+local _bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
+local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
+local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
+
+$(foreach source, $(notdir\
+ $($(target)_SOURCES.$(_bld_trg)) \
+ $($(target)_SOURCES.$(_bld_trg_arch)) \
+ $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
+ $($(target)_SOURCES.$(_bld_trg_cpu)) \
+ $($(target)_SOURCES.$(_bld_type)) \
+ $($(target)_SOURCES) \
+ ), $(evalval def_tools_sdks_target_source))
+endef # def_tools_srcname_target
+$(eval-opt-var def_tools_srcname_target)
+
+bld_trg := $(KBUILD_TARGET)
+bld_trg_arch := $(KBUILD_TARGET_ARCH)
+bld_trg_cpu := $(KBUILD_TARGET_CPU)
+$(foreach target, $(_ALL_TARGET_TARGETS), $(evalval def_tools_sdks_target))
+$(foreach target, $(_ALL_SRCNAME_TARGETS), $(evalval def_tools_srcname_target))
+
+bld_trg := $(KBUILD_HOST)
+bld_trg_arch := $(KBUILD_HOST_ARCH)
+bld_trg_cpu := $(KBUILD_HOST_CPU)
+$(foreach target, $(_ALL_HOST_TARGETS), $(evalval def_tools_sdks_target))
+
+_TOOLS := $(sort $(_TOOLS))
+_SDKS := $(sort $(_SDKS))
+
+## Tool load function.
+# @param loading The tool name
+define def_tools_load_function
+ifndef TOOL_$(loading)
+ TOOL_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TOOL_PATHS) $(KBUILD_PATH)/tools $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ ifeq ($(TOOL_$(loading)_KMK_FILE),)
+ $(error kBuild: Cannot find include file for the tool '$(loading)'! Searched: $(KBUILD_TOOL_PATHS) $(KBUILD_PATH)/tools $(KBUILD_DEFAULT_PATHS))
+ endif
+ include $(TOOL_$(loading)_KMK_FILE)
+ ifndef TOOL_$(loading)
+ $(warning kBuild: TOOL_$(loading) was not defined by $(TOOL_$(loading)_KMK_FILE)!)
+ endif
+endif
+endef # def_tools_include
+
+## SDK load function.
+# @param loading The tool name
+define def_sdk_load_function
+ifndef SDK_$(loading)
+ SDK_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_SDK_PATHS) $(KBUILD_PATH)/sdks $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ ifeq ($(SDK_$(loading)_KMK_FILE),)
+ $(error kBuild: Cannot find include file for the SDK '$(loading)'! Searched: $(KBUILD_SDK_PATHS) $(KBUILD_PATH)/sdks $(KBUILD_DEFAULT_PATHS))
+ endif
+ include $(SDK_$(loading)_KMK_FILE)
+ ifndef SDK_$(loading)
+ $(warning kBuild: SDK_$(loading) was not defined by $(SDK_$(loading)_KMK_FILE)!)
+ endif
+endif
+endef # def_sdk_load_function
+
+
+properties :=
+properties_now_l :=
+properties_now_r :=
+properties_deferred := $(PROPS_SINGLE) $(PROPS_DEFERRED)
+properties_deferred_l := $(PROPS_ACCUMULATE_L)
+properties_deferred_r := $(PROPS_ACCUMULATE_R)
+
+src_prefix := SDK_
+load_function := def_sdk_load_function
+$(foreach trg, $(addprefix SDK_,$(_SDKS)), $(evalval def_inherit))
+
+properties_deferred := $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_TOOLS_ONLY)
+src_prefix := TOOL_
+load_function := def_tools_load_function
+$(foreach trg, $(addprefix TOOL_,$(_TOOLS)), $(evalval def_inherit))
+
+# done inheriting.
+src_prefix :=
+load_function :=
+properties :=
+properties_now_l :=
+properties_now_r :=
+properties_deferred :=
+properties_deferred_l :=
+properties_deferred_r :=
+
+# No inheriting for the uses, they're just global 'code'.
+$(foreach loading, $(_USES), $(evalval def_unit_load_function))
+
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done tools + sdks + units)
+endif
+
diff --git a/kBuild/footer-misc.kmk b/kBuild/footer-misc.kmk
new file mode 100644
index 0000000..11c7510
--- /dev/null
+++ b/kBuild/footer-misc.kmk
@@ -0,0 +1,134 @@
+# $Id: footer-misc.kmk 3307 2020-01-15 02:26:07Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Misc.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+#
+# OTHERS
+#
+_OTHERS = $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
+
+
+
+#
+# TESTING
+#
+_TESTING += $(TESTING) \
+ $(TESTING.$(KBUILD_TARGET)) \
+ $(TESTING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(TESTING.$(KBUILD_TARGET_ARCH)) \
+ $(TESTING.$(KBUILD_TARGET_CPU))
+
+
+#
+# PACKING
+#
+_PACKING += $(PACKING) \
+ $(PACKING.$(KBUILD_TARGET)) \
+ $(PACKING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(PACKING.$(KBUILD_TARGET_ARCH)) \
+ $(PACKING.$(KBUILD_TARGET_CPU))
+
+
+#
+# DOCS
+#
+
+
+#
+# DIRECTORIES
+#
+_DIR_ALL := $(sort \
+ $(addsuffix /,$(patsubst %/,%,$(_DIRS) )) \
+ $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES) $(_DEBUG_INSTALL_FILES) $(_STAGE_FILES) $(_DEBUG_STAGE_FILES) ) \
+ $(foreach path, $(KBUILD_INST_PATHS), $(PATH_INS)/$(INST_$(path)) $(PATH_STAGE)/$(STAGE_$(path)) ) \
+ $(dir $(patsubst %/,%, $(_INSTALLS_DIRS) $(_STAGE_DIRS) $(_DEBUG_INSTALL_DIRS) $(_DEBUG_STAGE_DIRS)) ) \
+ )
+$(foreach directory, \
+ $(_INSTALLS_DIRS) \
+ $(_STAGE_DIRS) \
+ $(_DEBUG_INSTALL_DIRS) \
+ $(_DEBUG_STAGE_DIRS) \
+ , $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))) )
+
+
+define def_mkdir_rule
+$(directory):
+ %$$(call MSG_MKDIR,$$@)
+ $$(QUIET)$$(MKDIR) -p -- $$@
+endef
+
+$(foreach directory,$(_DIR_ALL),$(eval $(def_mkdir_rule)))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done directories)
+endif
+
+
+#
+# NOTHING
+#
+do-nothing:
+ %$(call MSG_NOTHING)
+ifdef KBUILD_PROFILE_SELF
+ @$(ECHO) 'prof: $(call _KBUILD_FMT_ELAPSED_EX, $(nanots ), $(_KBUILD_TS_HEADER_START)) - $(call _KBUILD_FMT_ELAPSED_EX, $(nanots ), $(_KBUILD_TS_PREV)) - executing $@'
+ ifeq ($(KBUILD_PROFILE_SELF),2)
+ @$(ECHO) 'stat: $(make-stats )'
+ endif
+endif
+
+
+#
+# CLEAN UP
+#
+do-clean:
+ %$(call MSG_CLEAN)
+ $(QUIET)$(RM) -f -- \
+ $(_OUT_FILES) \
+ $(_OBJS) \
+ $(_DEPFILES) \
+ $(_DEPFILES_INCLUDED) \
+ $(_CLEAN_FILES) \
+ $(OTHER_CLEAN) \
+ $(_STAGE_FILES) \
+ $(_DEBUG_STAGE_FILES)
+ $(QUIET)$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- \
+ $(rsort $(dir $(_OUT_FILES) \
+ $(_OBJS) \
+ $(_DEPFILES) \
+ $(_DEPFILES_INCLUDED) \
+ $(_CLEAN_FILES) \
+ $(OTHER_CLEAN) \
+ $(_STAGE_FILES) \
+ $(_DEBUG_STAGE_FILES) )\
+ $(_STAGE_DIRS) )
+
diff --git a/kBuild/footer-pass1.kmk b/kBuild/footer-pass1.kmk
new file mode 100644
index 0000000..dc31329
--- /dev/null
+++ b/kBuild/footer-pass1.kmk
@@ -0,0 +1,463 @@
+# $Id: footer-pass1.kmk 3417 2020-08-21 10:59:17Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 1.
+#
+# This pass is for defining variables that might be referenced in
+# properties of other targets.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+# Don't do anything for fetch targets (yet).
+
+##
+# Link prolog for Pass 1.
+#
+# @param $(target) Normalized target name.
+# @param $(EXT) EXE,DLL,SYS,LIB.
+# @param $(EXTPRE) HOST or nothing.
+# @param $(definst) The default _INST value.
+# @param $(tool_prefix) LD or AR.
+# @param $(bld_trg_base_var) TARGET or HOST.
+define def_pass1_link_common
+
+local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_$(bld_trg_base_var)))
+local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_$(bld_trg_base_var)_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_$(bld_trg_base_var)_CPU))
+
+local tool := $(call _TARGET_TOOL,$(target),$(tool_prefix))
+local name := $(firstword\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg).$(bld_type))\
+ $($(target)_NAME.$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg))\
+ $($(target)_NAME.$(bld_type))\
+ $($(target)_NAME)\
+ $(target))
+local outbase := $(call TARGET_BASE,$(name),$(target))
+$(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
+$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+
+## @todo fix the fun at the last line (AR != LIB => mess).
+local suff := $(firstword \
+ $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_$(EXT)SUFF.$(bld_trg))\
+ $($(target)_$(EXT)SUFF)\
+ $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
+ $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg))\
+ $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF)\
+ $(if $(eq $(tool_prefix),AR),$(SUFF_LIB),$($(EXTPRE)SUFF_$(EXT))) )
+local out := $(outbase)$(suff)
+
+# Object directory target variable.
+$(target)_1_TARGET := $(out)
+$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
+
+# Staging and install directory target variables.
+local insttype := $(firstword \
+ $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_INSTTYPE.$(bld_trg).$(bld_type)) \
+ $($(target)_INSTTYPE.$(bld_trg_arch)) \
+ $($(target)_INSTTYPE.$(bld_trg_cpu)) \
+ $($(target)_INSTTYPE.$(bld_trg)) \
+ $($(target)_INSTTYPE.$(bld_type)) \
+ $($(target)_INSTTYPE) \
+ )
+ifeq ($(insttype),)
+ ifneq ($(firstword \
+ $($(target)_NOINST) \
+ $($(target)_NOINST.$(bld_trg)) \
+ $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_NOINST.$(bld_trg_arch)) \
+ $($(target)_NOINST.$(bld_trg_cpu)) \
+ $($(target)_NOINST.$(bld_type)) ),)
+ local insttype := none
+ else
+ local insttype := both
+ endif
+endif
+$(target)_1_INSTTYPE := $(insttype)
+
+local inst := $(strip $(firstdefined \
+ $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_INST.$(bld_trg).$(bld_trg_arch) \
+ $(target)_INST.$(bld_trg).$(bld_type) \
+ $(target)_INST.$(bld_trg_arch) \
+ $(target)_INST.$(bld_trg_cpu) \
+ $(target)_INST.$(bld_trg) \
+ $(target)_INST.$(bld_type) \
+ $(target)_INST \
+ definst \
+ ,value))
+local stage := $(strip $(firstdefined \
+ $(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
+ $(target)_STAGE.$(bld_trg).$(bld_type) \
+ $(target)_STAGE.$(bld_trg_arch) \
+ $(target)_STAGE.$(bld_trg_cpu) \
+ $(target)_STAGE.$(bld_trg) \
+ $(target)_STAGE.$(bld_type) \
+ $(target)_STAGE \
+ inst \
+ ,value))
+if1of ($(insttype), stage both)
+ $(target)_1_STAGE := $(stage)
+ if "$(substr $(stage),-1,1)" == "/" # Multicast support requires addprefix/suffix.
+ $(target)_1_STAGE_TARGET := $(addprefix $(PATH_STAGE)/,$(addsuffix $(notdir $(out)),$(stage)))
+ else if "$(stage)" == ""
+ $(target)_1_STAGE_TARGET := $(PATH_STAGE)/$(notdir $(out))
+ else
+ $(target)_1_STAGE_TARGET := $(addprefix $(PATH_STAGE)/,$(stage))
+ endif
+else if1of ($(insttype), none)
+ $(target)_1_STAGE :=
+ $(target)_1_STAGE_TARGET :=
+else
+ $(error kBuild: Unknown value '$(insttype)' for '$(target)_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
+endif
+INSTARGET_$(target) := $($(target)_1_STAGE_TARGET)
+
+if1of ($(insttype), both)
+ $(target)_1_INST := $(inst)
+ if "$(substr $(inst),-1,1)" == "/" # Multicast support requires addprefix/suffix.
+ $(target)_1_INST_TARGET := $(addprefix $(PATH_INS)/,$(addsuffix $(notdir $(out)),$(inst)))
+ else if "$(inst)" == ""
+ $(target)_1_INST_TARGET := $(PATH_INS)/$(notdir $(out))
+ else
+ $(target)_1_INST_TARGET := $(addprefix $(PATH_INS)/,$(inst))
+ endif
+else
+ $(target)_1_INST :=
+ $(target)_1_INST_TARGET :=
+endif
+
+# Debug info related stuff.
+local debug_insttype := $(firstword \
+ $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_type)) \
+ $($(target)_DEBUG_INSTTYPE.$(bld_trg_arch)) \
+ $($(target)_DEBUG_INSTTYPE.$(bld_trg_cpu)) \
+ $($(target)_DEBUG_INSTTYPE.$(bld_trg)) \
+ $($(target)_DEBUG_INSTTYPE.$(bld_type)) \
+ $($(target)_DEBUG_INSTTYPE) \
+ $(insttype) )
+$(target)_1_DEBUG_INSTTYPE := $(debug_insttype)
+
+if1of ($(debug_insttype), stage both)
+ local debug_stage := $(firstdefined \
+ $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch) \
+ $(target)_DEBUG_STAGE.$(bld_trg).$(bld_type) \
+ $(target)_DEBUG_STAGE.$(bld_trg_arch) \
+ $(target)_DEBUG_STAGE.$(bld_trg_cpu) \
+ $(target)_DEBUG_STAGE.$(bld_trg) \
+ $(target)_DEBUG_STAGE.$(bld_type) \
+ $(target)_DEBUG_STAGE \
+ $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \
+ $(target)_DEBUG_INST.$(bld_trg).$(bld_type) \
+ $(target)_DEBUG_INST.$(bld_trg_arch) \
+ $(target)_DEBUG_INST.$(bld_trg_cpu) \
+ $(target)_DEBUG_INST.$(bld_trg) \
+ $(target)_DEBUG_INST.$(bld_type) \
+ $(target)_DEBUG_INST)
+ ifneq ($(debug_stage),)
+ $(target)_1_DEBUG_STAGE := $($(debug_stage))
+ else
+ $(target)_1_DEBUG_STAGE := $(addprefix $(STAGE_DEBUG),$(stage))
+ endif
+ ifndef $(target)_1_DEBUG_STAGE
+ $(target)_1_DEBUG_STAGE := ./
+ endif
+else if1of ($(debug_insttype), none)
+ $(target)_1_DEBUG_STAGE :=
+else
+ $(error kBuild: Unknown value '$(debug_insttype)' for '$(target)_DEBUG_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
+endif
+
+if1of ($(debug_insttype), both)
+ local debug_inst := $(firstdefined \
+ $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \
+ $(target)_DEBUG_INST.$(bld_trg).$(bld_type) \
+ $(target)_DEBUG_INST.$(bld_trg_arch) \
+ $(target)_DEBUG_INST.$(bld_trg_cpu) \
+ $(target)_DEBUG_INST.$(bld_trg) \
+ $(target)_DEBUG_INST.$(bld_type) \
+ $(target)_DEBUG_INST)
+ ifneq ($(debug_inst),)
+ $(target)_1_DEBUG_INST := $($(debug_inst))
+ else
+ $(target)_1_DEBUG_INST := $(addprefix $(INST_DEBUG),$(inst))
+ endif
+ ifndef $(target)_1_DEBUG_INST
+ $(target)_1_DEBUG_INST := ./
+ endif
+else
+ $(target)_1_DEBUG_INST :=
+endif
+#$(warning $(NLTAB)$(target)_1_DEBUG_INST=$($(target)_1_DEBUG_INST)$(NLTAB)$(target)_1_DEBUG_STAGE=$($(target)_1_DEBUG_STAGE)$(NLTAB)insttype=$(insttype)$(NLTAB)debug_insttype=$(debug_insttype))
+
+endef # def_pass1_link_common
+$(eval-opt-var def_pass1_link_common)
+
+
+#
+# BLDPROGS (Pass 1)
+#
+define def_pass1_bldprog
+# set NOINST if not forced installation before doing the usual stuff.
+ifndef $(target)_INSTTYPE
+ ifndef $(target)_INST
+ ifndef $(target)_STAGE
+$(target)_INSTTYPE := none
+ endif
+ endif
+endif
+$(evalvalctx def_pass1_link_common)
+endef
+
+EXT := EXE
+EXTPRE := HOST
+definst := $(INST_BIN)
+tool_prefix := LD
+bld_trg_base_var := HOST
+$(foreach target, $(_ALL_BLDPROGS), \
+ $(evalvalctx def_pass1_bldprog))
+
+
+#
+# LIBRARIES (Pass 1)
+#
+EXT := LIB
+EXTPRE :=
+definst := $(INST_LIB)
+tool_prefix := AR
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_LIBRARIES), \
+ $(evalvalctx def_pass1_link_common))
+
+
+#
+# DLLS (Pass 1)
+#
+EXT := DLL
+EXTPRE :=
+definst := $(INST_DLL)
+tool_prefix := LD
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_DLLS), \
+ $(evalvalctx def_pass1_link_common))
+
+
+#
+# IMPORT LIBRARIES (Pass 1)
+#
+# - On OS/2 and windows these are libraries.
+# - On other platforms they are fake DLLs.
+#
+if1of ($(KBUILD_TARGET), nt os2 win win64 win32)
+ EXT := LIB
+ EXTPRE :=
+ definst := $(INST_LIB)
+ tool_prefix := AR
+ bld_trg_base_var := TARGET
+ $(foreach target, $(_ALL_IMPORT_LIBS), \
+ $(evalvalctx def_pass1_link_common))
+else
+ EXT := DLL
+ EXTPRE :=
+ definst := $(INST_DLL)
+ tool_prefix := LD
+ bld_trg_base_var := TARGET
+ $(foreach target, $(_ALL_IMPORT_LIBS), \
+ $(evalvalctx def_pass1_link_common))
+endif
+
+
+#
+# PROGRAMS (Pass 1)
+#
+EXT := EXE
+EXTPRE :=
+definst := $(INST_BIN)
+tool_prefix := LD
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_PROGRAMS), \
+ $(evalvalctx def_pass1_link_common))
+
+
+#
+# SYSMODS (Pass 1)
+#
+EXT := SYS
+EXTPRE :=
+definst := $(INST_SYS)
+tool_prefix := LD
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_SYSMODS), \
+ $(evalvalctx def_pass1_link_common))
+
+
+#
+# MISCBINS (Pass 1)
+#
+EXT := BIN
+EXTPRE :=
+definst := $(INST_BIN)
+tool_prefix := LD
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_MISCBINS), \
+ $(evalvalctx def_pass1_link_common))
+
+
+#
+# INSTALLS (Pass 1)
+# Note! INSTARGET_* for INSTALLS aren't available until later.
+#
+define def_pass1_install
+local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
+local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
+# _1_TARGET
+$(target)_1_TARGET := $(PATH_TARGET)/$(target).ins
+$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
+
+# Determine and set 1_INSTTYPE.
+local insttype := $(firstword \
+ $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_INSTTYPE.$(bld_trg).$(bld_type)) \
+ $($(target)_INSTTYPE.$(bld_trg_arch)) \
+ $($(target)_INSTTYPE.$(bld_trg_cpu)) \
+ $($(target)_INSTTYPE.$(bld_trg)) \
+ $($(target)_INSTTYPE.$(bld_type)) \
+ $($(target)_INSTTYPE) \
+ )
+ifeq ($(insttype),)
+ ifneq ($(firstword \
+ $($(target)_NOINST) \
+ $($(target)_NOINST.$(bld_trg)) \
+ $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_NOINST.$(bld_trg_arch)) \
+ $($(target)_NOINST.$(bld_trg_cpu)) \
+ $($(target)_NOINST.$(bld_type)) ),)
+ local insttype := none
+ else
+ local insttype := both
+ endif
+endif
+ifn1of ($(insttype), none both stage)
+ $(error kBuild: Unknown value '$(insttype)' for '$(target)_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
+endif
+$(target)_1_INSTTYPE := $(insttype)
+
+# Determine the actual INST and STAGE sub-dirs to use for this target.
+if1of ($(insttype), stage both)
+ local stage := $(strip $(firstdefined \
+ $(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
+ $(target)_STAGE.$(bld_trg).$(bld_type) \
+ $(target)_STAGE.$(bld_trg_arch) \
+ $(target)_STAGE.$(bld_trg_cpu) \
+ $(target)_STAGE.$(bld_trg) \
+ $(target)_STAGE.$(bld_type) \
+ $(target)_STAGE \
+ $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_INST.$(bld_trg).$(bld_trg_arch) \
+ $(target)_INST.$(bld_trg).$(bld_type) \
+ $(target)_INST.$(bld_trg_arch) \
+ $(target)_INST.$(bld_trg_cpu) \
+ $(target)_INST.$(bld_trg) \
+ $(target)_INST.$(bld_type) \
+ $(target)_INST \
+ definst \
+ ,value))
+ if $(words $(stage)) > 1
+ $(warning kBuild: The STAGE/INST property of install '$(target)' specifies multiple location, that is not supported.)
+ local stage := $(word 1, $(stage))
+ endif
+ $(target)_1_STAGE := $(stage)
+else
+ $(target)_1_STAGE = $(error _1_STAGE not used)
+endif
+
+if1of ($(insttype), both)
+ local inst := $(strip $(firstdefined \
+ $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_INST.$(bld_trg).$(bld_trg_arch) \
+ $(target)_INST.$(bld_trg).$(bld_type) \
+ $(target)_INST.$(bld_trg_arch) \
+ $(target)_INST.$(bld_trg_cpu) \
+ $(target)_INST.$(bld_trg) \
+ $(target)_INST.$(bld_type) \
+ $(target)_INST \
+ definst \
+ ,value))
+ if $(words $(inst)) > 1
+ $(warning kBuild: The INST property of install '$(target)' specifies multiple location, that is not supported.)
+ local inst := $(word 1, $(inst))
+ endif
+ ifneq ($(root $(stage)),)
+ $(error kBuild: The effective INST property of install '$(target)' should not start with a root specification)
+ endif
+ $(target)_1_INST := $(inst)
+else
+ $(target)_1_INST = $(error _1_INST not used)
+endif
+
+# Block properties that we put off setting until pass 2 for INSTALLS.
+$(target)_1_STAGE_TARGET = $(error The '_1_STAGE_TARGET' property is not present on install targets. Use '_2_STAGE_TARGETS' instead (set by pass 2!).)
+$(target)_1_INST_TARGET = $(error The '_1_INST_TARGET' property is not present on install targets. Use '_2_INST_TARGETS' instead (set by pass 2!).)
+INSTARGET_$(target) = $(error The 'INSTARGET_' is deprecated and besides, it is being accessed to early. Consider '_2_STAGE_TARGETS' or '_2_INST_TARGETS'.)
+
+# INSTARGET_ later.
+# PATH_*
+local outbase := $(call TARGET_BASE,$(target),$(target))
+$(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
+$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+endef # def_pass1_install
+$(eval-opt-var def_pass1_install)
+
+$(foreach target, $(_ALL_INSTALLS), \
+ $(evalvalctx def_pass1_install))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done pass 1)
+endif
+
+
diff --git a/kBuild/footer-pass2-compiling-targets.kmk b/kBuild/footer-pass2-compiling-targets.kmk
new file mode 100644
index 0000000..62acb28
--- /dev/null
+++ b/kBuild/footer-pass2-compiling-targets.kmk
@@ -0,0 +1,1227 @@
+# $Id: footer-pass2-compiling-targets.kmk 3521 2021-12-18 13:41:28Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Compiling Targets.
+#
+
+#
+# Copyright (c) 2004-2019 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+#
+# Object processing.
+#
+
+ifndef NO_COMPILE_CMDS_DEPS
+ ## Generates the rules for building a specific object and the aliases.
+ # for building a source file.
+ # @param $(obj) The object file.
+ define def_target_source_rule_v3plus
+$$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
+$$(obj) + $$(kbsrc_output) +| $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+ ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
+ $$(QUIET)$$(RM) -f -- $(dep) $(obj) $(kbsrc_output) $(kbsrc_output_maybe)
+ endif
+
+$(kbsrc_cmds)
+
+ %$$(QUIET2)$$(APPEND) -in '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' '--insert-command=$(obj)' 'endef'
+$$(basename $$(notdir $$(obj))).o: $$(obj)
+ endef # def_target_source_rule_v3plus
+
+ ## Generates the rules for building a specific object and the aliases, kObjCache variant.
+ # for building a source file.
+ # @param $(obj) The object file.
+ define def_target_source_rule_v3plus_objcache
+$$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
+_OUT_FILES += $(outbase).koc
+$$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+
+$(kbsrc_cmds)
+
+ %$$(QUIET2)$$(APPEND) -in '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' '--insert-command=$(obj)' 'endef'
+$$(basename $$(notdir $$(obj))).o: $$(obj)
+ endef # def_target_source_rule_v3plus_objcache
+
+else # NO_COMPILE_CMDS_DEPS
+
+ ## Generates the rules for building a specific object and the aliases.
+ # for building a source file.
+ # @param $(obj) The object file.
+ define def_target_source_rule_v3plus
+$$(obj) + $$(kbsrc_output) +| $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+ ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
+ $$(QUIET)$$(RM) -f -- $(dep) $(obj) $(kbsrc_output) $(kbsrc_output_maybe)
+ endif
+
+$(kbsrc_cmds)
+
+$$(basename $$(notdir $$(obj))).o: $$(obj)
+ endef # def_target_source_rule_v3plus
+
+ ## Generates the rules for building a specific object and the aliases, kObjCache variant.
+ # for building a source file.
+ # @param $(obj) The object file.
+ define def_target_source_rule_v3plus_objcache
+_OUT_FILES += $(outbase).koc
+$$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+
+$(kbsrc_cmds)
+
+$$(basename $$(notdir $$(obj))).o: $$(obj)
+ endef # def_target_source_rule_v3plus_objcache
+
+endif # NO_COMPILE_CMDS_DEPS
+$(eval-opt-var def_target_source_rule_v3plus)
+$(eval-opt-var def_target_source_rule_v3plus_objcache)
+
+
+##
+## Legacy legacy legacy - start
+##
+
+## Wrapper
+ifndef NO_COMPILE_CMDS_DEPS
+ if1of ($(KMK_FEATURES),dot-must-make)
+ _DEP_COMPILE_CMDS =
+ # for debugging: $$(warning MUST_MAKE=$$$$(comp-cmds-ex $$$$($(target)_$(subst :,_,$(source))_CMDS_PREV_), $$$$(commands $$@)) -> $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE))
+ else
+ _DEP_COMPILE_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $(obj)),FORCE)
+ endif
+else
+ _DEP_COMPILE_CMDS =
+endif
+
+## Generates the rules for building a specific object, and the aliases - legacy version.
+# for building a source file.
+# @param $(obj) The object file.
+define def_target_source_rule
+ifndef NO_COMPILE_CMDS_DEPS
+$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
+endif
+ifneq ($(TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE),)
+_OUT_FILES += $(outbase).koc
+$(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \
+ $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
+ | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+else
+$(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
+ $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
+ | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
+ $$(QUIET)$$(RM) -f -- $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
+endif
+endif
+
+$($(target)_$(source)_CMDS_)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -in '$(dep)' \
+ '' \
+ 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' \
+ '--insert-command=$(obj)' \
+ 'endef'
+ else
+ %$$(QUIET2)$$(APPEND) -n '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(obj)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+ endif
+endif
+
+$(basename $(notdir $(obj))).o: $(obj)
+
+## @todo make this 'local cmds,output,output_maybe,depend and depord' in 0.2.x or when a new kb-src-one is added.
+$(target)_$(source)_CMDS_ :=
+$(target)_$(source)_OUTPUT_ :=
+$(target)_$(source)_OUTPUT_MAYBE_ :=
+$(target)_$(source)_DEPEND_ :=
+$(target)_$(source)_DEPORD_ :=
+endef # def_target_source_rule
+$(eval-opt-var def_target_source_rule)
+##
+## Legacy legacy legacy - end
+
+
+
+## wrapper the link command dependency check.
+ifndef NO_LINK_CMDS_DEPS
+ if1of ($(KMK_FEATURES),dot-must-make)
+ _DEP_LINK_CMDS =
+ else
+ _DEP_LINK_CMDS = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $(out)),FORCE)
+ endif
+else
+ _DEP_LINK_CMDS =
+endif
+
+## Generate the link rule for a target.
+# @param $(target) The normalized target name.
+# @param $(dirdep) Directories we depend upon begin created before linking.
+# @param $(dep) The name of the dependency file.
+# @param $(out)
+# @param $($(target)_2_OUTPUT) Output files from the link.
+# @param $($(target)_2_OUTPUT_MAYBE) Output files that the link may perhaps create.
+# @param $($(target)_2_OUTPUT_MAYBE_PRECIOUS) Output files that the link may perhaps create but shouldn't be deleted.
+# @param $($(target)_2_DEPEND) Dependencies.
+# @param $($(target)_2_DEPORD) Dependencies which should only affect build order.
+# @param $(cmds) The link commands.
+# @param $($(target)_CMDS_PREV_) The link commands from the previous run.
+define def_link_rule
+$$(call KB_FN_ASSERT_ABSPATH,out)
+ifndef NO_LINK_CMDS_DEPS
+$(out): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $$@),FORCE)
+endif
+$(out) \
++ $($(target)_2_OUTPUT) \
++ $($(target)_2_OUTPUT_DEBUG_FILES) \
++ $($(target)_2_OUTPUT_DEBUG_DIRS) \
++| $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) : \
+ $$$$($(target)_2_DEPEND) \
+ $(value _DEP_LINK_CMDS) \
+ | \
+ $$$$($(target)_2_DEPORD)
+ %$$(call MSG_LINK,$(target),$$@,$(tool_do))
+ $$(QUIET)$$(RM) -f -- $(dep) $(out) $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_DEBUG_FILES)
+ifdef $(target)_2_OUTPUT_DEBUG_DIRS
+ $$(QUIET)$$(RM) -Rf -- $($(target)_2_OUTPUT_DEBUG_DIRS)
+endif
+
+$(cmds)
+
+ifndef NO_LINK_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(basename $(notdir $(out))):: $(out)
+
+endef # def_link_rule
+$(eval-opt-var def_link_rule)
+
+
+## Generate the link & lib install rule
+# Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
+# pre_install_cmds, post_install_cmds
+define def_link_install_rule
+$$(call KB_FN_ASSERT_ABSPATH,$(target)_1_INST_TARGET)
+$($(target)_1_INST_TARGET): $(out) | $$$$(dir $$$$@)
+ %$$(call MSG_INST_TRG,$(target),$(out),$$@)
+ $(pre_install_cmds)
+
+ $$(QUIET)$$(INSTALL) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
+ $(post_install_cmds)
+
+endef
+
+
+## Generate the link & lib stage installation rule
+# Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
+# pre_install_cmds, post_install_cmds
+define def_link_stage_rule
+$$(call KB_FN_ASSERT_ABSPATH,$(target)_1_STAGE_TARGET)
+$($(target)_1_STAGE_TARGET): $(out) | $$$$(dir $$$$@)
+ %$$(call MSG_INST_TRG,$(target),$(out),$$@)
+ $(pre_install_cmds)
+
+ $$(QUIET)$$(INSTALL_STAGING) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
+ $(post_install_cmds)
+
+
+$(basename $(notdir $(out))):: $($(target)_1_STAGE_TARGET)
+
+endef
+
+
+## def_src_handler_*
+#
+# @{
+define def_src_handler_c
+local type := C
+ $(kb-src-one 4)
+endef
+
+define def_src_handler_cxx
+local type := CXX
+ $(kb-src-one 4)
+endef
+
+define def_src_handler_objc
+local type := OBJC
+ $(kb-src-one 4)
+endef
+
+define def_src_handler_objcxx
+local type := OBJCXX
+ $(kb-src-one 4)
+endef
+
+define def_src_handler_asm
+local type := AS
+ $(kb-src-one 4)
+endef
+
+define def_src_handler_rc
+local type := RC
+ $(kb-src-one 4)
+endef
+
+ifdef KMK_WITH_QUOTING
+define def_src_handler_obj
+ifeq ($(defpath),)
+ $(target)_2_OBJS += $(source)
+else
+ $(target)_2_OBJS += $(qabspathex ,$(source), $(defpath))
+endif
+endef
+else
+define def_src_handler_obj
+ifeq ($(defpath),)
+ $(target)_2_OBJS += $(source)
+else
+ $(target)_2_OBJS += $(abspathex $(source), $(defpath))
+endif
+endef
+endif
+## @}
+
+## Handle one source.
+# .
+define def_src_handler_one
+local suff := $(suffix $(source))
+local src_handler := $(firstword $(filter $(suff):%, $($(target)_$(source)_SRC_HANDLERS) $($(source)_SRC_HANDLERS) $(target_src_handlers) ))
+local handler := $(patsubst $(suff):%,%,$(src_handler))
+ifneq ($(handler),)
+ $(evalvalctx $(handler))
+else
+ othersrc += $(source)
+endif
+endef # def_src_handler_one
+
+## Generic macro for processing all target sources.
+# @param $(target) Normalized target name.
+# @param $(defpath)
+# @param much-more...
+# @returns othersrc, $(target)_2_OBJS, ++
+ifdef KMK_WITH_QUOTING
+define def_target_sources
+local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
+$(foreachfile source,\
+ $($(target)_SOURCES)\
+ $($(target)_SOURCES.$(bld_trg))\
+ $($(target)_SOURCES.$(bld_trg).$(bld_type))\
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_SOURCES.$(bld_trg_arch))\
+ $($(target)_SOURCES.$(bld_trg_cpu))\
+ $($(target)_SOURCES.$(bld_type))\
+ ,$(evalvalctx def_src_handler_one) )
+
+$(foreachfile source,\
+ $($(target)_GEN_SOURCES_)\
+ $($(target)_GEN_SOURCES_.$(bld_trg))\
+ $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_type))\
+ $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
+ $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
+ $($(target)_GEN_SOURCES_.$(bld_type))\
+ ,$(evalvalctx def_src_handler_one) )
+endef # def_target_sources
+else
+define def_target_sources
+local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
+$(foreach source,\
+ $($(target)_SOURCES)\
+ $($(target)_SOURCES.$(bld_trg))\
+ $($(target)_SOURCES.$(bld_trg).$(bld_type))\
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_SOURCES.$(bld_trg_arch))\
+ $($(target)_SOURCES.$(bld_trg_cpu))\
+ $($(target)_SOURCES.$(bld_type))\
+ ,$(evalvalctx def_src_handler_one) )
+
+$(foreach source,\
+ $($(target)_GEN_SOURCES_)\
+ $($(target)_GEN_SOURCES_.$(bld_trg))\
+ $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_type))\
+ $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
+ $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
+ $($(target)_GEN_SOURCES_.$(bld_type))\
+ ,$(evalvalctx def_src_handler_one) )
+endef # def_target_sources
+endif
+$(eval-opt-var def_target_sources)
+
+
+##
+# Install a debug directory.
+# @param debug_dir The directory name.
+define def_link_install_debug_dir_rule
+local dir := $(debug_inst_path)/$(debug_inst2)$(debug_dir)
+$$(call KB_FN_ASSERT_ABSPATH,dir)
+$$(dir): | $$$$(dir $$$$(patsubst %/,%,$$$$@))
+ %$$(call MSG_INST_DIR,$$@)
+ $$(QUIET)$$(MKDIR) -p -- $$@
+$(target)_2_DEBUG_$(debug_var)_TARGET_DIRS += $$(dir)
+endef # def_link_install_debug_dir_rule
+
+##
+# Install a debug file.
+# @param debug_file Src=>Dst file pair.
+define def_link_install_debug_file_rule
+local dst := $(debug_inst_path)/$(debug_inst2)$(word 2, $(subst =>,$(SP),$(debug_file)))
+$$(call KB_FN_ASSERT_ABSPATH,dst)
+local src := $(word 1, $(subst =>,$(SP),$(debug_file)))
+$$(call KB_FN_ASSERT_ABSPATH,src)
+$$(dst): $$(src) | $$$$(dir $$$$@)
+ %$$(call MSG_INST_FILE,$$<,$$@)
+ $$(QUIET)$(debug_install_cmd) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $$< $$@
+$(target)_2_DEBUG_$(debug_var)_TARGET_FILES += $$(dst)
+endef # def_link_install_debug_file_rule
+
+##
+# Install debug info to $(debug_inst), where debug_inst can be a directory or
+# file (just like $(inst) and $(stage). Used for both staging and installing.
+define def_target_install_only_debug
+if "$(substr $(debug_inst),-1,1)" == "/"
+ if "$(debug_inst)" == "./"
+ local debug_inst2 :=
+ else
+ local debug_inst2 := $(debug_inst)
+ endif
+ local debug_dirs := $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_DIRS))
+ ifneq ($(strip $(root $(debug_dirs))),)
+ $(error kBuild: Bad tool? debug_dirs='$(debug_dirs)', expected all to be under '$(outbase)')
+ endif
+ local debug_files := $(foreach file, $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_FILES)) \
+ ,$($(target)_0_OUTDIR)/$(file)=>$(file))
+else
+ local debug_notdir:= $(notdir $(debug_inst))
+ local debug_inst2 := $(dir $(debug_inst))
+ local debug_files := $(call TOOL_$(tool)_$(tool_do)_DEBUG_INSTALL_FN,$(out),$(outbase),$(debug_notdir))
+ local debug_dirs := $(filter %/,$(debug_files))
+ local debug_files := $(filter-out %/,$(debug_files))
+endif
+$(foreach debug_dir, $(debug_dirs), $(eval $(def_link_install_debug_dir_rule)))
+$(foreach debug_file, $(debug_files), $(eval $(def_link_install_debug_file_rule)))
+endef
+
+
+## Generic macro for generating the install rule(s) for a target.
+#
+# @param $(target) Normalized target name.
+# @param $(out) The output file.
+# @param $(typevar) The name of the variable with all the root targets of its type.
+# @param $(target_type_mode) The default file mode implied by the target type.
+define def_target_install_only
+if1of ($($(target)_1_INSTTYPE) $($(target)_1_DEBUG_INSTTYPE), both stage)
+ # Determin common variables.
+ local mode := $(firstword \
+ $($(target)_MODE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_MODE.$(bld_trg).$(bld_type)) \
+ $($(target)_MODE.$(bld_trg_arch)) \
+ $($(target)_MODE.$(bld_trg)) \
+ $($(target)_MODE.$(bld_type)) \
+ $($(target)_MODE) \
+ $(target_type_mode) )
+ local uid := $(firstword \
+ $($(target)_UID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_UID.$(bld_trg).$(bld_type)) \
+ $($(target)_UID.$(bld_trg_arch)) \
+ $($(target)_UID.$(bld_trg)) \
+ $($(target)_UID.$(bld_type)) \
+ $($(target)_UID) )
+ local gid := $(firstword \
+ $($(target)_GID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_GID.$(bld_trg).$(bld_type)) \
+ $($(target)_GID.$(bld_trg_arch)) \
+ $($(target)_GID.$(bld_trg)) \
+ $($(target)_GID.$(bld_type)) \
+ $($(target)_GID) )
+ local pre_install_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_INST_CMDS)
+ local post_install_cmds := $(evalcall def_fn_prop_get_first_defined,POST_INST_CMDS)
+endif
+
+ifneq ($($(target)_1_INSTTYPE),none)
+ # Generate the rules
+ ifeq ($($(target)_1_INSTTYPE),both)
+$(eval $(def_link_install_rule))
+ _INSTALLS_FILES += $($(target)_1_INST_TARGET)
+ endif
+$(eval $(def_link_stage_rule))
+ _STAGE_FILES += $($(target)_1_STAGE_TARGET)
+ $(typevar) += $($(target)_1_STAGE_TARGET)
+else # INSTTYPE == none
+ $(typevar) += $(out)
+endif # INSTTYPE == none
+
+# Install debug info.
+$(target)_2_DEBUG_STAGE_TARGET_DIRS :=
+$(target)_2_DEBUG_STAGE_TARGET_FILES :=
+$(target)_2_DEBUG_INSTALL_TARGET_DIRS :=
+$(target)_2_DEBUG_INSTALL_TARGET_FILES :=
+
+if ( defined($(target)_2_OUTPUT_DEBUG_DIRS) \
+ || defined($(target)_2_OUTPUT_DEBUG_FILES) ) \
+ && "$($(target)_1_DEBUG_INSTTYPE)" != "none"
+ local mode := $(if $(mode),$(mode)$(COMMA)a-x,0644)
+
+ ifeq ($($(target)_1_DEBUG_INSTTYPE),both)
+ local debug_inst_path := $(PATH_INS)
+ local debug_install_cmd := $(INSTALL)
+ local debug_var := INSTALL
+ $(foreach debug_inst, $($(target)_1_DEBUG_INST), $(evalvalctx def_target_install_only_debug))
+ endif
+
+ local debug_inst_path := $(PATH_STAGE)
+ local debug_install_cmd := $(INSTALL_STAGING)
+ local debug_var := STAGE
+ if1of ($($(target)_1_DEBUG_INSTTYPE), stage both)
+ $(foreach debug_inst, $($(target)_1_DEBUG_STAGE), $(evalvalctx def_target_install_only_debug))
+ endif
+ if1of ($($(target)_1_INSTTYPE), stage both)
+ ifndef debug_nostage
+ $(foreach debug_inst,$($(target)_1_STAGE), $(evalvalctx def_target_install_only_debug))
+ endif
+ endif
+
+ _DEBUG_STAGE_DIRS += $($(target)_2_DEBUG_STAGE_TARGET_DIRS)
+ _DEBUG_STAGE_FILES += $($(target)_2_DEBUG_STAGE_TARGET_FILES)
+ _DEBUG_INSTALL_DIRS += $($(target)_2_DEBUG_INSTALL_TARGET_DIRS)
+ _DEBUG_INSTALL_FILES += $($(target)_2_DEBUG_INSTALL_TARGET_FILES)
+
+ $(basename $(notdir $(out))):: $($(target)_2_DEBUG_STAGE_TARGET_DIRS) $($(target)_2_DEBUG_STAGE_TARGET_FILES)
+endif
+
+endef # def_target_install_only
+
+
+
+#
+# LIBRARIES
+#
+
+## Library (one).
+# @param $(target) Normalized library (target) name.
+define def_lib
+# library basics
+## @todo prefix
+local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
+local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
+local tool := $(call _TARGET_TOOL,$(target),AR)
+ifeq ($(tool),)
+$(error kBuild: Library target $(target) does not have a tool defined!)
+endif
+local name := $(firstword\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg).$(bld_type))\
+ $($(target)_NAME.$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg))\
+ $($(target)_NAME.$(bld_type))\
+ $($(target)_NAME)\
+ $(target))
+local outbase := $(call TARGET_BASE,$(name),$(target))
+$(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
+$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+local suff := $(firstword\
+ $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_LIBSUFF.$(bld_trg))\
+ $($(target)_LIBSUFF)\
+ $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
+ $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
+ $(TOOL_$(tool)_ARLIBSUFF)\
+ $(SUFF_LIB))
+local out := $(outbase)$(suff)
+local defpath := $($(target)_DEFPATH)
+ifeq ($(defpath),)
+ local defpath := $($(target)_PATH)
+endif
+$(target)_1_TARGET:= $(out)
+$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
+# no local here - must be writable across some foreachs.
+othersrc :=
+$(target)_2_OBJS :=
+$(target)_2_INTERMEDIATES =
+
+# kObjCache.
+ifdef KBUILD_USE_KOBJCACHE
+ ifneq ($($(target)_KOBJCACHE),)
+local use_objcache := 1
+ else
+local use_objcache :=
+ endif
+local use_objcache :=
+endif
+
+# Target level intermediates (before units!).
+local target_intermediate_vars := $$$$($(target)_2_INTERMEDIATES) $(foreach var, \
+ $(target)_INTERMEDIATES \
+ $(target)_INTERMEDIATES.$(bld_trg) \
+ $(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch) \
+ $(target)_INTERMEDIATES.$(bld_trg_arch) \
+ $(target)_INTERMEDIATES.$(bld_trg_cpu) \
+ $(target)_INTERMEDIATES.$(bld_type) \
+ ,$(if-expr defined($(var)),$$$$($(var)),))
+
+# Do units pre source callouts.
+local units := \
+ $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_USES.$(bld_trg_arch))\
+ $($(target)_USES.$(bld_trg))\
+ $($(target)_USES.$(bld_type))\
+ $($(target)_USES)
+$(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre))
+$(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre_2))
+
+# source -> object
+$(evalval def_target_sources)
+
+# library linking
+local tool := $(call _TARGET_TOOL,$(target),AR)
+local name := $(firstword\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg).$(bld_type))\
+ $($(target)_NAME.$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg))\
+ $($(target)_NAME.$(bld_type))\
+ $($(target)_NAME)\
+ $(target))
+local outbase := $(call TARGET_BASE,$(name),$(target))
+local flags :=\
+ $(TOOL_$(tool)_ARFLAGS)\
+ $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
+ $(ARFLAGS)\
+ $(ARFLAGS.$(bld_type))\
+ $($(target)_ARFLAGS)\
+ $($(target)_ARFLAGS.$(bld_type)) \
+ $($(target)_ARFLAGS.$(bld_trg)) \
+ $($(target)_ARFLAGS.$(bld_trg_arch)) \
+ $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_ARFLAGS.$(bld_trg_cpu))
+local dirdep := $(call DIRDEP,$(dir $(out)))
+local deps := \
+ $($(target)_DEPS.$(bld_trg_cpu)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_DEPS.$(bld_trg_arch)) \
+ $($(target)_DEPS.$(bld_trg)) \
+ $($(target)_DEPS.$(bld_type)) \
+ $($(target)_DEPS) \
+ $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
+ $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_LNK_DEPS.$(bld_trg_arch)) \
+ $($(target)_LNK_DEPS.$(bld_trg)) \
+ $($(target)_LNK_DEPS.$(bld_type)) \
+ $($(target)_LNK_DEPS)
+local orderdeps := \
+ $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_ORDERDEPS.$(bld_trg_arch)) \
+ $($(target)_ORDERDEPS.$(bld_trg)) \
+ $($(target)_ORDERDEPS.$(bld_type)) \
+ $($(target)_ORDERDEPS) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_type)) \
+ $($(target)_LNK_ORDERDEPS)
+
+# Adjust paths if we got a default path.
+ifneq ($(defpath),)
+ local deps := $(abspathex $(deps),$(defpath))
+ local orderdeps := $(abspathex $(orderdeps),$(defpath))
+ othersrc := $(abspathex $(othersrc),$(defpath))
+endif
+
+
+# Custom pre-link actions.
+local pre_cmds := $(evalcall def_fn_prop_get_all_prefixed_priority_last,PRE_CMDS,$(NLTAB))
+local post_cmds := $(evalcall def_fn_prop_get_all_prefixed_priority_last,POST_CMDS,$(NLTAB))
+
+# eliminate this guy?
+local objs = $($(target)_2_OBJS)
+
+# dependency file
+local dep := $(out)$(SUFF_DEP)
+ifndef NO_LINK_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ ifdef KB_HAVE_INCLUDEDEP_QUEUE
+ includedep-queue $(dep)
+ else
+ includedep $(dep)
+ endif
+endif
+
+# check that the tool is defined.
+ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
+$(warning kBuild: tools: \
+ 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 2 $($(target)_$(source)TOOL.$(bld_trg)) \
+ 3 $($(target)_$(source)TOOL) \
+ 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 5 $($(target)_TOOL.$(bld_trg)) \
+ 6 $($(target)_TOOL) \
+ 7 $($(source)TOOL) \
+ 8 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 9 $($(source)TOOL.$(bld_trg)) \
+ 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 11 $(TOOL.$(bld_trg)) \
+ 12 $(TOOL) )
+$(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
+endif
+
+# call the tool
+local cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
+ifneq ($(pre_cmds),)
+ local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
+endif
+ifneq ($(post_cmds),)
+ local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
+endif
+$(target)_2_OUTPUT := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
+$(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE)
+$(target)_2_OUTPUT_MAYBE_PRECIOUS := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE_PRECIOUS)
+$(target)_2_DEPEND := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $($(target)_2_OBJS)
+$(target)_2_DEPORD := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) $(orderdeps)
+
+# generate the link rule.
+$(eval $(def_link_rule))
+
+# installing and globals.
+local target_type_mode := a+r,u+w
+$(evalval def_target_install_only)
+
+_OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) $(out)
+_CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
+_DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
+_OBJS += $($(target)_2_OBJS)
+
+endef # def_lib
+$(eval-opt-var def_lib)
+
+# Process libraries
+typevar := _LIBS
+tool_do := LINK_LIBRARY
+mode := 0644
+$(foreach target, $(_ALL_LIBRARIES), $(evalvalctx def_lib))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done library targets)
+endif
+
+
+#
+# Link operations.
+#
+
+##
+# Link prolog
+#
+# @param $(target) Normalized target name.
+# @param $(EXT) EXE,DLL,SYS.
+# @param $(typevar) The name of the variable with all the root targets of its type.
+define def_link_common
+# basics
+local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_$(bld_trg_base_var)))
+local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_$(bld_trg_base_var)_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_$(bld_trg_base_var)_CPU))
+
+local tool := $(call _TARGET_TOOL,$(target),LD)
+local name := $(firstword\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg).$(bld_type))\
+ $($(target)_NAME.$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg))\
+ $($(target)_NAME.$(bld_type))\
+ $($(target)_NAME)\
+ $(target))
+local outbase := $(call TARGET_BASE,$(name),$(target))
+$(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
+$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+local suff := $(firstword \
+ $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_$(EXT)SUFF.$(bld_trg))\
+ $($(target)_$(EXT)SUFF)\
+ $(TOOL_$(tool)_LD$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
+ $(TOOL_$(tool)_LD$(EXT)SUFF.$(bld_trg))\
+ $(TOOL_$(tool)_LD$(EXT)SUFF)\
+ $($(EXTPRE)SUFF_$(EXT)) )
+local out := $(outbase)$(suff)
+$(target)_1_TARGET:= $(out)
+$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
+local defpath := $($(target)_DEFPATH)
+ifeq ($(defpath),)
+ local defpath := $($(target)_PATH)
+endif
+# no local here - must be writable across some foreachs.
+othersrc :=
+$(target)_2_OBJS :=
+$(target)_2_INTERMEDIATES =
+
+# kObjCache.
+ifdef KBUILD_USE_KOBJCACHE
+ ifneq ($($(target)_KOBJCACHE),)
+local use_objcache := 1
+ else
+local use_objcache :=
+ endif
+local use_objcache :=
+endif
+
+# Target level intermediates (before units!).
+local target_intermediate_vars := $$$$($(target)_2_INTERMEDIATES) $(foreach var, \
+ $(target)_INTERMEDIATES \
+ $(target)_INTERMEDIATES.$(bld_trg) \
+ $(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch) \
+ $(target)_INTERMEDIATES.$(bld_trg_arch) \
+ $(target)_INTERMEDIATES.$(bld_trg_cpu) \
+ $(target)_INTERMEDIATES.$(bld_type) \
+ ,$(if-expr defined($(var)),$$$$($(var)),))
+
+# Do units pre source callouts.
+local units := \
+ $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_USES.$(bld_trg_arch))\
+ $($(target)_USES.$(bld_trg))\
+ $($(target)_USES.$(bld_type))\
+ $($(target)_USES)
+$(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre))
+$(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre_2))
+
+# source -> object
+$(evalval def_target_sources)
+
+# more link stuff.
+local tool := $(call _TARGET_TOOL,$(target),LD)
+local name := $(firstword\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
+ $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg).$(bld_type))\
+ $($(target)_NAME.$(bld_trg_arch))\
+ $($(target)_NAME.$(bld_trg))\
+ $($(target)_NAME.$(bld_type))\
+ $($(target)_NAME)\
+ $(target))
+local outbase := $(call TARGET_BASE,$(name),$(target))
+local flags :=\
+ $(TOOL_$(tool)_LDFLAGS)\
+ $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
+ $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
+ $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
+ $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
+ $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
+ $(foreach sdk, $(SDKS) \
+ $(SDKS.$(bld_type)) \
+ $(SDKS.$(bld_trg)) \
+ $(SDKS.$(bld_trg_arch)) \
+ $(SDKS.$(bld_trg).$(bld_trg_arch)),\
+ $(SDK_$(sdk)_LDFLAGS)\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
+ $(LDFLAGS)\
+ $(LDFLAGS.$(bld_type))\
+ $(LDFLAGS.$(bld_trg))\
+ $(LDFLAGS.$(bld_trg_arch))\
+ $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
+ $(LDFLAGS.$(bld_trg_cpu))\
+ $(foreach sdk, $($(target)_SDKS) \
+ $($(target)_SDKS.$(bld_type)) \
+ $($(target)_SDKS.$(bld_trg)) \
+ $($(target)_SDKS.$(bld_trg_arch)) \
+ $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)),\
+ $(SDK_$(sdk)_LDFLAGS)\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
+ $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
+ $($(target)_LDFLAGS)\
+ $($(target)_LDFLAGS.$(bld_type))\
+ $($(target)_LDFLAGS.$(bld_trg))\
+ $($(target)_LDFLAGS.$(bld_trg_arch))\
+ $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_LDFLAGS.$(bld_trg_cpu))
+local libs :=\
+ $($(target)_LIBS.$(bld_trg_cpu))\
+ $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_LIBS.$(bld_trg_arch))\
+ $($(target)_LIBS.$(bld_trg))\
+ $($(target)_LIBS.$(bld_type))\
+ $($(target)_LIBS)\
+ $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SDKS.$(bld_trg_arch)) \
+ $($(target)_SDKS.$(bld_trg)) \
+ $($(target)_SDKS.$(bld_type)) \
+ $($(target)_SDKS),\
+ $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
+ $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBS.$(bld_trg))\
+ $(SDK_$(sdk)_LIBS.$(bld_type))\
+ $(SDK_$(sdk)_LIBS))\
+ $(LIBS.$(bld_trg_cpu))\
+ $(LIBS.$(bld_trg).$(bld_trg_arch))\
+ $(LIBS.$(bld_trg_arch))\
+ $(LIBS.$(bld_trg))\
+ $(LIBS.$(bld_type))\
+ $(LIBS)\
+ $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
+ $(SDKS.$(bld_trg_arch)) \
+ $(SDKS.$(bld_trg)) \
+ $(SDKS.$(bld_type)) \
+ $(SDKS),\
+ $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
+ $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBS.$(bld_trg))\
+ $(SDK_$(sdk)_LIBS.$(bld_type))\
+ $(SDK_$(sdk)_LIBS))\
+ $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
+ $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
+ $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
+ $(TOOL_$(tool)_LIBS.$(bld_trg))\
+ $(TOOL_$(tool)_LIBS.$(bld_type))\
+ $(TOOL_$(tool)_LIBS)
+local libpath :=\
+ $($(target)_LIBPATH.$(bld_trg_cpu))\
+ $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
+ $($(target)_LIBPATH.$(bld_trg_arch))\
+ $($(target)_LIBPATH.$(bld_trg))\
+ $($(target)_LIBPATH.$(bld_type))\
+ $($(target)_LIBPATH)\
+ $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SDKS.$(bld_trg_arch)) \
+ $($(target)_SDKS.$(bld_trg)) \
+ $($(target)_SDKS.$(bld_type)) \
+ $($(target)_SDKS),\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_type))\
+ $(SDK_$(sdk)_LIBPATH))\
+ $(LIBPATH.$(bld_trg_cpu))\
+ $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
+ $(LIBPATH.$(bld_trg_arch))\
+ $(LIBPATH.$(bld_trg))\
+ $(LIBPATH.$(bld_type))\
+ $(LIBPATH)\
+ $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
+ $(SDKS.$(bld_trg_arch)) \
+ $(SDKS.$(bld_trg)) \
+ $(SDKS.$(bld_type)) \
+ $(SDKS),\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
+ $(SDK_$(sdk)_LIBPATH.$(bld_type))\
+ $(SDK_$(sdk)_LIBPATH))\
+ $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
+ $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
+ $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
+ $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
+ $(TOOL_$(tool)_LIBPATH.$(bld_type))\
+ $(TOOL_$(tool)_LIBPATH)
+local dirdep := $(call DIRDEP,$(dir $(out)))
+local deps := \
+ $($(target)_DEPS.$(bld_trg_cpu)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_DEPS.$(bld_trg_arch)) \
+ $($(target)_DEPS.$(bld_trg)) \
+ $($(target)_DEPS.$(bld_type)) \
+ $($(target)_DEPS) \
+ $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
+ $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_LNK_DEPS.$(bld_trg_arch)) \
+ $($(target)_LNK_DEPS.$(bld_trg)) \
+ $($(target)_LNK_DEPS.$(bld_type)) \
+ $($(target)_LNK_DEPS)
+local orderdeps := \
+ $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_ORDERDEPS.$(bld_trg_arch)) \
+ $($(target)_ORDERDEPS.$(bld_trg)) \
+ $($(target)_ORDERDEPS.$(bld_type)) \
+ $($(target)_ORDERDEPS) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
+ $($(target)_LNK_ORDERDEPS.$(bld_type)) \
+ $($(target)_LNK_ORDERDEPS)
+
+# Adjust paths if we got a default path.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+ local libpath := $(qabspathex ,$(libpath),$(defpath))
+ local deps := $(qabspathex ,$(deps),$(defpath))
+ local orderdeps := $(qabspathex ,$(orderdeps),$(defpath))
+ othersrc := $(qabspathex ,$(othersrc),$(defpath))
+ else
+ local libpath := $(abspathex $(libpath),$(defpath))
+ local deps := $(abspathex $(deps),$(defpath))
+ local orderdeps := $(abspathex $(orderdeps),$(defpath))
+ othersrc := $(abspathex $(othersrc),$(defpath))
+ endif
+ # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_DEFPATH)/lib if relative to current dir!
+endif
+
+# Debug info.
+local ld_debug := $(evalcall def_fn_prop_get_first_defined,LD_DEBUG)
+local debug_inst := $(evalcall def_fn_prop_get_first_defined,DEBUG_INST)
+local debug_stage := $(evalcall def_fn_prop_get_first_defined,DEBUG_STAGE)
+local debug_nostage := $(evalcall def_fn_prop_get_first_word,DEBUG_NOSTAGE)
+
+# Custom pre/post-link actions.
+local pre_cmds := $(evalcall def_fn_prop_get_all_prefixed_priority_last,PRE_CMDS,$(NLTAB))
+local post_cmds := $(evalcall def_fn_prop_get_all_prefixed_priority_last,POST_CMDS,$(NLTAB))
+
+# eliminate this guy?
+local objs = $($(target)_2_OBJS)
+
+# dependency file
+local dep := $(outbase)$(SUFF_DEP)
+ifndef NO_LINK_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ ifdef KB_HAVE_INCLUDEDEP_QUEUE
+ includedep-queue $(dep)
+ else
+ includedep $(dep)
+ endif
+endif
+
+# check that the tool is defined.
+ifndef TOOL_$(tool)_$(tool_do)_CMDS
+$(warning kBuild: tools: \
+ 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 2 $($(target)_$(source)TOOL.$(bld_trg)) \
+ 3 $($(target)_$(source)TOOL) \
+ 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 5 $($(target)_TOOL.$(bld_trg)) \
+ 6 $($(target)_TOOL) \
+ 7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 8 $($(source)TOOL.$(bld_trg)) \
+ 9 $($(source)TOOL) \
+ 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
+ 11 $(TOOL.$(bld_trg)) \
+ 12 $(TOOL) )
+$(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
+endif
+
+# call the tool
+local cmds := $(TOOL_$(tool)_$(tool_do)_CMDS)
+ifneq ($(pre_cmds),)
+ local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
+endif
+ifneq ($(post_cmds),)
+ local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
+endif
+$(target)_2_OUTPUT := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
+$(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
+$(target)_2_OUTPUT_MAYBE_PRECIOUS := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE_PRECIOUS)
+if1of ($(ld_debug), split)
+ $(target)_2_OUTPUT_DEBUG_FILES := $(filter-out %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
+ $(target)_2_OUTPUT_DEBUG_DIRS := $(filter %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
+else
+ $(target)_2_OUTPUT_DEBUG_FILES :=
+ $(target)_2_OUTPUT_DEBUG_DIRS :=
+endif
+$(target)_2_DEPEND := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_2_OBJS)
+$(target)_2_DEPORD := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
+
+# generate the link rule.
+$(eval $(def_link_rule))
+
+# installation targets
+local target_type_mode :=
+$(evalval def_target_install_only)
+
+# Update globals.
+_OBJS += $($(target)_2_OBJS)
+_OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) $($(target)_2_OUTPUT_DEBUG_FILES) $(out)
+_CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
+_DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
+_INSTALLS_FILES += $(INSTARGET_$(target))
+
+endef # def_link_common
+$(eval-opt-var def_link_common)
+
+
+#
+# BLDPROGS
+#
+
+# Process build programs.
+EXT := EXE
+EXTPRE := HOST
+tool_do := LINK_PROGRAM
+typevar := _BLDPROGS
+mode := 0755
+bld_trg_base_var := HOST
+$(foreach target, $(_ALL_BLDPROGS), $(evalvalctx def_link_common))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done build program targets)
+endif
+
+
+#
+# DLLS
+#
+
+# Process dlls
+EXT := DLL
+EXTPRE :=
+tool_do := LINK_DLL
+typevar := _DLLS
+mode := 0644
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_DLLS), $(evalvalctx def_link_common))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done dll targets)
+endif
+
+
+#
+# IMPORT LIBRARIES
+#
+# - On OS/2 and windows these are libraries.
+# - On other platforms they are fake DLLs.
+#
+EXTPRE :=
+typevar := _IMPORT_LIBS
+mode := 0644
+bld_trg_base_var := TARGET
+ifeq ($(filter-out nt os2 win win64 win32,$(KBUILD_TARGET)),)
+ EXT := LIB
+ tool_do := LINK_LIBRARY
+ $(foreach target, $(_ALL_IMPORT_LIBS), $(evalvalctx def_lib))
+else
+ EXT := DLL
+ tool_do := LINK_DLL
+ $(foreach target, $(_ALL_IMPORT_LIBS), $(evalvalctx def_link_common))
+endif
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done import library targets)
+endif
+
+
+#
+# PROGRAMS
+#
+
+# Process programs
+EXT := EXE
+EXTPRE :=
+tool_do := LINK_PROGRAM
+typevar := _PROGRAMS
+mode := 0755
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_PROGRAMS), $(evalvalctx def_link_common))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done program targets)
+endif
+
+
+#
+# SYSMODS
+#
+
+# Process sysmods
+EXT := SYS
+EXTPRE :=
+tool_do := LINK_SYSMOD
+typevar := _SYSMODS
+mode := 0644
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_SYSMODS), $(evalvalctx def_link_common))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done sysmod targets)
+endif
+
+
+#
+# MISCBINS
+#
+
+# Process MISCBINS
+EXT := BIN
+EXTPRE :=
+tool_do := LINK_MISCBIN
+typevar := _MISCBINS
+mode := 0644
+bld_trg_base_var := TARGET
+$(foreach target, $(_ALL_MISCBINS), $(evalvalctx def_link_common))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done misc binary targets)
+endif
+
diff --git a/kBuild/footer-pass2-fetches.kmk b/kBuild/footer-pass2-fetches.kmk
new file mode 100644
index 0000000..ffa75b7
--- /dev/null
+++ b/kBuild/footer-pass2-fetches.kmk
@@ -0,0 +1,434 @@
+# $Id: footer-pass2-fetches.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Fetches.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+## @page pg_fetches Fetching Tools, Sources and Similar.
+#
+# The targets listed in the the FETCHES target list have the following attributes:
+# SOURCES
+# INST
+# FETCHTOOL
+# FETCHFLAGS
+# FETCHDIR
+# UNPACKTOOL
+# UNPACKFLAGS
+#
+# As usual the target name is an alias for 'creating' the target. Other
+# aliases are:
+# pass_fetches
+# fetch
+# unfetch
+# download
+# unpack
+#
+# @remark
+#
+# This is a little bit complex because we must guarantee that if a source file
+# changes only sligtly we must refetch it and to a proper unpacking of it. It
+# is also a desire that fetched archives and unpacked files can be deleted to
+# save space.
+#
+# Thus, we must be able to cleanup what we've unpacked should any of the
+# sources be removed. We do this by maintaining a file listing the files
+# and directories that was unpacked. This operation is named 'unfetch'.
+#
+# We make use of the SIZE and MD5 attributes for each of the sources to
+# create a digest that is stored in the primary target file. Subsequent
+# runswill compare their digest with it to decide if a refetch is required.
+# When a refetch is found necessary, an 'unfetch' is performed first to
+# clean out old files and directores. Note even changes in source order
+# will cause a refetch due to the way the digest is constructed and
+# evaluated.
+#
+# By not depending directly on the archives (nor on any unpacked files)
+# but on a goal made up from the archive name, size and md5, we allow
+# the user to delete the archives. Naturally, this means we'll have to
+# check and fetch missing archives before attempting to unpack them.
+#
+# @remark
+#
+# This feature will *NOT* work correctly with vanilla GNU make becuase
+# it makes use of includedep to avoid too many unnecessary files.
+#
+# @todo
+# 0. Move the fetches out into a unit.
+# 1. Download corruption / continuation.
+# 2. It's quite possible that there is one too many indirect dependency now...
+#
+
+## generates the fetch rule
+define def_fetch_src_fetch_rule
+# Indirect goal for downloading something.
+.PRECIOUS: $(out)
+$(out) + $($(target)_$(srcname)_FETCH_2_OUTPUT) +| $($(target)_$(srcname)_FETCH_2_OUTPUT_MAYBE) : \
+ | $($(target)_$(srcname)_FETCH_2_DEPORD)
+ %$$(call MSG_FETCH_DL,$(target),$(source),$(out))
+ @## @todo do fancy stuff like download continuation.
+ $$(QUIET)$$(RM) -f -- $(out)
+ $(cmds)
+ $$(QUIET)$(if $(md5),$$(MD5SUM_EXT) -b -C $(md5) $(out))
+
+
+
+# Intermediate goal for making sure the md5 and size matches. it will (re) fetch the archive if necessary.
+$(out).checked_$(md5)_$(size): $($(target)_$(srcname)_FETCH_2_DEPEND) | $($(target)_$(srcname)_FETCH_2_DEPORD)
+ %$$(call MSG_FETCH_CHK,$(target),$(source),$(out))
+ $$(QUIET)$$(RM) -f -- $$@
+ @# (re)fetch the file if it doesn't exist or if it doesn't matches the md5.
+ @## @todo do fancy stuff like download continuation.
+ $$(QUIET)( test -f $(out) && $(if $(md5),$$(MD5SUM_EXT) -b -C $(md5) $(out), true) ) \
+ || ( $$(RM_EXT) -f $(out) \
+ && $$(MAKE) $(out) -f $(MAKEFILE) --no-print-directory )
+ $$(QUIET2)$$(APPEND) $$@
+
+_TARGET_$(target)_FETCHED += $(out) $(out).checked_$(md5)_$(size)
+
+# Just a little precaution.
+.NOTPARALLEL: $(out) $(out).checked_$(md5)_$(size)
+
+endef # def_fetch_src_fetch_rule
+$(eval-opt-var def_fetch_src_fetch_rule)
+
+## generates the unpack rule
+define def_fetch_src_unpack_rule
+# This is the unpack rule. it has an order-only dependency on the download check.
+$(out) + $($(target)_$(srcname)_UNPACK_2_OUTPUT) +| $($(target)_$(srcname)_UNPACK_2_OUTPUT_MAYBE) : \
+ $($(target)_$(srcname)_UNPACK_2_DEPEND) \
+ | $($(target)_$(srcname)_UNPACK_2_DEPORD) \
+ $(archive).checked_$(md5)_$(size) \
+ $(dir $(out))
+ %$$(call MSG_FETCH_UP,$(target),$(archive),$(inst))
+ $$(QUIET)$$(RM) -f -- $(out)
+ $$(QUIET)$$(MKDIR) -p -- $(dir $(out))
+ @# if the source archive doesn't exist fetch it (may have been deleted to save space).
+ $$(QUIET)test -f $(archive) \
+ || ( $$(RM_EXT) -f $(archive).checked_$(md5)_$(size) \
+ && $$(MAKE) $(archive).checked_$(md5)_$(size) -f $(MAKEFILE) --no-print-directory )
+ $(cmds)
+ $$(QUIET2)$$(APPEND) $(out) $(notdir $(archive).checked_$(md5)_$(size))
+ $$(QUIET2)$$(APPEND) $(out) $(notdir $(out))
+
+$(eval _TARGET_$(target)_UNPACKED += $(out))
+_TARGET_$(target)_DIGEST := $(_TARGET_$(target)_DIGEST)-$(srcname)_$(md5)_$(size)
+
+.NOTPARALLEL: $(out)
+
+endef # def_fetch_src_unpack_rule
+$(eval-opt-var def_fetch_src_unpack_rule)
+
+## Processes a fetch source
+#
+define def_fetch_src
+#$ (warning dbg: def_fetch_src: source='$(source)' target='$(target)')
+
+# common
+local srcname := $(notdir $(source))
+local inst := $(firstword \
+ $($(target)_$(source)_INST)\
+ $($(target)_$(srcname)_INST)\
+ $($(source)_INST)\
+ $($(srcname)_INST)\
+ $($(target)_INST)\
+)
+ifneq ($(patsubst %/,ok,$(inst)),ok)
+$(error kBuild: Bad or missing INST property for source '$(source)' in target '$(target)': $(inst))
+endif
+## @todo Install-revamp: FIXME
+INSTARGET_$(target)_$(srcname) := $(inst)
+local fetchdir := $(firstword \
+ $($(target)_$(source)_FETCHDIR)\
+ $($(target)_$(srcname)_FETCHDIR)\
+ $($(source)_FETCHDIR)\
+ $($(srcname)_FETCHDIR)\
+ $($(target)_FETCHDIR)\
+ $(FETCHDIR)\
+ $(PATH_TARGET)\
+)
+local deps := \
+ $($(target)_$(source)_DEPS)\
+ $($(target)_$(srcname)_DEPS)\
+ $($(source)_DEPS)\
+ $($(srcname)_DEPS)\
+ $($(target)_DEPS)
+local orderdeps := \
+ $($(target)_$(source)_ORDERDEPS)\
+ $($(target)_$(srcname)_ORDERDEPS)\
+ $($(source)_ORDERDEPS)\
+ $($(srcname)_ORDERDEPS)\
+ $($(target)_ORDERDEPS)
+local md5 := $(firstword \
+ $($(target)_$(source)_MD5)\
+ $($(target)_$(srcname)_MD5)\
+ $($(source)_MD5)\
+ $($(srcname)_MD5)\
+ $($(target)_MD5)\
+)
+local size := $(firstword \
+ $($(target)_$(source)_SIZE)\
+ $($(target)_$(srcname)_SIZE)\
+ $($(source)_SIZE)\
+ $($(srcname)_SIZE)\
+ $($(target)_SIZE)\
+)
+clean_files += \
+ $($(target)_$(source)_CLEAN)\
+ $($(target)_$(srcname)_CLEAN)\
+ $($(source)_CLEAN)\
+ $($(srcname)_CLEAN)
+local dep := # not legal for fetch and unpack tools
+
+
+#
+# The fetching.
+#
+local out := $(fetchdir)/$(srcname)
+local archive := $(out)
+$(target)_$(srcname)_1_TARGET = $(TARGET_$(target)_$(srcname))
+$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target)_$(srcname),$(TARGET_$(target)_$(srcname)),TARGET_$(target)_$(srcname))
+
+local dirdep := $(call DIRDEP,$(fetchdir))
+local tool := $(firstword \
+ $($(target)_$(source)_FETCHTOOL)\
+ $($(target)_$(srcname)_FETCHTOOL)\
+ $($(target)_$(source)_TOOL)\
+ $($(target)_$(srcname)_TOOL)\
+ $($(source)_FETCHTOOL)\
+ $($(srcname)_FETCHTOOL)\
+ $($(source)_TOOL)\
+ $($(srcname)_TOOL)\
+ $($(target)_FETCHTOOL)\
+ $($(target)_TOOL)\
+ )
+local flags :=\
+ $(TOOL_$(tool)_FETCHFLAGS)\
+ $(FETCHFLAGS)\
+ $($(target)_FETCHFLAGS)\
+ $($(srcname)_FETCHFLAGS)\
+ $($(source)_FETCHFLAGS)\
+ $($(target)_$(srcname)_FETCHFLAGS)\
+ $($(target)_$(source)_FETCHFLAGS)
+
+#$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) fetchdir=$(fetchdir) md5=$(md5) size=$(size))
+
+ifndef TOOL_$(tool)_FETCH_CMDS
+$(warning kBuild: tools: \
+ 1 $($(target)_$(source)_FETCHTOOL)\
+ 2 $($(target)_$(srcname)_FETCHTOOL)\
+ 3 $($(target)_$(source)_TOOL)\
+ 4 $($(target)_$(srcname)_TOOL)\
+ 5 $($(source)_FETCHTOOL)\
+ 6 $($(srcname)_FETCHTOOL)\
+ 7 $($(source)_TOOL)\
+ 8 $($(srcname)_TOOL)\
+ 9 $($(target)_FETCHTOOL)\
+ 10 $($(target)_TOOL) )
+$(error kBuild: TOOL_$(tool)_FETCH_CMDS is not defined. source=$(source) target=$(target) )
+endif
+
+# call the tool
+local cmds := $(TOOL_$(tool)_FETCH_CMDS)
+$(target)_$(srcname)_FETCH_2_OUTPUT := $(TOOL_$(tool)_FETCH_OUTPUT)
+$(target)_$(srcname)_FETCH_2_OUTPUT_MAYBE := $(TOOL_$(tool)_FETCH_OUTPUT_MAYBE)
+$(target)_$(srcname)_FETCH_2_DEPEND := $(TOOL_$(tool)_FETCH_DEPEND) $(deps)
+$(target)_$(srcname)_FETCH_2_DEPORD := $(TOOL_$(tool)_FETCH_DEPORD) $(dirdep) $(orderdeps)
+
+# generate the fetch rule.
+$(eval $(def_fetch_src_fetch_rule))
+
+
+#
+# The unpacking / installing.
+#
+local out := $(inst)_kBuild_$(target)_$(srcname)_unpacked.lst
+local dirdep := $(call DIRDEP,$(inst))
+local tool := $(firstword \
+ $($(target)_$(source)_UNPACKTOOL)\
+ $($(target)_$(srcname)_UNPACKTOOL)\
+ $($(target)_$(source)_TOOL)\
+ $($(target)_$(srcname)_TOOL)\
+ $($(source)_UNPACKTOOL)\
+ $($(srcname)_UNPACKTOOL)\
+ $($(source)_TOOL)\
+ $($(srcname)_TOOL)\
+ $($(target)_UNPACKTOOL)\
+ $($(target)_TOOL) \
+ )
+ifeq ($(tool),)
+local tool := $(toupper $(subst .,,$(suffix $(subst tar.,TAR,$(srcname)))))
+$(evalval def_tools_include)
+endif
+local flags :=\
+ $(TOOL_$(tool)_UNPACKFLAGS)\
+ $(UNPACKFLAGS)\
+ $($(target)_UNPACKFLAGS)\
+ $($(srcname)_UNPACKFLAGS)\
+ $($(source)_UNPACKFLAGS)\
+ $($(target)_$(srcname)_UNPACKFLAGS)\
+ $($(target)_$(source)_UNPACKFLAGS)
+
+#$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) inst=$(inst) md5=$(md5) size=$(size))
+ifndef TOOL_$(tool)_UNPACK_CMDS
+$(warning kBuild: tools: \
+ 1 $($(target)_$(source)_UNPACKTOOL)\
+ 2 $($(target)_$(srcname)_UNPACKTOOL)\
+ 3 $($(target)_$(source)_TOOL)\
+ 4 $($(target)_$(srcname)_TOOL)\
+ 5 $($(source)_UNPACKTOOL)\
+ 6 $($(srcname)_UNPACKTOOL)\
+ 7 $($(source)_TOOL)\
+ 8 $($(srcname)_TOOL)\
+ 9 $($(target)_UNPACKTOOL)\
+ 10 $($(target)_TOOL) \
+ 11 $(toupper $(subst tar.,TAR,$(ext $(srcname)))) \
+ )
+$(error kBuild: TOOL_$(tool)_UNPACK_CMDS is not defined. source=$(source) target=$(target) )
+endif
+
+# call the tool
+local cmds := $(TOOL_$(tool)_UNPACK_CMDS)
+$(target)_$(srcname)_UNPACK_2_OUTPUT := $(TOOL_$(tool)_UNPACK_OUTPUT)
+$(target)_$(srcname)_UNPACK_2_OUTPUT_MAYBE := $(TOOL_$(tool)_UNPACK_OUTPUT_MAYBE)
+$(target)_$(srcname)_UNPACK_2_DEPEND := $(TOOL_$(tool)_UNPACK_DEPEND) $(deps)
+$(target)_$(srcname)_UNPACK_2_DEPORD := $(TOOL_$(tool)_UNPACK_DEPORD) $(dirdep) $(orderdeps)
+
+# generate the fetch rule.
+$(eval $(def_fetch_src_unpack_rule))
+
+_DIRS += $(inst) $(fetchdir)
+
+endef # def_fetch_src
+$(eval-opt-var def_fetch_src)
+
+
+##
+# Define the target level rules for a fetch.
+# @param target
+# @param out
+# @param inst
+# @param _TARGET_$(target)_UNPACKED
+# @param _TARGET_$(target)_DIGEST
+# @param bld_trg
+# @param bld_trg_arch
+define def_fetch_rules
+
+$(out).lst: $(_TARGET_$(target)_UNPACKED) | $(call DIRDEP,$(inst))
+ %$$(call MSG_FETCH_OK,$(target))
+ $$(QUIET)$$(RM) -f -- $$@ $$@.tmp
+ $$(QUIET2)$$(APPEND) $$@.tmp '$(notdir $(out))'
+ $$(QUIET)$(if $(_TARGET_$(target)_UNPACKED),$$(CAT_EXT) $(_TARGET_$(target)_UNPACKED) >> $$@.tmp)
+ $$(QUIET)$$(MV) -f -- $$@.tmp $$@
+
+$(out)_unfetched:
+ %$$(call MSG_UNFETCH,$(target))
+ $$(QUIET)$$(RM) -f -- $$(addprefix $(inst),$$(shell $$(CAT_EXT) $(out).lst 2> /dev/null | $$(SED) -e '/\/$$$$/d'))
+ $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- $$(dir $$@) \
+ $$(addprefix $(inst),$$(sort $$(dir $$(shell $$(CAT_EXT) $(out).lst 2> /dev/null))))
+ $$(QUIET)$$(RM) -f -- $(out).lst $(out)
+ $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- $$(dir $$@)
+
+$(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
+ $$(QUIET)$$(RM) -f -- $$@
+ %$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(eq $$(file-size $(out).lst),-1)\
+ ,$$(call MSG_REFETCH,$(target)),$$(call MSG_FETCH,$(target))),$$(call MSG_UNFETCH,$(target)))
+ $$(QUIET)$(TEST_EXT) -f $(out).lst -- $$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched
+if $(KBUILD_KMK_REVISION) > 2911
+ $$(QUIET)kmk_builtin_dircache deleted "$(dir $(out))"
+endif
+ $$(QUIET)$$(if $$(_TARGET_$(target)_DIGEST),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out).lst,$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- $$(dir $$@))
+ $$(QUIET2)$$(if $$(_TARGET_$(target)_DIGEST),$$(APPEND) $$@ "_TARGET_$(target)_DIGEST_PREV := $(_TARGET_$(target)_DIGEST)")
+
+.NOTPARALLEL: $(out).lst $(out)_unfetched $(out)
+
+endef
+
+
+##
+# Deal with one fetch target.
+# @param target
+# @param bld_trg
+# @param bld_trg_arch
+define def_fetch
+# common
+## @todo Install-revamp: FIXME
+INSTARGET_$(target) := $($(target)_INST)
+ifneq ($(patsubst %/,ok,$(INSTARGET_$(target))),ok)
+$(error kBuild: Bad or missing INST property for target '$(target)'. \
+ $(target)_INST='$($(target)_INST)' ($(origin $(target)_INST)))
+endif
+_TARGET_$(target)_FETCHED :=
+_TARGET_$(target)_UNPACKED :=
+_TARGET_$(target)_DIGEST :=
+local clean_files := $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(KBUILD_TYPE))
+
+# The 'sources'.
+#$ (warning dbg fetch: target=$(target) sources=$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(KBUILD_TARGET).$(bld_trg_arch)))
+$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)),\
+ $(evalval def_fetch_src))
+
+# The target.
+local inst := $(INSTARGET_$(target))
+local out := $(inst)_kBuild_fetch_$(target)
+
+$(eval includedep $(out))
+
+$(eval $(def_fetch_rules))
+
+# Define the aliases here (doesn't work if defined in def_fetch_rules, just like includedep).
+$(target): $(out)
+$(target)_unfetch: $(out)_unfetched
+
+_FETCHES += $(out)
+_DOWNLOADS += $(_TARGET_$(target)_FETCHED)
+_UNPACKS += $(_TARGET_$(target)_UNPACKED)
+_UNFETCHES += $(out)_unfetched
+_DIRS += $(inst)
+_CLEAN_FILES += $(clean_files)
+
+endef
+$(eval-opt-var def_fetch)
+
+# Walk the FETCH target lists.
+bld_trg := $(KBUILD_TARGET)
+bld_trg_arch := $(KBUILD_TARGET_ARCH)
+$(foreach target, $(_ALL_FETCHES), \
+ $(evalvalctx def_fetch))
+
+# some aliases.
+download: $(_DOWNLOADS)
+unpack: $(_UNPACKS)
+fetch: $(_FETCHES)
+unfetch: $(_UNFETCHES)
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done fetching targets)
+endif
diff --git a/kBuild/footer-pass2-installs.kmk b/kBuild/footer-pass2-installs.kmk
new file mode 100644
index 0000000..27ec7da
--- /dev/null
+++ b/kBuild/footer-pass2-installs.kmk
@@ -0,0 +1,641 @@
+# $Id: footer-pass2-installs.kmk 3373 2020-06-10 11:01:43Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Installs.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+#
+# INSTALLS
+#
+
+##
+# Generate the staging rules.
+#
+define def_install_src_rule_staging
+$$(call KB_FN_ASSERT_ABSPATH, stagedst)
+$$(call KB_FN_ASSERT_ABSPATH, srcsrc)
+$(stagedst) : $(srcsrc) $(top_deps) | $(dir $(stagedst)) $(top_orderdeps)
+ %$$(call MSG_INST_FILE,$(srcsrc),$(stagedst))
+ $(top_pre_file_cmds)
+ $$(QUIET)$(stagecmd)
+ $(top_post_file_cmds)
+endef
+$(eval-opt-var def_install_src_rule_staging)
+
+define def_install_src_rule_installing
+$$(call KB_FN_ASSERT_ABSPATH, instdst)
+$$(call KB_FN_ASSERT_ABSPATH, srcsrc)
+$(instdst) : $(srcsrc) $(top_deps) | $(dir $(instdst)) $(top_orderdeps)
+ %$$(call MSG_INST_FILE,$(srcsrc),$(instdst))
+ $(top_pre_file_cmds)
+ $$(QUIET)$(instcmd)
+ $(top_post_file_cmds)
+endef
+$(eval-opt-var def_install_src_rule_installing)
+
+##
+# Install one file.
+#
+define def_install_src
+
+# deal with '=>' in the source file name.
+ifeq ($(src),=>)
+ $(error kBuild: Install target '$(target)' has a bad source specifier containing '=>' without any file names)
+endif
+ifeq ($(substr $(src),1,2),=>)
+ $(warning kBuild: Install target '$(target)' has a bad source specifier: $(src))
+endif
+ifeq ($(substr $(src),-2),=>)
+ $(warning kBuild: Install target '$(target)' has a bad source specifier: $(src))
+endif
+local srcdst := $(subst =>, ,$(src))
+local srcsrc := $(firstword $(srcdst))
+local srcdstdir := $(dir $(word 2,$(srcdst)))
+ifeq ($(srcdstdir),./)
+ local srcdstdir:=
+endif
+local srcdst := $(word $(words $(srcdst)),$(srcdst))
+
+# instfun, mode, uid and gid.
+ifdef $(srcsrc)_INSTFUN
+ local instfun := $(srcsrc)_INSTFUN
+else
+ local instfun := $(top_instfun)
+endif
+local mode := $(firstword \
+ $($(target)_$(srcsrc)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcsrc)$(source_type_prefix)_MODE.$(bld_trg)) \
+ $($(target)_$(srcsrc)$(source_type_prefix)_MODE) \
+ $($(target)_$(srcdst)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcdst)$(source_type_prefix)_MODE.$(bld_trg)) \
+ $($(target)_$(srcdst)$(source_type_prefix)_MODE) \
+ $($(srcsrc)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcsrc)$(source_type_prefix)_MODE.$(bld_trg)) \
+ $($(srcsrc)$(source_type_prefix)_MODE) \
+ $($(srcdst)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcdst)$(source_type_prefix)_MODE.$(bld_trg)) \
+ $($(srcdst)$(source_type_prefix)_MODE) \
+ $(source_type_mode))
+local uid := $(firstword \
+ $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcsrc)_UID.$(bld_trg)) \
+ $($(target)_$(srcsrc)_UID) \
+ $($(target)_$(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcdst)_UID.$(bld_trg)) \
+ $($(target)_$(srcdst)_UID) \
+ $($(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcsrc)_UID.$(bld_trg)) \
+ $($(srcsrc)_UID) \
+ $($(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcdst)_UID.$(bld_trg)) \
+ $($(srcdst)_UID) \
+ $(top_uid))
+local gid := $(firstword \
+ $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcsrc)_GID.$(bld_trg)) \
+ $($(target)_$(srcsrc)_GID) \
+ $($(target)_$(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcdst)_GID.$(bld_trg)) \
+ $($(target)_$(srcdst)_GID) \
+ $($(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcsrc)_GID.$(bld_trg)) \
+ $($(srcsrc)_GID) \
+ $($(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcdst)_GID.$(bld_trg)) \
+ $($(srcdst)_GID) \
+ $(top_gid))
+local flags := \
+ $(top_ifflags) \
+ $($(srcdst)$(source_type_prefix)_IFFLAGS) \
+ $($(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
+ $($(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcsrc)$(source_type_prefix)_IFFLAGS) \
+ $($(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
+ $($(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcdst)$(source_type_prefix)_IFFLAGS) \
+ $($(target)_$(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
+ $($(target)_$(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcsrc)$(source_type_prefix)_IFFLAGS) \
+ $($(target)_$(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
+ $($(target)_$(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
+clean_files += \
+ $($(srcdst)_CLEAN) \
+ $($(srcdst)_CLEAN.$(bld_trg)) \
+ $($(srcdst)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
+ $($(srcsrc)_CLEAN) \
+ $($(srcsrc)_CLEAN.$(bld_trg)) \
+ $($(srcsrc)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcdst)_CLEAN) \
+ $($(target)_$(srcdst)_CLEAN.$(bld_trg)) \
+ $($(target)_$(srcdst)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(srcsrc)_CLEAN) \
+ $($(target)_$(srcsrc)_CLEAN.$(bld_trg)) \
+ $($(target)_$(srcsrc)_CLEAN.$(bld_trg).$(bld_trg_arch))
+
+
+# Adjust the source if we got a default PATH. (This must be done this late!)
+ifdef $(target)_DEFPATH
+local defpath := $($(target)_DEFPATH)
+else ifdef $(target)_PATH
+local defpath := $($(target)_PATH)
+else
+local defpath :=
+endif
+ifneq ($(defpath),)
+ local srcsrc := $(abspathex $(srcsrc),$(defpath))
+endif
+
+# Generate the staging rule (requires double evaluation).
+local stage := $(strip $(firstdefined $(srcsrc)_STAGE $(srcsrc)_INST $(target)_1_STAGE,value))
+if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
+ $(warning kBuild: File $(srcsrc) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
+ local stage := $(stage)/
+endif
+local stage := $(stage)$(dir $(srcdstdir))
+ifeq ($(root $(stage)),)
+ local stagedst := $(call $(instfun),$(srcdst),$(target),$(stage),$(PATH_STAGE))
+else
+ local stage := $(abspath $(stage))/
+ ifeq ($(pos $(PATH_OBJ),$(stage)),1)
+ local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
+ local stagedst := $(call $(instfun),$(srcdst),$(target),$(stage),$(PATH_OBJ))
+ else
+ $(error kBuild: File $(srcsrc) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
+ endif
+endif
+ifdef $(srcsrc)_INSTALLER
+ local stagecmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
+else ifdef $(target)_INSTALLER
+ local stagecmd := $(call $(target)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
+else
+ local stagecmd := $$(INSTALL_STAGING)\
+ $(if $(uid),-o $(uid))\
+ $(if $(gid),-g $(gid))\
+ $(if $(mode),-m $(mode))\
+ $(flags) -- \
+ $(srcsrc) $(stagedst)
+endif
+$(eval $(def_install_src_rule_staging))
+$(target)_2_STAGE_TARGETS += $(stagedst)
+
+# Generate the install rule
+ifeq ($(insttype),both)
+ local inst := $(strip $(firstdefined $(srcsrc)_INST $(target)_1_INST,value))
+ if "$(substr $(inst),-1)" != "/" && "$(inst)" != ""
+ $(warning kBuild: File $(srcsrc) in install target $(target) has a INST property without a trailing slash: '$(inst)')
+ local inst := $(inst)/
+ endif
+ local inst := $(inst)$(dir $(srcdstdir))
+ ifneq ($(root $(inst)),)
+ $(error kBuild: File $(srcsrc) in install target $(target) has a INST property with an absolute path: '$(inst)')
+ endif
+ local instdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
+
+ ifdef $(srcsrc)_INSTALLER
+ local instcmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
+ else ifdef $(target)_INSTALLER
+ local instcmd := $(call $(target)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
+ else
+ local instcmd := $$(INSTALL)\
+ $(if $(uid),-o $(uid))\
+ $(if $(gid),-g $(gid))\
+ $(if $(mode),-m $(mode))\
+ $(flags) -- \
+ $(srcsrc) $(instdst)
+ endif
+ $(eval $(def_install_src_rule_installing))
+ $(target)_2_INST_TARGETS += $(instdst)
+endif
+
+#$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => instdst=$(instdst); stage=$(stage) => stagedst=$(stagedst))
+endef # def_install_src
+$(eval-opt-var def_install_src)
+
+
+##
+# Generate the symlink rules.
+#
+define def_install_symlink_rule_staging
+$$(call KB_FN_ASSERT_ABSPATH, stagedst)
+$(stagedst) : $(top_deps) | $(dir $(stagedst)) $(top_orderdeps)
+ %$$(call MSG_INST_SYM,$(stagedst),$(symdst))
+ $$(QUIET)$$(RM) -f -- $$@
+ $(top_pre_sym_cmds)
+ $$(QUIET)$$(LN_SYMLINK) $(symdst) $(stagedst)
+ $(top_post_sym_cmds)
+endef
+$(eval-opt-var def_install_symlink_rule_staging)
+
+define def_install_symlink_rule_installing
+$$(call KB_FN_ASSERT_ABSPATH, instdst)
+$(instdst) : $(top_deps) | $(dir $(instdst)) $(top_orderdeps)
+ %$$(call MSG_INST_SYM,$(instdst),$(symdst))
+ $$(QUIET)$$(RM) -f -- $$@
+ $(top_pre_sym_cmds)
+ $$(QUIET)$$(LN_SYMLINK) $(symdst) $(instdst)
+ $(top_post_sym_cmds)
+endef
+$(eval-opt-var def_install_symlink_rule_installing)
+
+
+##
+# Create one symlink.
+#
+define def_install_symlink
+
+# deal with '=>' in the source file name.
+local symdst := $(subst =>, ,$(src))
+local symlnk := $(firstword $(symdst))
+local symdst := $(word $(words $(symdst)),$(symdst))
+local symlnkdir := $(dir $(symlnk))
+ifeq ($(symlnkdir),./)
+ local symlnkdir :=
+endif
+
+# Figure which install function to use below.
+ifdef $(symlnk)_INSTFUN
+ local instfun := $(symlnk)_INSTFUN
+else
+ local instfun := $(top_instfun)
+endif
+
+# Calc stage destination and generate the rule (requires double evaluation).
+local stage := $(strip $(firstdefined $(symlnk)_STAGE $(symlnk)_INST $(target)_1_STAGE,value))
+if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
+ $(warning kBuild: Symlink $(symlnk) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
+ local stage := $(stage)/
+endif
+local stage := $(stage)$(symlnkdir)
+ifeq ($(root $(stage)),)
+ local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_STAGE))
+else
+ local stage := $(abspath $(stage))/
+ ifeq ($(pos $(PATH_OBJ),$(stage)),1)
+ local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
+ local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_OBJ))
+ else
+ $(error kBuild: Symlink $(symlnk) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
+ endif
+endif
+
+$(eval $(def_install_symlink_rule_staging))
+$(target)_2_STAGE_TARGETS += $(stagedst)
+
+# Calcuate the install destiation and generate the rule (if necessary).
+ifeq ($(instmode),both)
+ local inst := $(strip $(firstdefined $(symlnk)_INST $(target)_1_INST,value))
+ if "$(substr $(inst),-1)" != "/" && "$(inst)" != ""
+ $(warning kBuild: Symlink $(symlnk) in install target $(target) has a INST property without a trailing slash: '$(inst)')
+ local inst := $(inst)/
+ endif
+ ifneq ($(root $(inst)),)
+ $(error kBuild: Symlink $(symlnk) in install target $(target) has a INST property with an absolute path: '$(inst)')
+ endif
+ local inst := $(inst)$(symlnkdir)
+ local instdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
+ $(eval $(def_install_symlink_rule_installing))
+ $(target)_2_INST_TARGETS += $(instdst)
+endif
+
+#$(warning symlnk=$(symlnk) symdst=$(symdst) instdst=$(instdst) stagedst=$(stagedst) instfun=$(instfun) inst=$(inst) stage='$(stage)')
+endef # def_install_symlink
+$(optmize def_install_symlink)
+
+
+##
+# Generate an directory installtion rule.
+# Note. Used both for staging and real install rules.
+#
+define def_install_directory_rule
+$$(call KB_FN_ASSERT_ABSPATH, insdst)
+$(insdst): $(top_deps) | $(top_orderdeps)
+ %$$(call MSG_INST_DIR,$(insdst))
+ $(top_pre_dir_cmds)
+ $$(QUIET)$$(INSTALL) -d \
+ $(if $(uid),-o $(uid))\
+ $(if $(gid),-g $(gid))\
+ $(if $(mode),-m $(mode))\
+ $(flags) -- \
+ $(insdst)
+ $(top_post_dir_cmds)
+
+endef # def_install_directory_rule
+$(eval-opt-var def_install_directory_rule)
+
+##
+# Create one directory.
+#
+define def_install_directory
+
+# gather common properties.
+local mode := $(firstword \
+ $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(directory)_MODE.$(bld_trg)) \
+ $($(target)_$(directory)_MODE) \
+ $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(directory)_MODE.$(bld_trg)) \
+ $($(directory)_MODE) \
+ $(top_mode) )
+local uid := $(firstword \
+ $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(directory)_UID.$(bld_trg)) \
+ $($(target)_$(directory)_UID) \
+ $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(directory)_UID.$(bld_trg)) \
+ $($(directory)_UID) \
+ $(top_uid) )
+local gid := $(firstword \
+ $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(directory)_GID.$(bld_trg)) \
+ $($(target)_$(directory)_GID) \
+ $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(directory)_GID.$(bld_trg)) \
+ $($(directory)_GID) \
+ $(top_gid) )
+local flags := \
+ $(top_idflags) \
+ $($(directory)_IDFLAGS) \
+ $($(directory)_IDFLAGS.$(bld_trg)) \
+ $($(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(directory)_IDFLAGS) \
+ $($(target)_$(directory)_IDFLAGS.$(bld_trg)) \
+ $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
+
+# The staging rule (requires double evaluation).
+local stage := $(strip $(firstdefined $(directory)_STAGE $(directory)_INST $(target)_1_STAGE,value))
+if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
+ $(warning kBuild: Directory $(directory) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
+ local stage := $(stage)/
+endif
+ifeq ($(root $(stage)),)
+ local insdst := $(PATH_STAGE)/$(stage)$(directory)/
+else
+ local stage := $(abspath $(stage))/
+ ifeq ($(pos $(PATH_OBJ),$(stage)),1)
+ local insdst := $(stage)$(directory)/
+ else
+ $(error kBuild: Directory $(directory) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
+ endif
+endif
+
+$(target)_2_STAGE_DIR_TARGETS += $(insdst)
+$(eval $(def_install_directory_rule))
+
+# The install rule.
+ifeq ($(insttype),both)
+ local inst := $(strip $(firstdefined $(directory)_INST $(target)_1_INST,value))
+ ifneq ($(substr $(inst),-1),/)
+ $(warning kBuild: Directory $(directory) in install target $(target) has a INST property without a trailing slash: '$(inst)')
+ local inst := $(inst)/
+ endif
+ ifneq ($(root $(stage)),)
+ $(error kBuild: Directory $(directory) in install target $(target) has a INST property with an absolute path: '$(inst)')
+ endif
+ local insdst := $(PATH_INS)/$(inst)$(directory)/
+ $(target)_2_INST_DIR_TARGETS += $(insdst)
+ $(eval $(def_install_directory_rule))
+endif
+
+#$(warning directory=$(directory) inst=$(inst) stage=$(stage) mode=$(mode) gid=$(gid) uid=$(uid))
+endef # def_install_directory
+$(eval-opt-var def_install_directory)
+
+
+##
+# Process one install target.
+#
+define def_install
+# the basics.
+local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
+local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
+local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
+local insttype := $($(target)_1_INSTTYPE)
+
+ifneq ($(insttype),none)
+ $(target)_2_STAGE_TARGETS := $($(target)_GOALS) $($(target)_STAGE_ONLY_GOALS)
+else
+ $(target)_2_STAGE_TARGETS :=
+endif
+$(target)_2_STAGE_DIR_TARGETS :=
+
+ifeq ($(insttype),both)
+ $(target)_2_INST_TARGETS := $($(target)_GOALS) $($(target)_INST_ONLY_GOALS)
+else
+ $(target)_2_INST_TARGETS :=
+endif
+$(target)_2_INST_DIR_TARGETS :=
+
+
+local outbase := $(call TARGET_BASE,$(target),$(target))
+$(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
+$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+
+ifneq ($(insttype),none)
+ # Cache top level target properties.
+ local top_mode := $(firstword \
+ $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_MODE.$(bld_trg)) \
+ $($(target)_MODE) )
+ local top_exec_mode := $(firstword \
+ $($(target)_EXEC_MODE.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_EXEC_MODE.$(bld_trg)) \
+ $($(target)_EXEC_MODE) )
+ local top_uid := $(firstword \
+ $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_UID.$(bld_trg)) \
+ $($(target)_UID) )
+ local top_gid := $(firstword \
+ $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_GID.$(bld_trg)) \
+ $($(target)_GID) )
+ local top_ifflags := \
+ $($(target)_IFFLAGS) \
+ $($(target)_IFFLAGS.$(bld_trg)) \
+ $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
+ local top_idflags := \
+ $($(target)_IDFLAGS) \
+ $($(target)_IDFLAGS.$(bld_trg)) \
+ $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
+ ifdef $(target)_INSTFUN
+ local top_instfun := $(target)_INSTFUN
+ else
+ local top_instfun := _INSTALL_FILE
+ endif
+ local top_deps := \
+ $($(target)_DEPS.$(bld_trg_cpu)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_DEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_DEPS.$(bld_trg_arch)) \
+ $($(target)_DEPS.$(bld_trg)) \
+ $($(target)_DEPS.$(bld_type)) \
+ $($(target)_DEPS)
+ local top_orderdeps := \
+ $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
+ $($(target)_ORDERDEPS.$(bld_trg_arch)) \
+ $($(target)_ORDERDEPS.$(bld_trg)) \
+ $($(target)_ORDERDEPS.$(bld_type)) \
+ $($(target)_ORDERDEPS)
+ ifdef $(target)_DEFPATH
+ local top_defpath := $($(target)_DEFPATH)
+ else ifdef $(target)_PATH
+ local top_defpath := $($(target)_PATH)
+ else
+ local top_defpath :=
+ endif
+ ifneq ($(top_defpath),)
+ local top_deps := $(abspathex $(top_deps),$(top_defpath))
+ local top_orderdeps := $(abspathex $(top_orderdeps),$(top_defpath))
+ endif
+
+ # The user have to use double expansion and can only use the above locals. Not 100% optimal...
+ local top_pre_file_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_XFILE_CMDS)
+ local top_post_file_cmds := $(evalcall def_fn_prop_get_first_defined,POST_XFILE_CMDS)
+ local top_pre_sym_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_SYMLINK_CMDS)
+ local top_post_sym_cmds := $(evalcall def_fn_prop_get_first_defined,POST_SYMLINK_CMDS)
+ local top_pre_dir_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_DIRECTORY_CMDS)
+ local top_post_dir_cmds := $(evalcall def_fn_prop_get_first_defined,POST_DIRECTORY_CMDS)
+
+ $(foreach directory, \
+ $($(target)_DIRS) \
+ $($(target)_DIRS.$(bld_trg)) \
+ $($(target)_DIRS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_DIRS.$(bld_trg_arch)) \
+ $($(target)_DIRS.$(bld_trg_cpu)) \
+ $($(target)_DIRS.$(bld_type)), \
+ $(evalval def_install_directory))
+
+ local clean_files := \
+ $($(target)_CLEAN) \
+ $($(target)_CLEAN.$(bld_trg)) \
+ $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_CLEAN.$(bld_trg_arch)) \
+ $($(target)_CLEAN.$(bld_trg_cpu)) \
+ $($(target)_CLEAN.$(bld_type))
+
+ local source_type_prefix :=
+ local source_type_mode := $(firstword $(top_mode) a+r,u+w)
+ $(foreach src,\
+ $($(target)_SOURCES) \
+ $($(target)_SOURCES.$(bld_trg)) \
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_SOURCES.$(bld_type)), \
+ $(evalval def_install_src))
+
+ local source_type_prefix := EXEC_
+ local source_type_mode := $(firstword $(top_exec_mode) a+xr,u+w)
+ $(foreach src,\
+ $($(target)_EXEC_SOURCES) \
+ $($(target)_EXEC_SOURCES.$(bld_trg)) \
+ $($(target)_EXEC_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_EXEC_SOURCES.$(bld_trg_arch)) \
+ $($(target)_EXEC_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_EXEC_SOURCES.$(bld_type)), \
+ $(evalval def_install_src))
+
+ $(foreach src,\
+ $($(target)_SYMLINKS) \
+ $($(target)_SYMLINKS.$(bld_trg)) \
+ $($(target)_SYMLINKS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SYMLINKS.$(bld_trg_arch)) \
+ $($(target)_SYMLINKS.$(bld_trg_cpu)) \
+ $($(target)_SYMLINKS.$(bld_type)), \
+ $(evalval def_install_symlink))
+else # none
+ local clean_files :=
+endif
+
+# The collection targets (staging only).
+local clean_files += $($(target)_1_TARGET)
+$($(target)_1_TARGET): $$($(target)_2_STAGE_TARGETS) | $$($(target)_2_STAGE_DIR_TARGETS) $$(dir $$@)
+ @$(QUIET2)$(APPEND) $@
+
+$(target): $$($(target)_1_TARGET)
+
+# Update Global lists.
+_INSTALLS += $($(target)_1_TARGET)
+_STAGE_FILES += $($(target)_2_STAGE_TARGETS)
+_STAGE_DIRS += $($(target)_2_STAGE_DIR_TARGETS)
+_INSTALLS_FILES += $($(target)_2_INST_TARGETS)
+_INSTALLS_DIRS += $($(target)_2_INST_DIR_TARGETS)
+_CLEAN_FILES += $(clean_files)
+_DIRS += \
+ $($(target)_0_OUTDIR) \
+ $($(target)_BLDDIRS) \
+ $($(target)_BLDDIRS.$(bld_trg)) \
+ $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_BLDDIRS.$(bld_trg_arch)) \
+ $($(target)_BLDDIRS.$(bld_trg_cpu)) \
+ $($(target)_BLDDIRS.$(bld_type))
+
+# Deprecated properties.
+INSTARGET_$(target) := $($(target)_2_STAGE_TARGETS)
+INSTARGET_DIRS_$(target) := $($(target)_2_STAGE_DIR_TARGETS)
+
+endef # def_install
+$(eval-opt-var def_install)
+
+## Do pass 1 on the implicit targets and add them to the list.
+$(foreach target, $(_ALL_INSTALLS_IMPLICIT), \
+ $(evalval def_pass1_install))
+_ALL_INSTALLS += $(_ALL_INSTALLS_IMPLICIT)
+
+## Do pass 2 on all install targets.
+$(foreach target, $(_ALL_INSTALLS), \
+ $(evalvalctx def_install))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done install targets)
+endif
+
+#
+# Some introspection targets that can be useful for package maintainers.
+#
+.PHONY: kbuild-show-install-files kbuild-show-install-dirs
+kbuild-show-install-files::
+ $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_FILES)))
+
+kbuild-show-install-dirs::
+ $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_DIRS)))
+
+kbuild-show-stage-files::
+ $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_FILES)))
+
+kbuild-show-stage-dirs::
+ $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_DIRS)))
+
+
diff --git a/kBuild/footer-pass2-patches.kmk b/kBuild/footer-pass2-patches.kmk
new file mode 100644
index 0000000..af07b6c
--- /dev/null
+++ b/kBuild/footer-pass2-patches.kmk
@@ -0,0 +1,55 @@
+# $Id: footer-pass2-patches.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Patches.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+##
+## Patching.
+##
+##
+#define def_patch_src
+#
+#endef
+#
+#
+## Deal with one patch target.
+#define def_patch
+#
+#$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(KBUILD_TARGET_ARCH)) $($(target)_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),\
+# $(evalval def_patch_src))
+#
+#_PATCHES +=
+#endef
+#
+#$(foreach target, $(_ALL_PATCHES), \
+# $(evalval def_patch))
+#
+
diff --git a/kBuild/footer-passes.kmk b/kBuild/footer-passes.kmk
new file mode 100644
index 0000000..40fd397
--- /dev/null
+++ b/kBuild/footer-passes.kmk
@@ -0,0 +1,255 @@
+# $Id: footer-passes.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild - Footer - Target lists - Pass 2 - Passes.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+#
+# PASSES (including directory and makefile walking)
+#
+
+#
+# First, check whether we need to order the passes explicitly or not.
+# This depends on whether we're a leaf makefile or not. A leaf will
+# know all its dependencies, while a recursive one relies on the
+# order sub-directories and other makefiles are executed it.
+#
+
+## Setup a pass and check for optimizations.
+# @param $(PASS) Uppercase pass name.
+define def_pass_setup_and_optimize
+
+# The setup. ## @todo This is looks a bit weird...
+ifndef SUBDIRS_$(PASS)
+ SUBDIRS_$(PASS) := $(SUBDIRS) $(SUBDIRS.$(KBUILD_TARGET)) $(SUBDIRS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
+endif
+ifndef SUBDIRS_AFTER_$(PASS)
+ SUBDIRS_AFTER_$(PASS) := $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(KBUILD_TARGET)) $(SUBDIRS_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
+endif
+ifndef MAKEFILES_BEFORE_$(PASS)
+ MAKEFILES_BEFORE_$(PASS) := $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(KBUILD_TARGET)) $(MAKEFILES_BEFORE.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
+endif
+ifndef MAKEFILES_AFTER_$(PASS)
+ MAKEFILES_AFTER_$(PASS) := $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(KBUILD_TARGET)) $(MAKEFILES_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
+endif
+
+# The check.
+ifeq ($(_KBUILD_STRICT_PASS_ORDER),nonstrict)
+ ifneq ($(strip \
+ $(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ $(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+ ),)
+ _KBUILD_STRICT_PASS_ORDER := strict
+ endif
+endif # _KBUILD_STRICT_PASS_ORDER == nonstrict
+endef # def_pass_setup_and_optimize
+$(eval-opt-var def_pass_setup_and_optimize)
+
+## PASS: Setup & optimization.
+# Check if we can apply the non-strict pass order optimzation (no SUBDIRS_* and MAKEFILES_*),
+# and set up the pass specific variables as we go along.
+_KBUILD_STRICT_PASS_ORDER := nonstrict
+$(foreach PASS, $(PASSES), $(evalval def_pass_setup_and_optimize))
+#$ (error _KBUILD_STRICT_PASS_ORDER=$(_KBUILD_STRICT_PASS_ORDER))
+
+ifeq ($(_KBUILD_STRICT_PASS_ORDER),strict)
+ if !defined(KBUILD_SAFE_PARALLEL) || "$(KMK_OPT_JOBS)" == "1"
+_KBUILD_STRICT_PASS_ORDER := strict_unsafe
+ endif
+endif
+
+
+## Subdir
+# @param $(pass) Lowercase pass name.
+# @param $(PASS) Uppercase pass name.
+# @param $(subdir) Subdirectory
+# @param $(tag) tag to attach to the rule name.
+define def_pass_subdir
+pass_$(pass)$(tag):: $(dep)
+ + $$(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
+endef
+
+## Submakefile
+# @param $(pass) Lowercase pass name.
+# @param $(PASS) Uppercase pass name.
+# @param $(makefile) Makefile.
+# @param $(tag) tag to attach to the rule name.
+define def_pass_makefile
+pass_$(pass)$(tag):: $(dep)
+ + $$(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
+endef
+
+## Execute a pass, strict order.
+# @param $(pass) Lowercase pass name.
+# @param $(PASS) Uppercase pass name.
+define def_pass_strict
+$(eval tag:=_before)
+$(eval dep:= )
+$(foreach subdir, $(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
+
+$(eval tag:=_after)
+$(eval dep:=pass_$(pass)_doit)
+$(foreach subdir, $(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
+
+.NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this
+.PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this pass_$(pass)_doit
+pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var)))
+pass_$(pass)_this: pass_$(pass)_before
+ + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
+pass_$(pass)_after:: pass_$(pass)_this
+pass_$(pass): pass_$(pass)_after
+#$ (warning pass=$(pass) PASS=$(PASS): $(PASS_$(PASS)_trgs) $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var))))
+endef # def_pass_strict
+$(eval-opt-var def_pass_strict)
+
+## Execute a pass, strict order.
+# @param $(pass) Lowercase pass name.
+# @param $(PASS) Uppercase pass name.
+define def_pass_strict_unsafe
+$(eval tag:=_before)
+$(eval dep:= )
+$(foreach subdir, $(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
+
+$(eval tag:=_after)
+$(eval dep:=pass_$(pass)_doit)
+$(foreach subdir, $(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
+
+.PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
+.NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
+pass_$(pass)_doit: pass_$(pass)_before \
+ $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var)))
+pass_$(pass): \
+ pass_$(pass)_before \
+ pass_$(pass)_doit \
+ pass_$(pass)_after
+#$ (warning pass=$(pass) PASS=$(PASS): $(PASS_$(PASS)_trgs) $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var))))
+endef # def_pass_strict_unsafe
+$(eval-opt-var def_pass_strict_unsafe)
+
+## Execute a pass, non-strict pass ordering.
+# @param $(pass) Lowercase pass name.
+# @param $(PASS) Uppercase pass name.
+define def_pass_nonstrict
+.PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
+pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$$$$($(var)))
+pass_$(pass): pass_$(pass)_doit
+endef # def_pass_nonstrict
+
+## PASS: rules
+# Generate the rules for the defined passes.
+$(foreach PASS, $(PASSES), \
+ $(eval pass := $(PASS_$(PASS)_pass)) \
+ $(eval $(def_pass_$(_KBUILD_STRICT_PASS_ORDER))))
+
+
+## Pass order, strict.
+# @param $(pass) Current pass name.
+# @param $(prev_pass) The previous pass name.
+define def_pass_order_strict
+.PHONY: pass_$(pass)_order
+.NOTPARALLEL: pass_$(pass)_order
+pass_$(pass)_order: $(pass_prev)
+ %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
+ + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
+$(eval pass_prev := pass_$(pass)_order)
+endef # def_pass_order_strict
+$(eval-opt-var def_pass_order_strict)
+
+## Pass order, strict unsafe.
+# @param $(pass) Current pass name.
+# @param $(prev_pass) The previous pass name.
+define def_pass_order_strict_unsafe
+.NOTPARALLEL: pass_$(pass)_order pass_$(pass)_banner
+.PHONY: pass_$(pass)_order pass_$(pass)_banner
+pass_$(pass)_banner: $(pass_prev)
+ %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
+pass_$(pass)_order: $(pass_prev) \
+ pass_$(pass)_banner \
+ pass_$(pass)
+$(eval pass_prev := pass_$(pass)_order)
+endef # def_pass_order_strict_unsafe
+$(eval-opt-var def_pass_order_strict_unsafe)
+
+## Pass order, non-strict.
+# @param $(pass) Current pass name.
+# @param $(prev_pass) The previous pass name.
+define def_pass_order_nonstrict
+.PHONY: pass_$(pass)_order pass_$(pass)_banner
+pass_$(pass)_banner:
+ %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
+pass_$(pass)_order: \
+ $(pass_prev) \
+ pass_$(pass)_banner \
+ pass_$(pass)
+$(eval pass_prev := pass_$(pass)_order)
+endef # def_pass_order_nonstrict
+$(eval-opt-var def_pass_order_nonstrict)
+
+## PASS: order
+# Use dependencies to ensure correct pass order.
+pass_prev :=
+$(foreach PASS,$(DEFAULT_PASSES),\
+ $(eval pass := $(PASS_$(PASS)_pass)) \
+ $(eval $(def_pass_order_$(_KBUILD_STRICT_PASS_ORDER))))
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, done passes)
+endif
+
+# Some common pass aliases
+ifndef KBUILD_NO_PASS_ALIASES
+.PHONY: clean
+clean: pass_clean
+
+.PHONY: nothing
+nothing: pass_nothing
+
+.PHONY: staging
+staging: pass_staging
+
+.PHONY: packing
+packing: pass_packing
+
+ ifndef KBUILD_NO_TESTING_PASS_ALIASES
+.PHONY: check
+check:: pass_testing
+
+.PHONY: test
+test:: pass_testing
+ endif # KBUILD_NO_TESTING_PASS_ALIASES
+endif # KBUILD_NO_PASS_ALIASES
+
+
diff --git a/kBuild/footer.kmk b/kBuild/footer.kmk
new file mode 100644
index 0000000..edb33e5
--- /dev/null
+++ b/kBuild/footer.kmk
@@ -0,0 +1,451 @@
+# $Id: footer.kmk 3305 2020-01-14 15:11:48Z bird $
+## @file
+# kBuild - File included at bottom of a makefile.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef __footer_kmk__
+# start-of-file-content
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, start of footer.kmk)
+ _KBUILD_TS_FOOTER_START := $(_KBUILD_TS_PREV)
+endif
+
+#
+# Variables.
+# (Some of these need initialization before including definitions using them.)
+#
+
+# All targets of each types.
+_ALL_BLDPROGS := $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_CPU)) $(BLDPROGS.$(KBUILD_TYPE))
+_ALL_LIBRARIES := $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_CPU)) $(LIBRARIES.$(KBUILD_TYPE))
+_ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU)) $(IMPORT_LIBS.$(KBUILD_TYPE))
+_ALL_DLLS := $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_CPU)) $(DLLS.$(KBUILD_TYPE))
+_ALL_PROGRAMS := $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_CPU)) $(PROGRAMS.$(KBUILD_TYPE))
+_ALL_SYSMODS := $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_CPU)) $(SYSMODS.$(KBUILD_TYPE))
+_ALL_MISCBINS := $(MISCBINS) $(MISCBINS.$(KBUILD_TARGET)) $(MISCBINS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_CPU)) $(MISCBINS.$(KBUILD_TYPE))
+_ALL_OTHERS := $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_CPU)) $(OTHERS.$(KBUILD_TYPE))
+_ALL_INSTALLS := $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_CPU)) $(INSTALLS.$(KBUILD_TYPE))
+_ALL_FETCHES := $(FETCHES) $(FETCHES.$(KBUILD_TARGET)) $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_CPU)) $(FETCHES.$(KBUILD_TYPE))
+_ALL_PATCHES := $(PATCHES) $(PATCHES.$(KBUILD_TARGET)) $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_CPU)) $(PATCHES.$(KBUILD_TYPE))
+
+# all targets.
+_ALL_TARGETS = \
+ $(_ALL_FETCHES) \
+ $(_ALL_PATCHES) \
+ $(_ALL_BLDPROGS) \
+ $(_ALL_LIBRARIES) \
+ $(_ALL_IMPORT_LIBS) \
+ $(_ALL_DLLS) \
+ $(_ALL_PROGRAMS) \
+ $(_ALL_SYSMODS) \
+ $(_ALL_MISCBINS) \
+ $(_ALL_INSTALLS) \
+ $(_ALL_OTHERS)
+
+# all $(KBUILD_TARGET) targets.
+_ALL_TARGET_TARGETS = \
+ $(_ALL_FETCHES) \
+ $(_ALL_PATCHES) \
+ $(_ALL_LIBRARIES) \
+ $(_ALL_IMPORT_LIBS) \
+ $(_ALL_DLLS) \
+ $(_ALL_PROGRAMS) \
+ $(_ALL_SYSMODS) \
+ $(_ALL_MISCBINS) \
+ $(_ALL_INSTALLS) \
+ $(_ALL_OTHERS)
+
+# all $(KBUILD_HOST) targets.
+_ALL_HOST_TARGETS = \
+ $(_ALL_BLDPROGS)
+
+# all targets making use of srcname.
+_ALL_SRCNAME_TARGETS = \
+ $(_ALL_FETCHES) \
+ $(_ALL_PATCHES)
+
+# Dependency files. (currently not on target level, only this global stuff)
+_DEPFILES := $(DEPFILES) $(DEPFILES.$(KBUILD_TARGET)) $(DEPFILES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DEPFILES.$(KBUILD_TARGET_ARCH)) $(DEPFILES.$(KBUILD_TARGET_CPU)) $(DEPFILES.$(KBUILD_TYPE))
+
+
+# All kind of output files except for _OBJS and _DEPFILES.
+# Compiling or linking definition outputting other things that $@ and any
+# required dependency file must add those output files to this variable.
+_OUT_FILES :=
+
+# Files which only requires cleaning up.
+_CLEAN_FILES :=
+
+# all of a type
+_OBJS :=
+_FETCHES :=
+_DOWNLOADS:=
+_UNPACKS :=
+_PATCHES :=
+_UNFETCHES:=
+_BLDPROGS :=
+_LIBS :=
+_DLLS :=
+_PROGRAMS :=
+_SYSMODS :=
+_MISCBINS :=
+_STAGE_FILES :=
+_STAGE_DIRS :=
+_INSTALLS :=
+_INSTALLS_FILES :=
+_INSTALLS_DIRS :=
+_DEBUG_STAGE_FILES :=
+_DEBUG_STAGE_DIRS :=
+_DEBUG_INSTALL_FILES :=
+_DEBUG_INSTALL_DIRS :=
+_OTHERS :=
+_PACKING :=
+_DIRS := $(PATH_TARGET)/ $(PATH_TARGET) $(BLDDIRS)
+_IMPORT_LIBS :=
+
+# Implicit targets added while processing other targets (usually by units).
+_ALL_INSTALLS_IMPLICIT :=
+
+# misc
+pass_prev :=
+
+
+
+#
+# Footer macros
+#
+
+## Figure out the tool for a target.
+# @param $1 normalized target.
+# @param $2 tooltype.
+# @param bld_trg build target.
+# @param bld_trg_arch build target architecture.
+# @param bld_type build target type.
+if 0
+_TARGET_TOOL = $(strip $(firstword \
+ $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $($(1)_$(2)TOOL.$(bld_trg)) \
+ $($(1)_$(2)TOOL) \
+ $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $($(1)_TOOL.$(bld_trg)) \
+ $($(1)_TOOL) \
+ $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $($(2)TOOL.$(bld_trg)) \
+ $($(2)TOOL) \
+ $(TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $(TOOL.$(bld_trg)) \
+ $(TOOL) \
+))
+else
+_TARGET_TOOL = $(strip $(firstword \
+ $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $($(1)_$(2)TOOL.$(bld_trg).$(bld_type)) \
+ $($(1)_$(2)TOOL.$(bld_trg_arch)) \
+ $($(1)_$(2)TOOL.$(bld_trg)) \
+ $($(1)_$(2)TOOL.$(bld_type)) \
+ $($(1)_$(2)TOOL) \
+ $($(1)_TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $($(1)_TOOL.$(bld_trg).$(bld_type)) \
+ $($(1)_TOOL.$(bld_trg_arch)) \
+ $($(1)_TOOL.$(bld_trg)) \
+ $($(1)_TOOL.$(bld_type)) \
+ $($(1)_TOOL) \
+ $($(2)TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $($(2)TOOL.$(bld_trg).$(bld_type)) \
+ $($(2)TOOL.$(bld_trg_arch)) \
+ $($(2)TOOL.$(bld_trg)) \
+ $($(2)TOOL.$(bld_type)) \
+ $($(2)TOOL) \
+ $(TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $(TOOL.$(bld_trg).$(bld_trg_arch)) \
+ $(TOOL.$(bld_trg).$(bld_type)) \
+ $(TOOL.$(bld_trg_arch)) \
+ $(TOOL.$(bld_trg)) \
+ $(TOOL.$(bld_type)) \
+ $(TOOL) \
+))
+endif
+
+## Figure out the actual name of an installed file.
+# @param $1 The file to install.
+# @param $2 The target name.
+# @param $3 The _INST value (can be empty).
+# @param $4 The installation root directory.
+_INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(4)/$(3),$(4)/))
+
+
+##
+# Function for getting the first defined propert value.
+#
+# @param 1 The property name.
+# @param 2 The default property name, empty if none.
+# @param 3 What to return if all variables are empty. (optional)
+# @note Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
+# @returns Expanded property value.
+#
+define def_fn_prop_get_first_defined
+local .RETURN := $(firstdefined \
+ $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(target)_$(1).$(bld_trg).$(bld_trg_arch) \
+ $(target)_$(1).$(bld_trg).$(bld_type) \
+ $(target)_$(1).$(bld_trg_cpu) \
+ $(target)_$(1).$(bld_trg_arch) \
+ $(target)_$(1).$(bld_trg) \
+ $(target)_$(1).$(bld_type) \
+ $(target)_$(1) \
+)
+ifeq ($(.RETURN),)
+ ifneq ($(2),)
+ local .RETURN := $(firstdefined \
+ $(2).$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ $(2).$(bld_trg).$(bld_trg_arch) \
+ $(2).$(bld_trg).$(bld_type) \
+ $(2).$(bld_trg_cpu) \
+ $(2).$(bld_trg_arch) \
+ $(2).$(bld_trg) \
+ $(2).$(bld_type) \
+ $(2) \
+ 3 \
+ )
+ else
+ local .RETURN := $(firstdefined \
+ kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
+ kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch) \
+ kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type) \
+ kBuildGlobalDefaults_$(1).$(bld_trg_cpu) \
+ kBuildGlobalDefaults_$(1).$(bld_trg_arch) \
+ kBuildGlobalDefaults_$(1).$(bld_trg) \
+ kBuildGlobalDefaults_$(1).$(bld_type) \
+ kBuildGlobalDefaults_$(1) \
+ 3 \
+ )
+ endif
+endif
+local .RETURN := $(strip $($(.RETURN)))
+endef # def_fn_prop_get_first_defined
+
+##
+# Function for getting the first property value (ignoring empty defines).
+#
+# @param 1 The property name.
+# @param 2 The default property name, empty if none.
+# @param 3 What to return if all variables are empty. (optional)
+# @note Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
+# @returns First word.
+#
+define def_fn_prop_get_first_word
+local .RETURN := $(firstword \
+ $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(1).$(bld_trg).$(bld_type)) \
+ $($(target)_$(1).$(bld_trg_cpu)) \
+ $($(target)_$(1).$(bld_trg_arch)) \
+ $($(target)_$(1).$(bld_trg)) \
+ $($(target)_$(1).$(bld_type)) \
+ $($(target)_$(1)) \
+)
+ifeq ($(.RETURN),)
+ ifneq ($(2),)
+ local .RETURN := $(firstword \
+ $($(2).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $($(2).$(bld_trg).$(bld_trg_arch)) \
+ $($(2).$(bld_trg).$(bld_type)) \
+ $($(2).$(bld_trg_cpu)) \
+ $($(2).$(bld_trg_arch)) \
+ $($(2).$(bld_trg)) \
+ $($(2).$(bld_type)) \
+ $($(2)) \
+ $(3) \
+ )
+ else
+ local .RETURN := $(firstword \
+ $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+ $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch)) \
+ $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type)) \
+ $(kBuildGlobalDefaults_$(1).$(bld_trg_cpu)) \
+ $(kBuildGlobalDefaults_$(1).$(bld_trg_arch)) \
+ $(kBuildGlobalDefaults_$(1).$(bld_trg)) \
+ $(kBuildGlobalDefaults_$(1).$(bld_type)) \
+ $(kBuildGlobalDefaults_$(1)) \
+ $(3) \
+ )
+ endif
+endif
+endef # def_fn_prop_get_first_word
+
+
+##
+# Function for collecting properties, priority ones last.
+#
+# @param 1 The property name.
+# @param 2 The default property name, empty if none.
+# @note Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
+# @returns All properties.
+#
+define def_fn_prop_get_all_priority_last
+local .RETURN := \
+ $($(target)_$(1)) \
+ $($(target)_$(1).$(bld_type)) \
+ $($(target)_$(1).$(bld_trg)) \
+ $($(target)_$(1).$(bld_trg_arch)) \
+ $($(target)_$(1).$(bld_trg_cpu)) \
+ $($(target)_$(1).$(bld_trg).$(bld_type)) \
+ $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
+endef # def_fn_prop_get_all_priority_last
+
+
+##
+# Function for collecting properties with prefixing, priority ones last.
+#
+# @param 1 The property name.
+# @param 2 Something like $(NLTAB).
+# @note Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
+# @returns All properties.
+#
+define def_fn_prop_get_all_prefixed_priority_last
+local .RETURN := \
+ $(if $($(target)_$(1)),$(2),)$($(target)_$(1)) \
+ $(if $($(target)_$(1).$(bld_type)),$(2),)$($(target)_$(1).$(bld_type)) \
+ $(if $($(target)_$(1).$(bld_trg)),$(2),)$($(target)_$(1).$(bld_trg)) \
+ $(if $($(target)_$(1).$(bld_trg_arch)),$(2),)$($(target)_$(1).$(bld_trg_arch)) \
+ $(if $($(target)_$(1).$(bld_trg_cpu)),$(2),)$($(target)_$(1).$(bld_trg_cpu)) \
+ $(if $($(target)_$(1).$(bld_trg).$(bld_type)),$(2),)$($(target)_$(1).$(bld_trg).$(bld_type)) \
+ $(if $($(target)_$(1).$(bld_trg).$(bld_trg_arch)),$(2),)$($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
+ $(if $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)),$(2),)$($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
+endef # def_fn_prop_get_all_prefixed_priority_last
+
+
+#
+# The main body.
+#
+include $(KBUILD_PATH)/footer-inherit-uses-tools.kmk
+include $(KBUILD_PATH)/footer-pass1.kmk
+include $(KBUILD_PATH)/footer-pass2-fetches.kmk
+include $(KBUILD_PATH)/footer-pass2-patches.kmk
+include $(KBUILD_PATH)/footer-pass2-compiling-targets.kmk
+include $(KBUILD_PATH)/footer-pass2-installs.kmk
+include $(KBUILD_PATH)/footer-misc.kmk
+include $(KBUILD_PATH)/footer-passes.kmk
+
+
+#
+# THE MAIN RULES
+#
+all_recursive: $(pass_prev)
+
+rebuild: clean
+ + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
+
+# @todo make this a non-default pass!
+uninstall::
+ $(RM) -f -- $(_INSTALLS_FILES)
+
+install:: pass_installs
+
+# misc shortcuts (use secondary expansion here to save strcache[file] space).
+targets: bldprogs libraries dlls programs sysmods miscbins others installs
+objects: $$(_OBJS)
+bldprogs: $$(_BLDPROGS)
+libraries: $$(_LIBS) $$(_IMPORT_LIBS) $$(_OTHER_LIBRARIES)
+dlls: $$(_DLLS)
+programs: $$(_PROGRAMS)
+sysmods: $$(_SYSMODS)
+miscbins: $$(_MISCBINS)
+others: $$(_OTHERS)
+stagings: $$(_INSTALLS) $$(_STAGE_DIRS) $$(_STAGE_FILES)
+installs: $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
+
+install-debug: $$(_DEBUG_INSTALL_DIRS) $$(_DEBUG_INSTALL_FILES)
+
+
+
+#
+# kBuild debugging stuff.
+#
+## @todo this doesn't work. Move to a debug unit and expand it.
+show_targets:
+ @$(foreach target, $(_ALL_TARGETS),\
+ @$(ECHO) "target: $(target)" $(NLTAB)\
+ @$(ECHO) " $(target)_0_OUTDIR=$($(target)_0_OUTDIR)" $(NLTAB)\
+ @$(ECHO) " $(target)_1_TARGET=$($(target)_1_TARGET)" $(NLTAB)\
+ @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
+$(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) 2_OBJS CLEAN, \
+ $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
+ $(if $($(target)_$(prop).$(_tmp)),\
+ @$(ECHO) " $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
+ $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) " $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
+)\
+$(foreach prop,$(PROPS_DEFERRED), \
+ $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
+ $(if $(value $(target)_$(prop).$(_tmp)),\
+ @$(ECHO) ' $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
+ $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) ' $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
+))
+
+
+
+#
+# Include dependency files.
+#
+ifdef _DEPFILES
+ # TODO: first works the second doesn't, provided _KB_INCLUDE_DEPS is undefined:
+ # if "$(_KB_INCLUDE_DEPS)" == "1"
+ # if $(_KB_INCLUDE_DEPS) == "1"
+
+ ifdef KB_HAVE_INCLUDEDEP_QUEUE
+ includedep-queue $(_DEPFILES)
+ else
+ $(foreach dep, $(_DEPFILES), $(eval includedep $(dep)))
+ endif
+endif
+
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, end of footer.kmk)
+ _KBUILD_TS_FOOTER_END := $(_KBUILD_TS_PREV)
+
+ ifneq ($(KBUILD_PROFILE_SELF),0)
+ $(info prof: ALL=$(words $(_ALL_TARGETS)) BLDPROGS=$(words $(_ALL_BLDPROGS)) LIBRARIES=$(words $(_ALL_LIBRARIES)) IMPORT_LIBS=$(words $(IMPORT_LIBS)) DLLS=$(words $(DLLS)) PROGRAMS=$(words $(_ALL_PROGRAMS)) )
+ $(info prof: SYSMODS=$(words $(_ALL_SYSMODS)) MISCBINS=$(words $(_ALL_MISCBINS)) OTHERS=$(words $(_ALL_OTHERS)) INSTALLS=$(words $(_ALL_INSTALLS)) FETCHES=$(words $(_ALL_FETCHES)) PACKING=$(words $(_PACKING)) TESTING=$(words $(TESTING)) )
+ $(info prof: DIRS=$(words $(_DIR_ALL)) TOOLS=$(words $(_TOOLS)) SDKS=$(words $(_SDKS)) USES=$(words $(_USES)) OUT_FILES=$(words $(_OUT_FILES)) OBJS=$(words $(_OBJS)) CLEAN_FILES=$(words $(CLEAN_FILES) $(OTHER_CLEAN)) )
+ $(info prof: DEPFILES_INCLUDED=$(words $(_DEPFILES_INCLUDED)) DEPFILES=$(words $(_DEPFILES)) MAKEFILES=$(words $(MAKEFILE_LIST)) )
+ endif
+endif
+
+
+# end-of-file-content
+__footer_kmk__ := target
+endif # !defined(__footer_kmk__)
+
diff --git a/kBuild/header.kmk b/kBuild/header.kmk
new file mode 100644
index 0000000..17c511c
--- /dev/null
+++ b/kBuild/header.kmk
@@ -0,0 +1,1785 @@
+# $Id: header.kmk 3579 2023-01-05 01:53:41Z bird $
+## @file
+# kBuild - File included at top of a makefile.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef __header_kmk__
+# start-of-file-content
+ifdef KBUILD_PROFILE_SELF
+ _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query
+ $(info prof: since start - since previous -- event description)
+ ifeq ($(KBUILD_PROFILE_SELF),2)
+ $(info stat: $(make-stats ))
+ endif
+ _KBUILD_TS_HEADER_START := $(nanots )
+ _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START)
+
+ _KBUILD_FMT_ELAPSED_EX = $(int-div $(int-add $(int-sub $1, $2),500000),1000000)ms
+ _KBUILD_FMT_ELAPSED = $(call _KBUILD_FMT_ELAPSED_EX,$(_KBUILD_TS_NOW),$1)
+
+define def_profile_self
+ _KBUILD_TS_NOW := $(nanots )
+ $(info prof: $(call _KBUILD_FMT_ELAPSED,$(_KBUILD_TS_HEADER_START)) - $(call _KBUILD_FMT_ELAPSED, $(_KBUILD_TS_PREV)) -- $(strip $1))
+ ifeq ($(KBUILD_PROFILE_SELF),2)
+ $(info stat: $(make-stats ))
+ endif
+ _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
+endef
+
+endif
+
+
+#
+# Check make version before we do anything else.
+#
+ifndef KMK_VERSION
+ $(error kBuild: The kmk default variable KMK_VERSION isn't defined! Make sure you are using 'kmk' and not 'make', 'gmake', 'kmk_gmake', 'dmake' or any other make program)
+endif
+ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
+ ifneq ($(KBUILD_VERSION_MAJOR),0)
+ $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!)
+ else
+ $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!)
+ endif
+else
+ if $(KBUILD_VERSION_PATCH) < 999
+ $(error kBuild: kmk version mismatch! Expected 0.1.999 or later. Actual version is $(KBUILD_VERSION).)
+ endif
+endif
+
+#
+# The revision in which this file was last modified.
+# This can be useful when using development versions of kBuild.
+#
+KMK_REVISION := $(patsubst %:,, $Rev: 3579 $ )
+
+
+#
+# Define the default goal.
+#
+.PHONY: all all_recursive
+all: all_recursive
+
+#
+# The phony FORCE target.
+#
+.PHONY: FORCE
+FORCE:
+
+
+#
+# Enable delete on error and second expansion of prerequisites and targets.
+#
+.DELETE_ON_ERROR:
+
+.SECONDEXPANSION:
+
+.SECONDTARGETEXPANSION:
+
+
+#
+# General purpose macros.
+#
+
+##
+# Newline character(s).
+define NL
+
+
+endef
+
+##
+# Tab character.
+TAB := $(subst ., ,.)
+
+##
+# Newline + tab characters (for generating commands).
+NLTAB = $(NL)$(TAB)
+
+##
+# Space character.
+SP := $(subst ., ,.)
+
+##
+# Hash character.
+define HASH
+#
+endef
+
+##
+# Colon character.
+COLON := :
+
+##
+# Semicolon character.
+SEMICOLON := ;
+
+##
+# Comma character.
+COMMA := ,
+
+##
+# Dot character.
+DOT := .
+
+##
+# Dollar character.
+DOLLAR := $$
+
+##
+# Equal character.
+EQUAL := =
+
+##
+# Percent character.
+PERCENT := %
+
+##
+# Single quote character.
+SQUOTE := '
+
+##
+# Double quote character.
+DQUOTE := "
+
+##
+# Opening parenthesis.
+OPENPAR := (
+
+##
+# Closing parenthesis.
+CLOSEPAR := )
+
+
+#
+# The list of standard build types in kBuild.
+#
+# This list can be extended in Config.kmk and it's possible to extend
+# (inherit) another build type.
+#
+KBUILD_BLD_TYPES := release profile debug
+
+
+#
+# The OSes, Architectures and CPUs that kBuild recognizes.
+#
+# When kBuild is ported to a new OS or architecture a unique keyword needs
+# to be assigned to it and added here. This strictness is required because
+# this keyword namespace is shared between OSes, architectures, cpus and
+# build types. (PORTME)
+#
+KBUILD_OSES := darwin dos dragonfly freebsd gnuhurd gnukfbsd gnuknbsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
+KBUILD_ARCHES := x86 amd64 noarch alpha arm32 arm64 hppa32 hppa64 ia64 m68k mips32 mips64 ppc32 ppc64 riscv32 riscv64 s390 s390x sh32 sh64 sparc32 sparc64 x32
+KBUILD_ARCHES_64 := amd64 alpha arm64 hppa64 ia64 mips64 ppc64 riscv64 s390x sh64 sparc64 x32
+KBUILD_ARCHES_32 := x86 arm32 hppa32 m68k mips32 ppc32 riscv32 s390 sh32 sparc32
+
+
+
+#
+# Mapping of kBuild OS + ARCH to GNU system type wildcards.
+# For use with the foreach/append/prepend and wildcard functions.
+#
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.darwin.x86 = i?86-apple-darwin*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.darwin.amd64 = x86_64-apple-darwin* amd64-apple-darwin*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.freebsd.x86 = i?86-*freebsd*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.freebsd.amd64 = x86_64-*freebsd* amd64-*freebsd*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.linux.x86 = i?86-*linux-gnu
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.linux.amd64 = x86_64-*linux-gnu amd64-*linux-gnu
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.netbsd.x86 = i?86-*netbsd*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.netbsd.amd64 = x86_64-*netbsd* amd64-*netbsd*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.os2.x86 = i?86-*os2*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.x86 = i?86-*solaris2*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.amd64 = amd64-*solaris2* x86_64-*solaris2*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.sparc32 = sparc-*solaris2*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.sparc64 = sparc64-*solaris2* sparcv9-*solaris2*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.win.x86 = i?86-*mingw32* i?86-*msys* i?86-*cygwin*
+KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.win.amd64 = x86_64-*mingw64* amd64-*mingw64* x86_64-*msys* amd64-*msys* x86_64-*cygwin* amd64-*cygwin*
+
+
+#
+# Set default build type.
+#
+ifndef KBUILD_TYPE
+ ifdef BUILD_TYPE
+ KBUILD_TYPE := $(BUILD_TYPE)
+ endif
+else ifdef BUILD_TYPE
+ ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
+ ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
+ $(warning kBuild: Please use KBUILD_TYPE instead of BUILD_TYPE on the command line!)
+ KBUILD_TYPE := $(BUILD_TYPE)
+ else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
+ $(error kBuild: KBUILD_TYPE (command line) and BUILD_TYPE (env) disagree.)
+ endif
+ endif
+endif
+override BUILD_TYPE = $(KBUILD_TYPE)
+
+ifndef KBUILD_TYPE
+ KBUILD_TYPE := release
+else
+ if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
+ $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
+ endif
+ ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
+ $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
+ endif
+endif
+
+
+#
+# Assert valid build platform variables.
+#
+# All these are set by kmk so they shouldn't be any trouble
+# unless the user starts messing about with environment variables.
+#
+ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
+ $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
+endif
+ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
+ $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
+endif
+
+ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
+ $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
+endif
+ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
+ $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
+endif
+
+ifeq ($(strip $(KBUILD_HOST_CPU)),)
+ KBUILD_HOST_CPU := blend
+else
+ ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
+ $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
+ endif
+ if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
+ $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
+ endif
+ ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
+ $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
+ endif
+endif
+
+
+#
+# Deal with target platform legacy.
+#
+ifndef KBUILD_TARGET
+ ifdef BUILD_TARGET
+ KBUILD_TARGET := $(BUILD_TARGET)
+ endif
+else ifdef BUILD_TARGET
+ ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
+ ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
+ $(warning kBuild: Please use KBUILD_TARGET instead of BUILD_TARGET on the command line!)
+ KBUILD_TARGET := $(BUILD_TARGET)
+ else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
+ $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
+ endif
+ endif
+endif
+override BUILD_TARGET = $(KBUILD_TARGET)
+
+ifndef KBUILD_TARGET_ARCH
+ ifdef BUILD_TARGET_ARCH
+ KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
+ endif
+else ifdef BUILD_TARGET_ARCH
+ ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
+ ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
+ $(warning kBuild: Please use KBUILD_TARGET_ARCH instead of BUILD_TARGET_ARCH on the command line!)
+ KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
+ else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
+ $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
+ endif
+ endif
+endif
+override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
+
+ifndef KBUILD_TARGET_CPU
+ ifdef BUILD_TARGET_CPU
+ KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
+ endif
+else ifdef BUILD_TARGET_CPU
+ ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
+ ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
+ $(warning kBuild: Please use KBUILD_TARGET_CPU instead of BUILD_TARGET_CPU on the command line!)
+ KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
+ else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
+ $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
+ endif
+ endif
+endif
+override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
+
+
+#
+# Assert or set default target platform.
+# When not defined use the corresponding KBUILD_HOST value.
+#
+ifndef KBUILD_TARGET
+ KBUILD_TARGET := $(KBUILD_HOST)
+else
+ ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
+ $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
+ endif
+ ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
+ $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
+ endif
+endif
+
+ifndef KBUILD_TARGET_ARCH
+ KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
+else
+ ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
+ $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
+ endif
+ ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
+ $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
+ endif
+endif
+
+ifndef KBUILD_TARGET_CPU
+ KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
+else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
+ ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
+ KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
+ else
+ KBUILD_TARGET_CPU := blend
+ endif
+else
+ ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
+ $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
+ endif
+ if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
+ $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
+ endif
+ ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
+ $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
+ endif
+endif
+
+# Short hand for $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).
+KBUILD_TARGET_DOT_ARCH = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
+KBUILD_HOST_DOT_ARCH = $(KBUILD_HOST).$(KBUILD_TARGET_ARCH)
+
+
+#
+# Feature indicators.
+#
+
+## File quoting functions.
+if1of (quote, $(KMK_FEATURES))
+ KMK_WITH_QUOTING := 1
+endif
+
+## Version sorting and comparing.
+if1of (versort, $(KMK_FEATURES))
+ KMK_WITH_VERSION_COMPARE := 1
+endif
+
+
+#
+# Paths and stuff.
+#
+
+# Adjust DEPTH first.
+DEPTH := $(strip $(DEPTH))
+ifeq ($(DEPTH),)
+ DEPTH := .
+endif
+
+## PATH_CURRENT is the current directory (getcwd).
+PATH_CURRENT := $(abspath $(CURDIR))
+## PATH_SUB_CURRENT points to current directory of the current makefile.
+# Meaning that it will change value as we enter and exit sub-makefiles.
+PATH_SUB_CURRENT := $(PATH_CURRENT)
+## PATH_ROOT points to the project root directory.
+PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
+## PATH_SUB_ROOT points to the directory of the top-level makefile.
+ifneq ($(strip $(SUB_DEPTH)),)
+ SUB_DEPTH := $(strip $(SUB_DEPTH))
+ PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
+else
+ PATH_SUB_ROOT := $(PATH_CURRENT)
+endif
+
+## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
+# This variable is used to determin where the object files and other output goes.
+ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
+ CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
+else
+ CURSUBDIR := .
+endif
+
+# Install directory layout. Relative to PATH_INS.
+KBUILD_INST_PATHS := BIN DLL SYS LIB DOC DEBUG SBIN LIBEXEC SHARE
+INST_BIN = bin/
+if1of ($(KBUILD_TARGET), win)
+INST_DLL = bin/
+else
+INST_DLL = lib/
+endif
+if1of ($(KBUILD_TARGET), os2 win)
+INST_SYS = drivers/
+else
+INST_SYS = kernel/
+endif
+INST_LIB = lib/
+INST_DOC = share/doc/
+INST_DEBUG = debug/
+INST_SBIN = sbin/
+INST_LIBEXEC = libexec/
+INST_SHARE = share/
+
+# Staging directory layout. Relative to PATH_STAGE.
+STAGE_BIN = $(INST_BIN)
+STAGE_DLL = $(INST_DLL)
+STAGE_SYS = $(INST_SYS)
+STAGE_LIB = $(INST_LIB)
+STAGE_DOC = $(INST_DOC)
+STAGE_DEBUG = $(INST_DEBUG)
+STAGE_SBIN = $(INST_SBIN)
+STAGE_LIBEXEC = $(INST_LIBEXEC)
+STAGE_SHARE = $(INST_SHARE)
+
+# Install and staging directory paths.
+$(foreach path, $(KBUILD_INST_PATHS), \
+ $(eval PATH_STAGE_$(path) = $$(patsubst %/,%,$$(PATH_STAGE)/$$(STAGE_$(path)))) \
+ $(eval PATH_INST_$(path) = $$(patsubst %/,%,$$(PATH_INS)/$$(INST_$(path)))) \
+)
+
+# Output directories.
+ifndef PATH_OUT_BASE
+ PATH_OUT_BASE := $(PATH_ROOT)/out
+endif
+ifndef PATH_OUT
+ ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
+ PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
+ else
+ PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
+ endif
+endif # !define PATH_OUT
+PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
+PATH_OBJ = $(PATH_OUT)/obj
+PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
+PATH_STAGE = $(PATH_OUT)/stage
+ifndef PATH_INS
+ ifdef DESTDIR
+PATH_INS = $(DESTDIR)
+ else ifdef DESTROOT
+PATH_INS = $(DESTROOT)
+ else
+PATH_INS = $(PATH_OUT)/dist
+ endif
+endif
+
+# Tripwire obsolete PATH defines.
+PATH_BIN = $(error kBuild: PATH_BIN is obsoleted in kBuild 0.1.2. Use PATH_STAGE_BIN or PATH_INST_BIN instead)
+PATH_DLL = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DLL or PATH_INST_DLL instead)
+PATH_LIB = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_LIB or PATH_INST_LIB instead)
+PATH_SYS = $(error kBuild: PATH_SYS is obsoleted in kBuild 0.1.2. Use PATH_STAGE_SYS or PATH_INST_SYS instead)
+PATH_DOC = $(error kBuild: PATH_DOC is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DOC or PATH_INST_DOC instead)
+
+# Development tool tree.
+ifndef KBUILD_DEVTOOLS
+ ifeq ($(PATH_DEVTOOLS),)
+ KBUILD_DEVTOOLS = $(PATH_ROOT)/tools
+ else
+ KBUILD_DEVTOOLS := $(PATH_DEVTOOLS)
+ export KBUILD_DEVTOOLS
+ endif
+endif
+KBUILD_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
+KBUILD_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
+KBUILD_DEVTOOLS_TRG_NOARCH ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).noarch
+KBUILD_DEVTOOLS_HST_NOARCH ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).noarch
+
+if1of ($(KBUILD_TARGET_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
+ ifeq ($(KBUILD_TARGET_ARCH),amd64)
+ KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).x86
+ else ifeq ($(KBUILD_TARGET_ARCH),hppa64)
+ KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).hppa32
+ else ifeq ($(KBUILD_TARGET_ARCH),mips64)
+ KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).mips32
+ else ifeq ($(KBUILD_TARGET_ARCH),ppc64)
+ KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).ppc32
+ else ifeq ($(KBUILD_TARGET_ARCH),s390x)
+ KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).s390
+ else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
+ KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).sparc32
+ endif
+endif
+
+if1of ($(KBUILD_HOST_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
+ ifeq ($(KBUILD_HOST_ARCH),amd64)
+ KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).x86
+ else ifeq ($(KBUILD_HOST_ARCH),hppa64)
+ KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).hppa32
+ else ifeq ($(KBUILD_HOST_ARCH),mips64)
+ KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).mips32
+ else ifeq ($(KBUILD_HOST_ARCH),ppc64)
+ KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).ppc32
+ else ifeq ($(KBUILD_HOST_ARCH),s390x)
+ KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).s390
+ else ifeq ($(KBUILD_HOST_ARCH),sparc64)
+ KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).sparc32
+ endif
+endif
+
+# Deprecated legacy names.
+unexport PATH_DEVTOOLS
+PATH_DEVTOOLS = $(warning Please replace obsolete PATH_DEVTOOLS with KBUILD_DEVTOOLS)$(KBUILD_DEVTOOLS)
+PATH_DEVTOOLS_TRG = $(warning Please replace obsolete PATH_DEVTOOLS_TRG with KBUILD_DEVTOOLS_TRG)$(KBUILD_DEVTOOLS_TRG)
+PATH_DEVTOOLS_BLD = $(warning Please replace obsolete PATH_DEVTOOLS_BLD with KBUILD_DEVTOOLS_BLD)$(KBUILD_DEVTOOLS_TRG)
+PATH_DEVTOOLS_TRG_ALT = $(warning Please replace obsolete PATH_DEVTOOLS_TRG_ALT with KBUILD_DEVTOOLS_TRG_ALT)$(KBUILD_DEVTOOLS_TRG_ALT)
+PATH_DEVTOOLS_HST = $(warning Please replace obsolete PATH_DEVTOOLS_HST with KBUILD_DEVTOOLS_HST)$(KBUILD_DEVTOOLS_HST)
+PATH_DEVTOOLS_HST_ALT = $(warning Please replace obsolete PATH_DEVTOOLS_HST_ALT with KBUILD_DEVTOOLS_HST_ALT)$(KBUILD_DEVTOOLS_HST_ALT)
+
+# KBUILD_PATH / PATH_KBUILD is determined by kmk.
+ifndef KBUILD_PATH
+ KBUILD_PATH := $(PATH_KBUILD)
+endif
+ifeq ($(strip $(KBUILD_PATH)),)
+ $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
+endif
+# KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
+ifndef KBUILD_BIN_PATH
+ KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
+endif
+ifeq ($(strip $(KBUILD_BIN_PATH)),)
+ $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
+endif
+
+# kBuild files which might be of interest.
+FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
+#FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
+FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
+FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk
+FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk
+
+## MAKEFILE is the name of the main makefile.
+MAKEFILE := $(firstword $(MAKEFILE_LIST))
+## MAKEFILE_CURRENT is the name of the current makefile.
+# This is updated everything a sub-makefile is included.
+MAKEFILE_CURRENT := $(MAKEFILE)
+
+
+## @todo this should be done via SUFF_XYZ.target/host...
+
+#
+# Build platform setup.
+# (PORTME)
+#
+if1of ($(KBUILD_HOST), win nt)
+# Win, Win32, Win64, NT.
+EXEC_X86_WIN32 :=
+HOSTSUFF_EXE := .exe
+HOST_PATH_SEP := $(SEMICOLON)
+
+# OS/2.
+else ifeq ($(KBUILD_HOST),os2)
+EXEC_X86_WIN32 := innopec.exe
+HOSTSUFF_EXE := .exe
+HOST_PATH_SEP := $(SEMICOLON)
+
+else if1of ($(KBUILD_HOST), dragonfly freebsd gnukfbsd gnuknbsd linux openbsd netbsd)
+# Unix (like) systems with wine.
+EXEC_X86_WIN32 := wine
+HOSTSUFF_EXE :=
+HOST_PATH_SEP := $(COLON)
+
+else
+# Unix (like) systems without wine.
+EXEC_X86_WIN32 := false
+HOSTSUFF_EXE :=
+HOST_PATH_SEP := $(COLON)
+endif
+
+
+#
+# Build target setup.
+# (PORTME)
+#
+SUFF_DEP := .dep
+SUFF_BIN :=
+if1of ($(KBUILD_TARGET), win nt os2)
+SUFF_OBJ := .obj
+SUFF_LIB := .lib
+SUFF_DLL := .dll
+SUFF_EXE := .exe
+SUFF_SYS := .sys
+SUFF_RES := .res
+else ifeq ($(KBUILD_TARGET),l4)
+SUFF_OBJ := .o
+SUFF_LIB := .a
+SUFF_DLL := .s.so
+SUFF_EXE :=
+SUFF_SYS := .a
+SUFF_RES :=
+else ifeq ($(KBUILD_TARGET),darwin)
+SUFF_OBJ := .o
+SUFF_LIB := .a
+SUFF_DLL := .dylib
+SUFF_EXE :=
+SUFF_SYS :=
+SUFF_RES :=
+else
+SUFF_OBJ := .o
+SUFF_LIB := .a
+SUFF_DLL := .so
+SUFF_EXE :=
+ if1of ($(KBUILD_TARGET), dragonfly freebsd gnukfbsd gnuknbsd linux netbsd openbsd) ## @todo check netbsd, gnuknbsd and openbsd.
+SUFF_SYS := .ko
+ else
+SUFF_SYS :=
+ endif
+SUFF_RES :=
+endif
+
+#
+# Standard kBuild tools.
+#
+ifeq ($(KMK),kmk)
+KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
+endif
+MAKE := $(KMK)
+
+GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
+
+#DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
+#DEP_INT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
+#DEP := $(DEP_INT)
+
+DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
+DEP_IDB_INT := kmk_builtin_kDepIDB
+DEP_IDB := $(DEP_IDB_INT)
+
+DEP_OBJ_EXT := $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE)
+DEP_OBJ_INT := kmk_builtin_kDepObj
+DEP_OBJ := $(DEP_OBJ_INT)
+
+DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
+
+KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
+KOBJCACHE := $(KOBJCACHE_EXT)
+
+KLIBTWEAKER_EXT := $(KBUILD_BIN_PATH)/kLibTweaker$(HOSTSUFF_EXE)
+KLIBTWEAKER := $(KLIBTWEAKER_EXT)
+
+APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
+APPEND_INT := kmk_builtin_append
+APPEND := $(APPEND_INT)
+
+CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
+CAT_INT := kmk_builtin_cat
+CAT := $(CAT_INT)
+
+CHMOD_EXT := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE)
+CHMOD_INT := kmk_builtin_chmod
+CHMOD := $(CHMOD_INT)
+
+CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
+CMP_INT := kmk_builtin_cmp
+CMP := $(CMP_INT)
+
+CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
+CP_INT := kmk_builtin_cp
+CP := $(CP_INT)
+
+ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
+ECHO_INT := kmk_builtin_echo
+ECHO := $(ECHO_INT)
+
+EXPR_EXT := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE)
+EXPR_INT := kmk_builtin_expr
+EXPR := $(EXPR_INT)
+
+INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
+INSTALL_INT := kmk_builtin_install
+INSTALL := $(INSTALL_INT)
+
+LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
+LN_INT := kmk_builtin_ln
+LN := $(LN_INT)
+
+MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
+MD5SUM_INT := kmk_builtin_md5sum
+MD5SUM := $(MD5SUM_INT)
+
+MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
+MKDIR_INT := kmk_builtin_mkdir
+MKDIR := $(MKDIR_INT)
+
+MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
+MV_INT := kmk_builtin_mv
+MV := $(MV_INT)
+
+PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
+PRINTF_INT := kmk_builtin_printf
+PRINTF := $(PRINTF_INT)
+
+REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
+if $(KBUILD_KMK_REVISION) > 2911
+REDIRECT_INT:= kmk_builtin_redirect
+else
+REDIRECT_INT:= $(REDIRECT_EXT)
+endif
+REDIRECT := $(REDIRECT_INT)
+
+RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
+RM_INT := kmk_builtin_rm
+RM := $(RM_INT)
+
+RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
+RMDIR_INT := kmk_builtin_rmdir
+RMDIR := $(RMDIR_INT)
+
+SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
+SED_INT := $(SED_EXT)
+SED := $(SED_EXT)
+
+SLEEP_INT := kmk_builtin_sleep
+SLEEP_EXT := $(KBUILD_BIN_PATH)/kmk_sleep$(HOSTSUFF_EXE)
+SLEEP := $(SLEEP_EXT)
+
+TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
+TEST_INT := kmk_builtin_test
+TEST := $(TEST_INT)
+
+TIME_EXT := $(KBUILD_BIN_PATH)/kmk_time$(HOSTSUFF_EXE)
+TIME_INT := $(TIME_EXT)
+TIME := $(TIME_INT)
+
+TOUCH_EXT := $(KBUILD_BIN_PATH)/kmk_touch$(HOSTSUFF_EXE)
+if $(KBUILD_KMK_REVISION) >= 3060
+TOUCH_INT := kmk_builtin_touch
+else
+TOUCH_INT := $(TOUCH_EXT)
+endif
+TOUCH := $(TOUCH_INT)
+
+# Our default shell is the Almquist shell from *BSD.
+ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
+MAKESHELL := $(ASH)
+SHELL := $(ASH)
+export SHELL MAKESHELL
+
+# Symlinking is problematic on some platforms...
+LN_SYMLINK := $(LN) -s
+
+# When copying to the staging area, use hard links to save time and space.
+ifndef KBUILD_NO_HARD_LINKING
+ INSTALL_STAGING := $(INSTALL) --hard-link-files-when-possible
+else
+ INSTALL_STAGING := $(INSTALL)
+endif
+
+
+#
+# Some Functions.
+# The lower cased ones are either fallbacks or candidates for functions.c.
+#
+
+## ABSPATH - make paths absolute.
+# This implementation is clumsy and doesn't resolve '..' and '.' components.
+#
+# @param $1 The paths to make absolute.
+# @obsolete Use the GNU make function $(abspath) directly now.
+ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
+
+## DIRDEP - make create directory dependencies.
+#
+# @param $1 The paths to the directories which must be created.
+DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
+
+## Cygwin kludge.
+# This converts /cygdrive/x/% to x:%.
+#
+# @param $1 The paths to make native.
+# @remark This macro is pretty much obsolete since we don't use cygwin base make.
+ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
+ CYGPATHMIXED = $(foreach path,$(1)\
+ ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
+else
+ CYGPATHMIXED = $(1)
+endif
+
+## Removes the drive letter from a path (if it has one)
+# @param $1 the path
+no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
+
+## Removes the root slash from a path (if it has one)
+# @param $1 the path
+no-root-slash = $(patsubst /%,%,$(1))
+
+##
+# Similar to firstword, except it returns the value of first defined variable.
+# @param $1 list of variables to probe.
+define FIRST-DEFINED-VAR
+local .RETURN := $(strip $(firstdefined $1, value))
+endef
+
+## Figure out where to put object files.
+# @param $1 real target name.
+# @param $2 normalized main target
+TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
+
+## Figure out where to put object files.
+# @param $1 normalized main target
+TARGET_PATH = $(PATH_TARGET)/$(1)
+
+##
+# Checks if the specified short option ($1) is found in the flags ($2),
+# assuming getopt style options.
+#
+# @returns $3 if present, $4 not.
+#
+# @param $1 The option (single char!).
+# @param $2 The option arguments.
+# @param $3 Eval and return if present.
+# @param $4 Eval and return if not present.
+#
+# @todo May confuse option values starting with '-' for options.
+# @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),present,not-present)
+#
+define KB_FN_OPT_TEST_SHORT
+local options := $(translate $(strip $(filter -%,$(filter-out --%,$2))),$(SP)-,)
+local .RETURN := $(if-expr $(pos $1,$(options)) != 0,$3,$4)
+endef
+
+##
+# Checks if the specified long option ($1) is found in the flags ($2),
+# assuming getopt style options.
+#
+# @returns $3 if present, $4 not.
+#
+# @param $1 The long option, dashes included. No % chars.
+# @param $2 The option arguments.
+# @param $3 Eval and return if present.
+# @param $4 Eval and return if not present.
+#
+# @todo May confuse option values starting with '--' for options.
+# @remarks Invoke like this: $(evalcall KBFN_OPT_TEST_SHORT,--defined,$(flags),present,not-present)
+#
+define KB_FN_OPT_TEST_LONG
+local options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$2)))
+local .RETURN := $(if-expr "$(filter $1,$(options))" != "",$3,$4)
+endef
+
+##
+# Checks if the specified short ($1) or long ($2) option is found in the flags ($2),
+# assuming getopt style options.
+#
+# @returns $4 if present, $5 not.
+#
+# @param $1 The short option (single char!).
+# @param $2 The long option, dashes included. No % chars.
+# @param $3 The option arguments.
+# @param $4 Eval and return if present.
+# @param $5 Eval and return if not present.
+#
+# @todo May confuse option values starting with '--' for options.
+# @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defined,$(flags),present,not-present)
+#
+define KB_FN_OPT_TEST_SHORT_LONG
+local short_options := $(translate $(strip $(filter -%,$(filter-out --%,$3))),$(SP)-,)
+local long_options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$3)))
+local .RETURN := $(if-expr $(pos $1,$(short_options)) != 0 || "$(filter $2,$(long_options))" != "",$4,$5)
+endef
+
+##
+# Make an assignment to a deprecated variable.
+#
+# @param $1 The variable name.
+# @param $2 The value.
+# @param $3 The variable to use instead.
+#
+ifdef KBUILD_WITH_DEPREATED_AS_ERROR
+ KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(error $1 is deprecated, use $3 instead))
+else
+ KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(warning $1 is deprecated, use $3 instead))
+endif
+
+##
+# Show an assertion message.
+#
+# @param $1 The assertion name.
+# @param $2 The details.
+#
+define KB_FN_ASSERT_MSG
+$(info !! kBuild $1 Assertion Failed !!)
+ifdef target
+ $(info !! target: $(target))
+ local varloc := $(where $(target))
+ if "$(varloc)" == "undefined"
+ local varloc := $(where $(target)_TEMPLATE)
+ endif
+ if "$(varloc)" == "undefined"
+ local varloc := $(where $(target)_SOURCES)
+ endif
+ if "$(varloc)" == "undefined"
+ local varloc := $(where $(target)_EXTENDS)
+ endif
+ if "$(varloc)" == "undefined"
+ local varloc := $(where target)
+ endif
+ ifneq ($(varloc),)
+ $(info !! location: $(varloc))
+ else
+ $(info !! probable location: $($(target)_DEFPATH)/Makefile.kmk)
+ endif
+endif
+$(info !! $2)
+$(error fixme)
+endef
+
+##
+# Throw an error if the given path $1 isn't absolute and assertions are enabled.
+#
+# @param $1 The name of the path variable to check.
+#
+ifdef KBUILD_INTERNAL_STRICT
+ KB_FN_ASSERT_ABSPATH = $(if-expr "$(abspath $($(strip $1)))" != "$(strip $($(strip $1)))",\
+ $(evalcall KB_FN_ASSERT_MSG,abspath,$1 is:$(NLTAB)'$($(strip $1))'$(NLTAB)expected:$(NLTAB)'$(abspath $($(strip $1)))'))
+else
+ KB_FN_ASSERT_ABSPATH :=
+endif
+
+
+#
+# Somewhat simple solution for automatic command dependencies.
+#
+
+## Included dependency files (used to be in footer.kmk).
+_DEPFILES_INCLUDED :=
+
+## Temporary for the compile rule below.
+if "$(KBUILD_KMK_REVISION)" >= 3134
+ KBUILD_HAVE_OPTIMIZED_APPEND := 1
+endif
+
+##
+# Advanced version of KB_FN_AUTO_CMD_DEPS_COMMANDS_EX where you set
+# the dependency file name yourself.
+#
+# After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS_EX,<recipe-target>,<dep-file>).
+#
+# @param 1 dep file.
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
+ %$(QUIET2)$(APPEND) -tin "$1" \
+ 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
+ '--insert-command=$@' \
+ 'endef'
+endef
+else
+define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
+ %$(QUIET2)$(RM) -f -- "$1"
+ %$(QUIET2)$(APPEND) "$1" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
+ %$(QUIET2)$(APPEND) -c "$1" '$@'
+ %$(QUIET2)$(APPEND) "$1" 'endef'
+endef
+endif
+
+##
+# Advanced version of KB_FN_AUTO_CMD_DEPS
+#
+# @param 1 recipe name
+# @param 2 dep file.
+KB_FN_AUTO_CMD_DEPS_EX = $(eval includedep $2$(NL)_DEPFILES_INCLUDED += $2)$1: .MUST_MAKE = $$(comp-cmds-ex $$(AUTO_CMD_DEP_$(translate $1,:,_)_PREV_CMDS),$$(commands $1),FORCE)
+
+##
+# $(call KB_FN_AUTO_CMD_DEPS_COMMANDS) as the first command in a recipe to
+# automatically generate command dependencies.
+# After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS,<recipe-target>).
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+define KB_FN_AUTO_CMD_DEPS_COMMANDS
+ %$(QUIET2)$(APPEND) -tni "$@.auto-dep" \
+ 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
+ '--insert-command=$@' \
+ 'endef'
+endef
+else
+define KB_FN_AUTO_CMD_DEPS_COMMANDS
+ %$(QUIET2)$(RM) -f -- "$@.auto-dep"
+ %$(QUIET2)$(APPEND) "$@.auto-dep" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
+ %$(QUIET2)$(APPEND) -c "$@.auto-dep" '$@'
+ %$(QUIET2)$(APPEND) "$@.auto-dep" 'endef'
+endef
+endif
+
+##
+# Call before or after defining a recipe that you want automatic command
+# dependencies on. The recipe must start off by $(call KB_FN_AUTO_CMD_DEPS_COMMANDS).
+#
+# @param 1 recipe name
+KB_FN_AUTO_CMD_DEPS = $(call KB_FN_AUTO_CMD_DEPS_EX,$1,$1.auto-dep)
+
+
+#
+# Initialize some of the globals which the Config.kmk and
+# others can add stuff to if they like for processing in the footer.
+#
+
+## KBUILD_TEMPLATE_PATHS
+# List a paths (separated by space) where templates can be found.
+KBUILD_TEMPLATE_PATHS :=
+
+## KBUILD_TOOL_PATHS
+# List of paths (separated by space) where tools can be found.
+KBUILD_TOOL_PATHS :=
+
+## KBUILD_SDK_PATHS
+# List of paths (separated by space) where SDKs can be found.
+KBUILD_SDK_PATHS :=
+
+## KBUILD_UNIT_PATHS
+# List of paths (separated by space) where units (USES) can be found.
+KBUILD_UNIT_PATHS :=
+
+## KBUILD_DEFAULT_PATHS
+# List of paths (separated by space) to search for stuff as a last resort.
+KBUILD_DEFAULT_PATHS :=
+
+## Proritized list of the default makefile when walking subdirectories.
+# The user can overload this list.
+DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
+
+## KBUILD_SRC_HANDLERS
+# The list of source handlers, pair of extension and handler.
+# The user can overload this list to provide additional or custom
+# handlers. On a per-target/template see SRC_HANDLERS.
+KBUILD_SRC_HANDLERS := \
+ .c:def_src_handler_c \
+ .C:def_src_handler_c \
+.cxx:def_src_handler_cxx \
+.CXX:def_src_handler_cxx \
+.cpp:def_src_handler_cxx \
+.CPP:def_src_handler_cxx \
+ .cc:def_src_handler_cxx \
+ .CC:def_src_handler_cxx \
+ .m:def_src_handler_objc \
+ .M:def_src_handler_objcxx \
+ .mm:def_src_handler_objcxx \
+.asm:def_src_handler_asm \
+.ASM:def_src_handler_asm \
+ .s:def_src_handler_asm \
+ .S:def_src_handler_asm \
+ .rc:def_src_handler_rc \
+.obj:def_src_handler_obj \
+ .o:def_src_handler_obj \
+.res:def_src_handler_obj
+
+## PROPS_TOOLS
+# This is a subset of PROPS_SINGLE.
+PROPS_TOOLS := TOOL CTOOL CXXTOOL PCHTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
+
+## PROPS_SINGLE
+# The list of non-accumulative target properties.
+# A Config.kmk file can add it's own properties to this list and kBuild
+# will do the necessary inheritance for templates, sdks, tools and targets.
+PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
+ OBJSUFF COBJSUFF CXXOBJSUFF PCHOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
+ MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE PCH_HDR
+## PROPS_SINGLE_LNK
+# Subset of PROPS_SINGLE which applies to all linkable targets.
+PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE))
+
+## PROPS_DEFERRED
+# This list of non-accumulative target properties which are or may be
+# functions, and thus should not be expanded until the very last moment.
+PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS \
+ PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS \
+ NAME SONAME
+
+## PROPS_ACCUMULATE_R
+# The list of accumulative target properties where the right most value/flag
+# is the 'most significant'.
+# A Config.kmk file can add it's own properties to this list and kBuild
+# will do the necessary inheritance from templates to targets.
+PROPS_ACCUMULATE_R := \
+ DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
+ ARFLAGS \
+ CFLAGS CDEFS \
+ CXXFLAGS CXXDEFS \
+ PCHFLAGS PCHDEFS \
+ OBJCFLAGS OBJCDEFS \
+ OBJCXXFLAGS OBJCXXDEFS \
+ ASFLAGS ASDEFS \
+ RCFLAGS RCDEFS \
+ LDFLAGS \
+ IDFLAGS IFFLAGS EXEC_IFFLAGS ISFLAGS \
+ FETCHFLAGS UNPACKFLAGS PATCHFLAGS
+## PROPS_ACCUMULATE_R_LNK
+# Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
+PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS UNPACKFLAGS PATCHFLAGS, $(PROPS_ACCUMULATE_R))
+
+## PROPS_ACCUMULATE
+# The list of accumulative target properties where the left most value/flag
+# is the 'most significant'.
+# A Config.kmk file can add it's own properties to this list and kBuild
+# will do the necessary inheritance from templates to targets.
+PROPS_ACCUMULATE_L := \
+ SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
+ INCS CINCS CXXINCS PCHINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
+ LIBS LIBPATH \
+ DIRS BLDDIRS CLEAN
+## PROPS_ACCUMULATE_L_LNK
+# Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
+PROPS_ACCUMULATE_L_LNK := $(filter-out LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L))
+
+## PROPS_ALL
+# List of all the properties.
+PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
+
+## @name Properties valid on programs (BLDPROGS and PROGRAMS)
+## @{
+PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
+PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
+PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
+PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
+## @}
+
+## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
+## @{
+PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
+PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
+PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
+PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
+## @}
+
+## @name Properties valid on dlls (DLLS)
+## @{
+PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
+PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
+PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
+PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
+## @}
+
+## @name Properties valid on system modules (SYSMODS)
+## @{
+PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
+PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
+PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
+PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
+## @}
+
+## @name Properties valid on misc binaries (MISCBINS)
+## @{
+PROPS_MISCBINS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL BINSUFF
+PROPS_MISCBINS_DEFERRED := $(PROPS_DEFERRED)
+PROPS_MISCBINS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
+PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
+## @}
+
+## @name Properties valid on installs (INSTALLS)
+## @{
+PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID
+PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS \
+ PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS
+PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS
+PROPS_INSTALLS_ACCUMULATE_L := SOURCES EXEC_SOURCES DIRS CLEAN
+## @}
+
+## @name Properties valid on fetches (FETCHES)
+## @{
+PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
+PROPS_FETCHES_DEFERRED :=
+PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
+PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
+## @}
+
+## KBUILD_COMPILE_CATEGTORIES
+# Tools categories for compiling.
+KBUILD_COMPILE_CATEGTORIES := AS C CXX PCH OBJC OBJCXX RC
+
+## KBUILD_GENERIC_CATEGORIES
+# Generic tool categories.
+KBUILD_GENERIC_CATEGORIES := FETCH UNPACK PATCH $(addprefix LINK_,LIBRARY PROGRAM DLL SYSMOD MISCBIN)
+
+## PROPS_TOOLS_ONLY
+# Properties found only on tools.
+# This is expanded in a deferred manner, so it will pick up changes made to
+# KBUILD_COMPILE_CATEGTORIES and KBUILD_GENERIC_CATEGORIES made by units.
+PROPS_TOOLS_ONLY = \
+ $(foreach cat, $(KBUILD_COMPILE_CATEGTORIES), \
+ COMPILE_$(cat)_CMDS \
+ COMPILE_$(cat)_OUTPUT \
+ COMPILE_$(cat)_OUTPUT_MAYBE \
+ COMPILE_$(cat)_DEPEND \
+ COMPILE_$(cat)_DEPORD \
+ COMPILE_$(cat)_USES_KOBJCACHE ) \
+ $(foreach cat, $(KBUILD_GENERIC_CATEGORIES), \
+ $(cat)_CMDS \
+ $(cat)_OUTPUT \
+ $(cat)_OUTPUT_MAYBE \
+ $(cat)_DEPEND \
+ $(cat)_DEPORD ))
+
+
+#
+# Here is a special 'hack' to prevent innocent environment variables being
+# picked up and treated as properties. (The most annoying example of why
+# this is necessary is the Visual C++ commandline with it's LIBPATH.)
+#
+# Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
+# disable this 'hack'.
+#
+ifndef KBUILD_DONT_KILL_ENV_PROPS
+
+define def_nuke_environment_prop
+ifeq ($(origin $(prop)),environment)
+$(prop) =
+endif
+endef
+$(foreach prop, $(PROPS_ALL) \
+ FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS MISCBINS INSTALLS OTHERS \
+ SUBDIRS MAKEFILES BLDDIRS \
+ ,$(eval $(value def_nuke_environment_prop)))
+
+endif # KBUILD_DONT_KILL_ENV_PROPS
+
+
+#
+# Pass configuration.
+#
+# The PASS_<passname>_trgs variable is listing the targets.
+# The PASS_<passname>_vars variable is listing the target variables.
+# The PASS_<passname>_pass variable is the lowercased passname.
+#
+
+## PASS: fetches
+# This pass fetches and unpacks things needed to complete the build.
+PASS_FETCHES := Fetches
+PASS_FETCHES_trgs :=
+PASS_FETCHES_vars := _FETCHES
+PASS_FETCHES_pass := fetches
+
+## PASS: patches
+# This pass applies patches.
+PASS_PATCHES := Patches
+PASS_PATCHES_trgs :=
+PASS_PATCHES_vars := _PATCHES
+PASS_PATCHES_pass := patches
+
+## PASS: bldprogs
+# This pass builds targets which are required for building the rest.
+PASS_BLDPROGS := Build Programs
+PASS_BLDPROGS_trgs :=
+PASS_BLDPROGS_vars := _BLDPROGS
+PASS_BLDPROGS_pass := bldprogs
+
+## PASS: libraries
+# This pass builds library targets.
+PASS_LIBRARIES := Libraries
+PASS_LIBRARIES_trgs :=
+PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
+PASS_LIBRARIES_pass := libraries
+
+## PASS: binaries
+# This pass builds dll targets.
+PASS_DLLS := DLLs
+PASS_DLLS_trgs :=
+PASS_DLLS_vars := _DLLS _OTHER_DLLS
+PASS_DLLS_pass := dlls
+
+## PASS: binaries
+# This pass builds binary targets, i.e. programs, system modules and stuff.
+PASS_BINARIES := Programs
+PASS_BINARIES_trgs :=
+PASS_BINARIES_vars := _PROGRAMS _SYSMODS _MISC_BINS _OTHER_BINARIES
+PASS_BINARIES_pass := binaries
+
+## PASS: others
+# This pass builds other targets.
+PASS_OTHERS := Other Stuff
+PASS_OTHERS_trgs :=
+PASS_OTHERS_vars := _OTHERS
+PASS_OTHERS_pass := others
+
+## PASS: staging
+# This pass installs the built entities to a sandbox area.
+## @todo split this up into build install (to sandbox) and real installation.
+PASS_STAGING := Staging
+PASS_STAGING_trgs :=
+PASS_STAGING_vars := _STAGE_DIRS _INSTALLS _STAGE_FILES _DEBUG_STAGE_DIRS _DEBUG_STAGE_FILES
+PASS_STAGING_pass := staging
+
+## PASS: install
+# This pass installs the built entities to where they will be used (using
+# DESTROOT or PATH_INS to indicate where this is).
+PASS_INSTALLS := Install
+PASS_INSTALLS_trgs :=
+PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS_FILES _DEBUG_INSTALL_DIRS _DEBUG_INSTALL_FILES
+PASS_INSTALLS_pass := installs
+
+## PASS: testing
+# This pass processes custom rules for executing tests.
+PASS_TESTING := Tests
+PASS_TESTING_trgs :=
+PASS_TESTING_vars := _TESTING
+PASS_TESTING_pass := testing
+
+## PASS: packing
+# This pass processes custom packing rules.
+PASS_PACKING := Packing
+PASS_PACKING_trgs :=
+PASS_PACKING_vars := _PACKING
+PASS_PACKING_pass := packing
+
+## PASS: clean
+# This pass removes all generated files.
+PASS_CLEAN := Clean
+PASS_CLEAN_trgs := do-clean
+PASS_CLEAN_vars :=
+PASS_CLEAN_pass := clean
+
+## PASS: nothing
+# This pass just walks the tree.
+PASS_NOTHING := Nothing
+PASS_NOTHING_trgs := do-nothing
+PASS_NOTHING_vars :=
+PASS_NOTHING_pass := nothing
+
+## DEFAULT_PASSES
+# The default passes and their order.
+DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS STAGING
+
+## PASSES
+# The passes that should be defined. This must include
+# all passes mentioned by DEFAULT_PASSES.
+PASSES := FETCHES PATCHES $(DEFAULT_PASSES) INSTALLS TESTING PACKING CLEAN NOTHING
+
+
+#
+# Check for --pretty-command-printing before including the Config.kmk
+# so that anyone overriding the message macros can take the implied
+# verbosity level change into account.
+#
+ifndef KBUILD_VERBOSE
+ ifndef KBUILD_QUIET
+ ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1)
+ export KBUILD_VERBOSE := 2
+ endif
+ endif
+endif
+
+
+#
+# Legacy variable translation.
+# These will be eliminated when switching to the next version.
+#
+ifdef USE_KOBJCACHE
+ ifndef KBUILD_USE_KOBJCACHE
+ export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
+ endif
+endif
+
+
+#
+# Library path searching hints (target OS + arch).
+#
+# KBUILD_LIB_SEARCH_SUBS - Subdirs typically containing the right libraries.
+# KBUILD_LIB_SEARCH_ROOTS - Roots to search for library subdirs.
+# KBUILD_LIB_SEARCH_PATHS - ROOTS + SUBS.
+#
+ifeq ($(KBUILD_TARGET),darwin)
+ KBUILD_LIB_SEARCH_ROOTS := \
+ /usr/ \
+ /Developer/usr/
+ KBUILD_LIB_SEARCH_SUBS := lib/
+
+else if1of ($(KBUILD_TARGET), freebsd openbsd dragonfly)
+ KBUILD_LIB_SEARCH_ROOTS := \
+ / \
+ /usr/ \
+ /usr/local/
+ KBUILD_LIB_SEARCH_SUBS := lib/
+
+else ifeq ($(KBUILD_TARGET),netbsd)
+ KBUILD_LIB_SEARCH_ROOTS := \
+ / \
+ /usr/ \
+ /usr/pkg/ \
+ /usr/local/
+ KBUILD_LIB_SEARCH_SUBS := lib/
+
+else if1of ($(KBUILD_TARGET), gnukfbsd gnuknbsd linux)
+ ifeq ($(realpath /bin),/usr/bin)
+ KBUILD_LIB_SEARCH_ROOTS := \
+ /usr/ \
+ / \
+ /usr/local/
+ else
+ KBUILD_LIB_SEARCH_ROOTS := \
+ / \
+ /usr/ \
+ /usr/local/
+ endif
+ ifeq ($(KBUILD_TARGET_ARCH),amd64)
+ KBUILD_LIB_SEARCH_SUBS := \
+ lib/x86_64-linux-gnu/ \
+ lib64/ \
+ lib/
+ else ifeq ($(KBUILD_TARGET_ARCH),x86)
+ KBUILD_LIB_SEARCH_SUBS := \
+ lib/i686-linux-gnu/ \
+ lib/i386-linux-gnu/ \
+ lib32/ \
+ lib/
+ else
+ KBUILD_LIB_SEARCH_SUBS := lib/
+ endif
+
+else ifeq ($(KBUILD_TARGET),solaris)
+ KBUILD_LIB_SEARCH_ROOTS := \
+ / \
+ /usr/ \
+ /usr/sfw/ \
+ /usr/local/ \
+ /sw/
+ ifeq ($(KBUILD_TARGET_ARCH),amd64)
+ KBUILD_LIB_SEARCH_SUBS := lib/amd64/ lib/
+ else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
+ KBUILD_LIB_SEARCH_SUBS := lib/sparcv9/ lib/
+ else
+ KBUILD_LIB_SEARCH_SUBS := lib/
+ endif
+
+else
+ KBUILD_LIB_SEARCH_SUBS :=
+ KBUILD_LIB_SEARCH_ROOTS :=
+endif
+KBUILD_LIB_SEARCH_PATHS := $(foreach root, $(KBUILD_LIB_SEARCH_ROOTS), $(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))
+
+
+#
+# This is how we find the closest config.kmk.
+# It's a little hacky but I think it works fine.
+#
+_CFGDIR := .
+_CFGFILES := ./Config.kmk ./config.kmk
+define def_include_config
+$(eval _CFGDIR := $(_CFGDIR)/$(dir))
+_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
+endef
+# walk down the _RELATIVE_ path specified by DEPTH.
+$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
+# add the default config file.
+_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
+_CFGFILES :=
+_CFGDIR :=
+ifeq ($(_CFGFILE),)
+$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
+endif
+
+# Include the config.kmk we found file (or the default one).
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, including $(_CFGFILE))
+ include $(_CFGFILE)
+ $(evalcall def_profile_self, included $(_CFGFILE))
+else
+ include $(_CFGFILE)
+endif
+
+
+
+#
+# Finalize a the central path variables now that we've included the Config.kmk file.
+#
+# This prevents some trouble when users override the defaults for these
+# variables and uses relative paths or paths with incorrect case.
+#
+PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE))
+PATH_OUT := $(abspath $(PATH_OUT))
+PATH_OBJ := $(abspath $(PATH_OBJ))
+PATH_TARGET := $(abspath $(PATH_TARGET))
+PATH_INS := $(abspath $(PATH_INS))
+PATH_STAGE := $(abspath $(PATH_STAGE))
+
+# Finalize the install and staging directory layouts.
+define def_kbuild_finalize_inst
+local val := $(strip $($(y)_$(x)))
+ifeq ($(val),)
+ $(error kBuild: '$(y)_$(x)' is set to an empty value.)
+endif
+ifneq ($(words $(val)),1)
+ $(error kBuild: The '$(y)_$(x)' value '$(val)' should not contain spaces.)
+endif
+ifneq ($(pos \,$(val)), 0)
+ $(error kBuild: The '$(y)_$(x)' value '$(val)' contains DOS slashes: not allowed.)
+endif
+ifneq ($(pos $(COLON),$(val)), 0)
+ $(error kBuild: The '$(y)_$(x)' value '$(val)' contains colon: not allowed.)
+endif
+ifneq ($(substr $(val),-1), /)
+ $(error kBuild: The '$(y)_$(x)' value '$(val)' has no trailing slash.)
+endif
+if $(pos /../,$(val)) != 0 || "$(substr $(val), 3)" == "../"
+ $(error kBuild: The '$(y)_$(x)' value '$(val)' contains dot-dot escape.)
+endif
+$($(y)_$(x) := $(val)
+
+local val := $(strip $(PATH_$(y)_$(x)))
+ifeq ($(val),)
+ $(error kBuild: 'PATH_$(y)_$(x)' is set to an empty value.)
+endif
+PATH_$(y)_$(x) := $(val)
+endef
+$(foreach y, INST STAGE, $(foreach x, $(KBUILD_INST_PATHS), $(evalcall def_kbuild_finalize_inst)))
+
+# No abspath for devtools since they might've been referenced already and we
+# don't want conflicting variable expansions.
+KBUILD_DEVTOOLS := $(KBUILD_DEVTOOLS)
+KBUILD_DEVTOOLS_TRG := $(KBUILD_DEVTOOLS_TRG)
+KBUILD_DEVTOOLS_TRG_ALT := $(KBUILD_DEVTOOLS_TRG_ALT)
+KBUILD_DEVTOOLS_HST := $(KBUILD_DEVTOOLS_HST)
+KBUILD_DEVTOOLS_HST_ALT := $(KBUILD_DEVTOOLS_HST_ALT)
+
+
+#
+# Setup the message style. The default one is inlined.
+#
+# See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
+# to create your own message style.
+#
+KBUILD_MSG_STYLE ?= default
+ifeq ($(KBUILD_MSG_STYLE),default)
+ #
+ # The 'default' style.
+ #
+
+ ## Fetch starting.
+ # @param 1 Target name.
+ MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
+ ## Re-fetch starting.
+ # @param 1 Target name.
+ MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
+ ## Downloading a fetch component.
+ # @param 1 Target name.
+ # @param 2 The source URL.
+ # @param 3 The destination file name.
+ MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
+ ## Checking a fetch component.
+ # @param 1 Target name.
+ # @param 2 The source URL.
+ # @param 3 The destination file name.
+ MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
+ ## Unpacking a fetch component.
+ # @param 1 Target name.
+ # @param 2 The archive file name.
+ # @param 3 The target directory.
+ MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
+ ## Fetch completed.
+ # @param 1 Target name.
+ MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
+ ## Unfetch a fetch target.
+ # @param 1 Target name.
+ MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
+ ## Compiling a source file.
+ # @param 1 Target name.
+ # @param 2 The source filename.
+ # @param 3 The primary link output file name.
+ # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
+ MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
+ ## Tool
+ # @param 1 The tool name (bin2c,...)
+ # @param 2 Target name.
+ # @param 3 The source filename.
+ # @param 4 The primary output file name.
+ MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
+ ## Generate a file, typically a source file.
+ # @param 1 Target name if applicable.
+ # @param 2 Output file name.
+ # @param 3 What it's generated from
+ MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
+ ## Linking a bldprog/dll/program/sysmod target.
+ # @param 1 Target name.
+ # @param 2 The primary link output file name.
+ # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
+ MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
+ ## Merging a library into the target (during library linking).
+ # @param 1 Target name.
+ # @param 2 The output library name.
+ # @param 3 The input library name.
+ MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
+ ## Creating a directory (build).
+ # @param 1 Directory name.
+ MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
+ ## Cleaning.
+ MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
+ ## Nothing.
+ MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
+ ## Pass
+ # @param 1 The pass name.
+ MSG_PASS ?= $(call MSG_L1,Pass - $1)
+ ## Installing a bldprog/lib/dll/program/sysmod target.
+ # @param 1 Target name.
+ # @param 2 The source filename.
+ # @param 3 The destination file name.
+ MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
+ ## Installing a file (install target).
+ # @param 1 The source filename.
+ # @param 2 The destination filename.
+ MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
+ ## Installing a symlink.
+ # @param 1 Symlink
+ # @param 2 Link target
+ MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
+ ## Installing a directory.
+ # @param 1 Directory name.
+ MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
+
+else
+ _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
+ ifneq ($(_KBUILD_MSG_STYLE_FILE),)
+ include $(_KBUILD_MSG_STYLE_FILE)
+ else
+ $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
+ endif
+endif
+
+
+#
+# Message macros.
+#
+# This is done after including Config.kmk as to allow for
+# KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
+#
+ifdef KBUILD_QUIET
+ # No output
+ QUIET := @
+ QUIET2 := @
+ MSG_L1 :=
+ MSG_L2 :=
+else
+ ifndef KBUILD_VERBOSE
+ # Default output level.
+ QUIET := @
+ QUIET2 := @
+ MSG_L1 ?= %@$(ECHO) "kBuild: $1"
+ MSG_L2 :=
+ else ifeq ($(KBUILD_VERBOSE),1)
+ # A bit more output
+ QUIET := @
+ QUIET2 := @
+ MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
+ MSG_L2 :=
+ else ifeq ($(KBUILD_VERBOSE),2)
+ # Lot more output
+ QUIET :=
+ QUIET2 := @
+ MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
+ MSG_L2 ?= %@$(ECHO) "kBuild: $1"
+ else
+ # maximal output.
+ QUIET :=
+ QUIET2 :=
+ MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
+ MSG_L2 ?= %@$(ECHO) "kBuild: $1"
+ endif
+endif
+
+
+##
+# An internal define used by subheader.kmk, subfooter.kmk, and
+# KB_FN_DO_PASS0_ON_TARGET.
+#
+# @param target The target to process.
+#
+define def_subfooter_header_target_pass
+ ifndef $(target)_PATH
+ ifndef $(target)_DEFPATH
+ $(target)_DEFPATH := $(PATH_SUB_CURRENT)
+ endif
+ $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
+ else ifndef $(target)_DEFPATH
+ $(target)_DEFPATH := $($(target)_PATH)
+ endif
+ ifndef $(target)_MAKEFILE
+ $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
+ endif
+ ifndef $(target)_0_OUTDIR
+ $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
+ $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+ endif
+endef
+
+##
+# Function to call to set _0_OUTDIR, _DEFPATH, and _MAKEFILE earlier than subfooter.
+# Can be used to avoid exploiting double expansion.
+#
+# @param 1 The target name.
+KB_FN_DO_PASS0_ON_TARGET = $(foreach target,$1,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter_header_target_pass)))
+
+
+#
+# Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
+#
+if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
+ $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
+endif
+if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
+ $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
+endif
+if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
+ $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
+endif
+ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
+ $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
+endif
+
+
+#
+# Mark the output and temporary directories as volatile on windows.
+#
+# This automatically means the directories not listed here are considered
+# static and won't be invalidated once we start running compile jobs.
+#
+ifeq ($(KBUILD_HOST),win)
+ if $(KBUILD_KMK_REVISION) >= 2886
+ $(dircache-ctl volatile, $(PATH_OUT_BASE), $(PATH_OUT), $(TEMP), $(TMP), $(TMPDIR), $(TMP))
+ endif
+endif
+
+
+ifdef KBUILD_PROFILE_SELF
+ $(evalcall def_profile_self, end of header.kmk)
+ _KBUILD_TS_HEADER_END := $(_KBUILD_TS_PREV)
+endif
+
+# end-of-file-content
+__header_kmk__ := 1
+endif # !__header_kmk__
+
+
diff --git a/kBuild/msgstyles/brief.kmk b/kBuild/msgstyles/brief.kmk
new file mode 100644
index 0000000..12ada4e
--- /dev/null
+++ b/kBuild/msgstyles/brief.kmk
@@ -0,0 +1,123 @@
+# $Id: brief.kmk 3130 2018-01-31 19:28:35Z bird $
+## @file
+# kBuild Message Style - 'brief'
+#
+
+#
+# Copyright (c) 2007-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+# Indent the messages, drop the kBuild: prefix, and shorten paths.
+ifndef KBUILD_VERBOSE
+ ifndef MSG_L1
+ MSG_L1 = %@$(PRINTF) " %-7s %s\n" \
+ "$(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))" \
+ "$(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$2))))"
+ endif
+else
+ MSG_L1 ?= %@$(ECHO) " $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1 $2))))"
+ MSG_L2 ?= %@$(ECHO) " $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))"
+endif
+
+## Fetch starting.
+# @param 1 Target name.
+MSG_FETCH ?= $(call MSG_L1,FTCH,$1...)
+## Re-fetch starting.
+# @param 1 Target name.
+MSG_REFETCH ?= $(call MSG_L1,RFTCH,$1...)
+## Downloading a fetch component.
+# @param 1 Target name.
+# @param 2 The source URL.
+# @param 3 The destination file name.
+MSG_FETCH_DL ?= $(call MSG_L1,GET,$1 - $2,=> $3)
+## Checking a fetch component.
+# @param 1 Target name.
+# @param 2 The source URL.
+# @param 3 The destination file name.
+MSG_FETCH_CHK?= $(call MSG_L1,CHK,$1 - $3, ($2))
+## Unpacking a fetch component.
+# @param 1 Target name.
+# @param 2 The archive file name.
+# @param 3 The target directory.
+MSG_FETCH_UP ?= $(call MSG_L1,UNPK,$1 - $2,=> $3)
+## Fetch completed.
+# @param 1 Target name.
+MSG_FETCH_OK ?= $(call MSG_L1,DONE,$1)
+## Unfetch a fetch target.
+# @param 1 Target name.
+MSG_UNFETCH ?= $(call MSG_L1,RM,$1...)
+## Compiling a source file.
+# @param 1 Target name.
+# @param 2 The source filename.
+# @param 3 The primary link output file name.
+# @param 4 The source type (CXX,C,AS,RC,++).
+MSG_COMPILE ?= $(call MSG_L1,$4,$1 - $2,=> $3)
+## Tool
+# @param 1 The tool name (bin2c,...)
+# @param 2 Target name.
+# @param 3 The source filename.
+# @param 4 The primary output file name.
+MSG_TOOL ?= $(call MSG_L1,$1,$2 - $3,=> $4)
+## Generate a file, typically a source file.
+# @param 1 Target name if applicable.
+# @param 2 Output file name.
+# @param 3 What it's generated from
+MSG_GENERATE ?= $(call MSG_L1,GEN,$2)
+## Linking a bldprog/dll/program/sysmod target.
+# @param 1 Target name.
+# @param 2 The primary link output file name.
+# @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
+MSG_LINK ?= $(call MSG_L1,$(if $(eq $3,LINK_LIBRARY),AR,LD),$1,=> $2)
+## Merging a library into the target (during library linking).
+# @param 1 Target name.
+# @param 2 The output library name.
+# @param 3 The input library name.
+MSG_AR_MERGE ?= $(NO_SUCH_VARIABLE)
+## Creating a directory (build).
+# @param 1 Directory name.
+MSG_MKDIR ?= $(call MSG_L2,DIR,$1)
+## Cleaning.
+MSG_CLEAN ?= $(call MSG_L1,CLEAN)
+## Nothing.
+MSG_NOTHING ?= $(call MSG_L1,NOTHING $(CURDIR))
+## Installing a bldprog/lib/dll/program/sysmod target.
+# @param 1 Target name.
+# @param 2 The source filename.
+# @param 3 The destination file name.
+MSG_INST_TRG ?= $(call MSG_L1,INST,$1 => $3)
+## Installing a file (install target).
+# @param 1 The source filename.
+# @param 2 The destination filename.
+MSG_INST_FILE?= $(call MSG_L1,IFIL,$2,(<= $1))
+## Installing a symlink.
+# @param 1 Symlink
+# @param 2 Link target
+MSG_INST_SYM ?= $(call MSG_L1,ISYM,$1,=> $2)
+## Installing a directory.
+# @param 1 Directory name.
+MSG_INST_DIR ?= $(call MSG_L1,IDIR,$1)
+
diff --git a/kBuild/msgstyles/brief2.kmk b/kBuild/msgstyles/brief2.kmk
new file mode 100644
index 0000000..02dc924
--- /dev/null
+++ b/kBuild/msgstyles/brief2.kmk
@@ -0,0 +1,127 @@
+# $Id: brief2.kmk 3130 2018-01-31 19:28:35Z bird $
+## @file
+# kBuild Message Style - 'brief'
+#
+
+#
+# Copyright (c) 2007-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+# Indent the messages, drop the kBuild: prefix, and shorten paths.
+ifndef KBUILD_VERBOSE
+ ifndef MSG_L1
+ MSG_L1 = %@$(PRINTF) " %-7s %s\n" \
+ "$(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))" \
+ "$(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$2))))"
+ endif
+ ifndef MSG_L1I
+ MSG_L1I = %@$(PRINTF) " %-7s %s\n" "$1" "$2"
+ endif
+else
+ MSG_L1 ?= %@$(ECHO) " $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1 $2))))"
+ MSG_L1I?= %@$(ECHO) " $1 $2"
+ MSG_L2 ?= %@$(ECHO) " $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))"
+endif
+
+## Fetch starting.
+# @param 1 Target name.
+MSG_FETCH ?= $(call MSG_L1,FTCH,$1...)
+## Re-fetch starting.
+# @param 1 Target name.
+MSG_REFETCH ?= $(call MSG_L1,RFTCH,$1...)
+## Downloading a fetch component.
+# @param 1 Target name.
+# @param 2 The source URL.
+# @param 3 The destination file name.
+MSG_FETCH_DL ?= $(call MSG_L1,GET,$1 - $2,=> $3)
+## Checking a fetch component.
+# @param 1 Target name.
+# @param 2 The source URL.
+# @param 3 The destination file name.
+MSG_FETCH_CHK?= $(call MSG_L1,CHK,$1 - $3, ($2))
+## Unpacking a fetch component.
+# @param 1 Target name.
+# @param 2 The archive file name.
+# @param 3 The target directory.
+MSG_FETCH_UP ?= $(call MSG_L1,UNPK,$1 - $2,=> $3)
+## Fetch completed.
+# @param 1 Target name.
+MSG_FETCH_OK ?= $(call MSG_L1,DONE,$1)
+## Unfetch a fetch target.
+# @param 1 Target name.
+MSG_UNFETCH ?= $(call MSG_L1,RM,$1...)
+## Compiling a source file.
+# @param 1 Target name.
+# @param 2 The source filename.
+# @param 3 The primary link output file name.
+# @param 4 The source type (CXX,C,AS,RC,++).
+MSG_COMPILE ?= $(call MSG_L1,$4,$1 - $2,=> $3)
+## Tool
+# @param 1 The tool name (bin2c,...)
+# @param 2 Target name.
+# @param 3 The source filename.
+# @param 4 The primary output file name.
+MSG_TOOL ?= $(call MSG_L1,$1,$2 - $3,=> $4)
+## Generate a file, typically a source file.
+# @param 1 Target name if applicable.
+# @param 2 Output file name.
+# @param 3 What it's generated from
+MSG_GENERATE ?= $(call MSG_L1,GEN,$2)
+## Linking a bldprog/dll/program/sysmod target.
+# @param 1 Target name.
+# @param 2 The primary link output file name.
+# @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
+MSG_LINK ?= $(call MSG_L1I,$(if $(eq $3,LINK_LIBRARY),AR,LD),$1 => $2,)
+## Merging a library into the target (during library linking).
+# @param 1 Target name.
+# @param 2 The output library name.
+# @param 3 The input library name.
+MSG_AR_MERGE ?= $(NO_SUCH_VARIABLE)
+## Creating a directory (build).
+# @param 1 Directory name.
+MSG_MKDIR ?= $(call MSG_L2,DIR,$1)
+## Cleaning.
+MSG_CLEAN ?= $(call MSG_L1,CLEAN)
+## Nothing.
+MSG_NOTHING ?= $(call MSG_L1,NOTHING $(CURDIR))
+## Installing a bldprog/lib/dll/program/sysmod target.
+# @param 1 Target name.
+# @param 2 The source filename.
+# @param 3 The destination file name.
+MSG_INST_TRG ?= $(call MSG_L1I,INST,$1 => $3)
+## Installing a file (install target).
+# @param 1 The source filename.
+# @param 2 The destination filename.
+MSG_INST_FILE?= $(call MSG_L1I,IFIL,$2,(<= $1))
+## Installing a symlink.
+# @param 1 Symlink
+# @param 2 Link target
+MSG_INST_SYM ?= $(call MSG_L1I,ISYM,$1,=> $2)
+## Installing a directory.
+# @param 1 Directory name.
+MSG_INST_DIR ?= $(call MSG_L1I,IDIR,$1)
+
diff --git a/kBuild/rules.kmk b/kBuild/rules.kmk
new file mode 100644
index 0000000..975438f
--- /dev/null
+++ b/kBuild/rules.kmk
@@ -0,0 +1,44 @@
+# $Id: rules.kmk 3422 2020-08-21 11:48:40Z bird $
+## @file
+# kBuild - File included at top of makefile.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifdef KBUILD_PATH
+# Usual location.
+include $(KBUILD_PATH)/header.kmk
+else
+# Default location.
+include $(DEPTH)/kBuild/header.kmk
+endif
+
+# KBUILD_PATH is defined now.
+include $(KBUILD_PATH)/footer.kmk
+
diff --git a/kBuild/sdks/DXSDK.kmk b/kBuild/sdks/DXSDK.kmk
new file mode 100644
index 0000000..581f265
--- /dev/null
+++ b/kBuild/sdks/DXSDK.kmk
@@ -0,0 +1,67 @@
+# $Id: DXSDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Direct X SDK, targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_DXSDK := The Microsoft Direct X SDK, targeting $(KBUILD_TARGET)
+
+# SDK Specific Properties
+ifndef PATH_SDK_DXSDK
+ ## @todo which order is logical here, BLD and then TRG or the other way?
+ PATH_SDK_DXSDK := $(sort $(wildcard $(KBUILD_DEVTOOLS_BLD)/dxsdk/2*))
+ ifeq ($(PATH_SDK_DXSDK),)
+ PATH_SDK_DXSDK := $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/dxsdk/2*))
+ endif
+ ifeq ($(PATH_SDK_DXSDK),)
+ PATH_SDK_DXSDK := $(sort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/dxsdk/2*))
+ endif
+ ifeq ($(PATH_SDK_DXSDK),)
+ PATH_SDK_DXSDK := $(sort $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/dxsdk/2*))
+ endif
+ ifneq ($(PATH_SDK_DXSDK),)
+ PATH_SDK_DXSDK := $(call lastword,$(PATH_SDK_DXSDK))
+ else
+ $(warning kBuild: PATH_SDK_DXSDK couldn't be determined!)
+ PATH_SDK_DXSDK := $(KBUILD_DEVTOOLS_TRG)/dxsdk/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_DXSDK := $(PATH_SDK_DXSDK)
+endif
+PATH_SDK_DXSDK_INC ?= $(PATH_SDK_DXSDK)/Include
+PATH_SDK_DXSDK_LIB.x86 ?= $(PATH_SDK_DXSDK)/Lib/x86
+PATH_SDK_DXSDK_LIB.amd64 ?= $(PATH_SDK_DXSDK)/Lib/x64
+PATH_SDK_DXSDK_LIB ?= $(PATH_SDK_DXSDK_LIB.$(KBUILD_TARGET_ARCH))
+
+# General Properties used by kBuild
+SDK_DXSDK_INCS ?= $(PATH_SDK_DXSDK_INC)
+SDK_DXSDK_LIBPATH ?= $(PATH_SDK_DXSDK_LIB)
+
diff --git a/kBuild/sdks/DXSDKAMD64.kmk b/kBuild/sdks/DXSDKAMD64.kmk
new file mode 100644
index 0000000..1bc213a
--- /dev/null
+++ b/kBuild/sdks/DXSDKAMD64.kmk
@@ -0,0 +1,61 @@
+# $Id: DXSDKAMD64.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Direct X SDK, targeting AMD64.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_DXSDKAMD64 := The Microsoft Direct X SDK, targeting AMD64.
+
+# SDK Specific Properties
+ifndef PATH_SDK_DXSDKAMD64
+ PATH_SDK_DXSDKAMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/dxsdk/2*)
+ ifeq ($(PATH_SDK_DXSDKAMD64),)
+ PATH_SDK_DXSDKAMD64 := $(PATH_SDK_DXSDK)
+ endif
+ ifeq ($(PATH_SDK_DXSDKAMD64),)
+ PATH_SDK_DXSDKAMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/dxsdk/2*)
+ endif
+ ifneq ($(PATH_SDK_DXSDKAMD64),)
+ PATH_SDK_DXSDKAMD64 := $(lastword $(sort $(PATH_SDK_DXSDKAMD64)))
+ else
+ $(warning kBuild: PATH_SDK_DXSDKAMD64 couldn't be determined!)
+ PATH_SDK_DXSDKAMD64 := $(KBUILD_DEVTOOLS)/win.amd64/dxsdk/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_DXSDKAMD64 := $(PATH_SDK_DXSDKAMD64)
+endif
+PATH_SDK_DXSDKAMD64_INC ?= $(PATH_SDK_DXSDKAMD64)/Include
+PATH_SDK_DXSDKAMD64_LIB ?= $(PATH_SDK_DXSDKAMD64)/Lib/x64
+
+# General Properties used by kBuild
+SDK_DXSDKAMD64_INCS ?= $(PATH_SDK_DXSDKAMD64_INC)
+SDK_DXSDKAMD64_LIBPATH ?= $(PATH_SDK_DXSDKAMD64_LIB)
+
diff --git a/kBuild/sdks/DXSDKX86.kmk b/kBuild/sdks/DXSDKX86.kmk
new file mode 100644
index 0000000..d0fa073
--- /dev/null
+++ b/kBuild/sdks/DXSDKX86.kmk
@@ -0,0 +1,62 @@
+# $Id: DXSDKX86.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Direct X SDK, targeting X86.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+SDK_DXSDKX86 := The Microsoft Direct X SDK, targeting X86.
+
+# SDK Specific Properties
+ifndef PATH_SDK_DXSDKX86
+ PATH_SDK_DXSDKX86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/dxsdk/2*)
+ ifeq ($(PATH_SDK_DXSDKX86),)
+ PATH_SDK_DXSDKX86 := $(PATH_SDK_DXSDK)
+ endif
+ ifeq ($(PATH_SDK_DXSDKX86),)
+ PATH_SDK_DXSDKX86 := $(wildcard $(KBUILD_DEVTOOLS)/amd64.win/dxsdk/2*)
+ endif
+ ifneq ($(PATH_SDK_DXSDKX86),)
+ PATH_SDK_DXSDKX86 := $(lastword $(sort $(PATH_SDK_DXSDKX86)))
+ else
+ $(warning kBuild: PATH_SDK_DXSDKX86 couldn't be determined!)
+ PATH_SDK_DXSDKX86 := $(KBUILD_DEVTOOLS)/win.x86/dxsdk/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_DXSDKX86 := $(PATH_SDK_DXSDKX86)
+endif
+PATH_SDK_DXSDKX86_INC ?= $(PATH_SDK_DXSDKX86)/Include
+PATH_SDK_DXSDKX86_LIB ?= $(PATH_SDK_DXSDKX86)/Lib/x86
+
+# General Properties used by kBuild
+SDK_DXSDKX86_INCS ?= $(PATH_SDK_DXSDKX86_INC)
+SDK_DXSDKX86_LIBPATH ?= $(PATH_SDK_DXSDKX86_LIB)
+
diff --git a/kBuild/sdks/LIBSDL.kmk b/kBuild/sdks/LIBSDL.kmk
new file mode 100644
index 0000000..2c82807
--- /dev/null
+++ b/kBuild/sdks/LIBSDL.kmk
@@ -0,0 +1,168 @@
+# $Id: LIBSDL.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - Simple DirectMedia Layer, targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_LIBSDL := Simple DirectMedia Layer, targeting $(KBUILD_TARGET).
+
+# SDK Specific Properties
+_SDK_LIBSDK_IS_FRAMEWORK := no
+ifndef PATH_SDK_LIBSDL
+ PATH_SDK_LIBSDL := $(wildcard $(KBUILD_DEVTOOLS_TRG)/libsdl/v*)
+ ifeq ($(PATH_SDK_LIBSDL),)
+ PATH_SDK_LIBSDL := $(wildcard $(KBUILD_DEVTOOLS_BLD)/libsdl/v*)
+ endif
+ ifneq ($(PATH_SDK_LIBSDL),)
+ PATH_SDK_LIBSDL := $(lastword $(sort $(PATH_SDK_LIBSDL)))
+ else
+
+ # Darwin might have a framework for it.
+ ifeq ($(KBUILD_TARGET),darwin)
+ PATH_SDK_LIBSDL := $(firstword $(wildcard \
+ /System/Library/Frameworks/SDL.framework/SDL \
+ /Library/Frameworks/SDL.framework/SDL \
+ ) )
+ ifneq ($(PATH_SDK_LIBSDL),)
+ PATH_SDK_LIBSDL := $(patsubst %/,%,$(dir $(PATH_SDK_LIBSDL)))
+ _SDK_LIBSDK_IS_FRAMEWORK := yes
+ endif
+ endif
+
+ ifeq ($(PATH_SDK_LIBSDL),)
+ PATH_SDK_LIBSDL := $(firstword $(foreach root,$(KBUILD_LIB_SEARCH_ROOTS) \
+ ,$(if $(wildcard $(addsuffix libSDL.*,$(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))),$(root),) ))
+ ifeq ($(PATH_SDK_LIBSDL),/)
+ PATH_SDK_LIBSDL := /.
+ else ifneq ($(PATH_SDK_LIBSDL),)
+ PATH_SDK_LIBSDL := $(patsubst %/,%,$(PATH_SDK_LIBSDL))
+ else
+ $(warning kBuild: PATH_SDK_LIBSDL couldn't be determined!)
+ PATH_SDK_LIBSDL := $(KBUILD_DEVTOOLS_TRG)/libsdl/not/found
+ endif
+ endif
+ endif
+else
+ PATH_SDK_LIBSDL := $(PATH_SDK_LIBSDL)
+ ifeq ($(KBUILD_TARGET),darwin)
+ # Check if it's the framework or not.
+ _SDK_LIBSDK_IS_FRAMEWORK := $(if $(wildcard $(PATH_SDK_LIBSDL)/Headers/SDL.h),yes)
+ endif
+endif
+
+#
+# The way libsdl is distributed on the different platforms
+# varies quite a bit, thus this kludge.
+#
+ifeq ($(KBUILD_TARGET),os2)
+ LIB_SDK_LIBSDL_SDLMAIN ?=
+ DLL_SDK_LIBSDL_SDL ?= $(PATH_SDK_LIBSDL)/SDL/SDL12.dll
+ DLL_SDK_LIBSDL_FSLIB ?= $(PATH_SDK_LIBSDL)/SDL/FSLib.dll
+ LIB_SDK_LIBSDL_SDL ?= $(PATH_SDK_LIBSDL)/SDL/SDL12.lib
+ LIB_SDK_LIBSDL_SDLGFX ?= $(PATH_SDK_LIBSDL)/SDLGfx/SDLGFX.lib
+ LIB_SDK_LIBSDL_SDLIMAGE ?= $(PATH_SDK_LIBSDL)/SDLImage/SDLIMAGE.lib
+ LIB_SDK_LIBSDL_SDLMIXER ?= $(PATH_SDK_LIBSDL)/SDLMixer/SDLMIXER.lib
+ LIB_SDK_LIBSDL_SDLNET ?= $(PATH_SDK_LIBSDL)/SDLNet/SDLNET.lib
+ LIB_SDK_LIBSDL_SDLTTF ?= $(PATH_SDK_LIBSDL)/SDLTTF/SDLTTF.lib
+
+ # General Properties used by kBuild
+ SDK_LIBSDL_INCS ?= \
+ $(PATH_SDK_LIBSDL)/SDL/include \
+ $(PATH_SDK_LIBSDL)/SDLGfx \
+ $(PATH_SDK_LIBSDL)/SDLImage \
+ $(PATH_SDK_LIBSDL)/SDLMixer \
+ $(PATH_SDK_LIBSDL)/SDLNet \
+ $(PATH_SDK_LIBSDL)/SDLTTF
+ SDK_LIBSDL_LIBS ?= \
+ $(LIB_SDK_LIBSDL_SDL)
+ SDK_LIBSDL_LIBPATH ?= \
+ $(PATH_SDK_LIBSDL)/SDL \
+ $(PATH_SDK_LIBSDL)/SDLGfx \
+ $(PATH_SDK_LIBSDL)/SDLImage \
+ $(PATH_SDK_LIBSDL)/SDLMixer \
+ $(PATH_SDK_LIBSDL)/SDLNet \
+ $(PATH_SDK_LIBSDL)/SDLTTF
+
+else ifeq ($(KBUILD_TARGET),win) # ASSUMES VC++ on windows, sorry.
+ LIB_SDK_LIBSDL_SDLMAIN ?= $(PATH_SDK_LIBSDL)/lib/SDLmain.lib
+ LIB_SDK_LIBSDL_SDL ?= $(PATH_SDK_LIBSDL)/lib/SDL.lib
+ DLL_SDK_LIBSDL_SDL ?= $(PATH_SDK_LIBSDL)/lib/SDL.dll
+ LIB_SDK_LIBSDL_SDLGFX ?= $(PATH_SDK_LIBSDL)/lib/SDL_gfx.lib
+ LIB_SDK_LIBSDL_SDLIMAGE ?= $(PATH_SDK_LIBSDL)/lib/SDL_image.lib
+ LIB_SDK_LIBSDL_SDLMIXER ?= $(PATH_SDK_LIBSDL)/lib/SDL_mixer.lib
+ LIB_SDK_LIBSDL_SDLNET ?= $(PATH_SDK_LIBSDL)/lib/SDL_net.lib
+ LIB_SDK_LIBSDL_SDLTTF ?= $(PATH_SDK_LIBSDL)/lib/SDL_ttf.lib
+ DLL_SDK_LIBSDL_SDLTTF ?= $(PATH_SDK_LIBSDL)/lib/SDL_ttf.dll
+
+ # General Properties used by kBuild
+ SDK_LIBSDL_INCS ?= \
+ $(PATH_SDK_LIBSDL)/include/SDL \
+ $(PATH_SDK_LIBSDL)/include
+ SDK_LIBSDL_LIBS ?= \
+ $(LIB_SDK_LIBSDL_SDL)
+ SDK_LIBSDL_LIBPATH ?= \
+ $(PATH_SDK_LIBSDL)/lib
+
+else ifeq ($(KBUILD_TARGET).$(_SDK_LIBSDK_IS_FRAMEWORK),darwin.yes)
+ # darwin + framework
+ LIB_SDK_LIBSDL_SDLMAIN ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL_SDL ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL_SDLGFX ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL_SDLIMAGE ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL_SDLMIXER ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL_SDLNET ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL_SDLTTF ?= $(NO_SUCH_VARIABLE)
+
+ # General Properties used by kBuild
+ SDK_LIBSDL_INCS ?= $(PATH_SDK_LIBSDL)/Headers
+ SDK_LIBSDL_LDFLAGS ?= -framework SDL
+
+else # ASSUMES Unix like system
+ LIB_SDK_LIBSDL_SDLMAIN ?= SDLmain
+ LIB_SDK_LIBSDL_SDL ?= SDL
+ LIB_SDK_LIBSDL_SDLGFX ?= SDL_gfx
+ LIB_SDK_LIBSDL_SDLIMAGE ?= SDL_image
+ LIB_SDK_LIBSDL_SDLMIXER ?= SDL_mixer
+ LIB_SDK_LIBSDL_SDLNET ?= SDL_net
+ LIB_SDK_LIBSDL_SDLTTF ?= SDL_ttf
+
+ # General Properties used by kBuild
+ ifndef SDK_LIBSDL_INCS
+ ifneq ($(wildcard $(PATH_SDK_LIBSDL)/include/SDL/),)
+ SDK_LIBSDL_INCS := $(PATH_SDK_LIBSDL)/include/SDL
+ else
+ SDK_LIBSDL_INCS := $(PATH_SDK_LIBSDL)/include
+ endif
+ endif
+ SDK_LIBSDL_LIBS ?= \
+ $(LIB_SDK_LIBSDL_SDL)
+ SDK_LIBSDL_LIBPATH ?= \
+ $(PATH_SDK_LIBSDL)/lib
+endif
diff --git a/kBuild/sdks/LIBSDL2.kmk b/kBuild/sdks/LIBSDL2.kmk
new file mode 100644
index 0000000..ac47361
--- /dev/null
+++ b/kBuild/sdks/LIBSDL2.kmk
@@ -0,0 +1,154 @@
+# $Id: LIBSDL2.kmk 3588 2023-01-31 13:45:33Z bird $
+## @file
+# kBuild SDK - Simple DirectMedia Layer v2.x, targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2006-2023 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_LIBSDL2 := Simple DirectMedia Layer v2.x, targeting $(KBUILD_TARGET).
+
+# SDK Specific Properties
+_SDK_LIBSDL2_IS_FRAMEWORK := no
+ifndef PATH_SDK_LIBSDL2
+ PATH_SDK_LIBSDL2 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TRG)/libsdl2/v*)))
+ ifeq ($(PATH_SDK_LIBSDL2),)
+ PATH_SDK_LIBSDL2 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_BLD)/libsdl2/v*)))
+ endif
+ ifeq ($(PATH_SDK_LIBSDL2),)
+ # Darwin might have a framework for it.
+ ifeq ($(KBUILD_TARGET),darwin)
+ PATH_SDK_LIBSDL2 := $(firstword $(wildcard \
+ /System/Library/Frameworks/SDL2.framework/SDL2 \
+ /Library/Frameworks/SDL2.framework/SDL2 \
+ ) )
+ ifneq ($(PATH_SDK_LIBSDL2),)
+ PATH_SDK_LIBSDL2 := $(patsubst %/,%,$(dir $(PATH_SDK_LIBSDL2)))
+ _SDK_LIBSDL2_IS_FRAMEWORK := yes
+ endif
+ endif
+
+ ifeq ($(PATH_SDK_LIBSDL2),)
+ PATH_SDK_LIBSDL2 := $(firstword $(foreach root,$(KBUILD_LIB_SEARCH_ROOTS) \
+ ,$(if $(wildcard $(addsuffix libSDL2.*,$(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))),$(root),) ))
+ ifeq ($(PATH_SDK_LIBSDL2),/)
+ PATH_SDK_LIBSDL2 := /.
+ else ifneq ($(PATH_SDK_LIBSDL2),)
+ PATH_SDK_LIBSDL2 := $(patsubst %/,%,$(PATH_SDK_LIBSDL2))
+ else
+ $(warning kBuild: PATH_SDK_LIBSDL2 couldn't be determined!)
+ PATH_SDK_LIBSDL2 := $(KBUILD_DEVTOOLS_TRG)/libsdl/not/found
+ endif
+ endif
+ endif
+else
+ PATH_SDK_LIBSDL2 := $(PATH_SDK_LIBSDL2)
+ ifeq ($(KBUILD_TARGET),darwin)
+ # Check if it's the framework or not.
+ _SDK_LIBSDL2_IS_FRAMEWORK := $(if $(wildcard $(PATH_SDK_LIBSDL2)/Headers/SDL.h),yes)
+ endif
+endif
+ifeq ($(KBUILD_TARGET).$(_SDK_LIBSDL2_IS_FRAMEWORK),darwin.yes)
+ PATH_SDK_LIBSDL2_FRAMEWORKS_DIR := $(abspath $(PATH_SDK_LIBSDL2)/..)
+endif
+
+#
+# The way libsdl is distributed on the different platforms
+# varies quite a bit, thus this kludge.
+#
+ifeq ($(KBUILD_TARGET),os2) ## @todo
+ LIB_SDK_LIBSDL2_SDLMAIN ?=
+ DLL_SDK_LIBSDL2_SDL ?= $(PATH_SDK_LIBSDL2)/dll/sdl2.dll
+ LIB_SDK_LIBSDL2_SDL ?= $(PATH_SDK_LIBSDL2)/lib/sdl2.lib
+ LIB_SDK_LIBSDL2_SDLIMAGE ?= $(PATH_SDK_LIBSDL2)/lib/sdl2img.lib
+ LIB_SDK_LIBSDL2_SDLMIXER ?= $(PATH_SDK_LIBSDL2)/lib/sdl2mix.lib
+ LIB_SDK_LIBSDL2_SDLTTF ?= $(PATH_SDK_LIBSDL2)/lib/sdl2ttf.lib
+
+ # General Properties used by kBuild
+ SDK_LIBSDL2_INCS ?= $(PATH_SDK_LIBSDL2)/h/SDL2
+ SDK_LIBSDL2_LIBS ?= $(LIB_SDK_LIBSDL2_SDL)
+ SDK_LIBSDL2_LIBPATH ?= $(PATH_SDK_LIBSDL2)/lib
+
+else ifeq ($(KBUILD_TARGET),win) # ASSUMES VC++ on windows, sorry.
+ include $(KBUILD_PATH)/win-common.kmk
+ LIB_SDK_LIBSDL2_SDLMAIN ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2main.lib
+ LIB_SDK_LIBSDL2_SDL ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2.lib
+ DLL_SDK_LIBSDL2_SDL ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2.dll
+ LIB_SDK_LIBSDL2_SDLTEST ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2test.lib
+
+ LIB_SDK_LIBSDL2_SDLGFX ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2test.lib
+ LIB_SDK_LIBSDL2_SDLIMAGE ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2_image.lib
+ LIB_SDK_LIBSDL2_SDLMIXER ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2_mixer.lib
+ LIB_SDK_LIBSDL2_SDLNET ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2_net.lib
+ LIB_SDK_LIBSDL2_SDLTTF ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2_ttf.lib
+ DLL_SDK_LIBSDL2_SDLTTF ?= $(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))/SDL2_ttf.dll
+
+ # General Properties used by kBuild
+ SDK_LIBSDL2_INCS ?= $(PATH_SDK_LIBSDL2)/include
+ SDK_LIBSDL2_LIBS ?= $(LIB_SDK_LIBSDL2_SDL)
+ SDK_LIBSDL2_LIBPATH ?= $(PATH_SDK_LIBSDL2)/$(PATH_SDK_LIBSDL2)/lib/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))
+
+else ifeq ($(KBUILD_TARGET).$(_SDK_LIBSDL2_IS_FRAMEWORK),darwin.yes)
+ # darwin + framework
+ LIB_SDK_LIBSDL2_SDLMAIN ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL2_SDL ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL2_SDLGFX ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL2_SDLIMAGE ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL2_SDLMIXER ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL2_SDLNET ?= $(NO_SUCH_VARIABLE)
+ LIB_SDK_LIBSDL2_SDLTTF ?= $(NO_SUCH_VARIABLE)
+
+ # General Properties used by kBuild
+ SDK_LIBSDL2_INCS ?= $(PATH_SDK_LIBSDL2)/Headers
+ SDK_LIBSDL2_LDFLAGS ?= -F$(PATH_SDK_LIBSDL2_FRAMEWORKS_DIR) -framework SDL2
+ SDK_LIBSDL2_CFLAGS ?= -F$(PATH_SDK_LIBSDL2_FRAMEWORKS_DIR)
+ SDK_LIBSDL2_CXXFLAGS ?= -F$(PATH_SDK_LIBSDL2_FRAMEWORKS_DIR)
+ SDK_LIBSDL2_OBJCFLAGS ?= -F$(PATH_SDK_LIBSDL2_FRAMEWORKS_DIR)
+ SDK_LIBSDL2_OBJCXXFLAGS ?= -F$(PATH_SDK_LIBSDL2_FRAMEWORKS_DIR)
+
+else # ASSUMES Unix like system
+ LIB_SDK_LIBSDL2_SDLMAIN ?= SDL2main
+ LIB_SDK_LIBSDL2_SDL ?= SDL2
+ LIB_SDK_LIBSDL2_SDLGFX ?= SDL2_gfx
+ LIB_SDK_LIBSDL2_SDLIMAGE ?= SDL2_image
+ LIB_SDK_LIBSDL2_SDLMIXER ?= SDL2_mixer
+ LIB_SDK_LIBSDL2_SDLNET ?= SDL2_net
+ LIB_SDK_LIBSDL2_SDLTTF ?= SDL2_ttf
+
+ # General Properties used by kBuild
+ ifndef SDK_LIBSDL2_INCS
+ if exists("$(PATH_SDK_LIBSDL2)/include/SDL2/")
+ SDK_LIBSDL2_INCS := $(PATH_SDK_LIBSDL2)/include/SDL2
+ else
+ SDK_LIBSDL2_INCS := $(PATH_SDK_LIBSDL2)/include
+ endif
+ endif
+ SDK_LIBSDL2_LIBS ?= $(LIB_SDK_LIBSDL2_SDL)
+ SDK_LIBSDL2_LIBPATH ?= $(PATH_SDK_LIBSDL2)/lib
+endif
+
diff --git a/kBuild/sdks/MACOSX1010.kmk b/kBuild/sdks/MACOSX1010.kmk
new file mode 100644
index 0000000..8abf5f0
--- /dev/null
+++ b/kBuild/sdks/MACOSX1010.kmk
@@ -0,0 +1,62 @@
+# $Id: MACOSX1010.kmk 3489 2020-09-22 13:44:52Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.10 SDK.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+SDK_MACOSX1010 := Mac OS X v10.10 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1010
+ PATH_SDK_MACOSX1010 := $(call DARWINCMN_FN_FIND_MACOSX_SDK,MacOSX10.10.sdk)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX1010 := $(PATH_SDK_MACOSX1010)
+endif
+ifeq ($(PATH_SDK_MACOSX1010),)
+ $(warning $(call DARWINCMN_FN_ERROR_MACOSX_SDK,MacOSX10.10.sdk))
+endif
+
+## The MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED value for this SDK.
+SDK_MACOSX1010_VERSION_VALUE := 101000
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX1010_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=101000
+SDK_MACOSX1010_CFLAGS ?= -mmacosx-version-min=10.10 -isysroot "$(PATH_SDK_MACOSX1010)"
+SDK_MACOSX1010_CXXFLAGS ?= -mmacosx-version-min=10.10 -isysroot "$(PATH_SDK_MACOSX1010)"
+SDK_MACOSX1010_OBJCFLAGS ?= -mmacosx-version-min=10.10 -isysroot "$(PATH_SDK_MACOSX1010)"
+SDK_MACOSX1010_OBJCXXFLAGS ?= -mmacosx-version-min=10.10 -isysroot "$(PATH_SDK_MACOSX1010)"
+SDK_MACOSX1010_LDFLAGS ?= -mmacosx-version-min=10.10 -isysroot "$(PATH_SDK_MACOSX1010)"
+
diff --git a/kBuild/sdks/MACOSX1013.kmk b/kBuild/sdks/MACOSX1013.kmk
new file mode 100644
index 0000000..a17d53f
--- /dev/null
+++ b/kBuild/sdks/MACOSX1013.kmk
@@ -0,0 +1,62 @@
+# $Id: MACOSX1013.kmk 3489 2020-09-22 13:44:52Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.13 SDK.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+SDK_MACOSX1013 := Mac OS X v10.13 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1013
+ PATH_SDK_MACOSX1013 := $(call DARWINCMN_FN_FIND_MACOSX_SDK,MacOSX10.13.sdk)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX1013 := $(PATH_SDK_MACOSX1013)
+endif
+ifeq ($(PATH_SDK_MACOSX1013),)
+ $(warning $(call DARWINCMN_FN_ERROR_MACOSX_SDK,MacOSX10.13.sdk))
+endif
+
+## The MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED value for this SDK.
+SDK_MACOSX1013_VERSION_VALUE := 101300
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX1013_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=101300
+SDK_MACOSX1013_CFLAGS ?= -mmacosx-version-min=10.13 -isysroot "$(PATH_SDK_MACOSX1013)"
+SDK_MACOSX1013_CXXFLAGS ?= -mmacosx-version-min=10.13 -isysroot "$(PATH_SDK_MACOSX1013)"
+SDK_MACOSX1013_OBJCFLAGS ?= -mmacosx-version-min=10.13 -isysroot "$(PATH_SDK_MACOSX1013)"
+SDK_MACOSX1013_OBJCXXFLAGS ?= -mmacosx-version-min=10.13 -isysroot "$(PATH_SDK_MACOSX1013)"
+SDK_MACOSX1013_LDFLAGS ?= -mmacosx-version-min=10.13 -isysroot "$(PATH_SDK_MACOSX1013)"
+
diff --git a/kBuild/sdks/MACOSX1013INCS.kmk b/kBuild/sdks/MACOSX1013INCS.kmk
new file mode 100644
index 0000000..83c15c1
--- /dev/null
+++ b/kBuild/sdks/MACOSX1013INCS.kmk
@@ -0,0 +1,49 @@
+# $Id: MACOSX1013INCS.kmk 3401 2020-07-05 15:58:36Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.13 SDK, includes only.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_MACOSX1013
+ include $(KBUILD_PATH)/sdks/MACOSX1013.kmk
+endif
+
+SDK_MACOSX1013INCS := Mac OS X v10.13 SDK, include only.
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1013INCS
+ PATH_SDK_MACOSX1013INCS := $(PATH_SDK_MACOSX1013)
+else
+ PATH_SDK_MACOSX1013INCS := $(PATH_SDK_MACOSX1013INCS)
+endif
+
+# General Properties (used by kBuild)
+SDK_MACOSX1013INCS_INCS = $(PATH_SDK_MACOSX1013INCS)/usr/include
+
diff --git a/kBuild/sdks/MACOSX1014.kmk b/kBuild/sdks/MACOSX1014.kmk
new file mode 100644
index 0000000..c851ef5
--- /dev/null
+++ b/kBuild/sdks/MACOSX1014.kmk
@@ -0,0 +1,62 @@
+# $Id: MACOSX1014.kmk 3489 2020-09-22 13:44:52Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.14 SDK.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+SDK_MACOSX1014 := Mac OS X v10.14 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1014
+ PATH_SDK_MACOSX1014 := $(call DARWINCMN_FN_FIND_MACOSX_SDK,MacOSX10.14.sdk)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX1014 := $(PATH_SDK_MACOSX1014)
+endif
+ifeq ($(PATH_SDK_MACOSX1014),)
+ $(warning $(call DARWINCMN_FN_ERROR_MACOSX_SDK,MacOSX10.14.sdk))
+endif
+
+## The MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED value for this SDK.
+SDK_MACOSX1014_VERSION_VALUE := 101400
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX1014_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=101400
+SDK_MACOSX1014_CFLAGS ?= -mmacosx-version-min=10.14 -isysroot "$(PATH_SDK_MACOSX1014)"
+SDK_MACOSX1014_CXXFLAGS ?= -mmacosx-version-min=10.14 -isysroot "$(PATH_SDK_MACOSX1014)"
+SDK_MACOSX1014_OBJCFLAGS ?= -mmacosx-version-min=10.14 -isysroot "$(PATH_SDK_MACOSX1014)"
+SDK_MACOSX1014_OBJCXXFLAGS ?= -mmacosx-version-min=10.14 -isysroot "$(PATH_SDK_MACOSX1014)"
+SDK_MACOSX1014_LDFLAGS ?= -mmacosx-version-min=10.14 -isysroot "$(PATH_SDK_MACOSX1014)"
+
diff --git a/kBuild/sdks/MACOSX1014INCS.kmk b/kBuild/sdks/MACOSX1014INCS.kmk
new file mode 100644
index 0000000..a7b8f55
--- /dev/null
+++ b/kBuild/sdks/MACOSX1014INCS.kmk
@@ -0,0 +1,49 @@
+# $Id: MACOSX1014INCS.kmk 3407 2020-07-17 20:03:06Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.14 SDK, includes only.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_MACOSX1014
+ include $(KBUILD_PATH)/sdks/MACOSX1014.kmk
+endif
+
+SDK_MACOSX1014INCS := Mac OS X v10.14 SDK, include only.
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1014INCS
+ PATH_SDK_MACOSX1014INCS := $(PATH_SDK_MACOSX1014)
+else
+ PATH_SDK_MACOSX1014INCS := $(PATH_SDK_MACOSX1014INCS)
+endif
+
+# General Properties (used by kBuild)
+SDK_MACOSX1014INCS_INCS = $(PATH_SDK_MACOSX1014INCS)/usr/include
+
diff --git a/kBuild/sdks/MACOSX1015.kmk b/kBuild/sdks/MACOSX1015.kmk
new file mode 100644
index 0000000..8e454df
--- /dev/null
+++ b/kBuild/sdks/MACOSX1015.kmk
@@ -0,0 +1,62 @@
+# $Id: MACOSX1015.kmk 3489 2020-09-22 13:44:52Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.15 SDK.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+SDK_MACOSX1015 := Mac OS X v10.15 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1015
+ PATH_SDK_MACOSX1015 := $(call DARWINCMN_FN_FIND_MACOSX_SDK,MacOSX10.15.sdk)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX1015 := $(PATH_SDK_MACOSX1015)
+endif
+ifeq ($(PATH_SDK_MACOSX1015),)
+ $(warning $(call DARWINCMN_FN_ERROR_MACOSX_SDK,MacOSX10.15.sdk))
+endif
+
+## The MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED value for this SDK.
+SDK_MACOSX1015_VERSION_VALUE := 101500
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX1015_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=101500
+SDK_MACOSX1015_CFLAGS ?= -mmacosx-version-min=10.15 -isysroot "$(PATH_SDK_MACOSX1015)"
+SDK_MACOSX1015_CXXFLAGS ?= -mmacosx-version-min=10.15 -isysroot "$(PATH_SDK_MACOSX1015)"
+SDK_MACOSX1015_OBJCFLAGS ?= -mmacosx-version-min=10.15 -isysroot "$(PATH_SDK_MACOSX1015)"
+SDK_MACOSX1015_OBJCXXFLAGS ?= -mmacosx-version-min=10.15 -isysroot "$(PATH_SDK_MACOSX1015)"
+SDK_MACOSX1015_LDFLAGS ?= -mmacosx-version-min=10.15 -isysroot "$(PATH_SDK_MACOSX1015)"
+
diff --git a/kBuild/sdks/MACOSX1015INCS.kmk b/kBuild/sdks/MACOSX1015INCS.kmk
new file mode 100644
index 0000000..cda5b44
--- /dev/null
+++ b/kBuild/sdks/MACOSX1015INCS.kmk
@@ -0,0 +1,49 @@
+# $Id: MACOSX1015INCS.kmk 3407 2020-07-17 20:03:06Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.15 SDK, includes only.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_MACOSX1015
+ include $(KBUILD_PATH)/sdks/MACOSX1015.kmk
+endif
+
+SDK_MACOSX1015INCS := Mac OS X v10.15 SDK, include only.
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX1015INCS
+ PATH_SDK_MACOSX1015INCS := $(PATH_SDK_MACOSX1015)
+else
+ PATH_SDK_MACOSX1015INCS := $(PATH_SDK_MACOSX1015INCS)
+endif
+
+# General Properties (used by kBuild)
+SDK_MACOSX1015INCS_INCS = $(PATH_SDK_MACOSX1015INCS)/usr/include
+
diff --git a/kBuild/sdks/MACOSX104.kmk b/kBuild/sdks/MACOSX104.kmk
new file mode 100644
index 0000000..4550973
--- /dev/null
+++ b/kBuild/sdks/MACOSX104.kmk
@@ -0,0 +1,52 @@
+# $Id: MACOSX104.kmk 3489 2020-09-22 13:44:52Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.4 SDK.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_MACOSX104 := Mac OS X v10.4 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX104
+ PATH_SDK_MACOSX104 := /Developer/SDKs/MacOSX10.4u.sdk
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX104 := $(PATH_SDK_MACOSX104)
+endif
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX104_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=1040
+SDK_MACOSX104_CFLAGS ?= -mmacosx-version-min=10.4 -isysroot "$(PATH_SDK_MACOSX104)"
+SDK_MACOSX104_CXXFLAGS ?= -mmacosx-version-min=10.4 -isysroot "$(PATH_SDK_MACOSX104)"
+SDK_MACOSX104_OBJCFLAGS ?= -mmacosx-version-min=10.4 -isysroot "$(PATH_SDK_MACOSX104)"
+SDK_MACOSX104_OBJCXXFLAGS ?= -mmacosx-version-min=10.4 -isysroot "$(PATH_SDK_MACOSX104)"
+SDK_MACOSX104_LDFLAGS ?= -mmacosx-version-min=10.4 -Wl,-syslibroot,"$(PATH_SDK_MACOSX104)"
+
diff --git a/kBuild/sdks/MACOSX104INCS.kmk b/kBuild/sdks/MACOSX104INCS.kmk
new file mode 100644
index 0000000..e8f656b
--- /dev/null
+++ b/kBuild/sdks/MACOSX104INCS.kmk
@@ -0,0 +1,50 @@
+# $Id: MACOSX104INCS.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.4 SDK, includes only.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_MACOSX104INCS := Mac OS X v10.4 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX104INCS
+ ifdef PATH_SDK_MACOSX104
+ PATH_SDK_MACOSX104INCS := $(PATH_SDK_MACOSX104)
+ else
+ PATH_SDK_MACOSX104INCS := /Developer/SDKs/MacOSX10.4u.sdk
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX104INCS := $(PATH_SDK_MACOSX104INCS)
+endif
+
+# General Properties (used by kBuild)
+SDK_MACOSX104INCS_INCS = $(PATH_SDK_MACOSX104INCS)/usr/include
+
diff --git a/kBuild/sdks/MACOSX105.kmk b/kBuild/sdks/MACOSX105.kmk
new file mode 100644
index 0000000..62b3cd2
--- /dev/null
+++ b/kBuild/sdks/MACOSX105.kmk
@@ -0,0 +1,52 @@
+# $Id: MACOSX105.kmk 3489 2020-09-22 13:44:52Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.5 SDK.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_MACOSX105 := Mac OS X v10.5 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX105
+ PATH_SDK_MACOSX105 := /Developer/SDKs/MacOSX10.5.sdk
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX105 := $(PATH_SDK_MACOSX105)
+endif
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX105_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=1050
+SDK_MACOSX105_CFLAGS ?= -mmacosx-version-min=10.5 -isysroot "$(PATH_SDK_MACOSX105)"
+SDK_MACOSX105_CXXFLAGS ?= -mmacosx-version-min=10.5 -isysroot "$(PATH_SDK_MACOSX105)"
+SDK_MACOSX105_OBJCFLAGS ?= -mmacosx-version-min=10.5 -isysroot "$(PATH_SDK_MACOSX105)"
+SDK_MACOSX105_OBJCXXFLAGS ?= -mmacosx-version-min=10.5 -isysroot "$(PATH_SDK_MACOSX105)"
+SDK_MACOSX105_LDFLAGS ?= -mmacosx-version-min=10.5 -Wl,-syslibroot,"$(PATH_SDK_MACOSX105)"
+
diff --git a/kBuild/sdks/MACOSX105INCS.kmk b/kBuild/sdks/MACOSX105INCS.kmk
new file mode 100644
index 0000000..7965c9d
--- /dev/null
+++ b/kBuild/sdks/MACOSX105INCS.kmk
@@ -0,0 +1,50 @@
+# $Id: MACOSX105INCS.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - Mac OS X v10.5 SDK, includes only.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_MACOSX105INCS := Mac OS X v10.5 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX105INCS
+ ifdef PATH_SDK_MACOSX105
+ PATH_SDK_MACOSX105INCS := $(PATH_SDK_MACOSX105)
+ else
+ PATH_SDK_MACOSX105INCS := /Developer/SDKs/MacOSX10.5.sdk
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX105INCS := $(PATH_SDK_MACOSX105INCS)
+endif
+
+# General Properties (used by kBuild)
+SDK_MACOSX105INCS_INCS = $(PATH_SDK_MACOSX105INCS)/usr/include
+
diff --git a/kBuild/sdks/MACOSX110.kmk b/kBuild/sdks/MACOSX110.kmk
new file mode 100644
index 0000000..1715f80
--- /dev/null
+++ b/kBuild/sdks/MACOSX110.kmk
@@ -0,0 +1,62 @@
+# $Id: MACOSX110.kmk 3495 2020-12-23 20:18:20Z bird $
+## @file
+# kBuild SDK - Mac OS X v11.0 SDK.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+SDK_MACOSX110 := Mac OS X v11.0 SDK
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX110
+ PATH_SDK_MACOSX110 := $(call DARWINCMN_FN_FIND_MACOSX_SDK,MacOSX11.0.sdk)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_MACOSX110 := $(PATH_SDK_MACOSX110)
+endif
+ifeq ($(PATH_SDK_MACOSX110),)
+ $(warning $(call DARWINCMN_FN_ERROR_MACOSX_SDK,MacOSX11.0.sdk))
+endif
+
+## The MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED value for this SDK.
+SDK_MACOSX110_VERSION_VALUE := 110000
+
+# General Properties (used by kBuild)
+# Note: The MAC_OS_X_VERSION_MAX_ALLOWED is left free for the SDK user to define.
+SDK_MACOSX110_DEFS ?= MAC_OS_X_VERSION_MIN_REQUIRED=110000
+SDK_MACOSX110_CFLAGS ?= -mmacosx-version-min=11.0 -isysroot "$(PATH_SDK_MACOSX110)"
+SDK_MACOSX110_CXXFLAGS ?= -mmacosx-version-min=11.0 -isysroot "$(PATH_SDK_MACOSX110)"
+SDK_MACOSX110_OBJCFLAGS ?= -mmacosx-version-min=11.0 -isysroot "$(PATH_SDK_MACOSX110)"
+SDK_MACOSX110_OBJCXXFLAGS ?= -mmacosx-version-min=11.0 -isysroot "$(PATH_SDK_MACOSX110)"
+SDK_MACOSX110_LDFLAGS ?= -mmacosx-version-min=11.0 -isysroot "$(PATH_SDK_MACOSX110)"
+
diff --git a/kBuild/sdks/MACOSX110INCS.kmk b/kBuild/sdks/MACOSX110INCS.kmk
new file mode 100644
index 0000000..aa26b10
--- /dev/null
+++ b/kBuild/sdks/MACOSX110INCS.kmk
@@ -0,0 +1,49 @@
+# $Id: MACOSX110INCS.kmk 3495 2020-12-23 20:18:20Z bird $
+## @file
+# kBuild SDK - Mac OS X v11.0 SDK, includes only.
+#
+
+#
+# Copyright (c) 2008-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_MACOSX110
+ include $(KBUILD_PATH)/sdks/MACOSX110.kmk
+endif
+
+SDK_MACOSX110INCS := Mac OS X v11.0 SDK, include only.
+
+# SDK Specific Properties
+ifndef PATH_SDK_MACOSX110INCS
+ PATH_SDK_MACOSX110INCS := $(PATH_SDK_MACOSX110)
+else
+ PATH_SDK_MACOSX110INCS := $(PATH_SDK_MACOSX110INCS)
+endif
+
+# General Properties (used by kBuild)
+SDK_MACOSX110INCS_INCS = $(PATH_SDK_MACOSX110INCS)/usr/include
+
diff --git a/kBuild/sdks/NT4DDK.kmk b/kBuild/sdks/NT4DDK.kmk
new file mode 100644
index 0000000..ede2b19
--- /dev/null
+++ b/kBuild/sdks/NT4DDK.kmk
@@ -0,0 +1,59 @@
+# $Id: NT4DDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows NT 4 DDK, targeting X86.
+#
+
+#
+# Copyright (c) 2005-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_NT4DDK := The MicroSoft NT 4 DDK, targeting X86 (free, not checked).
+
+# SDK Specific Properties
+ifndef PATH_SDK_NT4DDK
+ PATH_SDK_NT4DDK := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddknt4/1* $(KBUILD_DEVTOOLS)/win.x86/ddknt4/2*)
+ ifeq ($(PATH_SDK_NT4DDK),)
+ PATH_SDK_NT4DDK := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/ddknt4)
+ endif
+ ifneq ($(PATH_SDK_NT4DDK),)
+ PATH_SDK_NT4DDK := $(lastword $(sort $(PATH_SDK_NT4DDK)))
+ else
+ $(warning kBuild: PATH_SDK_NT4DDK couldn't be determined!)
+ PATH_SDK_NT4DDK := $(KBUILD_DEVTOOLS)/x86.win/ddknt4/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_NT4DDK := $(PATH_SDK_NT4DDK)
+endif
+PATH_SDK_NT4DDK_INC ?= $(PATH_SDK_NT4DDK)/inc
+PATH_SDK_NT4DDK_LIB ?= $(PATH_SDK_NT4DDK)/lib/i386/free
+
+# General Properties used by kBuild
+SDK_NT4DDK_DEFS ?= _X86_
+SDK_NT4DDK_INCS ?= $(PATH_SDK_NT4DDK_INC)
+SDK_NT4DDK_LIBPATH ?= $(PATH_SDK_NT4DDK_LIB)
+
diff --git a/kBuild/sdks/OS2DDKBASE32.kmk b/kBuild/sdks/OS2DDKBASE32.kmk
new file mode 100644
index 0000000..392fe3a
--- /dev/null
+++ b/kBuild/sdks/OS2DDKBASE32.kmk
@@ -0,0 +1,59 @@
+# $Id: OS2DDKBASE32.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+#
+# kBuild SDK - The OS/2 DDK, 32-bit base headers and libraries.
+
+#
+# Copyright (c) 2007-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_OS2DDKBASE32 := The OS/2 DDK, 32-bit base headers and libraries.
+
+# SDK Specific Properties
+ifndef PATH_SDK_OS2DDKBASE32
+ PATH_SDK_OS2DDKBASE32 := $(wildcard $(KBUILD_DEVTOOLS)/os2.x86/ddk/2*/base32)
+ ifeq ($(PATH_SDK_OS2DDKBASE32),)
+ PATH_SDK_OS2DDKBASE32 := $(wildcard $(PATH_DDKBASE)/../base32)
+ endif
+ ifneq ($(PATH_SDK_OS2DDKBASE32),)
+ PATH_SDK_OS2DDKBASE32 := $(lastword $(sort $(PATH_SDK_OS2DDKBASE32)))
+ else
+ $(warning kBuild: PATH_SDK_OS2DDKBASE32 couldn't be determined!)
+ PATH_SDK_OS2DDKBASE32 := $(KBUILD_DEVTOOLS)/x86.win/ddknt4/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_OS2DDKBASE32 := $(PATH_SDK_OS2DDKBASE32)
+endif
+PATH_SDK_OS2DDKBASE32_INC ?=
+PATH_SDK_OS2DDKBASE32_LIB ?= $(PATH_SDK_OS2DDKBASE32)/lib/i386/free
+
+# General Properties used by kBuild
+SDK_OS2DDKBASE32_INCS ?= $(PATH_SDK_OS2DDKBASE32)/rel/os2c/include/base/os2/16bit
+SDK_OS2DDKBASE32_ASINCS ?= $(PATH_SDK_OS2DDKBASE32)/rel/os2c/include/base/os2/inc
+SDK_OS2DDKBASE32_LIBPATH ?= $(PATH_SDK_OS2DDKBASE32_LIB)
+
diff --git a/kBuild/sdks/ReorderCompilerIncs.kmk b/kBuild/sdks/ReorderCompilerIncs.kmk
new file mode 100644
index 0000000..64fa115
--- /dev/null
+++ b/kBuild/sdks/ReorderCompilerIncs.kmk
@@ -0,0 +1,63 @@
+# $Id: ReorderCompilerIncs.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - Pseudo SDK that inserts the compiler includes a bit earlier.
+#
+# Note! This SDK is using a number of internal kBuild variables as well as
+# making assumptions about expansion order and location.
+# Please, do NOT attempt anything like this in your own SDKs!!
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_ReorderCompilerIncs := Pseudo SDK that inserts the compiler includes a bit earlier.
+
+FN_SDK_ReorderCompilerIncs_GET_INCS = \
+ $(TOOL_$(tool)_$(1)INCS.$(2).$(3).$(5)) \
+ $(TOOL_$(tool)_$(1)INCS.$(2).$(3)) \
+ $(TOOL_$(tool)_$(1)INCS.$(2).$(5)) \
+ $(TOOL_$(tool)_$(1)INCS.$(4)) \
+ $(TOOL_$(tool)_$(1)INCS.$(3)) \
+ $(TOOL_$(tool)_$(1)INCS.$(2)) \
+ $(TOOL_$(tool)_$(1)INCS.$(5)) \
+ $(TOOL_$(tool)_$(1)INCS) \
+ $(TOOL_$(tool)_INCS.$(2).$(3).$(5)) \
+ $(TOOL_$(tool)_INCS.$(2).$(3)) \
+ $(TOOL_$(tool)_INCS.$(2).$(5)) \
+ $(TOOL_$(tool)_INCS.$(4)) \
+ $(TOOL_$(tool)_INCS.$(3)) \
+ $(TOOL_$(tool)_INCS.$(2)) \
+ $(TOOL_$(tool)_INCS.$(5)) \
+ $(TOOL_$(tool)_INCS) \
+
+$(foreach os,$(KBUILD_OSES),$(foreach arch,$(KBUILD_ARCHES),$(foreach cat,$(KBUILD_COMPILE_CATEGTORIES) \
+ ,$(eval SDK_ReorderCompilerIncs_$(cat)INCS.$(os).$(arch) = \
+ $$(call FN_SDK_ReorderCompilerIncs_GET_INCS,CXX,win,amd64,$$(bld_trg_cpu),$$(bld_type))\
+ )\
+)))
+
diff --git a/kBuild/sdks/W2K3DDK.kmk b/kBuild/sdks/W2K3DDK.kmk
new file mode 100644
index 0000000..888de5e
--- /dev/null
+++ b/kBuild/sdks/W2K3DDK.kmk
@@ -0,0 +1,81 @@
+# $Id: W2K3DDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 2003 DDK, targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_W2K3DDK := The Microsoft Windows 2003 DDK, targeting $(KBUILD_TARGET).
+
+# SDK Specific Properties
+ifndef PATH_SDK_W2K3DDK
+ PATH_SDK_W2K3DDK := $(wildcard $(KBUILD_DEVTOOLS_TRG)/ddkwin2k3/2*)
+ ifeq ($(PATH_SDK_W2K3DDK),)
+ PATH_SDK_W2K3DDK := $(wildcard $(KBUILD_DEVTOOLS_BLD)/ddkwin2k3/2*)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDK),)
+ PATH_SDK_W2K3DDK := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddkwin2k3/2*)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDK),)
+ PATH_SDK_W2K3DDK := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/ddkwin2k3/2*)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDK),)
+ PATH_SDK_W2K3DDK := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/ddkwin2k3/2*)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDK),)
+ ifneq ($(wildcard $(KBUILD_DEVTOOLS)/x86.win32/ddkwin2k3/lib/wnet/i386/*.lib),)
+ PATH_SDK_W2K3DDK := $(KBUILD_DEVTOOLS)/x86.win32/ddkwin2k3
+ endif
+ endif
+ ifneq ($(PATH_SDK_W2K3DDK),)
+ PATH_SDK_W2K3DDK := $(lastword $(sort $(PATH_SDK_W2K3DDK)))
+ else
+ $(warning kBuild: PATH_SDK_W2K3DDK couldn't be determined!)
+ PATH_SDK_W2K3DDK := $(KBUILD_DEVTOOLS)/win.x86/ddkwin2k3/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_W2K3DDK := $(PATH_SDK_W2K3DDK)
+endif
+PATH_SDK_W2K3DDK_INC ?= $(PATH_SDK_W2K3DDK)/inc
+PATH_SDK_W2K3DDK_LIB.amd64 ?= $(PATH_SDK_W2K3DDK)/lib/wnet/AMD64
+PATH_SDK_W2K3DDK_LIB.x86 ?= $(PATH_SDK_W2K3DDK)/lib/wnet/i386
+PATH_SDK_W2K3DDK_LIB ?= $(PATH_SDK_W2K3DDK_LIB.$(KBUILD_TARGET_ARCH))
+
+# General Properties used by kBuild
+SDK_W2K3DDK_DEFS.amd64 ?= _AMD64_
+SDK_W2K3DDK_DEFS.x86 ?= _X86_
+SDK_W2K3DDK_INCS ?= \
+ $(PATH_SDK_W2K3DDK_INC)/ddk \
+ $(PATH_SDK_W2K3DDK_INC)/ddk/wnet \
+ $(PATH_SDK_W2K3DDK_INC)/wnet \
+ $(PATH_SDK_W2K3DDK_INC)/ddk/wdm/wnet
+SDK_W2K3DDK_LIBPATH.amd64 ?= $(PATH_SDK_W2K3DDK_LIB.amd64)
+SDK_W2K3DDK_LIBPATH.x86 ?= $(PATH_SDK_W2K3DDK_LIB.x86)
+
diff --git a/kBuild/sdks/W2K3DDKAMD64.kmk b/kBuild/sdks/W2K3DDKAMD64.kmk
new file mode 100644
index 0000000..a9f06e7
--- /dev/null
+++ b/kBuild/sdks/W2K3DDKAMD64.kmk
@@ -0,0 +1,71 @@
+# $Id: W2K3DDKAMD64.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 2003 DDK, targeting amd64.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_W2K3DDKAMD64 := The Microsoft Windows 2003 DDK, targeting amd64.
+
+# SDK Specific Properties
+ifndef PATH_SDK_W2K3DDKAMD64
+ PATH_SDK_W2K3DDKAMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/ddkwin2k3/2*)
+ ifeq ($(PATH_SDK_W2K3DDKAMD64),)
+ PATH_SDK_W2K3DDKAMD64 := $(PATH_SDK_W2K3DDK)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDKAMD64),)
+ PATH_SDK_W2K3DDKAMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddkwin2k3/2*)
+ endif
+ # legacy:
+ ifeq ($(PATH_SDK_W2K3DDKAMD64),)
+ PATH_SDK_W2K3DDKAMD64 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/ddkwin2k3/2*)
+ endif
+ ifneq ($(PATH_SDK_W2K3DDKAMD64),)
+ PATH_SDK_W2K3DDKAMD64 := $(lastword $(sort $(PATH_SDK_W2K3DDKAMD64)))
+ else
+ $(warning kBuild: PATH_SDK_W2K3DDKAMD64 couldn't be determined!)
+ PATH_SDK_W2K3DDKAMD64 := $(KBUILD_DEVTOOLS)/win.amd64/ddkwin2k3/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_W2K3DDKAMD64 := $(PATH_SDK_W2K3DDKAMD64)
+endif
+PATH_SDK_W2K3DDKAMD64_INC ?= $(PATH_SDK_W2K3DDKAMD64)/inc
+PATH_SDK_W2K3DDKAMD64_LIB ?= $(PATH_SDK_W2K3DDKAMD64)/lib/wnet/AMD64
+
+# General Properties used by kBuild
+SDK_W2K3DDKAMD64_DEFS ?= _AMD64_
+SDK_W2K3DDKAMD64_INCS ?= \
+ $(PATH_SDK_W2K3DDKAMD64_INC)/ddk \
+ $(PATH_SDK_W2K3DDKAMD64_INC)/ddk/wnet \
+ $(PATH_SDK_W2K3DDKAMD64_INC)/wnet \
+ $(PATH_SDK_W2K3DDKAMD64_INC)/ddk/wdm/wnet
+SDK_W2K3DDKAMD64_LIBPATH ?= \
+ $(PATH_SDK_W2K3DDKAMD64_LIB)
+
diff --git a/kBuild/sdks/W2K3DDKX86.kmk b/kBuild/sdks/W2K3DDKX86.kmk
new file mode 100644
index 0000000..4f4beb1
--- /dev/null
+++ b/kBuild/sdks/W2K3DDKX86.kmk
@@ -0,0 +1,74 @@
+# $Id: W2K3DDKX86.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 2003 DDK, targeting x86.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_W2K3DDKX86 := The Microsoft Windows 2003 DDK, targeting x86.
+
+# SDK Specific Properties
+ifndef PATH_SDK_W2K3DDKX86
+ PATH_SDK_W2K3DDKX86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddkwin2k3/2*)
+ ifeq ($(PATH_SDK_W2K3DDKX86),)
+ PATH_SDK_W2K3DDKX86 := $(PATH_SDK_W2K3DDK)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDKX86),)
+ PATH_SDK_W2K3DDKX86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/ddkwin2k3/2*)
+ endif
+ # legacy:
+ ifeq ($(PATH_SDK_W2K3DDKX86),)
+ PATH_SDK_W2K3DDKX86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/ddkwin2k3/2*)
+ endif
+ ifeq ($(PATH_SDK_W2K3DDKX86),)
+ PATH_SDK_W2K3DDKX86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/ddkwin2k3)
+ endif
+ ifneq ($(PATH_SDK_W2K3DDKX86),)
+ PATH_SDK_W2K3DDKX86 := $(lastword $(sort $(PATH_SDK_W2K3DDKX86)))
+ else
+ $(warning kBuild: PATH_SDK_W2K3DDKX86 couldn't be determined!)
+ PATH_SDK_W2K3DDKX86 := $(KBUILD_DEVTOOLS)/x86.win/ddkwin2k3/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_W2K3DDKX86 := $(PATH_SDK_W2K3DDKX86)
+endif
+PATH_SDK_W2K3DDKX86_INC ?= $(PATH_SDK_W2K3DDKX86)/inc
+PATH_SDK_W2K3DDKX86_LIB ?= $(PATH_SDK_W2K3DDKX86)/lib/wnet/i386
+
+# General Properties used by kBuild
+SDK_W2K3DDKX86_DEFS ?= _X86_
+SDK_W2K3DDKX86_INCS ?= \
+ $(PATH_SDK_W2K3DDKX86_INC)/ddk \
+ $(PATH_SDK_W2K3DDKX86_INC)/ddk/wnet \
+ $(PATH_SDK_W2K3DDKX86_INC)/wnet \
+ $(PATH_SDK_W2K3DDKX86_INC)/ddk/wdm/wnet
+SDK_W2K3DDKX86_LIBPATH ?= \
+ $(PATH_SDK_W2K3DDKX86_LIB)
+
diff --git a/kBuild/sdks/W32API.kmk b/kBuild/sdks/W32API.kmk
new file mode 100644
index 0000000..20c0a19
--- /dev/null
+++ b/kBuild/sdks/W32API.kmk
@@ -0,0 +1,58 @@
+# $Id: W32API.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - w32api (MinGW), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_W32API := w32api (MinGW), targeting x86.
+
+# SDK Specific Properties
+ifndef PATH_SDK_W32API
+ PATH_SDK_W32API := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/w32api/v*)
+ ifeq ($(PATH_SDK_W32API),)
+ PATH_SDK_W32API := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/w32api/v*)
+ endif
+ ifneq ($(PATH_SDK_W32API),)
+ PATH_SDK_W32API := $(lastword $(sort $(PATH_SDK_W32API)))
+ else
+ $(warning kBuild: PATH_SDK_W32API couldn't be determined!)
+ PATH_SDK_W32API := $(KBUILD_DEVTOOLS)/x86.win/w32api/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_W32API := $(PATH_SDK_W32API)
+endif
+PATH_SDK_W32API_INC ?= $(PATH_SDK_W32API)/include
+PATH_SDK_W32API_LIB ?= $(PATH_SDK_W32API)/lib
+
+# General Properties used by kBuild
+SDK_W32API_INCS ?= $(PATH_SDK_W32API_INC)
+SDK_W32API_LIBPATH ?= $(PATH_SDK_W32API_LIB)
+
diff --git a/kBuild/sdks/WIN32SDK.kmk b/kBuild/sdks/WIN32SDK.kmk
new file mode 100644
index 0000000..9f9cf20
--- /dev/null
+++ b/kBuild/sdks/WIN32SDK.kmk
@@ -0,0 +1,93 @@
+# $Id: WIN32SDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows Platform SDK, targeting x86.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WIN32SDK := The Windows Platform SDK, targeting x86.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WIN32SDK
+ PATH_SDK_WIN32SDK := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/2*)
+ ifeq ($(PATH_SDK_WIN32SDK),)
+ PATH_SDK_WIN32SDK := $(PATH_SDK_WINPSDK)
+ endif
+ ifeq ($(PATH_SDK_WIN32SDK),)
+ PATH_SDK_WIN32SDK := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/sdk/2*)
+ endif
+ ifeq ($(PATH_SDK_WIN32SDK),)
+ PATH_SDK_WIN32SDK := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/sdk/2*)
+ endif
+ ifneq ($(PATH_SDK_WIN32SDK),)
+ PATH_SDK_WIN32SDK := $(lastword $(sort $(PATH_SDK_WIN32SDK)))
+ else
+ $(warning kBuild: PATH_SDK_WIN32SDK couldn't be determined!)
+ PATH_SDK_WIN32SDK := $(KBUILD_DEVTOOLS)/win.x86/sdk/not/found
+ endif
+endif
+ifndef PATH_SDK_WIN32SDK_INC
+PATH_SDK_WIN32SDK_INC := $(firstword $(wildcard $(PATH_SDK_WIN32SDK)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WIN32SDK)/Include)
+endif
+ifndef PATH_SDK_WIN32SDK_LIB
+PATH_SDK_WIN32SDK_LIB := $(firstword $(wildcard $(PATH_SDK_WIN32SDK)/[Ll][Ii][Bb]) $(PATH_SDK_WIN32SDK)/Lib)
+endif
+ifndef PATH_SDK_WIN32SDK_BIN
+PATH_SDK_WIN32SDK_BIN := $(firstword $(wildcard $(PATH_SDK_WIN32SDK)/[Bb][Ii][Nn]) $(PATH_SDK_WIN32SDK)/Bin)
+endif
+
+
+# General Properties used by kBuild
+SDK_WIN32SDK_INCS ?= $(PATH_SDK_WIN32SDK_INC)
+SDK_WIN32SDK_LIBPATH ?= $(PATH_SDK_WIN32SDK_LIB)
+SDK_WIN32SDK_LIBS ?= \
+ $(PATH_SDK_WIN32SDK_LIB)/Kernel32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/User32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/Gdi32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/AdvAPI32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/Shell32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/ShLwApi.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/SetupAPI.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/Uuid.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/Version.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WIN32SDK_LIB)/Ole32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/OleAut32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/OleDlg.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WIN32SDK_LIB)/DbgHelp.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/ImageHlp.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/IPHlpApi.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/ComCtl32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/ComDlg32.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/WinSpool.Lib \
+ $(PATH_SDK_WIN32SDK_LIB)/WinMM.Lib \
+
diff --git a/kBuild/sdks/WIN32SDK2002.kmk b/kBuild/sdks/WIN32SDK2002.kmk
new file mode 100644
index 0000000..148e3a1
--- /dev/null
+++ b/kBuild/sdks/WIN32SDK2002.kmk
@@ -0,0 +1,90 @@
+# $Id: WIN32SDK2002.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - Windows Platform SDK (from ~2002), targeting x86.
+# Differs in that it has ddraw.lib and dxguid.lib.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+SDK_WIN32SDK2002 := Windows Platform SDK (from ~2002), targeting x86. \
+ Differs in that it has ddraw.lib and dxguid.lib.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WIN32SDK2002
+ PATH_SDK_WIN32SDK2002 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/2002*)
+ ifeq ($(PATH_SDK_WIN32SDK2002),)
+ PATH_SDK_WIN32SDK2002 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/sdk/2002*)
+ endif
+ ifeq ($(PATH_SDK_WIN32SDK2002),)
+ PATH_SDK_WIN32SDK2002 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/sdk2002*)
+ endif
+ ifneq ($(PATH_SDK_WIN32SDK2002),)
+ PATH_SDK_WIN32SDK2002 := $(lastword $(sort $(PATH_SDK_WIN32SDK2002)))
+ else
+ $(warning kBuild: PATH_SDK_WIN32SDK2002 couldn't be determined!)
+ PATH_SDK_WIN32SDK2002 := $(KBUILD_DEVTOOLS)/win.x86/sdk/2002/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_WIN32SDK2002 := $(PATH_SDK_WIN32SDK2002)
+endif
+PATH_SDK_WIN32SDK2002_INC ?= $(PATH_SDK_WIN32SDK2002)/include
+PATH_SDK_WIN32SDK2002_LIB ?= $(PATH_SDK_WIN32SDK2002)/lib
+
+# General Properties used by kBuild
+SDK_WIN32SDK2002_INCS ?= $(PATH_SDK_WIN32SDK2002_INC)
+SDK_WIN32SDK2002_LIBPATH ?= $(PATH_SDK_WIN32SDK2002_LIB)
+SDK_WIN32SDK2002_LIBS ?= \
+ $(PATH_SDK_WIN32SDK2002_LIB)/Kernel32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/User32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/Gdi32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/AdvAPI32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/Shell32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/ShLwApi.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/SetupAPI.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/Uuid.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/Version.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WIN32SDK2002_LIB)/Ole32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/OleAut32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/OleDlg.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WIN32SDK2002_LIB)/DbgHelp.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/ImageHlp.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/IPHlpApi.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/ddraw.lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/dxguid.lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/ComCtl32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/ComDlg32.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/WinSpool.Lib \
+ $(PATH_SDK_WIN32SDK2002_LIB)/WinMM.Lib
+
diff --git a/kBuild/sdks/WIN64SDK.kmk b/kBuild/sdks/WIN64SDK.kmk
new file mode 100644
index 0000000..4c3f51d
--- /dev/null
+++ b/kBuild/sdks/WIN64SDK.kmk
@@ -0,0 +1,99 @@
+# $Id: WIN64SDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows Platform SDK, targeting AMD64.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+SDK_WIN64SDK := The Windows Platform SDK, targeting AMD64.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WIN64SDK
+ PATH_SDK_WIN64SDK := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/sdk/2*)
+ ifeq ($(PATH_SDK_WIN64SDK),)
+ PATH_SDK_WIN64SDK := $(PATH_SDK_WINPSDK)
+ endif
+ ifeq ($(PATH_SDK_WIN64SDK),)
+ PATH_SDK_WIN64SDK := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/2*)
+ endif
+ ifneq ($(PATH_SDK_WIN64SDK),)
+ PATH_SDK_WIN64SDK := $(lastword $(sort $(PATH_SDK_WIN64SDK)))
+ else
+ $(warning kBuild: PATH_SDK_WIN64SDK couldn't be determined!)
+ PATH_SDK_WIN64SDK := $(KBUILD_DEVTOOLS)/win.amd64/sdk/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_WIN64SDK := $(PATH_SDK_WIN64SDK)
+endif
+ifndef PATH_SDK_WIN64SDK_INC
+PATH_SDK_WIN64SDK_INC := $(firstword $(wildcard $(PATH_SDK_WIN64SDK)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WIN64SDK)/Include)
+endif
+
+ifndef PATH_SDK_WIN64SDK_LIB
+PATH_SDK_WIN64SDK_LIB := $(firstword $(wildcard $(PATH_SDK_WIN64SDK)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64 $(PATH_SDK_WIN64SDK)/[Ll][Ii][Bb]/[xX]64) $(PATH_SDK_WIN64SDK)/Lib/AMD64)
+endif
+
+ifndef PATH_SDK_WIN64SDK_BIN
+PATH_SDK_WIN64SDK_BIN := $(firstword $(wildcard $(PATH_SDK_WIN64SDK)/[Bb][Ii][Nn]) $(PATH_SDK_WIN64SDK)/Bin)
+endif
+ifndef PATH_SDK_WIN64SDK_BIN_AMD64
+PATH_SDK_WIN64SDK_BIN_AMD64 := $(firstword $(wildcard $(PATH_SDK_WIN64SDK_BIN)/[Ww][Ii][Nn]64/[Xx]86/[Aa][Mm][Dd]64 $(PATH_SDK_WIN64SDK_BIN)/[Ww][Ii][Nn]64/[Xx]86) $(PATH_SDK_WIN64SDK_BIN)/win64/AMD64)
+endif
+
+
+# General Properties used by kBuild
+SDK_WIN64SDK_INCS ?= $(PATH_SDK_WIN64SDK_INC)
+SDK_WIN64SDK_LIBPATH ?= $(PATH_SDK_WIN64SDK_LIB)
+SDK_WIN64SDK_LIBS ?= \
+ $(PATH_SDK_WIN64SDK_LIB)/Kernel32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/User32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/Gdi32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/AdvAPI32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/Shell32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/ShLwApi.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/SetupAPI.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/Uuid.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/Version.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WIN64SDK_LIB)/Ole32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/OleAut32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/OleDlg.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WIN64SDK_LIB)/DbgHelp.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/ImageHlp.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/IPHlpApi.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/ComCtl32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/ComDlg32.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/WinSpool.Lib \
+ $(PATH_SDK_WIN64SDK_LIB)/WinMM.Lib
+
diff --git a/kBuild/sdks/WINDDK.kmk b/kBuild/sdks/WINDDK.kmk
new file mode 100644
index 0000000..a8e9163
--- /dev/null
+++ b/kBuild/sdks/WINDDK.kmk
@@ -0,0 +1,133 @@
+# $Id: WINDDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows Vista and Server 2008 DDKs.
+# Defaults to $(KBUILD_TARGET_ARCH). Base SDK.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK := The Microsoft Windows Vista and Server 2008 DDKs. \
+ Defaults to $(KBUILD_TARGET_ARCH). Base SDK.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINDDK
+ PATH_SDK_WINDDK := $(wildcard $(KBUILD_DEVTOOLS_TRG)/ddk/6*)
+ ifeq ($(PATH_SDK_WINDDK),)
+ PATH_SDK_WINDDK := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddk/6*)
+ endif
+ ifeq ($(PATH_SDK_WINDDK),)
+ PATH_SDK_WINDDK := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/ddk/6*)
+ endif
+ ifeq ($(PATH_SDK_WINDDK),)
+ ifeq ($(KBUILD_HOST),win)
+ PATH_SDK_WINDDK := $(wildcard C:/WinDDK/6*)
+ endif
+ endif
+ ifneq ($(PATH_SDK_WINDDK),)
+ PATH_SDK_WINDDK := $(lastword $(sort $(PATH_SDK_WINDDK)))
+ else
+ $(warning kBuild: PATH_SDK_WINDDK couldn't be determined!)
+ PATH_SDK_WINDDK := $(KBUILD_DEVTOOLS)/win.x86/ddk/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_WINDDK := $(PATH_SDK_WINDDK)
+endif
+
+PATH_SDK_WINDDK_INC ?= $(PATH_SDK_WINDDK)/inc
+PATH_SDK_WINDDK_INC_API ?= $(PATH_SDK_WINDDK_INC)/api
+PATH_SDK_WINDDK_INC_CRT ?= $(PATH_SDK_WINDDK_INC)/crt
+PATH_SDK_WINDDK_INC_DDK ?= $(PATH_SDK_WINDDK_INC)/ddk
+
+PATH_SDK_WINDDK_LIB_ROOT ?= $(PATH_SDK_WINDDK)/lib
+PATH_SDK_WINDDK_LIB_WLH_ROOT ?= $(PATH_SDK_WINDDK_LIB_ROOT)/wlh
+PATH_SDK_WINDDK_LIB_WNET_ROOT ?= $(PATH_SDK_WINDDK_LIB_ROOT)/wnet
+PATH_SDK_WINDDK_LIB_WXP_ROOT ?= $(PATH_SDK_WINDDK_LIB_ROOT)/wxp
+PATH_SDK_WINDDK_LIB_W2K_ROOT ?= $(PATH_SDK_WINDDK_LIB_ROOT)/w2k
+PATH_SDK_WINDDK_LIB_WDF_ROOT ?= $(PATH_SDK_WINDDK_LIB_ROOT)/w2k
+
+PATH_SDK_WINDDK_LIB_WLH.amd64 ?= $(PATH_SDK_WINDDK_LIB_WLH_ROOT)/amd64
+PATH_SDK_WINDDK_LIB_WLH.ia64 ?= $(PATH_SDK_WINDDK_LIB_WLH_ROOT)/ia64
+PATH_SDK_WINDDK_LIB_WLH.x86 ?= $(PATH_SDK_WINDDK_LIB_WLH_ROOT)/i386
+PATH_SDK_WINDDK_LIB_WLH ?= $(PATH_SDK_WINDDK_LIB_WLH.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK_LIB_WNET.amd64?= $(PATH_SDK_WINDDK_LIB_WNET_ROOT)/amd64
+PATH_SDK_WINDDK_LIB_WNET.ia64 ?= $(PATH_SDK_WINDDK_LIB_WNET_ROOT)/ia64
+PATH_SDK_WINDDK_LIB_WNET.x86 ?= $(PATH_SDK_WINDDK_LIB_WNET_ROOT)/i386
+PATH_SDK_WINDDK_LIB_WNET ?= $(PATH_SDK_WINDDK_LIB_WNET.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK_LIB_WXP.x86 ?= $(PATH_SDK_WINDDK_LIB_WXP_ROOT)/i386
+PATH_SDK_WINDDK_LIB_WXP ?= $(PATH_SDK_WINDDK_LIB_WXP.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK_LIB_W2K.x86 ?= $(PATH_SDK_WINDDK_LIB_W2K_ROOT)/i386
+PATH_SDK_WINDDK_LIB_W2K ?= $(PATH_SDK_WINDDK_LIB_W2K.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK_LIB.amd64 ?= $(PATH_SDK_WINDDK_LIB_WLH.amd64)
+PATH_SDK_WINDDK_LIB.ia64 ?= $(PATH_SDK_WINDDK_LIB_WLH.ia64)
+PATH_SDK_WINDDK_LIB.x86 ?= $(PATH_SDK_WINDDK_LIB_WLH.x86)
+PATH_SDK_WINDDK_LIB ?= $(PATH_SDK_WINDDK_LIB.$(KBUILD_TARGET_ARCH))
+
+# General Properties used by kBuild
+SDK_WINDDK_DEFS.amd64 ?= _AMD64_ AMD64 _WIN64
+SDK_WINDDK_DEFS.ia64 ?= _IA64_=1 IA64=1 _WIN64 _MSC_EXTENSIONS
+SDK_WINDDK_DEFS.x86 ?= _X86_=1 i386=1 STD_CALL
+SDK_WINDDK_INCS ?= \
+ $(PATH_SDK_WINDDK_INC_API) \
+ $(PATH_SDK_WINDDK_INC_DDK)
+# The compiler tool(s) will have to select the appropriate crt includes.
+SDK_WINDDK_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK_LIB_WLH.amd64)
+SDK_WINDDK_LIBPATH.ia64 ?= $(PATH_SDK_WINDDK_LIB_WLH.ia64)
+SDK_WINDDK_LIBPATH.x86 ?= $(PATH_SDK_WINDDK_LIB_WLH.x86)
+
+#
+# CDFS defines for the various build environments. Just to give an idea what
+# you should put in your templates and target DEFS.
+#
+
+# Vista / Server Longhorn x64 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0600 WINVER=0x0600 _WIN32_IE=0x0700 NTDDI_VERSION=0x06000000 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL
+# Vista / Server Longhorn ia64 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0600 WINVER=0x0600 _WIN32_IE=0x0700 NTDDI_VERSION=0x06000000 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL NO_HW_DETECT _MSC_EXTENSIONS _MERCED_A0_=1 FPO=0
+# Vista / Server Longhorn x86 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0600 WINVER=0x0600 _WIN32_IE=0x0700 NTDDI_VERSION=0x06000000 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL STD_CALL FPO=0
+# Windows Server 2003 amd64 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0502 WINVER=0x0502 _WIN32_IE=0x0603 NTDDI_VERSION=0x05020100 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL
+# Windows Server 2003 ia64 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0502 WINVER=0x0502 _WIN32_IE=0x0603 NTDDI_VERSION=0x05020100 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL NO_HW_DETECT _MSC_EXTENSIONS _MERCED_A0_=1 FPO=0
+# Windows Server 2003 x86 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0502 WINVER=0x0502 _WIN32_IE=0x0603 NTDDI_VERSION=0x05020100 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL STD_CALL FPO=0
+# Windows XP Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0501 WINVER=0x0501 _WIN32_IE=0x0603 NTDDI_VERSION=0x05010200 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL STD_CALL FPO=0
+# Windows 2000 Free: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0500 WINVER=0x0500 _WIN32_IE=0x0501 NTDDI_VERSION=0x05000400 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL STD_CALL FPO=0
+# Windows 2000 Checked: NT_INST=0 WIN32=100 _WIN32_WINNT=0x0500 WINVER=0x0500 _WIN32_IE=0x0501 NTDDI_VERSION=0x05000400 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005 WIN32_LEAN_AND_MEAN=1 CONDITION_HANDLING=1 DEVL=1 NDEBUG __BUILDMACHINE__=WinDDK _DLL STD_CALL FPO=0 MSC_NOOPT
+
+# Some notes about the defines:
+# NTDDI_VERSION indicates the target NT version, looks kind of important to get right.
+# _WIN32_WINNT, WINVER and _WIN32_IE are used by a bunch of headers for selecting features.
+# WIN32_LEAN_AND_MEAN is used by api\WINDOWS.H to drop a bunch of includes.
+# WIN32 is just used for some ifdef'ing by a handful headers.
+# __BUILDMACHINE__ is used by api\common.ver (for resources it seems).
+# STD_CALL is used by ddk\stdcall.inc (masm).
+# DEVL governs the IF_NTOS_DEBUG() macro in ddk\wdm.h.
+# NDEBUG is used by crt\assert.h dictated by the standards.
+# CONDITION_HANDLING, FPO, KMDF_MAJOR_VERSION, KMDF_MINOR_VERSION, MSC_NOOPT and NT_INST are not referenced in any headers.
+
diff --git a/kBuild/sdks/WINDDK71.kmk b/kBuild/sdks/WINDDK71.kmk
new file mode 100644
index 0000000..5ac75ca
--- /dev/null
+++ b/kBuild/sdks/WINDDK71.kmk
@@ -0,0 +1,107 @@
+# $Id: WINDDK71.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 7 DDK, v7.1.
+# Defaults to $(KBUILD_TARGET_ARCH). Base SDK.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK71 := The Microsoft Windows 7 DDK, v7.1. \
+ Defaults to $(KBUILD_TARGET_ARCH). Base SDK.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINDDK71
+ PATH_SDK_WINDDK71 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/ddk/7600.16385.1*)
+ ifeq ($(PATH_SDK_WINDDK71),)
+ PATH_SDK_WINDDK71 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddk/7600.16385.1*)
+ endif
+ ifeq ($(PATH_SDK_WINDDK71),)
+ PATH_SDK_WINDDK71 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/ddk/7600.16385.1*)
+ endif
+ ifeq ($(PATH_SDK_WINDDK71),)
+ ifeq ($(KBUILD_HOST),win)
+ PATH_SDK_WINDDK71 := $(wildcard C:/WinDDK/7600.16385.1*)
+ endif
+ endif
+ ifneq ($(PATH_SDK_WINDDK71),)
+ PATH_SDK_WINDDK71 := $(lastword $(sort $(PATH_SDK_WINDDK71)))
+ else
+ $(warning kBuild: PATH_SDK_WINDDK71 couldn't be determined!)
+ PATH_SDK_WINDDK71 := $(KBUILD_DEVTOOLS)/win.x86/ddk/7600.16385.1-not-found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_WINDDK71 := $(PATH_SDK_WINDDK71)
+endif
+
+PATH_SDK_WINDDK71_INC ?= $(PATH_SDK_WINDDK71)/inc
+PATH_SDK_WINDDK71_INC_API ?= $(PATH_SDK_WINDDK71_INC)/api
+PATH_SDK_WINDDK71_INC_CRT ?= $(PATH_SDK_WINDDK71_INC)/crt
+PATH_SDK_WINDDK71_INC_DDK ?= $(PATH_SDK_WINDDK71_INC)/ddk
+
+PATH_SDK_WINDDK71_LIB_ROOT ?= $(PATH_SDK_WINDDK71)/lib
+PATH_SDK_WINDDK71_LIB_WLH_ROOT ?= $(PATH_SDK_WINDDK71_LIB_ROOT)/wlh
+PATH_SDK_WINDDK71_LIB_WNET_ROOT ?= $(PATH_SDK_WINDDK71_LIB_ROOT)/wnet
+PATH_SDK_WINDDK71_LIB_WXP_ROOT ?= $(PATH_SDK_WINDDK71_LIB_ROOT)/wxp
+PATH_SDK_WINDDK71_LIB_W2K_ROOT ?= $(PATH_SDK_WINDDK71_LIB_ROOT)/w2k
+PATH_SDK_WINDDK71_LIB_WDF_ROOT ?= $(PATH_SDK_WINDDK71_LIB_ROOT)/w2k
+
+PATH_SDK_WINDDK71_LIB_WLH.amd64 ?= $(PATH_SDK_WINDDK71_LIB_WLH_ROOT)/amd64
+PATH_SDK_WINDDK71_LIB_WLH.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WLH_ROOT)/ia64
+PATH_SDK_WINDDK71_LIB_WLH.x86 ?= $(PATH_SDK_WINDDK71_LIB_WLH_ROOT)/i386
+PATH_SDK_WINDDK71_LIB_WLH ?= $(PATH_SDK_WINDDK71_LIB_WLH.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK71_LIB_WNET.amd64?= $(PATH_SDK_WINDDK71_LIB_WNET_ROOT)/amd64
+PATH_SDK_WINDDK71_LIB_WNET.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WNET_ROOT)/ia64
+PATH_SDK_WINDDK71_LIB_WNET.x86 ?= $(PATH_SDK_WINDDK71_LIB_WNET_ROOT)/i386
+PATH_SDK_WINDDK71_LIB_WNET ?= $(PATH_SDK_WINDDK71_LIB_WNET.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK71_LIB_WXP.x86 ?= $(PATH_SDK_WINDDK71_LIB_WXP_ROOT)/i386
+PATH_SDK_WINDDK71_LIB_WXP ?= $(PATH_SDK_WINDDK71_LIB_WXP.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK71_LIB_W2K.x86 ?= $(PATH_SDK_WINDDK71_LIB_W2K_ROOT)/i386
+PATH_SDK_WINDDK71_LIB_W2K ?= $(PATH_SDK_WINDDK71_LIB_W2K.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK71_LIB.amd64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.amd64)
+PATH_SDK_WINDDK71_LIB.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.ia64)
+PATH_SDK_WINDDK71_LIB.x86 ?= $(PATH_SDK_WINDDK71_LIB_WLH.x86)
+PATH_SDK_WINDDK71_LIB ?= $(PATH_SDK_WINDDK71_LIB.$(KBUILD_TARGET_ARCH))
+
+# General Properties used by kBuild
+SDK_WINDDK71_DEFS.amd64 ?= _AMD64_ AMD64 _WIN64
+SDK_WINDDK71_DEFS.ia64 ?= _IA64_=1 IA64=1 _WIN64 _MSC_EXTENSIONS
+SDK_WINDDK71_DEFS.x86 ?= _X86_=1 i386=1 STD_CALL
+SDK_WINDDK71_INCS ?= \
+ $(PATH_SDK_WINDDK71_INC_API) \
+ $(PATH_SDK_WINDDK71_INC_DDK)
+# The compiler tool(s) will have to select the appropriate crt includes.
+SDK_WINDDK71_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.amd64)
+SDK_WINDDK71_LIBPATH.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.ia64)
+SDK_WINDDK71_LIBPATH.x86 ?= $(PATH_SDK_WINDDK71_LIB_WLH.x86)
+
diff --git a/kBuild/sdks/WINDDK71WLH.kmk b/kBuild/sdks/WINDDK71WLH.kmk
new file mode 100644
index 0000000..7b29885
--- /dev/null
+++ b/kBuild/sdks/WINDDK71WLH.kmk
@@ -0,0 +1,47 @@
+# $Id: WINDDK71WLH.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 7 DDKs, v7.1, Targeting Vista and 2008 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK71WLH := The Microsoft Windows 7 DDKs, v7.1, Targeting Vista and 2008 (KBUILD_TARGET_ARCH).
+SDK_WINDDK71WLH_EXTENDS = WINDDK71
+SDK_WINDDK71WLH_DEFS ?= WIN32=100 _WIN32_WINNT=0x0600 WINVER=0x0600 _WIN32_IE=0x0700 NTDDI_VERSION=0x06000000 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005
+SDK_WINDDK71WLH_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.amd64)
+SDK_WINDDK71WLH_LIBPATH.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.ia64)
+SDK_WINDDK71WLH_LIBPATH.x86 ?= $(PATH_SDK_WINDDK71_LIB_WLH.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK71 sdk, so use those variables where ever possible
+PATH_SDK_WINDDK71WLH_LIB.amd64?= $(PATH_SDK_WINDDK71_LIB_WLH.amd64)
+PATH_SDK_WINDDK71WLH_LIB.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WLH.ia64)
+PATH_SDK_WINDDK71WLH_LIB.x86 ?= $(PATH_SDK_WINDDK71_LIB_WLH.x86)
+PATH_SDK_WINDDK71WLH_LIB ?= $(PATH_SDK_WINDDK71WLH_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINDDK71WNET.kmk b/kBuild/sdks/WINDDK71WNET.kmk
new file mode 100644
index 0000000..2dbde56
--- /dev/null
+++ b/kBuild/sdks/WINDDK71WNET.kmk
@@ -0,0 +1,47 @@
+# $Id: WINDDK71WNET.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 7 DDKs, v7.1, Targeting Windows Server 2003 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK71WNET := The Microsoft Windows 7 DDKs, v7.1, Targeting Windows Server 2003 (KBUILD_TARGET_ARCH).
+SDK_WINDDK71WNET_EXTENDS = WINDDK71
+SDK_WINDDK71WNET_DEFS ?= WIN32=100 _WIN32_WINNT=0x0502 WINVER=0x0502 _WIN32_IE=0x0603 NTDDI_VERSION=0x05020100
+SDK_WINDDK71WNET_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK71_LIB_WNET.amd64)
+SDK_WINDDK71WNET_LIBPATH.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WNET.ia64)
+SDK_WINDDK71WNET_LIBPATH.x86 ?= $(PATH_SDK_WINDDK71_LIB_WNET.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK71 sdk, so use those variables where ever possible
+PATH_SDK_WINDDK71WNET_LIB.amd64?= $(PATH_SDK_WINDDK71_LIB_WNET.amd64)
+PATH_SDK_WINDDK71WNET_LIB.ia64 ?= $(PATH_SDK_WINDDK71_LIB_WNET.ia64)
+PATH_SDK_WINDDK71WNET_LIB.x86 ?= $(PATH_SDK_WINDDK71_LIB_WNET.x86)
+PATH_SDK_WINDDK71WNET_LIB ?= $(PATH_SDK_WINDDK71WNET_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINDDK71WXP.kmk b/kBuild/sdks/WINDDK71WXP.kmk
new file mode 100644
index 0000000..61814a2
--- /dev/null
+++ b/kBuild/sdks/WINDDK71WXP.kmk
@@ -0,0 +1,43 @@
+# $Id: WINDDK71WXP.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 7 DDK, v7.1, Targeting Windows XP (x86).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK71WXP := The Microsoft Windows 7 DDK, v7.1, Targeting Windows XP (x86).
+SDK_WINDDK71WXP_EXTENDS = WINDDK71
+SDK_WINDDK71WXP_DEFS ?= WIN32=100 _WIN32_WINNT=0x0501 WINVER=0x0501 _WIN32_IE=0x0603 NTDDI_VERSION=0x05010200
+SDK_WINDDK71WXP_LIBPATH.x86 ?= $(PATH_SDK_WINDDK71_LIB_WXP.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK71 sdk, so use those variables where ever possible
+PATH_SDK_WINDDK71WXP_LIB.x86 ?= $(PATH_SDK_WINDDK71_LIB_WXP.x86)
+PATH_SDK_WINDDK71WXP_LIB ?= $(PATH_SDK_WINDDK71WXP_LIB.x86)
+
diff --git a/kBuild/sdks/WINDDK80.kmk b/kBuild/sdks/WINDDK80.kmk
new file mode 100644
index 0000000..3fecd3b
--- /dev/null
+++ b/kBuild/sdks/WINDDK80.kmk
@@ -0,0 +1,98 @@
+# $Id: WINDDK80.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 8 DDK.
+# Defaults to $(KBUILD_TARGET_ARCH). Base SDK.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK80 := The Microsoft Windows 8 DDK. \
+ Defaults to $(KBUILD_TARGET_ARCH). Base SDK.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINDDK80
+ PATH_SDK_WINDDK80 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/ddk/v8*)
+ ifeq ($(PATH_SDK_WINDDK80),)
+ PATH_SDK_WINDDK80 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/ddk/v8*)
+ endif
+ ifeq ($(PATH_SDK_WINDDK80),)
+ PATH_SDK_WINDDK80 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/ddk/v8*)
+ endif
+ ifneq ($(PATH_SDK_WINDDK80),)
+ PATH_SDK_WINDDK80 := $(lastword $(sort $(PATH_SDK_WINDDK80)))
+ else
+ $(warning kBuild: PATH_SDK_WINDDK80 couldn't be determined!)
+ PATH_SDK_WINDDK80 := $(KBUILD_DEVTOOLS)/win.x86/ddk/v8.0/not/found
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_WINDDK80 := $(PATH_SDK_WINDDK80)
+endif
+
+PATH_SDK_WINDDK80_INC ?= $(PATH_SDK_WINDDK80)/Include
+PATH_SDK_WINDDK80_INC_UM ?= $(PATH_SDK_WINDDK80_INC)/um
+PATH_SDK_WINDDK80_INC_KM ?= $(PATH_SDK_WINDDK80_INC)/km
+PATH_SDK_WINDDK80_INC_KM_CRT ?= $(PATH_SDK_WINDDK80_INC_KM)/crt
+PATH_SDK_WINDDK80_INC_SHARED ?= $(PATH_SDK_WINDDK80_INC)/Shared
+
+PATH_SDK_WINDDK80_LIB_ROOT ?= $(PATH_SDK_WINDDK80)/Lib
+PATH_SDK_WINDDK80_LIB_W8_ROOT ?= $(PATH_SDK_WINDDK80_LIB_ROOT)/win8
+PATH_SDK_WINDDK80_LIB_W7_ROOT ?= $(PATH_SDK_WINDDK80_LIB_ROOT)/win7
+PATH_SDK_WINDDK80_LIB_WLH_ROOT ?= $(PATH_SDK_WINDDK80_LIB_ROOT)/wlh
+PATH_SDK_WINDDK80_LIB_WDF_ROOT ?= $(PATH_SDK_WINDDK80_LIB_ROOT)/wdf
+PATH_SDK_WINDDK80_LIB_MFC_ROOT ?= $(PATH_SDK_WINDDK80_LIB_ROOT)/Mfc
+PATH_SDK_WINDDK80_LIB_ATL_ROOT ?= $(PATH_SDK_WINDDK80_LIB_ROOT)/Atl
+
+PATH_SDK_WINDDK80_LIB_W8.amd64 ?= $(PATH_SDK_WINDDK80_LIB_W8_ROOT)/km/x64
+PATH_SDK_WINDDK80_LIB_W8.x86 ?= $(PATH_SDK_WINDDK80_LIB_W8_ROOT)/km/x86
+PATH_SDK_WINDDK80_LIB_W8 ?= $(PATH_SDK_WINDDK80_LIB_W8.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK80_LIB_W7.amd64 ?= $(PATH_SDK_WINDDK80_LIB_W7_ROOT)/km/x64
+PATH_SDK_WINDDK80_LIB_W7.x86 ?= $(PATH_SDK_WINDDK80_LIB_W7_ROOT)/km/x86
+PATH_SDK_WINDDK80_LIB_W7 ?= $(PATH_SDK_WINDDK80_LIB_W7.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK80_LIB_WLH.amd64 ?= $(PATH_SDK_WINDDK80_LIB_WLH_ROOT)/km/x64
+PATH_SDK_WINDDK80_LIB_WLH.x86 ?= $(PATH_SDK_WINDDK80_LIB_WLH_ROOT)/km/x86
+PATH_SDK_WINDDK80_LIB_WLH ?= $(PATH_SDK_WINDDK80_LIB_WLH.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINDDK80_LIB.amd64 ?= $(PATH_SDK_WINDDK80_LIB_WLH.amd64)
+PATH_SDK_WINDDK80_LIB.x86 ?= $(PATH_SDK_WINDDK80_LIB_WLH.x86)
+PATH_SDK_WINDDK80_LIB ?= $(PATH_SDK_WINDDK80_LIB.$(KBUILD_TARGET_ARCH))
+
+# General Properties used by kBuild
+SDK_WINDDK80_DEFS.amd64 ?= _AMD64_ AMD64 _WIN64
+SDK_WINDDK80_DEFS.x86 ?= _X86_=1 i386=1 STD_CALL
+SDK_WINDDK80_INCS ?= \
+ $(PATH_SDK_WINDDK80_INC_KM) \
+ $(PATH_SDK_WINDDK80_INC_UM) \
+ $(PATH_SDK_WINDDK80_INC_SHARED) \
+# The compiler tool(s) will have to select the appropriate crt includes.
+SDK_WINDDK80_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK80_LIB_WLH.amd64)
+SDK_WINDDK80_LIBPATH.x86 ?= $(PATH_SDK_WINDDK80_LIB_WLH.x86)
+
diff --git a/kBuild/sdks/WINDDK80W8.kmk b/kBuild/sdks/WINDDK80W8.kmk
new file mode 100644
index 0000000..08b571c
--- /dev/null
+++ b/kBuild/sdks/WINDDK80W8.kmk
@@ -0,0 +1,46 @@
+# $Id: WINDDK80W8.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows 8 DDKs, Targeting Windows 8 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDK80W8 := The Microsoft Windows 8 DDKs, Targeting Windows 8 (KBUILD_TARGET_ARCH).
+SDK_WINDDK80W8_EXTENDS = WINDDK80
+SDK_WINDDK80W8_DEFS ?= WIN32=100 _WIN32_WINNT=0x0602 WINVER=0x0602 _WIN32_IE=0x0A00 NTDDI_VERSION=0x06020000 \
+ KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005
+SDK_WINDDK80W8_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK80_LIB_W8.amd64)
+SDK_WINDDK80W8_LIBPATH.x86 ?= $(PATH_SDK_WINDDK80_LIB_W8.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK80 sdk, so use those variables where ever possible
+PATH_SDK_WINDDK80W8_LIB.amd64?= $(PATH_SDK_WINDDK80_LIB_W8.amd64)
+PATH_SDK_WINDDK80W8_LIB.x86 ?= $(PATH_SDK_WINDDK80_LIB_W8.x86)
+PATH_SDK_WINDDK80W8_LIB ?= $(PATH_SDK_WINDDK80W8_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINDDKW2K.kmk b/kBuild/sdks/WINDDKW2K.kmk
new file mode 100644
index 0000000..318f9a6
--- /dev/null
+++ b/kBuild/sdks/WINDDKW2K.kmk
@@ -0,0 +1,43 @@
+# $Id: WINDDKW2K.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows Vista and Server 2008 DDKs, Targeting Windows 2000 (x86).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDKW2K := The Microsoft Windows Vista and Server 2008 DDKs, Targeting Windows 2000 (x86).
+SDK_WINDDKW2K_EXTENDS = WINDDK
+SDK_WINDDKW2K_DEFS ?= WIN32=100 _WIN32_WINNT=0x0500 WINVER=0x0500 _WIN32_IE=0x0501 NTDDI_VERSION=0x05000400
+SDK_WINDDKW2K_LIBPATH.x86 ?= $(PATH_SDK_WINDDK_LIB_W2K.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK sdk, so use those variables where ever possible
+PATH_SDK_WINDDKW2K_LIB.x86 ?= $(PATH_SDK_WINDDK_LIB_W2K.x86)
+PATH_SDK_WINDDKW2K_LIB ?= $(PATH_SDK_WINDDKW2K_LIB.x86)
+
diff --git a/kBuild/sdks/WINDDKWLH.kmk b/kBuild/sdks/WINDDKWLH.kmk
new file mode 100644
index 0000000..63952a0
--- /dev/null
+++ b/kBuild/sdks/WINDDKWLH.kmk
@@ -0,0 +1,47 @@
+# $Id: WINDDKWLH.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows Vista and Server 2008 DDKs, Targeting Vista and 2008 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDKWLH := The Microsoft Windows Vista and Server 2008 DDKs, Targeting Vista and 2008 (KBUILD_TARGET_ARCH).
+SDK_WINDDKWLH_EXTENDS = WINDDK
+SDK_WINDDKWLH_DEFS ?= WIN32=100 _WIN32_WINNT=0x0600 WINVER=0x0600 _WIN32_IE=0x0700 NTDDI_VERSION=0x06000000 KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=005
+SDK_WINDDKWLH_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK_LIB_WLH.amd64)
+SDK_WINDDKWLH_LIBPATH.ia64 ?= $(PATH_SDK_WINDDK_LIB_WLH.ia64)
+SDK_WINDDKWLH_LIBPATH.x86 ?= $(PATH_SDK_WINDDK_LIB_WLH.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK sdk, so use those variables where ever possible
+PATH_SDK_WINDDKWLH_LIB.amd64?= $(PATH_SDK_WINDDK_LIB_WLH.amd64)
+PATH_SDK_WINDDKWLH_LIB.ia64 ?= $(PATH_SDK_WINDDK_LIB_WLH.ia64)
+PATH_SDK_WINDDKWLH_LIB.x86 ?= $(PATH_SDK_WINDDK_LIB_WLH.x86)
+PATH_SDK_WINDDKWLH_LIB ?= $(PATH_SDK_WINDDKWLH_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINDDKWNET.kmk b/kBuild/sdks/WINDDKWNET.kmk
new file mode 100644
index 0000000..f4b092e
--- /dev/null
+++ b/kBuild/sdks/WINDDKWNET.kmk
@@ -0,0 +1,47 @@
+# $Id: WINDDKWNET.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows Vista and Server 2008 DDKs, Targeting Windows Server 2003 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDKWNET := The Microsoft Windows Vista and Server 2008 DDKs, Targeting Windows Server 2003 (KBUILD_TARGET_ARCH).
+SDK_WINDDKWNET_EXTENDS = WINDDK
+SDK_WINDDKWNET_DEFS ?= WIN32=100 _WIN32_WINNT=0x0502 WINVER=0x0502 _WIN32_IE=0x0603 NTDDI_VERSION=0x05020100
+SDK_WINDDKWNET_LIBPATH.amd64 ?= $(PATH_SDK_WINDDK_LIB_WNET.amd64)
+SDK_WINDDKWNET_LIBPATH.ia64 ?= $(PATH_SDK_WINDDK_LIB_WNET.ia64)
+SDK_WINDDKWNET_LIBPATH.x86 ?= $(PATH_SDK_WINDDK_LIB_WNET.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK sdk, so use those variables where ever possible
+PATH_SDK_WINDDKWNET_LIB.amd64?= $(PATH_SDK_WINDDK_LIB_WNET.amd64)
+PATH_SDK_WINDDKWNET_LIB.ia64 ?= $(PATH_SDK_WINDDK_LIB_WNET.ia64)
+PATH_SDK_WINDDKWNET_LIB.x86 ?= $(PATH_SDK_WINDDK_LIB_WNET.x86)
+PATH_SDK_WINDDKWNET_LIB ?= $(PATH_SDK_WINDDKWNET_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINDDKWXP.kmk b/kBuild/sdks/WINDDKWXP.kmk
new file mode 100644
index 0000000..8df29d5
--- /dev/null
+++ b/kBuild/sdks/WINDDKWXP.kmk
@@ -0,0 +1,43 @@
+# $Id: WINDDKWXP.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows Vista and Server 2008 DDKs, Targeting Windows XP (x86).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINDDKWXP := The Microsoft Windows Vista and Server 2008 DDKs, Targeting Windows XP (x86).
+SDK_WINDDKWXP_EXTENDS = WINDDK
+SDK_WINDDKWXP_DEFS ?= WIN32=100 _WIN32_WINNT=0x0501 WINVER=0x0501 _WIN32_IE=0x0603 NTDDI_VERSION=0x05010200
+SDK_WINDDKWXP_LIBPATH.x86 ?= $(PATH_SDK_WINDDK_LIB_WXP.x86)
+
+# SDK Specific Properties.
+# Note! extends the WINDDK sdk, so use those variables where ever possible
+PATH_SDK_WINDDKWXP_LIB.x86 ?= $(PATH_SDK_WINDDK_LIB_WXP.x86)
+PATH_SDK_WINDDKWXP_LIB ?= $(PATH_SDK_WINDDKWXP_LIB.x86)
+
diff --git a/kBuild/sdks/WINPSDK.kmk b/kBuild/sdks/WINPSDK.kmk
new file mode 100644
index 0000000..9f24a38
--- /dev/null
+++ b/kBuild/sdks/WINPSDK.kmk
@@ -0,0 +1,161 @@
+# $Id: WINPSDK.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows Platform SDK, targeting (KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINPSDK := The Windows Platform SDK, targeting (KBUILD_TARGET).
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINPSDK
+ PATH_SDK_WINPSDK := $(wildcard $(KBUILD_DEVTOOLS_BLD)/sdk/2*)
+ ifeq ($(PATH_SDK_WINPSDK),)
+ PATH_SDK_WINPSDK := $(wildcard $(KBUILD_DEVTOOLS_TRG)/sdk/2*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDK),)
+ PATH_SDK_WINPSDK := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/2*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDK),)
+ PATH_SDK_WINPSDK := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/sdk/2*)
+ endif
+ ifneq ($(PATH_SDK_WINPSDK),)
+ PATH_SDK_WINPSDK := $(lastword $(sort $(PATH_SDK_WINPSDK)))
+ else
+ $(warning kBuild: PATH_SDK_WINPSDK couldn't be determined!)
+ PATH_SDK_WINPSDK := $(KBUILD_DEVTOOLS_BLD)/sdk/not/found
+ endif
+else
+ PATH_SDK_WINPSDK := $(PATH_SDK_WINPSDK)
+endif
+
+ifndef PATH_SDK_WINPSDK_INC
+PATH_SDK_WINPSDK_INC := $(firstword $(wildcard $(PATH_SDK_WINPSDK)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WINPSDK)/Include)
+endif
+
+ifndef PATH_SDK_WINPSDK_LIB.x86
+PATH_SDK_WINPSDK_LIB.x86 := $(firstword $(wildcard $(PATH_SDK_WINPSDK)/[Ll][Ii][Bb]) $(PATH_SDK_WINPSDK)/Lib)
+endif
+ifndef PATH_SDK_WINPSDK_LIB.amd64
+PATH_SDK_WINPSDK_LIB.amd64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64 $(PATH_SDK_WINPSDK)/[Ll][Ii][Bb]/[xX]64) $(PATH_SDK_WINPSDK)/Lib/AMD64)
+endif
+ifndef PATH_SDK_WINPSDK_LIB.ia64
+PATH_SDK_WINPSDK_LIB.ia64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK)/[Ll][Ii][Bb]/[Ii][Aa]64) $(PATH_SDK_WINPSDK)/Lib/IA64)
+endif
+PATH_SDK_WINPSDK_LIB ?= $(PATH_SDK_WINPSDK_LIB.$(KBUILD_TARGET_ARCH))
+
+ifndef PATH_SDK_WINPSDK_BIN
+PATH_SDK_WINPSDK_BIN := $(firstword $(wildcard $(PATH_SDK_WINPSDK)/[Bb][Ii][Nn]) $(PATH_SDK_WINPSDK)/Bin)
+endif
+ifndef PATH_SDK_WINPSDK_BIN_AMD64
+PATH_SDK_WINPSDK_BIN_AMD64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK_BIN)/[Ww][Ii][Nn]64/[Xx]86/[Aa][Mm][Dd]64 $(PATH_SDK_WINPSDK_BIN)/[Ww][Ii][Nn]64/[Xx]86) $(PATH_SDK_WINPSDK_BIN)/win64/AMD64)
+endif
+ifndef PATH_SDK_WINPSDK_BIN_IA64
+PATH_SDK_WINPSDK_BIN_IA64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK_BIN)/[Ww][Ii][Nn]64) $(PATH_SDK_WINPSDK_BIN)/win64)
+endif
+
+
+# General Properties used by kBuild
+SDK_WINPSDK_INCS ?= $(PATH_SDK_WINPSDK_INC)
+SDK_WINPSDK_LIBPATH.x86 ?= $(PATH_SDK_WINPSDK_LIB.x86)
+SDK_WINPSDK_LIBPATH.amd64 ?= $(PATH_SDK_WINPSDK_LIB.amd64)
+SDK_WINPSDK_LIBPATH.ia64 ?= $(PATH_SDK_WINPSDK_LIB.ia64)
+SDK_WINPSDK_LIBS.x86 ?= \
+ $(PATH_SDK_WINPSDK_LIB.x86)/Kernel32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/User32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/Gdi32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/AdvAPI32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/shell32.lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/ShLwApi.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/SetupAPI.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/Uuid.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/Version.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WINPSDK_LIB.x86)/Ole32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/OleAut32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/OleDlg.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WINPSDK_LIB.x86)/DbgHelp.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/ImageHlp.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/IPHlpApi.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/ComCtl32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/ComDlg32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/WinSpool.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/WinMM.Lib
+SDK_WINPSDK_LIBS.amd64 ?= \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/Kernel32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/User32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/Gdi32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/AdvAPI32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/Shell32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/ShLwApi.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/SetupAPI.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/Uuid.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/Version.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/Ole32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/OleAut32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/OleDlg.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/DbgHelp.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/ImageHlp.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/IPHlpApi.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/ComCtl32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/ComDlg32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/WinSpool.Lib \
+ $(PATH_SDK_WINPSDK_LIB.amd64)/WinMM.Lib
+SDK_WINPSDK_LIBS.ia64 ?= \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/Kernel32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/User32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/Gdi32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/AdvAPI32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/Shell32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/ShLwApi.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/SetupAPI.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/Uuid.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/Version.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/Ole32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/OleAut32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/OleDlg.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/DbgHelp.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/ImageHlp.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/IPHlpApi.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/ComCtl32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/ComDlg32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/WinSpool.Lib \
+ $(PATH_SDK_WINPSDK_LIB.ia64)/WinMM.Lib
+
diff --git a/kBuild/sdks/WINPSDK71.kmk b/kBuild/sdks/WINPSDK71.kmk
new file mode 100644
index 0000000..1330f56
--- /dev/null
+++ b/kBuild/sdks/WINPSDK71.kmk
@@ -0,0 +1,161 @@
+# $Id: WINPSDK71.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows Platform SDK v7.1, targeting (KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINPSDK71 := The Windows Platform SDK v7.1, targeting (KBUILD_TARGET).
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINPSDK71
+ PATH_SDK_WINPSDK71 := $(wildcard $(KBUILD_DEVTOOLS_BLD)/sdk/v7.1*)
+ ifeq ($(PATH_SDK_WINPSDK71),)
+ PATH_SDK_WINPSDK71 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/sdk/v7.1*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDK71),)
+ PATH_SDK_WINPSDK71 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDK71),)
+ PATH_SDK_WINPSDK71 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/sdk/v7.1*)
+ endif
+ ifneq ($(PATH_SDK_WINPSDK71),)
+ PATH_SDK_WINPSDK71 := $(lastword $(sort $(PATH_SDK_WINPSDK71)))
+ else
+ $(warning kBuild: PATH_SDK_WINPSDK71 couldn't be determined!)
+ PATH_SDK_WINPSDK71 := $(KBUILD_DEVTOOLS_BLD)/sdk/v7.1-not-found
+ endif
+else
+ PATH_SDK_WINPSDK71 := $(PATH_SDK_WINPSDK71)
+endif
+
+ifndef PATH_SDK_WINPSDK71_INC
+PATH_SDK_WINPSDK71_INC := $(firstword $(wildcard $(PATH_SDK_WINPSDK71)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WINPSDK71)/Include)
+endif
+
+ifndef PATH_SDK_WINPSDK71_LIB.x86
+PATH_SDK_WINPSDK71_LIB.x86 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71)/[Ll][Ii][Bb]) $(PATH_SDK_WINPSDK71)/Lib)
+endif
+ifndef PATH_SDK_WINPSDK71_LIB.amd64
+PATH_SDK_WINPSDK71_LIB.amd64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64 $(PATH_SDK_WINPSDK71)/[Ll][Ii][Bb]/[xX]64) $(PATH_SDK_WINPSDK71)/Lib/AMD64)
+endif
+ifndef PATH_SDK_WINPSDK71_LIB.ia64
+PATH_SDK_WINPSDK71_LIB.ia64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71)/[Ll][Ii][Bb]/[Ii][Aa]64) $(PATH_SDK_WINPSDK71)/Lib/IA64)
+endif
+PATH_SDK_WINPSDK71_LIB ?= $(PATH_SDK_WINPSDK71_LIB.$(KBUILD_TARGET_ARCH))
+
+ifndef PATH_SDK_WINPSDK71_BIN
+PATH_SDK_WINPSDK71_BIN := $(firstword $(wildcard $(PATH_SDK_WINPSDK71)/[Bb][Ii][Nn]) $(PATH_SDK_WINPSDK71)/Bin)
+endif
+ifndef PATH_SDK_WINPSDK71_BIN_AMD64
+PATH_SDK_WINPSDK71_BIN_AMD64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71_BIN)/[Ww][Ii][Nn]64/[Xx]86/[Aa][Mm][Dd]64 $(PATH_SDK_WINPSDK71_BIN)/[Ww][Ii][Nn]64/[Xx]86) $(PATH_SDK_WINPSDK71_BIN)/win64/AMD64)
+endif
+ifndef PATH_SDK_WINPSDK71_BIN_IA64
+PATH_SDK_WINPSDK71_BIN_IA64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71_BIN)/[Ww][Ii][Nn]64) $(PATH_SDK_WINPSDK71_BIN)/win64)
+endif
+
+
+# General Properties used by kBuild
+SDK_WINPSDK71_INCS ?= $(PATH_SDK_WINPSDK71_INC)
+SDK_WINPSDK71_LIBPATH.x86 ?= $(PATH_SDK_WINPSDK71_LIB.x86)
+SDK_WINPSDK71_LIBPATH.amd64 ?= $(PATH_SDK_WINPSDK71_LIB.amd64)
+SDK_WINPSDK71_LIBPATH.ia64 ?= $(PATH_SDK_WINPSDK71_LIB.ia64)
+SDK_WINPSDK71_LIBS.x86 ?= \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/Kernel32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/User32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/Gdi32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/AdvAPI32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/shell32.lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/ShLwApi.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/SetupAPI.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/Uuid.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/Version.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/Ole32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/OleAut32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/OleDlg.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/DbgHelp.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/ImageHlp.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/IPHlpApi.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/ComCtl32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/ComDlg32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/WinSpool.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/WinMM.Lib
+SDK_WINPSDK71_LIBS.amd64 ?= \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/Kernel32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/User32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/Gdi32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/AdvAPI32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/Shell32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/ShLwApi.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/SetupAPI.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/Uuid.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/Version.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/Ole32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/OleAut32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/OleDlg.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/DbgHelp.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/ImageHlp.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/IPHlpApi.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/ComCtl32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/ComDlg32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/WinSpool.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.amd64)/WinMM.Lib
+SDK_WINPSDK71_LIBS.ia64 ?= \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/Kernel32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/User32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/Gdi32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/AdvAPI32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/Shell32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/ShLwApi.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/SetupAPI.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/Uuid.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/Version.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/WS2_32.Lib \
+ \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/Ole32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/OleAut32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/OleDlg.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/RpcRT4.Lib \
+ \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/DbgHelp.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/ImageHlp.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/IPHlpApi.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/ComCtl32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/ComDlg32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/WinSpool.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.ia64)/WinMM.Lib
+
diff --git a/kBuild/sdks/WINPSDK71INCS.kmk b/kBuild/sdks/WINPSDK71INCS.kmk
new file mode 100644
index 0000000..3ab712d
--- /dev/null
+++ b/kBuild/sdks/WINPSDK71INCS.kmk
@@ -0,0 +1,90 @@
+# $Id: WINPSDK71INCS.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows Platform SDK v7.1, targeting (KBUILD_TARGET) but
+# without any libraries or LIBPATH properties.
+# Basically for finding specstrings.h when using the DDK.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINPSDK71INCS := The Windows Platform SDK v7.1, targeting (KBUILD_TARGET) but \
+ without any library or LIBPATH properties. \
+ Basically for finding specstrings.h when using the DDK.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINPSDK71INCS
+ ifdef PATH_SDK_WINPSDK71
+ PATH_SDK_WINPSDK71INCS := $(PATH_SDK_WINPSDK71)
+ else
+ PATH_SDK_WINPSDK71INCS := $(wildcard $(KBUILD_DEVTOOLS_BLD)/sdk/v7.1*)
+ ifeq ($(PATH_SDK_WINPSDK71INCS),)
+ PATH_SDK_WINPSDK71INCS := $(wildcard $(KBUILD_DEVTOOLS_TRG)/sdk/v7.1*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDK71INCS),)
+ PATH_SDK_WINPSDK71INCS := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDK71INCS),)
+ PATH_SDK_WINPSDK71INCS := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/sdk/v7.1*)
+ endif
+ ifneq ($(PATH_SDK_WINPSDK71INCS),)
+ PATH_SDK_WINPSDK71INCS := $(lastword $(sort $(PATH_SDK_WINPSDK71INCS)))
+ else
+ $(warning kBuild: PATH_SDK_WINPSDK71INCS couldn't be determined!)
+ PATH_SDK_WINPSDK71INCS := $(KBUILD_DEVTOOLS_BLD)/sdk/v7.1-not-found
+ endif
+ endif
+else
+ PATH_SDK_WINPSDK71INCS := $(PATH_SDK_WINPSDK71INCS)
+endif
+ifndef PATH_SDK_WINPSDK71INCS_INC
+PATH_SDK_WINPSDK71INCS_INC := $(firstword $(wildcard $(PATH_SDK_WINPSDK71INCS)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WINPSDK71INCS)/Include)
+endif
+
+ifndef PATH_SDK_WINPSDK71INCS_LIB.x86
+PATH_SDK_WINPSDK71INCS_LIB.x86 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71INCS)/[Ll][Ii][Bb]) $(PATH_SDK_WINPSDK71INCS)/Lib)
+endif
+ifndef PATH_SDK_WINPSDK71INCS_LIB.amd64
+PATH_SDK_WINPSDK71INCS_LIB.amd64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71INCS)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64) $(PATH_SDK_WINPSDK71INCS)/Lib/AMD64)
+endif
+PATH_SDK_WINPSDK71INCS_LIB ?= $(PATH_SDK_WINPSDK71INCS_LIB.$(KBUILD_TARGET_ARCH))
+
+ifndef PATH_SDK_WINPSDK71INCS_BIN
+PATH_SDK_WINPSDK71INCS_BIN := $(firstword $(wildcard $(PATH_SDK_WINPSDK71INCS)/[Bb][Ii][Nn]) $(PATH_SDK_WINPSDK71INCS)/Bin)
+endif
+ifndef PATH_SDK_WINPSDK71INCS_BIN_AMD64
+PATH_SDK_WINPSDK71INCS_BIN_AMD64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71INCS_BIN)/[Ww][Ii][Nn]64/[Xx]86/[Aa][Mm][Dd]64) $(PATH_SDK_WINPSDK71INCS_BIN)/win64/AMD64)
+endif
+ifndef PATH_SDK_WINPSDK71INCS_BIN_IA64
+PATH_SDK_WINPSDK71INCS_BIN_IA64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK71INCS_BIN)/[Ww][Ii][Nn]64) $(PATH_SDK_WINPSDK71INCS_BIN)/win64)
+endif
+
+
+# General Properties used by kBuild
+SDK_WINPSDK71INCS_INCS ?= $(PATH_SDK_WINPSDK71INCS_INC)
+
diff --git a/kBuild/sdks/WINPSDKINCS.kmk b/kBuild/sdks/WINPSDKINCS.kmk
new file mode 100644
index 0000000..e7c8b69
--- /dev/null
+++ b/kBuild/sdks/WINPSDKINCS.kmk
@@ -0,0 +1,93 @@
+# $Id: WINPSDKINCS.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# kBuild SDK - The Windows Platform SDK, targeting (KBUILD_TARGET) but
+# without any libraries or LIBPATH properties.
+# Basically for finding specstrings.h when using the DDK.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINPSDKINCS := The Windows Platform SDK, targeting (KBUILD_TARGET) but \
+ without any library or LIBPATH properties. \
+ Basically for finding specstrings.h when using the DDK.
+
+# SDK Specific Properties
+ifndef PATH_SDK_WINPSDKINCS
+ ifdef PATH_SDK_WINPSDK
+ PATH_SDK_WINPSDKINCS := $(PATH_SDK_WINPSDK)
+ else
+ PATH_SDK_WINPSDKINCS := $(wildcard $(KBUILD_DEVTOOLS_BLD)/sdk/2*)
+ ifeq ($(PATH_SDK_WINPSDKINCS),)
+ PATH_SDK_WINPSDKINCS := $(wildcard $(KBUILD_DEVTOOLS_TRG)/sdk/2*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDKINCS),)
+ PATH_SDK_WINPSDKINCS := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/sdk/2*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDKINCS),)
+ PATH_SDK_WINPSDKINCS := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/sdk/2*)
+ endif
+ ifeq ($(PATH_SDK_WINPSDKINCS),)
+ PATH_SDK_WINPSDKINCS := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/sdk/2*)
+ endif
+ ifneq ($(PATH_SDK_WINPSDKINCS),)
+ PATH_SDK_WINPSDKINCS := $(lastword $(sort $(PATH_SDK_WINPSDKINCS)))
+ else
+ $(warning kBuild: PATH_SDK_WINPSDKINCS couldn't be determined!)
+ PATH_SDK_WINPSDKINCS := $(KBUILD_DEVTOOLS_BLD)/sdk/not/found
+ endif
+ endif
+else
+ PATH_SDK_WINPSDKINCS := $(PATH_SDK_WINPSDKINCS)
+endif
+ifndef PATH_SDK_WINPSDKINCS_INC
+PATH_SDK_WINPSDKINCS_INC := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WINPSDKINCS)/Include)
+endif
+
+ifndef PATH_SDK_WINPSDKINCS_LIB.x86
+PATH_SDK_WINPSDKINCS_LIB.x86 := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS)/[Ll][Ii][Bb]) $(PATH_SDK_WINPSDKINCS)/Lib)
+endif
+ifndef PATH_SDK_WINPSDKINCS_LIB.amd64
+PATH_SDK_WINPSDKINCS_LIB.amd64 := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64) $(PATH_SDK_WINPSDKINCS)/Lib/AMD64)
+endif
+PATH_SDK_WINPSDKINCS_LIB ?= $(PATH_SDK_WINPSDKINCS_LIB.$(KBUILD_TARGET_ARCH))
+
+ifndef PATH_SDK_WINPSDKINCS_BIN
+PATH_SDK_WINPSDKINCS_BIN := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS)/[Bb][Ii][Nn]) $(PATH_SDK_WINPSDKINCS)/Bin)
+endif
+ifndef PATH_SDK_WINPSDKINCS_BIN_AMD64
+PATH_SDK_WINPSDKINCS_BIN_AMD64 := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS_BIN)/[Ww][Ii][Nn]64/[Xx]86/[Aa][Mm][Dd]64) $(PATH_SDK_WINPSDKINCS_BIN)/win64/AMD64)
+endif
+ifndef PATH_SDK_WINPSDKINCS_BIN_IA64
+PATH_SDK_WINPSDKINCS_BIN_IA64 := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS_BIN)/[Ww][Ii][Nn]64) $(PATH_SDK_WINPSDKINCS_BIN)/win64)
+endif
+
+
+# General Properties used by kBuild
+SDK_WINPSDKINCS_INCS ?= $(PATH_SDK_WINPSDKINCS_INC)
+
diff --git a/kBuild/sdks/WINSDK10-KM-W7.kmk b/kBuild/sdks/WINSDK10-KM-W7.kmk
new file mode 100644
index 0000000..22e70c0
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-KM-W7.kmk
@@ -0,0 +1,51 @@
+# $Id: WINSDK10-KM-W7.kmk 3508 2021-12-16 11:05:20Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, kernel mode, Targeting Windows 7 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2021 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10-KM.kmk
+endif
+
+SDK_WINSDK10-KM-W7 := The Microsoft Windows 10 SDK, kernel mode, Targeting Windows 7 (KBUILD_TARGET_ARCH).
+SDK_WINSDK10-KM-W7_EXTENDS := WINSDK10-KM
+SDK_WINSDK10-KM-W7_DEFS ?= WIN32=100 _WIN32_WINNT=0x0601 WINVER=0x0601 _WIN32_IE=0x0800 NTDDI_VERSION=0x06010000 \
+ KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=007
+SDK_WINSDK10-KM-W7_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.x86)
+SDK_WINSDK10-KM-W7_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.amd64)
+SDK_WINSDK10-KM-W7_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.arm32)
+
+# SDK Specific Properties.
+PATH_SDK_WINSDK10-KM-W7_LIB.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.x86)
+PATH_SDK_WINSDK10-KM-W7_LIB.amd64?= $(PATH_SDK_WINSDK10_KM_LIB_W7.amd64)
+PATH_SDK_WINSDK10-KM-W7_LIB.arm32?= $(PATH_SDK_WINSDK10_KM_LIB_W7.arm32)
+PATH_SDK_WINSDK10-KM-W7_LIB ?= $(PATH_SDK_WINSDK10-KM-W7_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINSDK10-KM-W8.kmk b/kBuild/sdks/WINSDK10-KM-W8.kmk
new file mode 100644
index 0000000..b6d9ea3
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-KM-W8.kmk
@@ -0,0 +1,51 @@
+# $Id: WINSDK10-KM-W8.kmk 3508 2021-12-16 11:05:20Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, kernel mode, Targeting Windows 8 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2021 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10-KM.kmk
+endif
+
+SDK_WINSDK10-KM-W8 := The Microsoft Windows 10 SDK, kernel mode, Targeting Windows 8 (KBUILD_TARGET_ARCH).
+SDK_WINSDK10-KM-W8_EXTENDS := WINSDK10-KM
+SDK_WINSDK10-KM-W8_DEFS ?= WIN32=100 _WIN32_WINNT=0x0602 WINVER=0x0602 _WIN32_IE=0x0A00 NTDDI_VERSION=0x06020000 \
+ KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=011
+SDK_WINSDK10-KM-W8_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB_W8.x86)
+SDK_WINSDK10-KM-W8_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_KM_LIB_W8.amd64)
+SDK_WINSDK10-KM-W8_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_KM_LIB_W8.arm32)
+
+# SDK Specific Properties.
+PATH_SDK_WINSDK10-KM-W8_LIB.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB_W8.x86)
+PATH_SDK_WINSDK10-KM-W8_LIB.amd64?= $(PATH_SDK_WINSDK10_KM_LIB_W8.amd64)
+PATH_SDK_WINSDK10-KM-W8_LIB.arm32?= $(PATH_SDK_WINSDK10_KM_LIB_W8.arm32)
+PATH_SDK_WINSDK10-KM-W8_LIB ?= $(PATH_SDK_WINSDK10-KM-W8_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINSDK10-KM-W81.kmk b/kBuild/sdks/WINSDK10-KM-W81.kmk
new file mode 100644
index 0000000..c2538b8
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-KM-W81.kmk
@@ -0,0 +1,51 @@
+# $Id: WINSDK10-KM-W81.kmk 3508 2021-12-16 11:05:20Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, kernel mode, Targeting Windows 8.1 (KBUILD_TARGET_ARCH).
+#
+
+#
+# Copyright (c) 2006-2021 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10-KM.kmk
+endif
+
+SDK_WINSDK10-KM-W81 := The Microsoft Windows 10 SDK, kernel mode, Targeting Windows 8.1 (KBUILD_TARGET_ARCH).
+SDK_WINSDK10-KM-W81_EXTENDS := WINSDK10-KM
+SDK_WINSDK10-KM-W81_DEFS ?= WIN32=100 _WIN32_WINNT=0x0603 WINVER=0x0603 _WIN32_IE=0x0A00 NTDDI_VERSION=0x06030000 \
+ KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=013
+SDK_WINSDK10-KM-W81_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB_W81.x86)
+SDK_WINSDK10-KM-W81_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_KM_LIB_W81.amd64)
+SDK_WINSDK10-KM-W81_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_KM_LIB_W81.arm32)
+
+# SDK Specific Properties.
+PATH_SDK_WINSDK10-KM-W81_LIB.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB_W81.x86)
+PATH_SDK_WINSDK10-KM-W81_LIB.amd64?= $(PATH_SDK_WINSDK10_KM_LIB_W81.amd64)
+PATH_SDK_WINSDK10-KM-W81_LIB.arm32?= $(PATH_SDK_WINSDK10_KM_LIB_W81.arm32)
+PATH_SDK_WINSDK10-KM-W81_LIB ?= $(PATH_SDK_WINSDK10-KM-W81_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINSDK10-KM.kmk b/kBuild/sdks/WINSDK10-KM.kmk
new file mode 100644
index 0000000..f5f8484
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-KM.kmk
@@ -0,0 +1,59 @@
+# $Id: WINSDK10-KM.kmk 3507 2021-12-16 01:35:08Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, kernel mode.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10.kmk
+endif
+
+SDK_WINSDK10-KM := The Microsoft Windows 10 SDK, kernel mode.
+SDK_WINSDK10-KM_DEFS.amd64 ?= _AMD64_ AMD64 _WIN64
+SDK_WINSDK10-KM_DEFS.x86 ?= _X86_=1 i386=1 STD_CALL
+SDK_WINSDK10-KM_DEFS.arm32 ?= #??
+SDK_WINSDK10-KM_DEFS.arm64 ?= #??
+SDK_WINSDK10-KM_INCS ?= \
+ $(PATH_SDK_WINSDK10_KM_INC) \
+ $(PATH_SDK_WINSDK10_SHARED_INC)
+SDK_WINSDK10-KM_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_KM_LIB.x86)
+SDK_WINSDK10-KM_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_KM_LIB.amd64)
+SDK_WINSDK10-KM_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_KM_LIB.arm32)
+SDK_WINSDK10-KM_LIBPATH.arm64 ?= $(PATH_SDK_WINSDK10_KM_LIB.arm64)
+
+# Path variables for smoothing the transistion from older PSDKs.
+PATH_SDK_WINSDK10_KM = $(PATH_SDK_WINSDK10)
+
+PATH_SDK_WINSDK10-KM_LIB.x86 = $(PATH_SDK_WINSDK10_KM_LIB.x86)
+PATH_SDK_WINSDK10-KM_LIB.amd64 = $(PATH_SDK_WINSDK10_KM_LIB.amd64)
+PATH_SDK_WINSDK10-KM_LIB.arm32 = $(PATH_SDK_WINSDK10_KM_LIB.arm32)
+PATH_SDK_WINSDK10-KM_LIB.arm64 = $(PATH_SDK_WINSDK10_KM_LIB.arm64)
+PATH_SDK_WINSDK10-KM_LIB ?= $(PATH_SDK_WINSDK10_KM_LIB.$(KBUILD_TARGET_ARCH))
+
diff --git a/kBuild/sdks/WINSDK10-UCRT-INCS.kmk b/kBuild/sdks/WINSDK10-UCRT-INCS.kmk
new file mode 100644
index 0000000..682ce07
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-UCRT-INCS.kmk
@@ -0,0 +1,40 @@
+# $Id: WINSDK10-UCRT-INCS.kmk 3320 2020-04-16 22:19:22Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, Universal CRT, includes only.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10.kmk
+endif
+
+SDK_WINSDK10-UCRT-INCS := The Microsoft Windows 10 SDK, Universal CRT, only includes.
+SDK_WINSDK10-UCRT-INCS_INCS ?= $(PATH_SDK_WINSDK10_UCRT_INC)
+
diff --git a/kBuild/sdks/WINSDK10-UCRT-STATIC.kmk b/kBuild/sdks/WINSDK10-UCRT-STATIC.kmk
new file mode 100644
index 0000000..d1ab310
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-UCRT-STATIC.kmk
@@ -0,0 +1,56 @@
+# $Id: WINSDK10-UCRT-STATIC.kmk 3320 2020-04-16 22:19:22Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, Universal CRT, DLL linking.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10.kmk
+endif
+
+SDK_WINSDK10-UCRT-STATIC := The Microsoft Windows 10 SDK, Universal CRT, static linking.
+SDK_WINSDK10-UCRT-STATIC_INCS ?= $(PATH_SDK_WINSDK10_UCRT_INC)
+SDK_WINSDK10-UCRT-STATIC_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.x86)
+SDK_WINSDK10-UCRT-STATIC_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.amd64)
+SDK_WINSDK10-UCRT-STATIC_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.arm32)
+SDK_WINSDK10-UCRT-STATIC_LIBPATH.arm64 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.arm64)
+ifndef SDK_WINSDK10-UCRT-STATIC_LIBS.amd64
+SDK_WINSDK10-UCRT-STATIC_LIBS.amd64 := $(PATH_SDK_WINSDK10_UCRT_LIB.amd64)/$(SDK_WINSDK10_UCRT_STATIC_NAME)
+endif
+ifndef SDK_WINSDK10-UCRT-STATIC_LIBS.arm32
+SDK_WINSDK10-UCRT-STATIC_LIBS.arm32 := $(PATH_SDK_WINSDK10_UCRT_LIB.arm32)/$(SDK_WINSDK10_UCRT_STATIC_NAME)
+endif
+ifndef SDK_WINSDK10-UCRT-STATIC_LIBS.arm64
+SDK_WINSDK10-UCRT-STATIC_LIBS.arm64 := $(PATH_SDK_WINSDK10_UCRT_LIB.arm32)/$(SDK_WINSDK10_UCRT_STATIC_NAME)
+endif
+ifndef SDK_WINSDK10-UCRT-STATIC_LIBS.x86
+SDK_WINSDK10-UCRT-STATIC_LIBS.x86 := $(PATH_SDK_WINSDK10_UCRT_LIB.x86)/$(SDK_WINSDK10_UCRT_STATIC_NAME)
+endif
+
diff --git a/kBuild/sdks/WINSDK10-UCRT.kmk b/kBuild/sdks/WINSDK10-UCRT.kmk
new file mode 100644
index 0000000..f1d0483
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-UCRT.kmk
@@ -0,0 +1,56 @@
+# $Id: WINSDK10-UCRT.kmk 3320 2020-04-16 22:19:22Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, Universal CRT, DLL linking.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10.kmk
+endif
+
+SDK_WINSDK10-UCRT := The Microsoft Windows 10 SDK, Universal CRT, DLL linking.
+SDK_WINSDK10-UCRT_INCS ?= $(PATH_SDK_WINSDK10_UCRT_INC)
+SDK_WINSDK10-UCRT_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.x86)
+SDK_WINSDK10-UCRT_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.amd64)
+SDK_WINSDK10-UCRT_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.arm32)
+SDK_WINSDK10-UCRT_LIBPATH.arm64 ?= $(PATH_SDK_WINSDK10_UCRT_LIB.arm64)
+ifndef SDK_WINSDK10-UCRT_LIBS.amd64
+SDK_WINSDK10-UCRT_LIBS.amd64 := $(PATH_SDK_WINSDK10_UCRT_LIB.amd64)/$(SDK_WINSDK10_UCRT_IMPLIB_NAME)
+endif
+ifndef SDK_WINSDK10-UCRT_LIBS.arm32
+SDK_WINSDK10-UCRT_LIBS.arm32 := $(PATH_SDK_WINSDK10_UCRT_LIB.arm32)/$(SDK_WINSDK10_UCRT_IMPLIB_NAME)
+endif
+ifndef SDK_WINSDK10-UCRT_LIBS.arm64
+SDK_WINSDK10-UCRT_LIBS.arm64 := $(PATH_SDK_WINSDK10_UCRT_LIB.arm32)/$(SDK_WINSDK10_UCRT_IMPLIB_NAME)
+endif
+ifndef SDK_WINSDK10-UCRT_LIBS.x86
+SDK_WINSDK10-UCRT_LIBS.x86 := $(PATH_SDK_WINSDK10_UCRT_LIB.x86)/$(SDK_WINSDK10_UCRT_IMPLIB_NAME)
+endif
+
diff --git a/kBuild/sdks/WINSDK10-UM-INCS.kmk b/kBuild/sdks/WINSDK10-UM-INCS.kmk
new file mode 100644
index 0000000..890b0ea
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-UM-INCS.kmk
@@ -0,0 +1,42 @@
+# $Id: WINSDK10-UM-INCS.kmk 3500 2021-12-14 09:38:34Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, user mode includes only.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10.kmk
+endif
+
+SDK_WINSDK10-UM-INCS := The Microsoft Windows 10 SDK, user mode includes only.
+SDK_WINSDK10-UM-INCS_INCS ?= \
+ $(PATH_SDK_WINSDK10_UM_INC) \
+ $(PATH_SDK_WINSDK10_SHARED_INC)
+
diff --git a/kBuild/sdks/WINSDK10-UM.kmk b/kBuild/sdks/WINSDK10-UM.kmk
new file mode 100644
index 0000000..3773cb4
--- /dev/null
+++ b/kBuild/sdks/WINSDK10-UM.kmk
@@ -0,0 +1,69 @@
+# $Id: WINSDK10-UM.kmk 3501 2021-12-14 21:54:48Z bird $
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, user mode.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10.kmk
+endif
+
+SDK_WINSDK10-UM := The Microsoft Windows 10 SDK, user mode.
+SDK_WINSDK10-UM_INCS ?= \
+ $(PATH_SDK_WINSDK10_UM_INC) \
+ $(PATH_SDK_WINSDK10_SHARED_INC)
+SDK_WINSDK10-UM_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_UM_LIB.x86)
+SDK_WINSDK10-UM_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_UM_LIB.amd64)
+SDK_WINSDK10-UM_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_UM_LIB.arm32)
+SDK_WINSDK10-UM_LIBPATH.arm64 ?= $(PATH_SDK_WINSDK10_UM_LIB.arm64)
+ifndef SDK_WINSDK10-UM_LIBS.amd64
+SDK_WINSDK10-UM_LIBS.amd64 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.amd64)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+ifndef SDK_WINSDK10-UM_LIBS.arm32
+SDK_WINSDK10-UM_LIBS.arm32 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.arm32)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+ifndef SDK_WINSDK10-UM_LIBS.arm64
+SDK_WINSDK10-UM_LIBS.arm64 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.arm64)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+ifndef SDK_WINSDK10-UM_LIBS.x86
+SDK_WINSDK10-UM_LIBS.x86 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.x86)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+
+# Path variables for smoothing the transistion from older PSDKs.
+PATH_SDK_WINSDK10_UM = $(PATH_SDK_WINSDK10)
+
+PATH_SDK_WINSDK10-UM_LIB.x86 = $(PATH_SDK_WINSDK10_UM_LIB.x86)
+PATH_SDK_WINSDK10-UM_LIB.amd64 = $(PATH_SDK_WINSDK10_UM_LIB.amd64)
+PATH_SDK_WINSDK10-UM_LIB.arm32 = $(PATH_SDK_WINSDK10_UM_LIB.arm32)
+PATH_SDK_WINSDK10-UM_LIB.arm64 = $(PATH_SDK_WINSDK10_UM_LIB.arm64)
+PATH_SDK_WINSDK10-UM_LIB ?= $(PATH_SDK_WINSDK10_UM_LIB.$(KBUILD_TARGET_ARCH))
+
+PATH_SDK_WINSDK10-UM_BIN ?= $(PATH_SDK_WINSDK10_BIN)
+
diff --git a/kBuild/sdks/WINSDK10.kmk b/kBuild/sdks/WINSDK10.kmk
new file mode 100644
index 0000000..bec1ce9
--- /dev/null
+++ b/kBuild/sdks/WINSDK10.kmk
@@ -0,0 +1,256 @@
+# $Id: WINSDK10.kmk 3511 2021-12-16 12:00:28Z bird $
+## @file
+# kBuild SDK - The Microsoft Windows SDK v10.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+SDK_WINSDK10 := The Windows Platform SDK v10, targeting (KBUILD_TARGET).
+
+ifndef INCLUDED_WIN_COMMON_KMK
+ include $(KBUILD_PATH)/win-common.kmk
+endif
+
+#
+# SDK Specific Properties
+#
+
+## @def PATH_SDK_WINSDK10
+## The base path of the Windows 10 SDK.
+## @def SDK_WINSDK10_VERSION
+## The SDK version for subdirectories.
+ifndef PATH_SDK_WINSDK10
+ ifndef SDK_WINSDK10_VERSION
+ PATH_SDK_WINSDK10 := $(firstfile $(foreachfile toolsdir, \
+ $(KBUILD_DEVTOOLS_BLD) $(KBUILD_DEVTOOLS_TRG) $(KBUILD_DEVTOOLS)/win.x86 $(KBUILD_DEVTOOLS)/win.amd64 \
+ , $(rsortfiles $(qwildcard ,$(toolsdir)/sdk/v10*/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*))))
+ ifeq ($(PATH_SDK_WINSDK10),)
+ PATH_SDK_WINSDK10 := $(firstfile $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
+ ,$(rsortfiles $(qwildcard ,$(progfilesdir)/Windows\ Kits/10/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*)) ))
+ ifeq ($(PATH_SDK_WINSDK10),)
+ $(warning kBuild: PATH_SDK_WINSDK10 couldn't be determined!)
+ PATH_SDK_WINSDK10 := $(KBUILD_DEVTOOLS_BLD)/sdk/v10-not-found/Include/10.0.10240.0
+ endif
+ endif
+ SDK_WINSDK10_VERSION := $(qnotdir ,$(PATH_SDK_WINSDK10))
+ else
+ PATH_SDK_WINSDK10 := $(firstfile $(foreachfile toolsdir, \
+ $(KBUILD_DEVTOOLS_BLD) $(KBUILD_DEVTOOLS_TRG) $(KBUILD_DEVTOOLS)/win.x86 $(KBUILD_DEVTOOLS)/win.amd64 \
+ , $(rsortfiles $(qwildcard ,$(toolsdir)/sdk/v10*/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/$(SDK_WINSDK10_VERSION)))))
+ ifeq ($(PATH_SDK_WINSDK10),)
+ PATH_SDK_WINSDK10 := $(firstfile $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
+ ,$(rsortfiles $(qwildcard ,$(progfilesdir)/Windows\ Kits/10/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/$(SDK_WINSDK10_VERSION))) ))
+ ifeq ($(PATH_SDK_WINSDK10),)
+ $(warning kBuild: PATH_SDK_WINSDK10 couldn't be determined!)
+ PATH_SDK_WINSDK10 := $(KBUILD_DEVTOOLS_BLD)/sdk/v10-not-found/Include/$(SDK_WINSDK10_VERSION)
+ endif
+ endif
+ SDK_WINSDK10_VERSION := $(qnotdir ,$(PATH_SDK_WINSDK10))
+ endif
+ PATH_SDK_WINSDK10 := $(substr $(qdir ,$(PATH_SDK_WINSDK10)),1,-9)
+else
+ PATH_SDK_WINSDK10 := $(PATH_SDK_WINSDK10)
+ ifndef SDK_WINSDK10_VERSION
+ SDK_WINSDK10_VERSION := $(qnotdir ,$(firstfile $(rsortfiles $(qwildcard ,$(PATH_SDK_WINSDK10)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*))))
+ ifeq ($(SDK_WINSDK10_VERSION),)
+ $(warning kBuild: SDK_WINSDK10_VERSION could not be determined for PATH_SDK_WINSDK10=$(PATH_SDK_WINSDK10))
+ SDK_WINSDK10_VERSION := 10.0.10240.0
+ endif
+ endif
+endif
+
+# Non-versioned base directory paths:
+ifndef PATH_SDK_WINSDK10_BASE_INC
+PATH_SDK_WINSDK10_BASE_INC := $(firstfile $(qwildcard ,$(PATH_SDK_WINSDK10)/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]) $(PATH_SDK_WINSDK10)/Include)
+endif
+ifndef PATH_SDK_WINSDK10_BASE_LIB
+PATH_SDK_WINSDK10_BASE_LIB := $(firstfile $(qwildcard ,$(PATH_SDK_WINSDK10)/[Ll][Ii][Bb]) $(PATH_SDK_WINSDK10)/lib)
+endif
+ifndef PATH_SDK_WINSDK10_BASE_BIN
+PATH_SDK_WINSDK10_BASE_BIN := $(firstfile $(qwildcard ,$(PATH_SDK_WINSDK10)/[Bb][Ii][Nn]) $(PATH_SDK_WINSDK10)/bin)
+endif
+
+# Universal CRT (UCRT).
+ifndef PATH_SDK_WINSDK10_UCRT_INC
+PATH_SDK_WINSDK10_UCRT_INC := $(PATH_SDK_WINSDK10_BASE_INC)/$(SDK_WINSDK10_VERSION)/ucrt
+endif
+ifndef PATH_SDK_WINSDK10_UCRT_LIB.amd64
+PATH_SDK_WINSDK10_UCRT_LIB.amd64 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/ucrt/x64
+endif
+ifndef PATH_SDK_WINSDK10_UCRT_LIB.arm32
+PATH_SDK_WINSDK10_UCRT_LIB.arm32 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/ucrt/arm
+endif
+ifndef PATH_SDK_WINSDK10_UCRT_LIB.arm64
+PATH_SDK_WINSDK10_UCRT_LIB.arm64 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/ucrt/arm64
+endif
+ifndef PATH_SDK_WINSDK10_UCRT_LIB.x86
+PATH_SDK_WINSDK10_UCRT_LIB.x86 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/ucrt/x86
+endif
+PATH_SDK_WINSDK10_UCRT_LIB = $(PATH_SDK_WINSDK10_UCRT_LIB.$(KBUILD_TARGET_ARCH))
+SDK_WINSDK10_UCRT_IMPLIB_NAME := ucrt.lib
+SDK_WINSDK10_UCRT_IMPLIB_DBG_NAME := ucrtd.lib
+SDK_WINSDK10_UCRT_STATIC_NAME := libucrt.lib
+SDK_WINSDK10_UCRT_STATIC_DBG_NAME := libucrtd.lib
+
+# Shared API headers
+ifndef PATH_SDK_WINSDK10_SHARED_INC
+PATH_SDK_WINSDK10_SHARED_INC := $(PATH_SDK_WINSDK10_BASE_INC)/$(SDK_WINSDK10_VERSION)/shared
+endif
+
+# User-mode API (MS WIN SDK)
+ifndef PATH_SDK_WINSDK10_UM_INC
+PATH_SDK_WINSDK10_UM_INC := $(PATH_SDK_WINSDK10_BASE_INC)/$(SDK_WINSDK10_VERSION)/um
+endif
+ifndef PATH_SDK_WINSDK10_UM_LIB.amd64
+PATH_SDK_WINSDK10_UM_LIB.amd64 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/um/x64
+endif
+ifndef PATH_SDK_WINSDK10_UM_LIB.arm32
+PATH_SDK_WINSDK10_UM_LIB.arm32 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/um/arm
+endif
+ifndef PATH_SDK_WINSDK10_UM_LIB.arm64
+PATH_SDK_WINSDK10_UM_LIB.arm64 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/um/arm64
+endif
+ifndef PATH_SDK_WINSDK10_UM_LIB.x86
+PATH_SDK_WINSDK10_UM_LIB.x86 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/um/x86
+endif
+PATH_SDK_WINSDK10_UM_LIB = $(PATH_SDK_WINSDK10_UM_LIB.$(KBUILD_TARGET_ARCH))
+ifndef SDK_WINSDK10_UM_LIB_NAMES
+SDK_WINSDK10_UM_LIB_NAMES := \
+ Kernel32.Lib \
+ User32.Lib \
+ Gdi32.Lib \
+ AdvAPI32.Lib \
+ shell32.lib \
+ ShLwApi.Lib \
+ SetupAPI.Lib \
+ Uuid.Lib \
+ Version.Lib \
+ WS2_32.Lib \
+ \
+ Ole32.Lib \
+ OleAut32.Lib \
+ OleDlg.Lib \
+ RpcRT4.Lib \
+ DbgHelp.Lib \
+ \
+ ImageHlp.Lib \
+ IPHlpApi.Lib \
+ ComCtl32.Lib \
+ ComDlg32.Lib \
+ WinSpool.Lib \
+ WinMM.Lib
+endif
+
+# Kernel-mode API headers (WDK).
+ifndef PATH_SDK_WINSDK10_KM_INC
+PATH_SDK_WINSDK10_KM_INC := $(PATH_SDK_WINSDK10_BASE_INC)/$(SDK_WINSDK10_VERSION)/km
+endif
+
+# Kernel-mode API libraries (WDK).
+ifndef PATH_SDK_WINSDK10_KM_LIB.amd64
+PATH_SDK_WINSDK10_KM_LIB.amd64 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/km/x64
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB.arm32
+PATH_SDK_WINSDK10_KM_LIB.arm32 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/km/arm
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB.arm64
+PATH_SDK_WINSDK10_KM_LIB.arm64 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/km/arm64
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB.x86
+PATH_SDK_WINSDK10_KM_LIB.x86 := $(PATH_SDK_WINSDK10_BASE_LIB)/$(SDK_WINSDK10_VERSION)/km/x86
+endif
+PATH_SDK_WINSDK10_KM_LIB = $(PATH_SDK_WINSDK10_KM_LIB.$(KBUILD_TARGET_ARCH))
+
+# Kernel-mode API libraries for Windows 7 (WDK).
+ifndef PATH_SDK_WINSDK10_KM_LIB_W7.amd64
+PATH_SDK_WINSDK10_KM_LIB_W7.amd64 := $(PATH_SDK_WINSDK10_BASE_LIB)/win7/km/x64
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB_W7.x86
+PATH_SDK_WINSDK10_KM_LIB_W7.x86 := $(PATH_SDK_WINSDK10_BASE_LIB)/win7/km/x86
+endif
+PATH_SDK_WINSDK10_KM_LIB_W7 = $(PATH_SDK_WINSDK10_KM_LIB_W7.$(KBUILD_TARGET_ARCH))
+
+# Kernel-mode API libraries for Windows 8 (WDK).
+ifndef PATH_SDK_WINSDK10_KM_LIB_W8.amd64
+PATH_SDK_WINSDK10_KM_LIB_W8.amd64 := $(PATH_SDK_WINSDK10_BASE_LIB)/win8/km/x64
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB_W8.arm32
+PATH_SDK_WINSDK10_KM_LIB_W8.arm32 := $(PATH_SDK_WINSDK10_BASE_LIB)/win8/km/arm
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB_W8.x86
+PATH_SDK_WINSDK10_KM_LIB_W8.x86 := $(PATH_SDK_WINSDK10_BASE_LIB)/win8/km/x86
+endif
+PATH_SDK_WINSDK10_KM_LIB_W8 = $(PATH_SDK_WINSDK10_KM_LIB_W8.$(KBUILD_TARGET_ARCH))
+
+# Kernel-mode API libraries for Windows 8.1 (WDK).
+ifndef PATH_SDK_WINSDK10_KM_LIB_W81.amd64
+PATH_SDK_WINSDK10_KM_LIB_W81.amd64 := $(PATH_SDK_WINSDK10_BASE_LIB)/winv6.3/km/x64
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB_W81.arm32
+PATH_SDK_WINSDK10_KM_LIB_W81.arm32 := $(PATH_SDK_WINSDK10_BASE_LIB)/winv6.3/km/arm
+endif
+ifndef PATH_SDK_WINSDK10_KM_LIB_W81.x86
+PATH_SDK_WINSDK10_KM_LIB_W81.x86 := $(PATH_SDK_WINSDK10_BASE_LIB)/winv6.3/km/x86
+endif
+PATH_SDK_WINSDK10_KM_LIB_W81 = $(PATH_SDK_WINSDK10_KM_LIB_W81.$(KBUILD_TARGET_ARCH))
+
+# Binary directory for host.
+ifndef PATH_SDK_WINSDK10_BIN
+ ifeq ($(KBUILD_HOST_ARCH),amd64)
+PATH_SDK_WINSDK10_BIN := $(PATH_SDK_WINSDK10_BASE_BIN)/$(SDK_WINSDK10_VERSION)/x64
+ else ifeq ($(KBUILD_HOST_ARCH),arm)
+PATH_SDK_WINSDK10_BIN := $(PATH_SDK_WINSDK10_BASE_BIN)/$(SDK_WINSDK10_VERSION)/arm
+ else
+PATH_SDK_WINSDK10_BIN := $(PATH_SDK_WINSDK10_BASE_BIN)/$(SDK_WINSDK10_VERSION)/$(KBUILD_HOST_ARCH)
+ endif
+endif
+
+#
+# Properties used by kBuild.
+#
+SDK_WINSDK10_INCS ?= \
+ $(PATH_SDK_WINSDK10_UM_INC) \
+ $(PATH_SDK_WINSDK10_SHARED_INC)
+SDK_WINSDK10_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_UM_LIB.amd64)
+SDK_WINSDK10_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_UM_LIB.arm32)
+SDK_WINSDK10_LIBPATH.arm64 ?= $(PATH_SDK_WINSDK10_UM_LIB.arm64)
+SDK_WINSDK10_LIBPATH.x86 ?= $(PATH_SDK_WINSDK10_UM_LIB.x86)
+ifndef SDK_WINSDK10_LIBS.amd64
+SDK_WINSDK10_LIBS.amd64 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.amd64)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+ifndef SDK_WINSDK10_LIBS.arm32
+SDK_WINSDK10_LIBS.arm32 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.arm32)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+ifndef SDK_WINSDK10_LIBS.arm64
+SDK_WINSDK10_LIBS.arm64 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.arm64)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+ifndef SDK_WINSDK10_LIBS.x86
+SDK_WINSDK10_LIBS.x86 := $(addprefix $(PATH_SDK_WINSDK10_UM_LIB.x86)/,$(SDK_WINSDK10_UM_LIB_NAMES))
+endif
+
diff --git a/kBuild/subfooter.kmk b/kBuild/subfooter.kmk
new file mode 100644
index 0000000..209ef35
--- /dev/null
+++ b/kBuild/subfooter.kmk
@@ -0,0 +1,75 @@
+# $Id: subfooter.kmk 3422 2020-08-21 11:48:40Z bird $
+## @file
+# kBuild - File included at bottom of a makefile or sub-makefile.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+#
+# Sanity check.
+#
+ifdef __footer_kmk__
+ $(error kBuild: footer.kmk has already been included. Fix your sub-makefiles! $(MAKEFILE_CURRENT))
+endif
+
+#
+# Set the default path for all new targets.
+#
+## @todo Wish there was an easy way of only enumerating only new targets...
+$(foreach target,\
+ $(ALL_TARGETS) \
+ $(FETCHES) $(FETCHES.$(KBUILD_TARGET)) $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_CPU)) $(FETCHES.$(KBUILD_TYPE)) \
+ $(PATCHES) $(PATCHES.$(KBUILD_TARGET)) $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_CPU)) $(PATCHES.$(KBUILD_TYPE)) \
+ $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_CPU)) $(BLDPROGS.$(KBUILD_TYPE)) \
+ $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_CPU)) $(LIBRARIES.$(KBUILD_TYPE)) \
+ $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU)) $(IMPORT_LIBS.$(KBUILD_TYPE)) \
+ $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_CPU)) $(DLLS.$(KBUILD_TYPE)) \
+ $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_CPU)) $(PROGRAMS.$(KBUILD_TYPE)) \
+ $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_CPU)) $(SYSMODS.$(KBUILD_TYPE)) \
+ $(MISCBINS) $(MISCBINS.$(KBUILD_TARGET)) $(MISCBINS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_CPU)) $(MISCBINS.$(KBUILD_TYPE)) \
+ $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_CPU)) $(INSTALLS.$(KBUILD_TYPE)) \
+ $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_CPU)) $(OTHERS.$(KBUILD_TYPE)) \
+,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter_header_target_pass)))
+
+
+ifneq ($(_SUB_MAKEFILE_STACK),)
+ #
+ # Switch back to the context of previous makefile on the stack.
+ #
+ MAKEFILE_CURRENT := $(stack-pop _SUB_MAKEFILE_STACK)
+ PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
+
+else
+ #
+ # We've reached the end of the line, include the real footer.
+ #
+ include $(KBUILD_PATH)/footer.kmk
+
+endif
+
diff --git a/kBuild/subheader.kmk b/kBuild/subheader.kmk
new file mode 100644
index 0000000..8b9040b
--- /dev/null
+++ b/kBuild/subheader.kmk
@@ -0,0 +1,85 @@
+# $Id: subheader.kmk 3422 2020-08-21 11:48:40Z bird $
+## @file
+# kBuild - File included at top of a makefile or sub-makefile.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+#
+# Sanity check.
+#
+ifdef __footer_kmk__
+$(error kBuild: footer.kmk has already been included. Fix your sub-makefiles! $(MAKEFILE_CURRENT))
+endif
+
+ifndef _SUB_MAKEFILE_NOT_FIRST
+
+ #
+ # The first time we just take the makefile context set by header.kmk.
+ #
+ _SUB_MAKEFILE_NOT_FIRST := 1
+ DEPTH ?= $(SUB_DEPTH)
+ include $(KBUILD_PATH)/header.kmk
+
+else
+
+ #
+ # Set the default path and makefile for all new targets.
+ #
+ ## @todo Wish there was an easy way of only enumerating only new targets...
+ $(foreach target,\
+ $(ALL_TARGETS) \
+ $(FETCHES) $(FETCHES.$(KBUILD_TARGET)) $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_CPU)) $(FETCHES.$(KBUILD_TYPE)) \
+ $(PATCHES) $(PATCHES.$(KBUILD_TARGET)) $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_CPU)) $(PATCHES.$(KBUILD_TYPE)) \
+ $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_CPU)) $(BLDPROGS.$(KBUILD_TYPE)) \
+ $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_CPU)) $(LIBRARIES.$(KBUILD_TYPE)) \
+ $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU)) $(IMPORT_LIBS.$(KBUILD_TYPE)) \
+ $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_CPU)) $(DLLS.$(KBUILD_TYPE)) \
+ $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_CPU)) $(PROGRAMS.$(KBUILD_TYPE)) \
+ $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_CPU)) $(SYSMODS.$(KBUILD_TYPE)) \
+ $(MISCBINS) $(MISCBINS.$(KBUILD_TARGET)) $(MISCBINS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_CPU)) $(MISCBINS.$(KBUILD_TYPE)) \
+ $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_CPU)) $(INSTALLS.$(KBUILD_TYPE)) \
+ $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_CPU)) $(OTHERS.$(KBUILD_TYPE)) \
+ ,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter_header_target_pass)))
+
+
+ #
+ # Switch context.
+ #
+
+ # push the current old makefile onto the stack.
+ $(stack-push _SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
+
+ # the current makefile is the 2nd from the end of the MAKEFILE_LIST (we're the last one).
+ __tmp := $(MAKEFILE_LIST)
+ $(stack-popv __tmp)
+ MAKEFILE_CURRENT := $(stack-top __tmp)
+ PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
+endif
+
diff --git a/kBuild/templates/DUMMY.kmk b/kBuild/templates/DUMMY.kmk
new file mode 100644
index 0000000..fe54ad9
--- /dev/null
+++ b/kBuild/templates/DUMMY.kmk
@@ -0,0 +1,35 @@
+# $Id: DUMMY.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Template Config - Empty dummy template.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TEMPLATE_DUMMY = Empty dummy template
+
diff --git a/kBuild/tools/7ZIP.kmk b/kBuild/tools/7ZIP.kmk
new file mode 100644
index 0000000..2a48a19
--- /dev/null
+++ b/kBuild/tools/7ZIP.kmk
@@ -0,0 +1,75 @@
+# $Id: 7ZIP.kmk 3345 2020-05-22 14:23:56Z bird $
+## @file
+# kBuild Tool Config - 7-Zip unpacker.
+#
+
+#
+# Copyright (c) 2006-2020 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_7ZIP := 7-Zip unpacker.
+
+# Tool Specific Properties
+ifndef TOOL_7ZIP_7Z
+ TOOL_7ZIP_7Z := $(wildcard $(KBUILD_DEVTOOLS_HST)/7zip/v*/7z$(HOSTSUFF_EXE))
+ ifeq ($(TOOL_7ZIP_7Z),)
+ TOOL_7ZIP_7Z := $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/7z$(HOSTSUFF_EXE))
+ endif
+ ifneq ($(TOOL_7ZIP_7Z),)
+ TOOL_7ZIP_7Z := $(lastword $(sort $(TOOL_7ZIP_7Z)))
+ else
+ TOOL_7ZIP_7Z := 7z$(HOSTSUFF_EXE)
+ endif
+else
+ TOOL_7ZIP_7Z := $(TOOL_7ZIP_7Z)
+endif
+TOOL_7ZIP_UNPACK ?= $(TOOL_7ZIP_7Z)
+
+# General Properties used by kBuild
+TOOL_7ZIP_UNPACKFLAGS ?=
+
+## UNPACK one file.
+# @param $(target) Normalized main target name.
+# @param $(archive) The file to unpack.
+# @param $(flags) Flags.
+# @param $(inst) Where to unpack it.
+# @param $(out) Where to write the file list.
+TOOL_7ZIP_UNPACK_OUTPUT =
+TOOL_7ZIP_UNPACK_DEPEND =
+TOOL_7ZIP_UNPACK_DEPORD =
+define TOOL_7ZIP_UNPACK_CMDS
+ $(QUIET)$(TOOL_7ZIP_UNPACK) x $(flags) -o"$(inst)" "$(archive)"
+ $(QUIET)$(TOOL_7ZIP_UNPACK) l $(filter-out -bb%,$(flags)) "$(archive)" \
+ | $(SED) \
+ -e '1,/-------------------/d' \
+ -e '/-------------------/,$$(DOLLAR)d' \
+ -e '/^[^ ]* [^ ]* D/d' \
+ -e 's/^.................................................... *//' \
+ -e 's,\\,/,g' \
+ --output $(out)
+endef
+
diff --git a/kBuild/tools/ALP.kmk b/kBuild/tools/ALP.kmk
new file mode 100644
index 0000000..e2e3824
--- /dev/null
+++ b/kBuild/tools/ALP.kmk
@@ -0,0 +1,78 @@
+# $Id: ALP.kmk 3575 2022-12-28 12:44:00Z bird $
+## @file
+# kBuild Tool Config - ALP or later.
+#
+
+#
+# Copyright (c) 2005-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_ALP := The IBM Assembly Language Processor
+
+# Tool Specific Properties
+ifndef PATH_TOOL_ALP
+ PATH_TOOL_ALP := $(sort $(wildcard $(KBUILD_DEVTOOLS_HST)/alp/v*.*))
+ ifneq ($(PATH_TOOL_ALP),)
+ PATH_TOOL_ALP := $(call lastword,$(PATH_TOOL_ALP))
+ endif
+endif
+ifneq ($(PATH_TOOL_ALP),)
+ TOOL_ALP_AS ?= $(PATH_TOOL_ALP)/alp$(HOSTSUFF_EXE)
+else
+ TOOL_ALP_AS ?= alp$(HOSTSUFF_EXE)
+endif
+
+# General Properties used by kBuild
+TOOL_ALP_ASFLAGS ?= -Mb
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_ALP_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_ALP_COMPILE_AS_DEPEND =
+TOOL_ALP_COMPILE_AS_DEPORD =
+define TOOL_ALP_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_ALP_AS)\
+ $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
+ $(source)\
+ -Fl:$(outbase).lst\
+ -Fd:$(dep)\
+ -Fo:$(obj)
+ $(QUIET)$(SED_EXT) -i -e 's/\\/\//g' -e 's/\/$$(DOLLAR)/\\/' "$(dep)"
+endef
+
diff --git a/kBuild/tools/BISON.kmk b/kBuild/tools/BISON.kmk
new file mode 100644
index 0000000..435e4bf
--- /dev/null
+++ b/kBuild/tools/BISON.kmk
@@ -0,0 +1,48 @@
+# $Id: BISON.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# GNU bison tool
+#
+
+#
+# Copyright (c) 2009-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_BISON = GNU bison
+
+ifndef TOOL_BISON_YACC
+TOOL_BISON_YACC := bison$(HOSTSUFF_EXE)
+endif
+
+#TOOL_BISON_YACCFLAGS ?=
+TOOL_BISON_YACC_OUTPUT = $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defines,$(flags),$(outbase).h$(substr $(suffix $(source)),3),)
+TOOL_BISON_YACC_OUTPUT_MAYBE =
+TOOL_BISON_YACC_DEPEND =
+TOOL_BISON_YACC_DEPORD =
+define TOOL_BISON_YACC_CMDS
+ $(QUIET)$(TOOL_BISON_YACC) $(flags) -o $(out) $(source)
+endef
+
diff --git a/kBuild/tools/CLANGCCMACHO.kmk b/kBuild/tools/CLANGCCMACHO.kmk
new file mode 100644
index 0000000..bdeb6c1
--- /dev/null
+++ b/kBuild/tools/CLANGCCMACHO.kmk
@@ -0,0 +1,501 @@
+# $Id: CLANGCCMACHO.kmk 3580 2023-01-05 02:16:42Z bird $
+## @file
+# kBuild Tool Config - LLVM Clang targeting Darwin (Mac OS X) Mach-O, for building C code.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+TOOL_CLANGCCMACHO := LLVM Clang targeting Darwin (Mac OS X) Mach-O, for building C code.
+
+# Tool Specific Properties
+# PREFIX/SUFFIX: clang; PREFIX2/SUFFIX2: cctool;
+ifndef PATH_TOOL_CLANGCCMACHO
+ PATH_TOOL_CLANGCCMACHO := $(substr $(firstfile $(foreachfile toolchaindir, $(DARWINCMN_TOOLCHAIN_DIRS) \
+ , $(qwildcard ,$(toolchaindir)/usr/bin/clang++))), 1, -12)
+else
+ PATH_TOOL_CLANGCCMACHO := $(PATH_TOOL_CLANGCCMACHO)
+endif
+ifndef TOOL_CLANGCCMACHO_PREFIX
+ ifdef PATH_TOOL_CLANGCCMACHO
+ TOOL_CLANGCCMACHO_PREFIX := $(PATH_TOOL_CLANGCCMACHO)/bin/
+ else
+ TOOL_CLANGCCMACHO_PREFIX :=
+ endif
+endif
+ifndef TOOL_CLANGCCMACHO_SUFFIX
+ TOOL_CLANGCCMACHO_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_CLANGCCMACHO_PREFIX2 ?= $(TOOL_CLANGCCMACHO_PREFIX)
+TOOL_CLANGCCMACHO_SUFFIX2 ?= $(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_CC ?= $(TOOL_CLANGCCMACHO_PREFIX)clang$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_CXX ?= $(TOOL_CLANGCCMACHO_PREFIX)clang++$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_PCH ?= $(TOOL_CLANGCCMACHO_CXX)
+TOOL_CLANGCCMACHO_OBJC ?= $(TOOL_CLANGCCMACHO_PREFIX)clang$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_OBJCXX ?= $(TOOL_CLANGCCMACHO_PREFIX)clang$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_AS ?= $(TOOL_CLANGCCMACHO_PREFIX)clang$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_LD ?= $(TOOL_CLANGCCMACHO_PREFIX)clang$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_LD_SYSMOD ?= $(TOOL_CLANGCCMACHO_PREFIX)clang$(TOOL_CLANGCCMACHO_SUFFIX)
+TOOL_CLANGCCMACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_CLANGCCMACHO_LDFLAGS.sysmod ?= -r
+#TOOL_CLANGCCMACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_CLANGCCMACHO_DSYMUTIL ?= $(TOOL_CLANGCCMACHO_PREFIX)dsymutil$(TOOL_CLANGCCMACHO_SUFFIX)
+
+TOOL_CLANGCCMACHO_AR ?= $(TOOL_CLANGCCMACHO_PREFIX2)ar$(TOOL_CLANGCCMACHO_SUFFIX2)
+TOOL_CLANGCCMACHO_STRIP ?= $(TOOL_CLANGCCMACHO_PREFIX2)strip$(TOOL_CLANGCCMACHO_SUFFIX2)
+TOOL_CLANGCCMACHO_STRIP_PROGRAM ?= $(TOOL_CLANGCCMACHO_STRIP) -SXxru
+TOOL_CLANGCCMACHO_STRIP_DLL ?= $(TOOL_CLANGCCMACHO_STRIP) -Sxru
+TOOL_CLANGCCMACHO_STRIP_SYSMOD ?= $(TOOL_CLANGCCMACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_CLANGCCMACHO_COBJSUFF ?= .o
+TOOL_CLANGCCMACHO_CFLAGS ?=
+TOOL_CLANGCCMACHO_CFLAGS.debug ?= -g
+TOOL_CLANGCCMACHO_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_CLANGCCMACHO_CFLAGS.release ?= -O2
+TOOL_CLANGCCMACHO_CINCS ?=
+TOOL_CLANGCCMACHO_CDEFS ?=
+
+TOOL_CLANGCCMACHO_CXXOBJSUFF ?= .o
+TOOL_CLANGCCMACHO_CXXFLAGS ?=
+TOOL_CLANGCCMACHO_CXXFLAGS.debug ?= -g
+TOOL_CLANGCCMACHO_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_CLANGCCMACHO_CXXFLAGS.release ?= -O2
+TOOL_CLANGCCMACHO_CXXINCS ?=
+TOOL_CLANGCCMACHO_CXXDEFS ?=
+
+TOOL_CLANGCCMACHO_PCHOBJSUFF ?= .h.gch
+TOOL_CLANGCCMACHO_PCHFLAGS ?= $(TOOL_CLANGCCMACHO_CXXFLAGS)
+TOOL_CLANGCCMACHO_PCHFLAGS.debug ?= $(TOOL_CLANGCCMACHO_CXXFLAGS.debug)
+TOOL_CLANGCCMACHO_PCHFLAGS.profile ?= $(TOOL_CLANGCCMACHO_CXXFLAGS.profile)
+TOOL_CLANGCCMACHO_PCHFLAGS.release ?= $(TOOL_CLANGCCMACHO_CXXFLAGS.release)
+TOOL_CLANGCCMACHO_PCHINCS ?= $(TOOL_CLANGCCMACHO_CXXINCS)
+TOOL_CLANGCCMACHO_PCHDEFS ?= $(TOOL_CLANGCCMACHO_CXXDEFS)
+
+TOOL_CLANGCCMACHO_OBJCOBJSUFF ?= .o
+TOOL_CLANGCCMACHO_OBJCFLAGS ?=
+TOOL_CLANGCCMACHO_OBJCFLAGS.debug ?= -g
+TOOL_CLANGCCMACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_CLANGCCMACHO_OBJCFLAGS.release?= -O2
+TOOL_CLANGCCMACHO_OBJCINCS ?=
+TOOL_CLANGCCMACHO_OBJCDEFS ?=
+
+TOOL_CLANGCCMACHO_OBJCXXOBJSUFF ?= .o
+TOOL_CLANGCCMACHO_OBJCXXFLAGS ?=
+TOOL_CLANGCCMACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_CLANGCCMACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_CLANGCCMACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_CLANGCCMACHO_OBJCXXINCS ?=
+TOOL_CLANGCCMACHO_OBJCXXDEFS ?=
+
+TOOL_CLANGCCMACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_CLANGCCMACHO_ASFLAGS.debug ?= -g
+TOOL_CLANGCCMACHO_ASFLAGS.profile ?= -g
+TOOL_CLANGCCMACHO_ASOBJSUFF ?= .o
+
+TOOL_CLANGCCMACHO_ARFLAGS ?= -c -rs
+TOOL_CLANGCCMACHO_ARLIBSUFF ?= .a
+
+TOOL_CLANGCCMACHO_LDFLAGS ?=
+TOOL_CLANGCCMACHO_LDFLAGS.debug ?= -g
+TOOL_CLANGCCMACHO_LDFLAGS.profile ?= -g
+
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_CLANGCCMACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_CLANGCCMACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGCCMACHO_COMPILE_C_DEPEND =
+TOOL_CLANGCCMACHO_COMPILE_C_DEPORD =
+TOOL_CLANGCCMACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_CLANGCCMACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_CLANGCCMACHO_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_CLANGCCMACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGCCMACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_CLANGCCMACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGCCMACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_CLANGCCMACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_CLANGCCMACHO_COMPILE_CXX_DEPORD =
+TOOL_CLANGCCMACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_CLANGCCMACHO_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_CLANGCCMACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGCCMACHO_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_CLANGCCMACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGCCMACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_CLANGCCMACHO_COMPILE_PCH_DEPEND =
+TOOL_CLANGCCMACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_CLANGCCMACHO_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_CLANGCCMACHO_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGCCMACHO_COMPILE_OBJC_DEPEND =
+TOOL_CLANGCCMACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_CLANGCCMACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_CLANGCCMACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_CLANGCCMACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_CLANGCCMACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGCCMACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x objective-c \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_CLANGCCMACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_CLANGCCMACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_CLANGCCMACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGCCMACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_CLANGCCMACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_CLANGCCMACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_CLANGCCMACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_CLANGCCMACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_CLANGCCMACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGCCMACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++ \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_CLANGCCMACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_CLANGCCMACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_CLANGCCMACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_CLANGCCMACHO_COMPILE_AS_OUTPUT =
+TOOL_CLANGCCMACHO_COMPILE_AS_DEPEND =
+TOOL_CLANGCCMACHO_COMPILE_AS_DEPORD =
+define TOOL_CLANGCCMACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_CLANGCCMACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGCCMACHO_LINK_LIBRARY_OUTPUT =
+TOOL_CLANGCCMACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_CLANGCCMACHO_LINK_LIBRARY_DEPORD =
+define TOOL_CLANGCCMACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_CLANGCCMACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_CLANGCCMACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_CLANGCCMACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGCCMACHO_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_CLANGCCMACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_CLANGCCMACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_CLANGCCMACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_CLANGCCMACHO_DEBUG_INSTALL_FN)
+TOOL_CLANGCCMACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_CLANGCCMACHO_LINK_PROGRAM_DEPORD =
+define TOOL_CLANGCCMACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_CLANGCCMACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_CLANGCCMACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_CLANGCCMACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGCCMACHO_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_CLANGCCMACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_CLANGCCMACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_CLANGCCMACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_CLANGCCMACHO_DEBUG_INSTALL_FN)
+TOOL_CLANGCCMACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_CLANGCCMACHO_LINK_DLL_DEPORD =
+define TOOL_CLANGCCMACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_CLANGCCMACHO_LD) $(TOOL_CLANGCCMACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_CLANGCCMACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_CLANGCCMACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_CLANGCCMACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGCCMACHO_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_CLANGCCMACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_CLANGCCMACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_CLANGCCMACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_CLANGCCMACHO_DEBUG_INSTALL_FN)
+TOOL_CLANGCCMACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_CLANGCCMACHO_LINK_SYSMOD_DEPORD =
+define TOOL_CLANGCCMACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_CLANGCCMACHO_LD_SYSMOD) $(TOOL_CLANGCCMACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_CLANGCCMACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_CLANGCCMACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/CLANGXXMACHO.kmk b/kBuild/tools/CLANGXXMACHO.kmk
new file mode 100644
index 0000000..5a40bbe
--- /dev/null
+++ b/kBuild/tools/CLANGXXMACHO.kmk
@@ -0,0 +1,501 @@
+# $Id: CLANGXXMACHO.kmk 3580 2023-01-05 02:16:42Z bird $
+## @file
+# kBuild Tool Config - LLVM Clang targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef INCLUDED_DARWIN_COMMON_KMK
+ include $(KBUILD_PATH)/darwin-common.kmk
+endif
+
+TOOL_CLANGXXMACHO := LLVM Clang targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+
+# Tool Specific Properties
+# PREFIX/SUFFIX: clang; PREFIX2/SUFFIX2: cctool;
+ifndef PATH_TOOL_CLANGXXMACHO
+ PATH_TOOL_CLANGXXMACHO := $(substr $(firstfile $(foreachfile toolchaindir, $(DARWINCMN_TOOLCHAIN_DIRS) \
+ , $(qwildcard ,$(toolchaindir)/usr/bin/clang++))), 1, -12)
+else
+ PATH_TOOL_CLANGXXMACHO := $(PATH_TOOL_CLANGXXMACHO)
+endif
+ifndef TOOL_CLANGXXMACHO_PREFIX
+ ifdef PATH_TOOL_CLANGXXMACHO
+ TOOL_CLANGXXMACHO_PREFIX := $(PATH_TOOL_CLANGXXMACHO)/bin/
+ else
+ TOOL_CLANGXXMACHO_PREFIX :=
+ endif
+endif
+ifndef TOOL_CLANGXXMACHO_SUFFIX
+ TOOL_CLANGXXMACHO_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_CLANGXXMACHO_PREFIX2 ?= $(TOOL_CLANGXXMACHO_PREFIX)
+TOOL_CLANGXXMACHO_SUFFIX2 ?= $(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_CC ?= $(TOOL_CLANGXXMACHO_PREFIX)clang$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_CXX ?= $(TOOL_CLANGXXMACHO_PREFIX)clang++$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_PCH ?= $(TOOL_CLANGXXMACHO_CXX)
+TOOL_CLANGXXMACHO_OBJC ?= $(TOOL_CLANGXXMACHO_PREFIX)clang$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_OBJCXX ?= $(TOOL_CLANGXXMACHO_PREFIX)clang$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_AS ?= $(TOOL_CLANGXXMACHO_PREFIX)clang$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_LD ?= $(TOOL_CLANGXXMACHO_PREFIX)clang++$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_LD_SYSMOD ?= $(TOOL_CLANGXXMACHO_PREFIX)clang++$(TOOL_CLANGXXMACHO_SUFFIX)
+TOOL_CLANGXXMACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_CLANGXXMACHO_LDFLAGS.sysmod ?= -r
+#TOOL_CLANGXXMACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_CLANGXXMACHO_DSYMUTIL ?= $(TOOL_CLANGXXMACHO_PREFIX)dsymutil$(TOOL_CLANGXXMACHO_SUFFIX)
+
+TOOL_CLANGXXMACHO_AR ?= $(TOOL_CLANGXXMACHO_PREFIX2)ar$(TOOL_CLANGXXMACHO_SUFFIX2)
+TOOL_CLANGXXMACHO_STRIP ?= $(TOOL_CLANGXXMACHO_PREFIX2)strip$(TOOL_CLANGXXMACHO_SUFFIX2)
+TOOL_CLANGXXMACHO_STRIP_PROGRAM ?= $(TOOL_CLANGXXMACHO_STRIP) -SXxru
+TOOL_CLANGXXMACHO_STRIP_DLL ?= $(TOOL_CLANGXXMACHO_STRIP) -Sxru
+TOOL_CLANGXXMACHO_STRIP_SYSMOD ?= $(TOOL_CLANGXXMACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_CLANGXXMACHO_COBJSUFF ?= .o
+TOOL_CLANGXXMACHO_CFLAGS ?=
+TOOL_CLANGXXMACHO_CFLAGS.debug ?= -g
+TOOL_CLANGXXMACHO_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_CLANGXXMACHO_CFLAGS.release ?= -O2
+TOOL_CLANGXXMACHO_CINCS ?=
+TOOL_CLANGXXMACHO_CDEFS ?=
+
+TOOL_CLANGXXMACHO_CXXOBJSUFF ?= .o
+TOOL_CLANGXXMACHO_CXXFLAGS ?=
+TOOL_CLANGXXMACHO_CXXFLAGS.debug ?= -g
+TOOL_CLANGXXMACHO_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_CLANGXXMACHO_CXXFLAGS.release ?= -O2
+TOOL_CLANGXXMACHO_CXXINCS ?=
+TOOL_CLANGXXMACHO_CXXDEFS ?=
+
+TOOL_CLANGXXMACHO_PCHOBJSUFF ?= .h.gch
+TOOL_CLANGXXMACHO_PCHFLAGS ?= $(TOOL_CLANGXXMACHO_CXXFLAGS)
+TOOL_CLANGXXMACHO_PCHFLAGS.debug ?= $(TOOL_CLANGXXMACHO_CXXFLAGS.debug)
+TOOL_CLANGXXMACHO_PCHFLAGS.profile ?= $(TOOL_CLANGXXMACHO_CXXFLAGS.profile)
+TOOL_CLANGXXMACHO_PCHFLAGS.release ?= $(TOOL_CLANGXXMACHO_CXXFLAGS.release)
+TOOL_CLANGXXMACHO_PCHINCS ?= $(TOOL_CLANGXXMACHO_CXXINCS)
+TOOL_CLANGXXMACHO_PCHDEFS ?= $(TOOL_CLANGXXMACHO_CXXDEFS)
+
+TOOL_CLANGXXMACHO_OBJCOBJSUFF ?= .o
+TOOL_CLANGXXMACHO_OBJCFLAGS ?=
+TOOL_CLANGXXMACHO_OBJCFLAGS.debug ?= -g
+TOOL_CLANGXXMACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_CLANGXXMACHO_OBJCFLAGS.release?= -O2
+TOOL_CLANGXXMACHO_OBJCINCS ?=
+TOOL_CLANGXXMACHO_OBJCDEFS ?=
+
+TOOL_CLANGXXMACHO_OBJCXXOBJSUFF ?= .o
+TOOL_CLANGXXMACHO_OBJCXXFLAGS ?=
+TOOL_CLANGXXMACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_CLANGXXMACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_CLANGXXMACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_CLANGXXMACHO_OBJCXXINCS ?=
+TOOL_CLANGXXMACHO_OBJCXXDEFS ?=
+
+TOOL_CLANGXXMACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_CLANGXXMACHO_ASFLAGS.debug ?= -g
+TOOL_CLANGXXMACHO_ASFLAGS.profile ?= -g
+TOOL_CLANGXXMACHO_ASOBJSUFF ?= .o
+
+TOOL_CLANGXXMACHO_ARFLAGS ?= -c -rs
+TOOL_CLANGXXMACHO_ARLIBSUFF ?= .a
+
+TOOL_CLANGXXMACHO_LDFLAGS ?=
+TOOL_CLANGXXMACHO_LDFLAGS.debug ?= -g
+TOOL_CLANGXXMACHO_LDFLAGS.profile ?= -g
+
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_CLANGXXMACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_CLANGXXMACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGXXMACHO_COMPILE_C_DEPEND =
+TOOL_CLANGXXMACHO_COMPILE_C_DEPORD =
+TOOL_CLANGXXMACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_CLANGXXMACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_CLANGXXMACHO_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_CLANGXXMACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGXXMACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_CLANGXXMACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGXXMACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_CLANGXXMACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_CLANGXXMACHO_COMPILE_CXX_DEPORD =
+TOOL_CLANGXXMACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_CLANGXXMACHO_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_CLANGXXMACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGXXMACHO_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_CLANGXXMACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGXXMACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_CLANGXXMACHO_COMPILE_PCH_DEPEND =
+TOOL_CLANGXXMACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_CLANGXXMACHO_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_CLANGXXMACHO_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGXXMACHO_COMPILE_OBJC_DEPEND =
+TOOL_CLANGXXMACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_CLANGXXMACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_CLANGXXMACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_CLANGXXMACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_CLANGXXMACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGXXMACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x objective-c \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_CLANGXXMACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_CLANGXXMACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_CLANGXXMACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_CLANGXXMACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_CLANGXXMACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_CLANGXXMACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_CLANGXXMACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_CLANGXXMACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_CLANGXXMACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_CLANGXXMACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++ \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_CLANGXXMACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_CLANGXXMACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_CLANGXXMACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_CLANGXXMACHO_COMPILE_AS_OUTPUT =
+TOOL_CLANGXXMACHO_COMPILE_AS_DEPEND =
+TOOL_CLANGXXMACHO_COMPILE_AS_DEPORD =
+define TOOL_CLANGXXMACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_CLANGXXMACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGXXMACHO_LINK_LIBRARY_OUTPUT =
+TOOL_CLANGXXMACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_CLANGXXMACHO_LINK_LIBRARY_DEPORD =
+define TOOL_CLANGXXMACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_CLANGXXMACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_CLANGXXMACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_CLANGXXMACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGXXMACHO_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_CLANGXXMACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_CLANGXXMACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_CLANGXXMACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_CLANGXXMACHO_DEBUG_INSTALL_FN)
+TOOL_CLANGXXMACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_CLANGXXMACHO_LINK_PROGRAM_DEPORD =
+define TOOL_CLANGXXMACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_CLANGXXMACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_CLANGXXMACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_CLANGXXMACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGXXMACHO_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_CLANGXXMACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_CLANGXXMACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_CLANGXXMACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_CLANGXXMACHO_DEBUG_INSTALL_FN)
+TOOL_CLANGXXMACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_CLANGXXMACHO_LINK_DLL_DEPORD =
+define TOOL_CLANGXXMACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_CLANGXXMACHO_LD) $(TOOL_CLANGXXMACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_CLANGXXMACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_CLANGXXMACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_CLANGXXMACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_CLANGXXMACHO_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_CLANGXXMACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_CLANGXXMACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_CLANGXXMACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_CLANGXXMACHO_DEBUG_INSTALL_FN)
+TOOL_CLANGXXMACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_CLANGXXMACHO_LINK_SYSMOD_DEPORD =
+define TOOL_CLANGXXMACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_CLANGXXMACHO_LD_SYSMOD) $(TOOL_CLANGXXMACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_CLANGXXMACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_CLANGXXMACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/FLEX.kmk b/kBuild/tools/FLEX.kmk
new file mode 100644
index 0000000..8f1dc20
--- /dev/null
+++ b/kBuild/tools/FLEX.kmk
@@ -0,0 +1,46 @@
+# $Id: FLEX.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# flex tool
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_FLEX = flex
+TOOL_FLEX_LEX ?= flex$(HOSTSUFF_EXE)
+
+#TOOL_FLEX_LEXFLAGS ?=
+TOOL_FLEX_LEX_OUT_FILE = $(evalcall KB_FN_OPT_TEST_SHORT_LONG,+,--c++,$(flags),$(outbase).cpp,$(outbase).c)
+TOOL_FLEX_LEX_OUTPUT =
+TOOL_FLEX_LEX_OUTPUT_MAYBE =
+TOOL_FLEX_LEX_DEPEND =
+TOOL_FLEX_LEX_DEPORD =
+define TOOL_FLEX_LEX_CMDS
+ $(QUIET)$(TOOL_FLEX_LEX) $(flags) -o$(out) $(source)
+endef
+
diff --git a/kBuild/tools/GCC.kmk b/kBuild/tools/GCC.kmk
new file mode 100644
index 0000000..0be63f9
--- /dev/null
+++ b/kBuild/tools/GCC.kmk
@@ -0,0 +1,239 @@
+# $Id: GCC.kmk 3566 2022-06-13 15:37:08Z bird $
+## @file
+# kBuild Tool Config - Generic GCC Using The System GCC.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC := Generic GCC Using The System GCC.
+
+# Tool Specific Properties
+ifndef TOOL_GCC_PREFIX
+ TOOL_GCC_PREFIX :=
+endif
+ifndef TOOL_GCC_SUFFIX
+ TOOL_GCC_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GCC_PREFIX2 ?= $(TOOL_GCC_PREFIX)
+TOOL_GCC_SUFFIX2 ?= $(TOOL_GCC_SUFFIX)
+TOOL_GCC_CC ?= $(TOOL_GCC_PREFIX)gcc$(TOOL_GCC_SUFFIX)
+TOOL_GCC_CXX ?= $(TOOL_GCC_PREFIX)g++$(TOOL_GCC_SUFFIX)
+TOOL_GCC_AS ?= $(TOOL_GCC_PREFIX)gcc$(TOOL_GCC_SUFFIX)
+TOOL_GCC_AR ?= $(TOOL_GCC_PREFIX2)ar$(TOOL_GCC_SUFFIX2)
+TOOL_GCC_RANLIB ?= $(TOOL_GCC_PREFIX2)ranlib$(TOOL_GCC_SUFFIX2)
+TOOL_GCC_LD ?= $(TOOL_GCC_PREFIX)gcc$(TOOL_GCC_SUFFIX)
+TOOL_GCC_LDFLAGS.dll.os2 ?= -Zdll
+TOOL_GCC_LDFLAGS.dll.darwin ?= -dynamiclib
+ifndef TOOL_GCC_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GCC_LDFLAGS.dll ?= -shared
+else
+ TOOL_GCC_LDFLAGS.dll ?= $(TOOL_GCC_LDFLAGS.$(KBUILD_TARGET))
+endif
+
+# General Properties used by kBuild
+TOOL_GCC_COBJSUFF ?= .o
+TOOL_GCC_CFLAGS ?=
+TOOL_GCC_CFLAGS.debug ?= -g
+TOOL_GCC_CFLAGS.profile ?= -g -O2 #-pg
+TOOL_GCC_CFLAGS.release ?= -O2
+TOOL_GCC_CINCS ?=
+TOOL_GCC_CDEFS ?=
+
+TOOL_GCC_CXXOBJSUFF ?= .o
+TOOL_GCC_CXXOBJSUFF ?= .o
+TOOL_GCC_CXXFLAGS ?=
+TOOL_GCC_CXXFLAGS.debug ?= -g -O0
+TOOL_GCC_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GCC_CXXFLAGS.release ?= -O2
+TOOL_GCC_CXXINCS ?=
+TOOL_GCC_CXXDEFS ?=
+
+TOOL_GCC_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC_ASFLAGS.debug ?= -g
+TOOL_GCC_ASFLAGS.profile ?= -g
+TOOL_GCC_ASOBJSUFF ?= .o
+
+TOOL_GCC_ARFLAGS ?= cr
+TOOL_GCC_ARLIBSUFF ?= .a
+
+TOOL_GCC_LDFLAGS ?=
+TOOL_GCC_LDFLAGS.debug ?= -g
+TOOL_GCC_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC_COMPILE_C_OUTPUT =
+TOOL_GCC_COMPILE_C_DEPEND =
+TOOL_GCC_COMPILE_C_DEPORD =
+define TOOL_GCC_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC_COMPILE_CXX_OUTPUT =
+TOOL_GCC_COMPILE_CXX_DEPEND =
+TOOL_GCC_COMPILE_CXX_DEPORD =
+define TOOL_GCC_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC_COMPILE_AS_OUTPUT =
+TOOL_GCC_COMPILE_AS_DEPEND =
+TOOL_GCC_COMPILE_AS_DEPORD =
+define TOOL_GCC_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC_LINK_LIBRARY_OUTPUT =
+TOOL_GCC_LINK_LIBRARY_DEPEND =
+TOOL_GCC_LINK_LIBRARY_DEPORD =
+define TOOL_GCC_LINK_LIBRARY_CMDS
+ $(QUIET)$(TOOL_GCC_AR) $(flags) $(out) $(objs)
+ $(call xargs,$(QUIET)$(TOOL_GCC_AR) $(flags) $(out),$(objs))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GCC_AR) x $(abspath $(lib)) \
+ && $(TOOL_GCC_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+ $(QUIET)$(TOOL_GCC_RANLIB) $(out)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC_LINK_PROGRAM_OUTPUT =
+TOOL_GCC_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC_LINK_PROGRAM_DEPORD =
+define TOOL_GCC_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GCC_LD) $(flags) -o $(out) $(objs) \
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC_LINK_DLL_OUTPUT =
+TOOL_GCC_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC_LINK_DLL_DEPORD =
+define TOOL_GCC_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GCC_LD) $(TOOL_GCC_LDFLAGS.dll) $(flags) -o $(out) $(objs) \
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
diff --git a/kBuild/tools/GCC3.kmk b/kBuild/tools/GCC3.kmk
new file mode 100644
index 0000000..a5e9dfa
--- /dev/null
+++ b/kBuild/tools/GCC3.kmk
@@ -0,0 +1,357 @@
+# $Id: GCC3.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic GCC v3.2.x or later Using The System GCC and Binutils.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC3 := Generic GCC v3.2.x or later Using The System GCC and Binutils.
+
+# Tool Specific Properties
+ifndef TOOL_GCC3_PREFIX
+ TOOL_GCC3_PREFIX :=
+endif
+ifndef TOOL_GCC3_SUFFIX
+ TOOL_GCC3_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GCC3_PREFIX2 ?= g
+else
+ TOOL_GCC3_PREFIX2 ?=
+endif
+TOOL_GCC3_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GCC3_PREFIX3 ?=
+TOOL_GCC3_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GCC3_CC ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
+TOOL_GCC3_CXX ?= $(TOOL_GCC3_PREFIX)g++$(TOOL_GCC3_SUFFIX)
+TOOL_GCC3_AS ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
+TOOL_GCC3_AR ?= $(TOOL_GCC3_PREFIX2)ar$(TOOL_GCC3_SUFFIX2)
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GCC3_AR_IMP ?= $(TOOL_GCC3_PREFIX3)emximp$(TOOL_GCC3_SUFFIX3)
+else
+ TOOL_GCC3_AR_IMP ?= $(ECHO) not supported!
+endif
+TOOL_GCC3_LD ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
+if1of ($(KBUILD_HOST), solaris)
+TOOL_GCC3_LD_SYSMOD ?= $(TOOL_GCC3_PREFIX3)ld$(TOOL_GCC3_SUFFIX3)
+else
+TOOL_GCC3_LD_SYSMOD ?= $(TOOL_GCC3_PREFIX2)ld$(TOOL_GCC3_SUFFIX2)
+endif
+ifndef TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GCC3_LDFLAGS.dll ?= -shared
+else
+ TOOL_GCC3_LDFLAGS.dll ?= $(TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GCC3_LDFLAGS.sysmod ?= -r
+TOOL_GCC3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GCC3_LD_MAP ?= -Zmap=$(1)
+ TOOL_GCC3_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GCC3_LD_MAP ?=
+ TOOL_GCC3_LD_SYSMOD_MAP ?=
+endif
+TOOL_GCC3_OBJCOPY ?= $(TOOL_GCC3_PREFIX2)objcopy$(TOOL_GCC3_SUFFIX2)
+
+# General Properties used by kBuild
+TOOL_GCC3_COBJSUFF ?= .o
+TOOL_GCC3_CFLAGS ?=
+TOOL_GCC3_CFLAGS.debug ?= -g
+TOOL_GCC3_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC3_CFLAGS.release ?= -O2
+TOOL_GCC3_CINCS ?=
+TOOL_GCC3_CDEFS ?=
+
+TOOL_GCC3_CXXOBJSUFF ?= .o
+TOOL_GCC3_CXXOBJSUFF ?= .o
+TOOL_GCC3_CXXFLAGS ?=
+TOOL_GCC3_CXXFLAGS.debug ?= -g
+TOOL_GCC3_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC3_CXXFLAGS.release ?= -O2
+TOOL_GCC3_CXXINCS ?=
+TOOL_GCC3_CXXDEFS ?=
+
+TOOL_GCC3_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC3_ASFLAGS.debug ?= -g
+TOOL_GCC3_ASFLAGS.profile ?= -g
+TOOL_GCC3_ASOBJSUFF ?= .o
+
+TOOL_GCC3_ARFLAGS ?= cr
+TOOL_GCC3_ARLIBSUFF ?= .a
+
+TOOL_GCC3_LDFLAGS ?=
+TOOL_GCC3_LDFLAGS.debug ?= -g
+TOOL_GCC3_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3_COMPILE_C_DEPEND =
+TOOL_GCC3_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC3_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC3_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC3_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC3_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC3_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC3_COMPILE_C_OUTPUT =
+define TOOL_GCC3_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC3_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3_COMPILE_CXX_DEPEND =
+TOOL_GCC3_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC3_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC3_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC3_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC3_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC3_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC3_COMPILE_CXX_OUTPUT =
+define TOOL_GCC3_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC3_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC3_COMPILE_AS_OUTPUT =
+TOOL_GCC3_COMPILE_AS_DEPEND =
+TOOL_GCC3_COMPILE_AS_DEPORD =
+define TOOL_GCC3_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC3_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_GCC3_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
+TOOL_GCC3_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC3_LINK_LIBRARY_DEPORD =
+define TOOL_GCC3_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(objs), 'ADDMOD $(o)') \
+ $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
+ $(if $(filter %.def %.imp %.dll,$(othersrc))\
+ ,$(TOOL_GCC3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GCC3_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3_LINK_PROGRAM_OUTPUT =
+TOOL_GCC3_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC3_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC3_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC3_LINK_PROGRAM_DEPORD =
+define TOOL_GCC3_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GCC3_LD) $(flags) -o $(out) $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC3_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3_LINK_DLL_OUTPUT =
+TOOL_GCC3_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC3_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC3_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC3_LINK_DLL_DEPORD =
+define TOOL_GCC3_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\
+ $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC3_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3_LINK_SYSMOD_OUTPUT =
+TOOL_GCC3_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC3_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC3_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC3_LINK_SYSMOD_DEPORD =
+define TOOL_GCC3_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GCC32.kmk b/kBuild/tools/GCC32.kmk
new file mode 100644
index 0000000..e59e3f3
--- /dev/null
+++ b/kBuild/tools/GCC32.kmk
@@ -0,0 +1,355 @@
+# $Id: GCC32.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic 32-bit GCC v3.2.x or later Using The System GCC.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC32 := Generic 32-bit GCC v3.2.x or later Using The System GCC. \
+ More or less Linux/ELF specfic.
+
+# Tool Specific Properties
+ifndef TOOL_GCC32_PREFIX
+ TOOL_GCC32_PREFIX :=
+endif
+ifndef TOOL_GCC32_SUFFIX
+ TOOL_GCC32_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GCC32_PREFIX2 ?= g
+else
+ TOOL_GCC32_PREFIX2 ?=
+endif
+TOOL_GCC32_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GCC32_PREFIX3 ?=
+TOOL_GCC32_SUFFIX3 ?= $(HOSTSUFF_EXE)
+
+TOOL_GCC32_CC ?= $(TOOL_GCC32_PREFIX)gcc$(TOOL_GCC32_SUFFIX) -m32
+TOOL_GCC32_CXX ?= $(TOOL_GCC32_PREFIX)g++$(TOOL_GCC32_SUFFIX) -m32
+TOOL_GCC32_AS ?= $(TOOL_GCC32_PREFIX)gcc$(TOOL_GCC32_SUFFIX) -m32
+TOOL_GCC32_AR ?= $(TOOL_GCC32_PREFIX2)ar$(TOOL_GCC32_SUFFIX2)
+TOOL_GCC32_LD ?= $(TOOL_GCC32_PREFIX)gcc$(TOOL_GCC32_SUFFIX) -m32
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GCC32_LD_SYSMOD ?= $(TOOL_GCC32_PREFIX3)ld$(TOOL_GCC32_SUFFIX3)
+else
+ TOOL_GCC32_LD_SYSMOD ?= $(TOOL_GCC32_PREFIX2)ld$(TOOL_GCC32_SUFFIX2)
+endif
+ifndef TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET)
+TOOL_GCC32_LDFLAGS.dll ?= -shared
+else
+TOOL_GCC32_LDFLAGS.dll ?= $(TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GCC32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
+TOOL_GCC32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
+TOOL_GCC32_LD_MAP ?= -Zmap=$(1)
+else
+TOOL_GCC32_LD_MAP ?=
+endif
+ifeq ($(KBUILD_TARGET),os2)
+TOOL_GCC32_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+TOOL_GCC32_LD_SYSMOD_MAP ?=
+endif
+TOOL_GCC32_OBJCOPY ?= $(TOOL_GCC32_PREFIX2)objcopy$(TOOL_GCC32_SUFFIX2)
+
+# General Properties used by kBuild
+TOOL_GCC32_COBJSUFF ?= .o
+TOOL_GCC32_CFLAGS ?=
+TOOL_GCC32_CFLAGS.debug ?= -g
+TOOL_GCC32_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC32_CFLAGS.release ?= -O2
+TOOL_GCC32_CINCS ?=
+TOOL_GCC32_CDEFS ?=
+
+TOOL_GCC32_CXXOBJSUFF ?= .o
+TOOL_GCC32_CXXOBJSUFF ?= .o
+TOOL_GCC32_CXXFLAGS ?=
+TOOL_GCC32_CXXFLAGS.debug ?= -g
+TOOL_GCC32_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC32_CXXFLAGS.release ?= -O2
+TOOL_GCC32_CXXINCS ?=
+TOOL_GCC32_CXXDEFS ?=
+
+TOOL_GCC32_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC32_ASFLAGS.debug ?= -g
+TOOL_GCC32_ASFLAGS.profile ?= -g
+TOOL_GCC32_ASOBJSUFF ?= .o
+
+TOOL_GCC32_ARFLAGS ?= cr
+TOOL_GCC32_ARLIBSUFF ?= .a
+
+TOOL_GCC32_LDFLAGS ?=
+TOOL_GCC32_LDFLAGS.debug ?= -g
+TOOL_GCC32_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC32_COMPILE_C_DEPEND =
+TOOL_GCC32_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC32_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC32_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC32_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC32_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC32_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC32_COMPILE_C_OUTPUT =
+define TOOL_GCC32_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC32_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC32_COMPILE_CXX_DEPEND =
+TOOL_GCC32_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC32_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC32_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC32_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC32_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC32_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+
+TOOL_GCC32_COMPILE_CXX_OUTPUT =
+define TOOL_GCC32_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC32_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC32_COMPILE_AS_OUTPUT =
+TOOL_GCC32_COMPILE_AS_DEPEND =
+TOOL_GCC32_COMPILE_AS_DEPORD =
+define TOOL_GCC32_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC32_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC32_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_GCC32_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC32_LINK_LIBRARY_DEPORD =
+define TOOL_GCC32_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(objs), 'ADDMOD $(o)') \
+ $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
+ $(if $(filter %.def %.imp %.dll,$(othersrc))\
+ ,$(TOOL_GCC32_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GCC32_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC32_LINK_PROGRAM_OUTPUT =
+TOOL_GCC32_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC32_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC32_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC32_LINK_PROGRAM_DEPORD =
+define TOOL_GCC32_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GCC32_LD) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC32_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC32_LINK_DLL_OUTPUT =
+TOOL_GCC32_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC32_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC32_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC32_LINK_DLL_DEPORD =
+define TOOL_GCC32_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GCC32_LD) $(TOOL_GCC32_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC32_LD_SONAME,$(target),$(out)))\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC32_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC32_LINK_SYSMOD_OUTPUT =
+TOOL_GCC32_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC32_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC32_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC32_LINK_SYSMOD_DEPORD =
+define TOOL_GCC32_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_GCC32_LD_SYSMOD) $(TOOL_GCC32_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC32_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GCC3OMF.kmk b/kBuild/tools/GCC3OMF.kmk
new file mode 100644
index 0000000..f749965
--- /dev/null
+++ b/kBuild/tools/GCC3OMF.kmk
@@ -0,0 +1,348 @@
+# $Id: GCC3OMF.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - GCC v3 targeting OS/2 OMF.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC3OMF := GCC v3 targeting OS/2 OMF.
+
+# Tool Specific Properties
+ifndef TOOL_GCC3OMF_PREFIX
+ TOOL_GCC3OMF_PREFIX :=
+endif
+ifndef TOOL_GCC3OMF_SUFFIX
+ TOOL_GCC3OMF_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GCC3OMF_PREFIX2 ?=
+TOOL_GCC3OMF_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GCC3OMF_PREFIX3 ?=
+TOOL_GCC3OMF_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GCC3OMF_CC ?= $(TOOL_GCC3OMF_PREFIX)gcc$(TOOL_GCC3OMF_SUFFIX)
+TOOL_GCC3OMF_CXX ?= $(TOOL_GCC3OMF_PREFIX)g++$(TOOL_GCC3OMF_SUFFIX)
+TOOL_GCC3OMF_AS ?= $(TOOL_GCC3OMF_PREFIX)gcc$(TOOL_GCC3OMF_SUFFIX)
+TOOL_GCC3OMF_AR ?= $(TOOL_GCC3OMF_PREFIX2)emxomfar$(TOOL_GCC3OMF_SUFFIX2)
+TOOL_GCC3OMF_AR_IMP ?= $(TOOL_GCC3OMF_PREFIX2)emximp$(TOOL_GCC3OMF_SUFFIX2)
+TOOL_GCC3OMF_LD ?= $(TOOL_GCC3OMF_PREFIX)gcc$(TOOL_GCC3OMF_SUFFIX)
+TOOL_GCC3OMF_LD_SYSMOD ?= $(TOOL_GCC3OMF_PREFIX)gcc$(TOOL_GCC3OMF_SUFFIX)
+TOOL_GCC3OMF_LDFLAGS.dll ?= -shared -Zdll
+TOOL_GCC3OMF_LDFLAGS.sysmod ?= -nostdlib
+TOOL_GCC3OMF_LD_MAP ?= -Zmap=$(1)
+TOOL_GCC3OMF_LD_SYSMOD_MAP ?= -Zmap=$(1)
+
+TOOL_GCC3OMF_RC = $(TOOL_GCC3OMF_PREFIX3)rc$(TOOL_GCC3OMF_SUFFIX3)
+
+# General Properties used by kBuild
+TOOL_GCC3OMF_COBJSUFF ?= .o
+TOOL_GCC3OMF_CFLAGS ?= -Zomf
+TOOL_GCC3OMF_CFLAGS.debug ?= -g
+TOOL_GCC3OMF_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC3OMF_CFLAGS.release ?= -O2
+TOOL_GCC3OMF_CINCS ?=
+TOOL_GCC3OMF_CDEFS ?=
+
+TOOL_GCC3OMF_CXXOBJSUFF ?= .o
+TOOL_GCC3OMF_CXXOBJSUFF ?= .o
+TOOL_GCC3OMF_CXXFLAGS ?= -Zomf
+TOOL_GCC3OMF_CXXFLAGS.debug ?= -g
+TOOL_GCC3OMF_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC3OMF_CXXFLAGS.release ?= -O2
+TOOL_GCC3OMF_CXXINCS ?=
+TOOL_GCC3OMF_CXXDEFS ?=
+
+TOOL_GCC3OMF_ASFLAGS ?= -x assembler-with-cpp -Zomf
+TOOL_GCC3OMF_ASFLAGS.debug ?= -g
+TOOL_GCC3OMF_ASFLAGS.profile ?= -g
+TOOL_GCC3OMF_ASOBJSUFF ?= .obj
+
+TOOL_GCC3OMF_RCOBJSUFF ?= .res
+TOOL_GCC3OMF_RCFLAGS ?= -n
+TOOL_GCC3OMF_RCINCS ?= $(shell $(TOOL_GCC3OMF_CXX) -E -x c++ - 2>&1 < /dev/null \
+ | $(SED_EXT) -e "/search starts here/,/[Ee]nd of search list/!d" -e "/^ /!d")
+
+TOOL_GCC3OMF_ARFLAGS ?= cr
+TOOL_GCC3OMF_ARLIBSUFF ?= .lib
+
+TOOL_GCC3OMF_LDFLAGS ?= -Zomf
+TOOL_GCC3OMF_LDFLAGS.debug ?= -g
+TOOL_GCC3OMF_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3OMF_COMPILE_C_DEPEND =
+TOOL_GCC3OMF_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC3OMF_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC3OMF_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC3OMF_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC3OMF_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC3OMF_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC3OMF_COMPILE_C_OUTPUT =
+define TOOL_GCC3OMF_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC3OMF_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3OMF_COMPILE_CXX_DEPEND =
+TOOL_GCC3OMF_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC3OMF_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC3OMF_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC3OMF_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC3OMF_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC3OMF_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC3OMF_COMPILE_CXX_OUTPUT =
+define TOOL_GCC3OMF_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC3OMF_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC3OMF_COMPILE_AS_OUTPUT =
+TOOL_GCC3OMF_COMPILE_AS_DEPEND =
+TOOL_GCC3OMF_COMPILE_AS_DEPORD =
+define TOOL_GCC3OMF_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC3OMF_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3OMF_COMPILE_RC_OUTPUT =
+TOOL_GCC3OMF_COMPILE_RC_DEPEND =
+TOOL_GCC3OMF_COMPILE_RC_DEPORD =
+define TOOL_GCC3OMF_COMPILE_RC_CMDS
+ $(QUIET)$(REDIRECT) -E 'INCLUDE=' -- $(TOOL_GCC3OMF_RC) -r \
+ $(flags) $(addprefix -i, $(subst /,\\,$(subst /@unixroot,$(UNIXROOT),$(incs)))) $(addprefix -d, $(defs))\
+ $(subst /,\\,$(abspath $(source))) \
+ $(obj)
+endef
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3OMF_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_GCC3OMF_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC3OMF_LINK_LIBRARY_DEPORD =
+define TOOL_GCC3OMF_LINK_LIBRARY_CMDS
+ $(if $(filter %.def %.imp %.dll,$(othersrc))\
+ ,$(QUIET)$(APPEND) -n $(outbase).rsp $(filter %.def %.imp %.dll,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(QUIET)$(TOOL_GCC3OMF_AR_IMP) -o $(out) @$(outbase).rsp\
+ $(NL)$(TAB)$(QUIET)$(RM) -f $(outbase).rsp)
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(flags) $(out) $(objs) $(filter-out %.def %.imp %.dll,$(othersrc))
+ $(QUIET)$(TOOL_GCC3OMF_AR) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3OMF_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_GCC3OMF_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_GCC3OMF_LINK_PROGRAM_DEPORD =
+define TOOL_GCC3OMF_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp\
+ $(flags)\
+ -o $(out)\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(othersrc)\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ -Zmap=$(outbase).map
+ $(QUIET)$(TOOL_GCC3OMF_LD) @$(outbase).rsp
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3OMF_LINK_DLL_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_GCC3OMF_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_GCC3OMF_LINK_DLL_DEPORD =
+define TOOL_GCC3OMF_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp\
+ $(TOOL_GCC3OMF_LDFLAGS.dll)\
+ $(flags)\
+ -o $(out)\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(othersrc)\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ -Zmap=$(outbase).map
+ $(QUIET)$(TOOL_GCC3OMF_LD) @$(outbase).rsp
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3OMF_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_GCC3OMF_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_GCC3OMF_LINK_SYSMOD_DEPORD =
+define TOOL_GCC3OMF_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp\
+ $(TOOL_GCC3OMF_LDFLAGS.sysmod)\
+ $(flags)\
+ -o $(out)\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(othersrc)\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ -Zmap=$(outbase).map
+ $(QUIET)$(TOOL_GCC3OMF_LD_SYSMOD) @$(outbase).rsp
+endef
+
diff --git a/kBuild/tools/GCC3PLAIN.kmk b/kBuild/tools/GCC3PLAIN.kmk
new file mode 100644
index 0000000..944e494
--- /dev/null
+++ b/kBuild/tools/GCC3PLAIN.kmk
@@ -0,0 +1,324 @@
+# $Id: GCC3PLAIN.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic GCC v3.2.x or later Using The System GCC, any Unix Linker and Unix Archiver.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC3PLAIN := Generic GCC v3.2.x or later Using The System GCC, any Unix Linker and Unix Archiver.
+
+# Tool Specific Properties
+ifndef TOOL_GCC3PLAIN_PREFIX
+ TOOL_GCC3PLAIN_PREFIX :=
+endif
+ifndef TOOL_GCC3PLAIN_SUFFIX
+ TOOL_GCC3PLAIN_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GCC3PLAIN_PREFIX2 ?= $(TOOL_GCC3PLAIN_PREFIX)
+TOOL_GCC3PLAIN_SUFFIX2 ?= $(TOOL_GCC3PLAIN_SUFFIX)
+TOOL_GCC3PLAIN_CC ?= $(TOOL_GCC3PLAIN_PREFIX)gcc$(TOOL_GCC3PLAIN_SUFFIX)
+TOOL_GCC3PLAIN_CXX ?= $(TOOL_GCC3PLAIN_PREFIX)g++$(TOOL_GCC3PLAIN_SUFFIX)
+TOOL_GCC3PLAIN_AS ?= $(TOOL_GCC3PLAIN_PREFIX)gcc$(TOOL_GCC3PLAIN_SUFFIX)
+TOOL_GCC3PLAIN_AR ?= $(TOOL_GCC3PLAIN_PREFIX2)ar$(TOOL_GCC3PLAIN_SUFFIX2)
+TOOL_GCC3PLAIN_RANLIB ?= $(TOOL_GCC3PLAIN_PREFIX2)ranlib$(TOOL_GCC3PLAIN_SUFFIX2)
+TOOL_GCC3PLAIN_LD ?= $(TOOL_GCC3PLAIN_PREFIX)gcc$(TOOL_GCC3PLAIN_SUFFIX)
+TOOL_GCC3PLAIN_LD_SYSMOD ?= $(TOOL_GCC3PLAIN_PREFIX2)ld$(TOOL_GCC3PLAIN_SUFFIX2)
+TOOL_GCC3PLAIN_LD_SYSMOD.os2 ?= $(TOOL_GCC3PLAIN_PREFIX)g++$(TOOL_GCC3PLAIN_SUFFIX)
+TOOL_GCC3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
+TOOL_GCC3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
+ifndef TOOL_GCC3PLAIN_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GCC3PLAIN_LDFLAGS.dll ?= -shared
+else
+ TOOL_GCC3PLAIN_LDFLAGS.dll ?= $(TOOL_GCC3PLAIN_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GCC3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
+TOOL_GCC3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
+TOOL_GCC3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_GCC3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
+ifndef TOOL_GCC3PLAIN_LD_SONAME.$(KBUILD_TARGET)
+ TOOL_GCC3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+else
+ TOOL_GCC3PLAIN_LD_SONAME ?= $(TOOL_GCC3PLAIN_LD_SONAME.$(KBUILD_TARGET))
+endif
+
+# General Properties used by kBuild
+TOOL_GCC3PLAIN_COBJSUFF ?= .o
+TOOL_GCC3PLAIN_CFLAGS ?=
+TOOL_GCC3PLAIN_CFLAGS.debug ?= -g
+TOOL_GCC3PLAIN_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC3PLAIN_CFLAGS.release ?= -O2
+TOOL_GCC3PLAIN_CINCS ?=
+TOOL_GCC3PLAIN_CDEFS ?=
+
+TOOL_GCC3PLAIN_CXXOBJSUFF ?= .o
+TOOL_GCC3PLAIN_CXXOBJSUFF ?= .o
+TOOL_GCC3PLAIN_CXXFLAGS ?=
+TOOL_GCC3PLAIN_CXXFLAGS.debug ?= -g
+TOOL_GCC3PLAIN_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC3PLAIN_CXXFLAGS.release ?= -O2
+TOOL_GCC3PLAIN_CXXINCS ?=
+TOOL_GCC3PLAIN_CXXDEFS ?=
+
+TOOL_GCC3PLAIN_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC3PLAIN_ASFLAGS.debug ?= -g
+TOOL_GCC3PLAIN_ASFLAGS.profile ?= -g
+TOOL_GCC3PLAIN_ASOBJSUFF ?= .o
+
+TOOL_GCC3PLAIN_ARFLAGS ?= cr
+TOOL_GCC3PLAIN_ARLIBSUFF ?= .a
+
+TOOL_GCC3PLAIN_LDFLAGS ?=
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3PLAIN_COMPILE_C_DEPEND =
+TOOL_GCC3PLAIN_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC3PLAIN_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC3PLAIN_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC3PLAIN_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC3PLAIN_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC3PLAIN_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC3PLAIN_COMPILE_C_OUTPUT =
+define TOOL_GCC3PLAIN_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC3PLAIN_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC3PLAIN_COMPILE_CXX_DEPEND =
+TOOL_GCC3PLAIN_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC3PLAIN_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC3PLAIN_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC3PLAIN_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC3PLAIN_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC3PLAIN_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC3PLAIN_COMPILE_CXX_OUTPUT =
+define TOOL_GCC3PLAIN_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC3PLAIN_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC3PLAIN_COMPILE_AS_OUTPUT =
+TOOL_GCC3PLAIN_COMPILE_AS_DEPEND =
+TOOL_GCC3PLAIN_COMPILE_AS_DEPORD =
+define TOOL_GCC3PLAIN_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC3PLAIN_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3PLAIN_LINK_LIBRARY_OUTPUT =
+TOOL_GCC3PLAIN_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC3PLAIN_LINK_LIBRARY_DEPORD =
+define TOOL_GCC3PLAIN_LINK_LIBRARY_CMDS
+ $(call xargs,$(QUIET)$(TOOL_GCC3PLAIN_AR) $(flags) $(out),$(objs))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GCC3PLAIN_AR) x $(abspath $(lib)) \
+ && $(TOOL_GCC3PLAIN_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+ $(QUIET)$(TOOL_GCC3PLAIN_RANLIB) $(out)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3PLAIN_LINK_PROGRAM_OUTPUT =
+TOOL_GCC3PLAIN_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC3PLAIN_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC3PLAIN_LINK_PROGRAM_DEPORD =
+define TOOL_GCC3PLAIN_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GCC3PLAIN_LD) $(flags) -o $(out) $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3PLAIN_LINK_DLL_OUTPUT =
+TOOL_GCC3PLAIN_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC3PLAIN_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC3PLAIN_LINK_DLL_DEPORD =
+define TOOL_GCC3PLAIN_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GCC3PLAIN_LD) $(TOOL_GCC3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GCC3PLAIN_LD_SONAME,$(target),$(out)))\
+ $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# This tool target might not work everywhere, but is provided for the
+# platforms where it works (Solaris, etc).
+#
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC3PLAIN_LINK_SYSMOD_OUTPUT =
+TOOL_GCC3PLAIN_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC3PLAIN_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GCC3PLAIN_LINK_SYSMOD_DEPORD =
+define TOOL_GCC3PLAIN_LINK_SYSMOD_CMDS
+ $(QUIET)$(if $(TOOL_GCC3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GCC3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GCC3PLAIN_LD_SYSMOD))\
+ $(TOOL_GCC3PLAIN_LDFLAGS_SYSMOD.$(bld_trg)) $(flags) -o $(out)\
+ $(objs)\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
diff --git a/kBuild/tools/GCC42MACHO.kmk b/kBuild/tools/GCC42MACHO.kmk
new file mode 100644
index 0000000..82a857a
--- /dev/null
+++ b/kBuild/tools/GCC42MACHO.kmk
@@ -0,0 +1,461 @@
+# $Id: GCC42MACHO.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - GCC v4.2.x targeting Darwin (Mac OS X) Mach-O.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC42MACHO := GCC v4.2.x targeting Darwin (Mac OS X) Mach-O.
+
+# Tool Specific Properties
+ifndef TOOL_GCC42MACHO_PREFIX
+ TOOL_GCC42MACHO_PREFIX :=
+endif
+ifndef TOOL_GCC42MACHO_SUFFIX
+ TOOL_GCC42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
+endif
+TOOL_GCC42MACHO_PREFIX2 ?=
+TOOL_GCC42MACHO_SUFFIX2 ?=
+TOOL_GCC42MACHO_CC ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_CXX ?= $(TOOL_GCC42MACHO_PREFIX)g++$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_OBJC ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_OBJCXX ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_AS ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_LD ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_LD_SYSMOD ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
+TOOL_GCC42MACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_GCC42MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_GCC42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+TOOL_GCC42MACHO_AR ?= $(TOOL_GCC4MACHO_PREFIX2)ar$(TOOL_GCC4MACHO_SUFFIX2)
+TOOL_GCC42MACHO_DSYMUTIL ?= $(TOOL_GCC4MACHO_PREFIX2)dsymutil$(TOOL_GCC4MACHO_SUFFIX2)
+TOOL_GCC42MACHO_STRIP ?= $(TOOL_GCC4MACHO_PREFIX2)strip$(TOOL_GCC4MACHO_SUFFIX2)
+TOOL_GCC42MACHO_STRIP_PROGRAM ?= $(TOOL_GCC42MACHO_STRIP) -SXxru
+TOOL_GCC42MACHO_STRIP_DLL ?= $(TOOL_GCC42MACHO_STRIP) -Sxru
+TOOL_GCC42MACHO_STRIP_SYSMOD ?= $(TOOL_GCC42MACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_GCC42MACHO_COBJSUFF ?= .o
+TOOL_GCC42MACHO_CFLAGS ?=
+TOOL_GCC42MACHO_CFLAGS.debug ?= -g
+TOOL_GCC42MACHO_CFLAGS.profile ?= -g -O2 #-pg
+TOOL_GCC42MACHO_CFLAGS.release ?= -O2
+TOOL_GCC42MACHO_CINCS ?=
+TOOL_GCC42MACHO_CDEFS ?=
+
+TOOL_GCC42MACHO_CXXOBJSUFF ?= .o
+TOOL_GCC42MACHO_CXXFLAGS ?=
+TOOL_GCC42MACHO_CXXFLAGS.debug ?= -g
+TOOL_GCC42MACHO_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GCC42MACHO_CXXFLAGS.release ?= -O2
+TOOL_GCC42MACHO_CXXINCS ?=
+TOOL_GCC42MACHO_CXXDEFS ?=
+
+TOOL_GCC42MACHO_OBJCOBJSUFF ?= .o
+TOOL_GCC42MACHO_OBJCFLAGS ?=
+TOOL_GCC42MACHO_OBJCFLAGS.debug ?= -g
+TOOL_GCC42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_GCC42MACHO_OBJCFLAGS.release?= -O2
+TOOL_GCC42MACHO_OBJCINCS ?=
+TOOL_GCC42MACHO_OBJCDEFS ?=
+
+TOOL_GCC42MACHO_OBJCXXOBJSUFF ?= .o
+TOOL_GCC42MACHO_OBJCXXFLAGS ?=
+TOOL_GCC42MACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_GCC42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC42MACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_GCC42MACHO_OBJCXXINCS ?=
+TOOL_GCC42MACHO_OBJCXXDEFS ?=
+
+TOOL_GCC42MACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC42MACHO_ASFLAGS.debug ?= -g
+TOOL_GCC42MACHO_ASFLAGS.profile ?= -g
+TOOL_GCC42MACHO_ASOBJSUFF ?= .o
+
+TOOL_GCC42MACHO_ARFLAGS ?= -c -rs
+TOOL_GCC42MACHO_ARLIBSUFF ?= .a
+
+TOOL_GCC42MACHO_LDFLAGS ?=
+TOOL_GCC42MACHO_LDFLAGS.debug ?= -g
+TOOL_GCC42MACHO_LDFLAGS.profile ?= -g
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_GCC42MACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/ \
+ $(1).dSYM/Contents/ \
+ $(1).dSYM/Contents/Resources/ \
+ $(1).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_GCC42MACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC42MACHO_COMPILE_C_DEPEND =
+TOOL_GCC42MACHO_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC42MACHO_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC42MACHO_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC42MACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC42MACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_C_OUTPUT =
+define TOOL_GCC42MACHO_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC42MACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KUSE_OBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC42MACHO_COMPILE_CXX_DEPEND =
+TOOL_GCC42MACHO_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC42MACHO_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC42MACHO_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC42MACHO_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_CXX_OUTPUT =
+define TOOL_GCC42MACHO_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC42MACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC42MACHO_COMPILE_OBJC_DEPEND =
+TOOL_GCC42MACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_GCC42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_GCC42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC42MACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC42MACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x cbjective-c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_GCC42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_GCC42MACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC42MACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_GCC42MACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_GCC42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_GCC42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_GCC42MACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC42MACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC42MACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_GCC42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_GCC42MACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC42MACHO_COMPILE_AS_OUTPUT =
+TOOL_GCC42MACHO_COMPILE_AS_DEPEND =
+TOOL_GCC42MACHO_COMPILE_AS_DEPORD =
+define TOOL_GCC42MACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC42MACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC42MACHO_LINK_LIBRARY_OUTPUT =
+TOOL_GCC42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC42MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_GCC42MACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_GCC42MACHO_AR) $(flags) $(out),$(objs)))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GCC42MACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_GCC42MACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
+TOOL_GCC42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GCC42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN)
+TOOL_GCC42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC42MACHO_LINK_PROGRAM_DEPORD =
+define TOOL_GCC42MACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_GCC42MACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GCC42MACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+TOOL_GCC42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GCC42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN)
+TOOL_GCC42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC42MACHO_LINK_DLL_DEPORD =
+define TOOL_GCC42MACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_GCC42MACHO_LD) $(TOOL_GCC42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_GCC42MACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GCC42MACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+TOOL_GCC42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GCC42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN)
+TOOL_GCC42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC42MACHO_LINK_SYSMOD_DEPORD =
+define TOOL_GCC42MACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_GCC42MACHO_LD_SYSMOD) $(TOOL_GCC42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GCC42MACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GCC4MACHO.kmk b/kBuild/tools/GCC4MACHO.kmk
new file mode 100644
index 0000000..9baabb3
--- /dev/null
+++ b/kBuild/tools/GCC4MACHO.kmk
@@ -0,0 +1,461 @@
+# $Id: GCC4MACHO.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-O.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-O.
+
+# Tool Specific Properties
+ifndef TOOL_GCC4MACHO_PREFIX
+ TOOL_GCC4MACHO_PREFIX :=
+endif
+ifndef TOOL_GCC4MACHO_SUFFIX
+ TOOL_GCC4MACHO_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GCC4MACHO_PREFIX2 ?=
+TOOL_GCC4MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_CC ?= $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_CXX ?= $(TOOL_GCC4MACHO_PREFIX)g++$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_OBJC ?= $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_OBJCXX ?= $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_AS ?= $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_LD ?= $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_LD_SYSMOD ?= $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX)
+TOOL_GCC4MACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_GCC4MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_GCC4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+TOOL_GCC4MACHO_AR ?= $(TOOL_GCC4MACHO_PREFIX2)ar$(TOOL_GCC4MACHO_SUFFIX2)
+TOOL_GCC4MACHO_DSYMUTIL ?= $(TOOL_GCC4MACHO_PREFIX2)dsymutil$(TOOL_GCC4MACHO_SUFFIX2)
+TOOL_GCC4MACHO_STRIP ?= $(TOOL_GCC4MACHO_PREFIX2)strip$(TOOL_GCC4MACHO_SUFFIX2)
+TOOL_GCC4MACHO_STRIP_PROGRAM ?= $(TOOL_GCC4MACHO_STRIP) -SXxru
+TOOL_GCC4MACHO_STRIP_DLL ?= $(TOOL_GCC4MACHO_STRIP) -Sxru
+TOOL_GCC4MACHO_STRIP_SYSMOD ?= $(TOOL_GCC4MACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_GCC4MACHO_COBJSUFF ?= .o
+TOOL_GCC4MACHO_CFLAGS ?=
+TOOL_GCC4MACHO_CFLAGS.debug ?= -g
+TOOL_GCC4MACHO_CFLAGS.profile ?= -g -O2 #-pg
+TOOL_GCC4MACHO_CFLAGS.release ?= -O2
+TOOL_GCC4MACHO_CINCS ?=
+TOOL_GCC4MACHO_CDEFS ?=
+
+TOOL_GCC4MACHO_CXXOBJSUFF ?= .o
+TOOL_GCC4MACHO_CXXFLAGS ?=
+TOOL_GCC4MACHO_CXXFLAGS.debug ?= -g
+TOOL_GCC4MACHO_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GCC4MACHO_CXXFLAGS.release ?= -O2
+TOOL_GCC4MACHO_CXXINCS ?=
+TOOL_GCC4MACHO_CXXDEFS ?=
+
+TOOL_GCC4MACHO_OBJCOBJSUFF ?= .o
+TOOL_GCC4MACHO_OBJCFLAGS ?=
+TOOL_GCC4MACHO_OBJCFLAGS.debug ?= -g
+TOOL_GCC4MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_GCC4MACHO_OBJCFLAGS.release?= -O2
+TOOL_GCC4MACHO_OBJCINCS ?=
+TOOL_GCC4MACHO_OBJCDEFS ?=
+
+TOOL_GCC4MACHO_OBJCXXOBJSUFF ?= .o
+TOOL_GCC4MACHO_OBJCXXFLAGS ?=
+TOOL_GCC4MACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_GCC4MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC4MACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_GCC4MACHO_OBJCXXINCS ?=
+TOOL_GCC4MACHO_OBJCXXDEFS ?=
+
+TOOL_GCC4MACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC4MACHO_ASFLAGS.debug ?= -g
+TOOL_GCC4MACHO_ASFLAGS.profile ?= -g
+TOOL_GCC4MACHO_ASOBJSUFF ?= .o
+
+TOOL_GCC4MACHO_ARFLAGS ?= -c -rs
+TOOL_GCC4MACHO_ARLIBSUFF ?= .a
+
+TOOL_GCC4MACHO_LDFLAGS ?=
+TOOL_GCC4MACHO_LDFLAGS.debug ?= -g
+TOOL_GCC4MACHO_LDFLAGS.profile ?= -g
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_GCC4MACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/ \
+ $(1).dSYM/Contents/ \
+ $(1).dSYM/Contents/Resources/ \
+ $(1).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_GCC4MACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC4MACHO_COMPILE_C_DEPEND =
+TOOL_GCC4MACHO_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC4MACHO_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC4MACHO_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC4MACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC4MACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_C_OUTPUT =
+define TOOL_GCC4MACHO_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC4MACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KUSE_OBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC4MACHO_COMPILE_CXX_DEPEND =
+TOOL_GCC4MACHO_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC4MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC4MACHO_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC4MACHO_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC4MACHO_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_CXX_OUTPUT =
+define TOOL_GCC4MACHO_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC4MACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC4MACHO_COMPILE_OBJC_DEPEND =
+TOOL_GCC4MACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_GCC4MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_GCC4MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC4MACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC4MACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x cbjective-c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_GCC4MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_GCC4MACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC4MACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_GCC4MACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_GCC4MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_GCC4MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_GCC4MACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC4MACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC4MACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_GCC4MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_GCC4MACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC4MACHO_COMPILE_AS_OUTPUT =
+TOOL_GCC4MACHO_COMPILE_AS_DEPEND =
+TOOL_GCC4MACHO_COMPILE_AS_DEPORD =
+define TOOL_GCC4MACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC4MACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC4MACHO_LINK_LIBRARY_OUTPUT =
+TOOL_GCC4MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC4MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_GCC4MACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_GCC4MACHO_AR) $(flags) $(out),$(objs)))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GCC4MACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_GCC4MACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC4MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
+TOOL_GCC4MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GCC4MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GCC4MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GCC4MACHO_DEBUG_INSTALL_FN)
+TOOL_GCC4MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC4MACHO_LINK_PROGRAM_DEPORD =
+define TOOL_GCC4MACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_GCC4MACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GCC4MACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+TOOL_GCC4MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GCC4MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GCC4MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GCC4MACHO_DEBUG_INSTALL_FN)
+TOOL_GCC4MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC4MACHO_LINK_DLL_DEPORD =
+define TOOL_GCC4MACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_GCC4MACHO_LD) $(TOOL_GCC4MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_GCC4MACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GCC4MACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+TOOL_GCC4MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GCC4MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GCC4MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GCC4MACHO_DEBUG_INSTALL_FN)
+TOOL_GCC4MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC4MACHO_LINK_SYSMOD_DEPORD =
+define TOOL_GCC4MACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_GCC4MACHO_LD_SYSMOD) $(TOOL_GCC4MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GCC4MACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GCC64.kmk b/kBuild/tools/GCC64.kmk
new file mode 100644
index 0000000..f23d8e8
--- /dev/null
+++ b/kBuild/tools/GCC64.kmk
@@ -0,0 +1,346 @@
+# $Id: GCC64.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic 64-bit GCC v3.2.x or later Using The System GCC.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GCC64 := Generic 64-bit GCC v3.2.x or later Using The System GCC. \
+ More or less Linux/ELF specfic.
+
+# Tool Specific Properties
+ifndef TOOL_GCC64_PREFIX
+ TOOL_GCC64_PREFIX :=
+endif
+ifndef TOOL_GCC64_SUFFIX
+ TOOL_GCC64_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GCC64_PREFIX2 ?= g
+else
+ TOOL_GCC64_PREFIX2 ?=
+endif
+TOOL_GCC64_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GCC64_PREFIX3 ?=
+TOOL_GCC64_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GCC64_CC ?= $(TOOL_GCC64_PREFIX)gcc$(TOOL_GCC64_SUFFIX) -m64
+TOOL_GCC64_CXX ?= $(TOOL_GCC64_PREFIX)g++$(TOOL_GCC64_SUFFIX) -m64
+TOOL_GCC64_AS ?= $(TOOL_GCC64_PREFIX)gcc$(TOOL_GCC64_SUFFIX) -m64
+TOOL_GCC64_AR ?= $(TOOL_GCC64_PREFIX2)ar$(TOOL_GCC64_SUFFIX2)
+TOOL_GCC64_LD ?= $(TOOL_GCC64_PREFIX)gcc$(TOOL_GCC64_SUFFIX) -m64
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GCC64_LD_SYSMOD ?= $(TOOL_GCC64_PREFIX3)ld$(TOOL_GCC64_SUFFIX3)
+else
+ TOOL_GCC64_LD_SYSMOD ?= $(TOOL_GCC64_PREFIX2)ld$(TOOL_GCC64_SUFFIX2)
+endif
+ifndef TOOL_GCC64_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GCC64_LDFLAGS.dll ?= -shared
+else
+ TOOL_GCC64_LDFLAGS.dll ?= $(TOOL_GCC64_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GCC64_LDFLAGS.sysmod ?= -r -m elf_x86_64$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
+TOOL_GCC64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GCC64_LD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GCC64_LD_MAP ?=
+endif
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GCC64_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GCC64_LD_SYSMOD_MAP ?=
+endif
+TOOL_GCC64_OBJCOPY ?= $(TOOL_GCC64_PREFIX2)gobjcopy$(TOOL_GCC64_SUFFIX2)
+
+# General Properties used by kBuild
+TOOL_GCC64_COBJSUFF ?= .o
+TOOL_GCC64_CFLAGS ?=
+TOOL_GCC64_CFLAGS.debug ?= -g
+TOOL_GCC64_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC64_CFLAGS.release ?= -O2
+TOOL_GCC64_CINCS ?=
+TOOL_GCC64_CDEFS ?=
+
+TOOL_GCC64_CXXOBJSUFF ?= .o
+TOOL_GCC64_CXXOBJSUFF ?= .o
+TOOL_GCC64_CXXFLAGS ?=
+TOOL_GCC64_CXXFLAGS.debug ?= -g
+TOOL_GCC64_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GCC64_CXXFLAGS.release ?= -O2
+TOOL_GCC64_CXXINCS ?=
+TOOL_GCC64_CXXDEFS ?=
+
+TOOL_GCC64_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GCC64_ASFLAGS.debug ?= -g
+TOOL_GCC64_ASFLAGS.profile ?= -g
+TOOL_GCC64_ASOBJSUFF ?= .o
+
+TOOL_GCC64_ARFLAGS ?= cr
+TOOL_GCC64_ARLIBSUFF ?= .a
+
+TOOL_GCC64_LDFLAGS ?=
+TOOL_GCC64_LDFLAGS.debug ?= -g
+TOOL_GCC64_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC64_COMPILE_C_DEPEND =
+TOOL_GCC64_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC64_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_GCC64_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_GCC64_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GCC64_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC64_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC64_COMPILE_C_OUTPUT =
+define TOOL_GCC64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GCC64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GCC64_COMPILE_CXX_DEPEND =
+TOOL_GCC64_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GCC64_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_GCC64_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_GCC64_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GCC64_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GCC64_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GCC64_COMPILE_CXX_OUTPUT =
+define TOOL_GCC64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GCC64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GCC64_COMPILE_AS_OUTPUT =
+TOOL_GCC64_COMPILE_AS_DEPEND =
+TOOL_GCC64_COMPILE_AS_DEPORD =
+define TOOL_GCC64_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GCC64_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC64_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_GCC64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GCC64_LINK_LIBRARY_DEPORD =
+define TOOL_GCC64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(objs), 'ADDMOD $(o)') \
+ $(foreach o,$(othersrc), 'ADDLIB $(o)')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GCC64_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC64_LINK_PROGRAM_OUTPUT =
+TOOL_GCC64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC64_LINK_PROGRAM_DEPORD =
+define TOOL_GCC64_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GCC64_LD) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC64_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC64_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC64_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC64_LINK_DLL_OUTPUT =
+TOOL_GCC64_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC64_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC64_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC64_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC64_LINK_DLL_DEPORD =
+define TOOL_GCC64_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GCC64_LD) $(TOOL_GCC64_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC64_LD_SONAME,$(target),$(out)))\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC64_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC64_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC64_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GCC64_LINK_SYSMOD_OUTPUT =
+TOOL_GCC64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GCC64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GCC64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GCC64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GCC64_LINK_SYSMOD_DEPORD =
+define TOOL_GCC64_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_GCC64_LD_SYSMOD) $(TOOL_GCC64_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GCC64_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GCC64_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GCC64_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GXX.kmk b/kBuild/tools/GXX.kmk
new file mode 100644
index 0000000..2f4e2e8
--- /dev/null
+++ b/kBuild/tools/GXX.kmk
@@ -0,0 +1,281 @@
+# $Id: GXX.kmk 3566 2022-06-13 15:37:08Z bird $
+## @file
+# kBuild Tool Config - Generic GCC using the system GCC, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX := Generic GCC using the system GCC, for building C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_GXX_PREFIX
+ TOOL_GXX_PREFIX :=
+endif
+ifndef TOOL_GXX_SUFFIX
+ TOOL_GXX_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX_PREFIX2 ?= g
+else
+ TOOL_GXX_PREFIX2 ?=
+endif
+TOOL_GXX_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX_PREFIX3 ?=
+TOOL_GXX_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GXX_CC ?= $(TOOL_GXX_PREFIX)gcc$(TOOL_GXX_SUFFIX)
+TOOL_GXX_CXX ?= $(TOOL_GXX_PREFIX)g++$(TOOL_GXX_SUFFIX)
+TOOL_GXX_PCH ?= $(TOOL_GXX_CXX)
+TOOL_GXX_AS ?= $(TOOL_GXX_PREFIX)gcc$(TOOL_GXX_SUFFIX)
+TOOL_GXX_AR ?= $(TOOL_GXX_PREFIX2)ar$(TOOL_GXX_SUFFIX2)
+TOOL_GXX_RANLIB ?= $(TOOL_GXX_PREFIX2)ranlib$(TOOL_GXX_SUFFIX2)
+TOOL_GXX_LD ?= $(TOOL_GXX_PREFIX)g++$(TOOL_GXX_SUFFIX)
+TOOL_GXX_LDFLAGS.dll.os2 ?= -Zdll
+TOOL_GXX_LDFLAGS.dll.darwin ?= -dynamiclib
+ifndef TOOL_GXX_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GXX_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX_LDFLAGS.dll ?= $(TOOL_GXX_LDFLAGS.$(KBUILD_TARGET))
+endif
+
+# General Properties used by kBuild
+TOOL_GXX_COBJSUFF ?= .o
+TOOL_GXX_CFLAGS ?=
+TOOL_GXX_CFLAGS.debug ?= -g
+TOOL_GXX_CFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX_CFLAGS.release ?= -O2
+TOOL_GXX_CINCS ?=
+TOOL_GXX_CDEFS ?=
+
+TOOL_GXX_CXXOBJSUFF ?= .o
+TOOL_GXX_CXXOBJSUFF ?= .o
+TOOL_GXX_CXXFLAGS ?=
+TOOL_GXX_CXXFLAGS.debug ?= -g -O0
+TOOL_GXX_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX_CXXFLAGS.release ?= -O2
+TOOL_GXX_CXXINCS ?=
+TOOL_GXX_CXXDEFS ?=
+
+TOOL_GXX_PCHOBJSUFF ?= .h.gch
+TOOL_GXX_PCHFLAGS ?= $(TOOL_GXX_CXXFLAGS)
+TOOL_GXX_PCHFLAGS.debug ?= $(TOOL_GXX_CXXFLAGS.debug)
+TOOL_GXX_PCHFLAGS.profile ?= $(TOOL_GXX_CXXFLAGS.profile)
+TOOL_GXX_PCHFLAGS.release ?= $(TOOL_GXX_CXXFLAGS.release)
+TOOL_GXX_PCHINCS ?= $(TOOL_GXX_CXXINCS)
+TOOL_GXX_PCHDEFS ?= $(TOOL_GXX_CXXDEFS)
+
+TOOL_GXX_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX_ASFLAGS.debug ?= -g
+TOOL_GXX_ASFLAGS.profile ?= -g
+TOOL_GXX_ASOBJSUFF ?= .o
+
+TOOL_GXX_ARFLAGS ?= cr
+TOOL_GXX_ARLIBSUFF ?= .a
+
+TOOL_GXX_LDFLAGS ?=
+TOOL_GXX_LDFLAGS.debug ?= -g
+TOOL_GXX_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX_COMPILE_C_OUTPUT =
+TOOL_GXX_COMPILE_C_DEPEND =
+TOOL_GXX_COMPILE_C_DEPORD =
+define TOOL_GXX_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_GXX_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX_COMPILE_CXX_OUTPUT =
+TOOL_GXX_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX_COMPILE_CXX_DEPORD =
+define TOOL_GXX_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_GXX_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX_COMPILE_PCH_DEPEND =
+TOOL_GXX_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX_COMPILE_AS_OUTPUT =
+TOOL_GXX_COMPILE_AS_DEPEND =
+TOOL_GXX_COMPILE_AS_DEPORD =
+define TOOL_GXX_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX_LINK_LIBRARY_OUTPUT =
+TOOL_GXX_LINK_LIBRARY_DEPEND =
+TOOL_GXX_LINK_LIBRARY_DEPORD =
+define TOOL_GXX_LINK_LIBRARY_CMDS
+ $(QUIET)$(TOOL_GXX_AR) $(flags) $(out) $(filter-out %.h.gch,$(objs))
+ $(call xargs,$(QUIET)$(TOOL_GXX_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs)))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GXX_AR) x $(abspath $(lib)) \
+ && $(TOOL_GXX_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+ $(QUIET)$(TOOL_GXX_RANLIB) $(out)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX_LINK_PROGRAM_OUTPUT =
+TOOL_GXX_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX_LINK_PROGRAM_DEPORD =
+define TOOL_GXX_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GXX_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs)) \
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX_LINK_DLL_OUTPUT =
+TOOL_GXX_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX_LINK_DLL_DEPORD =
+define TOOL_GXX_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GXX_LD) $(TOOL_GXX_LDFLAGS.dll) $(flags) -o $(out) $(filter-out %.h.gch,$(objs)) \
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
diff --git a/kBuild/tools/GXX3.kmk b/kBuild/tools/GXX3.kmk
new file mode 100644
index 0000000..b2fbed7
--- /dev/null
+++ b/kBuild/tools/GXX3.kmk
@@ -0,0 +1,386 @@
+# $Id: GXX3.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic GCC v3.2+ using the system GCC and Binutils, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX3 := Generic GCC v3.2.x or later using the system GCC and Binutils, for building C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_GXX3_PREFIX
+ TOOL_GXX3_PREFIX :=
+endif
+ifndef TOOL_GXX3_SUFFIX
+ TOOL_GXX3_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX3_PREFIX2 ?= g
+else
+ TOOL_GXX3_PREFIX2 ?=
+endif
+TOOL_GXX3_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX3_PREFIX3 ?=
+TOOL_GXX3_SUFFIX3 ?= $(HOSTSUFF_EXE)
+
+TOOL_GXX3_CC ?= $(TOOL_GXX3_PREFIX)gcc$(TOOL_GXX3_SUFFIX)
+TOOL_GXX3_CXX ?= $(TOOL_GXX3_PREFIX)g++$(TOOL_GXX3_SUFFIX)
+TOOL_GXX3_PCH ?= $(TOOL_GXX3_CXX)
+TOOL_GXX3_AS ?= $(TOOL_GXX3_PREFIX)gcc$(TOOL_GXX3_SUFFIX)
+TOOL_GXX3_AR ?= $(TOOL_GXX3_PREFIX2)ar$(TOOL_GXX3_SUFFIX2)
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GXX3_AR_IMP ?= $(TOOL_GXX3_PREFIX3)emximp$(TOOL_GXX3_SUFFIX3)
+else
+ TOOL_GXX3_AR_IMP ?= $(ECHO) not supported!
+endif
+TOOL_GXX3_LD ?= $(TOOL_GXX3_PREFIX)g++$(TOOL_GXX3_SUFFIX)
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX3_LD_SYSMOD ?= $(TOOL_GXX3_PREFIX3)ld$(TOOL_GXX3_SUFFIX3)
+else
+ TOOL_GXX3_LD_SYSMOD ?= $(TOOL_GXX3_PREFIX2)ld$(TOOL_GXX3_SUFFIX2)
+endif
+ifndef TOOL_GXX3_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GXX3_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX3_LDFLAGS.dll ?= $(TOOL_GXX3_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GXX3_LDFLAGS.sysmod ?= -r
+TOOL_GXX3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GXX3_LD_MAP ?= -Zmap=$(1)
+ TOOL_GXX3_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GXX3_LD_MAP ?=
+ TOOL_GXX3_LD_SYSMOD_MAP ?=
+endif
+TOOL_GXX3_OBJCOPY ?= $(TOOL_GXX3_PREFIX)objcopy$(TOOL_GXX3_SUFFIX)
+
+# General Properties used by kBuild
+TOOL_GXX3_COBJSUFF ?= .o
+TOOL_GXX3_CFLAGS ?=
+TOOL_GXX3_CFLAGS.debug ?= -g
+TOOL_GXX3_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX3_CFLAGS.release ?= -O2
+TOOL_GXX3_CINCS ?=
+TOOL_GXX3_CDEFS ?=
+
+TOOL_GXX3_CXXOBJSUFF ?= .o
+TOOL_GXX3_CXXFLAGS ?=
+TOOL_GXX3_CXXFLAGS.debug ?= -g
+TOOL_GXX3_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX3_CXXFLAGS.release ?= -O2
+TOOL_GXX3_CXXINCS ?=
+TOOL_GXX3_CXXDEFS ?=
+
+TOOL_GXX3_PCHOBJSUFF ?= .h.gch
+TOOL_GXX3_PCHFLAGS ?= $(TOOL_GXX3_CXXFLAGS)
+TOOL_GXX3_PCHFLAGS.debug ?= $(TOOL_GXX3_CXXFLAGS.debug)
+TOOL_GXX3_PCHFLAGS.profile ?= $(TOOL_GXX3_CXXFLAGS.profile)
+TOOL_GXX3_PCHFLAGS.release ?= $(TOOL_GXX3_CXXFLAGS.release)
+TOOL_GXX3_PCHINCS ?= $(TOOL_GXX3_CXXINCS)
+TOOL_GXX3_PCHDEFS ?= $(TOOL_GXX3_CXXDEFS)
+
+TOOL_GXX3_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX3_ASFLAGS.debug ?= -g
+TOOL_GXX3_ASFLAGS.profile ?= -g
+TOOL_GXX3_ASOBJSUFF ?= .o
+
+TOOL_GXX3_ARFLAGS ?= cr
+TOOL_GXX3_ARLIBSUFF ?= .a
+
+TOOL_GXX3_LDFLAGS ?=
+TOOL_GXX3_LDFLAGS.debug ?= -g
+TOOL_GXX3_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3_COMPILE_C_DEPEND =
+TOOL_GXX3_COMPILE_C_DEPORD =
+TOOL_GXX3_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX3_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX3_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX3_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX3_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX3_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX3_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX3_COMPILE_CXX_DEPORD =
+TOOL_GXX3_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX3_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX3_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX3_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX3_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX3_COMPILE_PCH_DEPEND =
+TOOL_GXX3_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX3_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX3_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX3_COMPILE_AS_OUTPUT =
+TOOL_GXX3_COMPILE_AS_DEPEND =
+TOOL_GXX3_COMPILE_AS_DEPORD =
+define TOOL_GXX3_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX3_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_GXX3_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
+TOOL_GXX3_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX3_LINK_LIBRARY_DEPORD =
+define TOOL_GXX3_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(filter-out %.h.gch,$(objs)), 'ADDMOD $(o)') \
+ $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
+ $(if $(filter %.def %.imp %.dll,$(othersrc))\
+ ,$(TOOL_GXX3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GXX3_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3_LINK_PROGRAM_OUTPUT =
+TOOL_GXX3_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX3_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX3_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX3_LINK_PROGRAM_DEPORD =
+define TOOL_GXX3_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GXX3_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX3_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3_LINK_DLL_OUTPUT =
+TOOL_GXX3_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX3_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX3_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX3_LINK_DLL_DEPORD =
+define TOOL_GXX3_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GXX3_LD) $(TOOL_GXX3_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX3_LD_SONAME,$(target),$(out)))\
+ $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX3_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3_LINK_SYSMOD_OUTPUT =
+TOOL_GXX3_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX3_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX3_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX3_LINK_SYSMOD_DEPORD =
+define TOOL_GXX3_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_GXX3_LD_SYSMOD) $(TOOL_GXX3_LDFLAGS.sysmod) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX3_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GXX32.kmk b/kBuild/tools/GXX32.kmk
new file mode 100644
index 0000000..9047194
--- /dev/null
+++ b/kBuild/tools/GXX32.kmk
@@ -0,0 +1,381 @@
+# $Id: GXX32.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic 32-bit GCC v3.2.x or later using the system GCC, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX32 := Generic 32-bit GCC v3.2.x or later using the system GCC, for building C++ code. \
+ More or less Linux/ELF specfic.
+
+# Tool Specific Properties
+ifndef TOOL_GXX32_PREFIX
+ TOOL_GXX32_PREFIX :=
+endif
+ifndef TOOL_GXX32_SUFFIX
+ TOOL_GXX32_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX32_PREFIX2 ?= g
+else
+ TOOL_GXX32_PREFIX2 ?=
+endif
+TOOL_GXX32_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX32_PREFIX3 ?=
+TOOL_GXX32_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GXX32_CC ?= $(TOOL_GXX32_PREFIX)gcc$(TOOL_GXX32_SUFFIX) -m32
+TOOL_GXX32_CXX ?= $(TOOL_GXX32_PREFIX)g++$(TOOL_GXX32_SUFFIX) -m32
+TOOL_GXX32_PCH ?= $(TOOL_GXX32_CXX)
+TOOL_GXX32_AS ?= $(TOOL_GXX32_PREFIX)gcc$(TOOL_GXX32_SUFFIX) -m32
+TOOL_GXX32_AR ?= $(TOOL_GXX32_PREFIX2)ar$(TOOL_GXX32_SUFFIX2)
+TOOL_GXX32_LD ?= $(TOOL_GXX32_PREFIX)g++$(TOOL_GXX32_SUFFIX) -m32
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX32_LD_SYSMOD ?= $(TOOL_GXX32_PREFIX3)ld$(TOOL_GXX32_SUFFIX3)
+else
+ TOOL_GXX32_LD_SYSMOD ?= $(TOOL_GXX32_PREFIX2)ld$(TOOL_GXX32_SUFFIX2)
+endif
+ifndef TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GXX32_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX32_LDFLAGS.dll ?= $(TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GXX32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
+TOOL_GXX32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GXX32_LD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GXX32_LD_MAP ?=
+endif
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GXX32_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GXX32_LD_SYSMOD_MAP ?=
+endif
+TOOL_GXX32_OBJCOPY ?= $(TOOL_GXX32_PREFIX2)objcopy$(TOOL_GXX32_SUFFIX)
+
+# General Properties used by kBuild
+TOOL_GXX32_COBJSUFF ?= .o
+TOOL_GXX32_CFLAGS ?=
+TOOL_GXX32_CFLAGS.debug ?= -g
+TOOL_GXX32_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX32_CFLAGS.release ?= -O2
+TOOL_GXX32_CINCS ?=
+TOOL_GXX32_CDEFS ?=
+
+TOOL_GXX32_CXXOBJSUFF ?= .o
+TOOL_GXX32_CXXFLAGS ?=
+TOOL_GXX32_CXXFLAGS.debug ?= -g
+TOOL_GXX32_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX32_CXXFLAGS.release ?= -O2
+TOOL_GXX32_CXXINCS ?=
+TOOL_GXX32_CXXDEFS ?=
+
+TOOL_GXX32_PCHOBJSUFF ?= .h.gch
+TOOL_GXX32_PCHFLAGS ?= $(TOOL_GXX32_CXXFLAGS)
+TOOL_GXX32_PCHFLAGS.debug ?= $(TOOL_GXX32_CXXFLAGS.debug)
+TOOL_GXX32_PCHFLAGS.profile ?= $(TOOL_GXX32_CXXFLAGS.profile)
+TOOL_GXX32_PCHFLAGS.release ?= $(TOOL_GXX32_CXXFLAGS.release)
+TOOL_GXX32_PCHINCS ?= $(TOOL_GXX32_CXXINCS)
+TOOL_GXX32_PCHDEFS ?= $(TOOL_GXX32_CXXDEFS)
+
+TOOL_GXX32_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX32_ASFLAGS.debug ?= -g
+TOOL_GXX32_ASFLAGS.profile ?= -g
+TOOL_GXX32_ASOBJSUFF ?= .o
+
+TOOL_GXX32_ARFLAGS ?= cr
+TOOL_GXX32_ARLIBSUFF ?= .a
+
+TOOL_GXX32_LDFLAGS ?=
+TOOL_GXX32_LDFLAGS.debug ?= -g
+TOOL_GXX32_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX32_COMPILE_C_DEPEND =
+TOOL_GXX32_COMPILE_C_DEPORD =
+TOOL_GXX32_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX32_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX32_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX32_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX32_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX32_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX32_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX32_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX32_COMPILE_CXX_DEPORD =
+TOOL_GXX32_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX32_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX32_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX32_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX32_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX32_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX32_COMPILE_PCH_DEPEND =
+TOOL_GXX32_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX32_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX32_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX32_COMPILE_AS_OUTPUT =
+TOOL_GXX32_COMPILE_AS_DEPEND =
+TOOL_GXX32_COMPILE_AS_DEPORD =
+define TOOL_GXX32_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX32_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX32_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_GXX32_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX32_LINK_LIBRARY_DEPORD =
+define TOOL_GXX32_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(filter-out %.h.gch,$(objs)), 'ADDMOD $(o)') \
+ $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
+ $(if $(filter %.def %.imp %.dll,$(othersrc))\
+ ,$(TOOL_GXX32_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GXX32_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX32_LINK_PROGRAM_OUTPUT =
+TOOL_GXX32_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX32_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX32_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX32_LINK_PROGRAM_DEPORD =
+define TOOL_GXX32_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GXX32_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX32_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX32_LINK_DLL_OUTPUT =
+TOOL_GXX32_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX32_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX32_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX32_LINK_DLL_DEPORD =
+define TOOL_GXX32_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GXX32_LD) $(TOOL_GXX32_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX32_LD_SONAME,$(target),$(out)))\
+ $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX32_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX32_LINK_SYSMOD_OUTPUT =
+TOOL_GXX32_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX32_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX32_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX32_LINK_SYSMOD_DEPORD =
+define TOOL_GXX32_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_GXX32_LD_SYSMOD) $(TOOL_GXX32_LDFLAGS.sysmod) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX32_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GXX3OMF.kmk b/kBuild/tools/GXX3OMF.kmk
new file mode 100644
index 0000000..97acbb0
--- /dev/null
+++ b/kBuild/tools/GXX3OMF.kmk
@@ -0,0 +1,381 @@
+# $Id: GXX3OMF.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - GCC v3 targeting OS/2 OMF, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX3OMF := GCC v3 targeting OS/2 OMF, for building C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_GXX3OMF_PREFIX
+ TOOL_GXX3OMF_PREFIX :=
+endif
+ifndef TOOL_GXX3OMF_SUFFIX
+ TOOL_GXX3OMF_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GXX3OMF_PREFIX2 ?=
+TOOL_GXX3OMF_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX3OMF_PREFIX3 ?=
+TOOL_GXX3OMF_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GXX3OMF_CC ?= $(TOOL_GXX3OMF_PREFIX)gcc$(TOOL_GXX3OMF_SUFFIX)
+TOOL_GXX3OMF_CXX ?= $(TOOL_GXX3OMF_PREFIX)g++$(TOOL_GXX3OMF_SUFFIX)
+TOOL_GXX3OMF_PCH ?= $(TOOL_GXX3OMF_CXX)
+TOOL_GXX3OMF_AS ?= $(TOOL_GXX3OMF_PREFIX)gcc$(TOOL_GXX3OMF_SUFFIX)
+TOOL_GXX3OMF_AR ?= $(TOOL_GXX3OMF_PREFIX2)emxomfar$(TOOL_GXX3OMF_SUFFIX2)
+TOOL_GXX3OMF_AR_IMP ?= $(TOOL_GXX3OMF_PREFIX2)emximp$(TOOL_GXX3OMF_SUFFIX2)
+TOOL_GXX3OMF_LD ?= $(TOOL_GXX3OMF_PREFIX)g++$(TOOL_GXX3OMF_SUFFIX)
+TOOL_GXX3OMF_LD_SYSMOD ?= $(TOOL_GXX3OMF_PREFIX)g++$(TOOL_GXX3OMF_SUFFIX)
+ifndef TOOL_GXX3OMF_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GXX3OMF_LDFLAGS.dll ?= -shared -Zdll
+else
+ TOOL_GXX3OMF_LDFLAGS.dll ?= $(TOOL_GXX3OMF_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GXX3OMF_LDFLAGS.sysmod ?= -nostdlib
+TOOL_GXX3OMF_LD_MAP ?= -Zmap=$(1)
+TOOL_GXX3OMF_LD_SYSMOD_MAP ?= -Zmap=$(1)
+
+TOOL_GXX3OMF_RC = $(TOOL_GXX3OMF_PREFIX3)rc$(TOOL_GXX3OMF_SUFFIX3)
+
+# General Properties used by kBuild
+TOOL_GXX3OMF_COBJSUFF ?= .o
+TOOL_GXX3OMF_CFLAGS ?= -Zomf
+TOOL_GXX3OMF_CFLAGS.debug ?= -g
+TOOL_GXX3OMF_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX3OMF_CFLAGS.release ?= -O2
+TOOL_GXX3OMF_CINCS ?=
+TOOL_GXX3OMF_CDEFS ?=
+
+TOOL_GXX3OMF_CXXOBJSUFF ?= .o
+TOOL_GXX3OMF_CXXFLAGS ?= -Zomf
+TOOL_GXX3OMF_CXXFLAGS.debug ?= -g
+TOOL_GXX3OMF_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX3OMF_CXXFLAGS.release ?= -O2
+TOOL_GXX3OMF_CXXINCS ?=
+TOOL_GXX3OMF_CXXDEFS ?=
+
+TOOL_GXX3OMF_PCHOBJSUFF ?= .h.gch
+TOOL_GXX3OMF_PCHFLAGS ?= $(TOOL_GXX3OMF_CXXFLAGS)
+TOOL_GXX3OMF_PCHFLAGS.debug ?= $(TOOL_GXX3OMF_CXXFLAGS.debug)
+TOOL_GXX3OMF_PCHFLAGS.profile ?= $(TOOL_GXX3OMF_CXXFLAGS.profile)
+TOOL_GXX3OMF_PCHFLAGS.release ?= $(TOOL_GXX3OMF_CXXFLAGS.release)
+TOOL_GXX3OMF_PCHINCS ?= $(TOOL_GXX3OMF_CXXINCS)
+TOOL_GXX3OMF_PCHDEFS ?= $(TOOL_GXX3OMF_CXXDEFS)
+
+TOOL_GXX3OMF_ASFLAGS ?= -x assembler-with-cpp -Zomf
+TOOL_GXX3OMF_ASFLAGS.debug ?= -g
+TOOL_GXX3OMF_ASFLAGS.profile ?= -g
+TOOL_GXX3OMF_ASOBJSUFF ?= .obj
+
+TOOL_GXX3OMF_RCOBJSUFF ?= .res
+TOOL_GXX3OMF_RCFLAGS ?= -n
+TOOL_GXX3OMF_RCINCS ?= $(shell $(TOOL_GXX3OMF_CXX) -E -x c++ - 2>&1 < /dev/null \
+ | $(SED_EXT) -e "/search starts here/,/[Ee]nd of search list/!d" -e "/^ /!d")
+
+TOOL_GXX3OMF_ARFLAGS ?= cr
+TOOL_GXX3OMF_ARLIBSUFF ?= .lib
+
+TOOL_GXX3OMF_LDFLAGS ?= -Zomf
+TOOL_GXX3OMF_LDFLAGS.debug ?= -g
+TOOL_GXX3OMF_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3OMF_COMPILE_C_DEPEND =
+TOOL_GXX3OMF_COMPILE_C_DEPORD =
+TOOL_GXX3OMF_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX3OMF_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX3OMF_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX3OMF_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX3OMF_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX3OMF_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3OMF_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX3OMF_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX3OMF_COMPILE_CXX_DEPORD =
+TOOL_GXX3OMF_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX3OMF_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX3OMF_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX3OMF_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX3OMF_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3OMF_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX3OMF_COMPILE_PCH_DEPEND =
+TOOL_GXX3OMF_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX3OMF_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX3OMF_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX3OMF_COMPILE_AS_OUTPUT =
+TOOL_GXX3OMF_COMPILE_AS_DEPEND =
+TOOL_GXX3OMF_COMPILE_AS_DEPORD =
+define TOOL_GXX3OMF_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX3OMF_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3OMF_COMPILE_RC_OUTPUT =
+TOOL_GXX3OMF_COMPILE_RC_DEPEND =
+TOOL_GXX3OMF_COMPILE_RC_DEPORD =
+define TOOL_GXX3OMF_COMPILE_RC_CMDS
+ $(QUIET)$(REDIRECT) -E 'INCLUDE=' -- $(TOOL_GXX3OMF_RC) -r \
+ $(flags) $(addprefix -i, $(subst /,\\,$(subst /@unixroot,$(UNIXROOT),$(incs)))) $(addprefix -d, $(defs))\
+ $(subst /,\\,$(abspath $(source))) \
+ $(obj)
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3OMF_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_GXX3OMF_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX3OMF_LINK_LIBRARY_DEPORD =
+define TOOL_GXX3OMF_LINK_LIBRARY_CMDS
+ $(if $(filter %.def %.imp %.dll,$(othersrc))\
+ ,$(QUIET)$(APPEND) -n $(outbase).rsp $(filter %.def %.imp %.dll,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(QUIET)$(TOOL_GXX3OMF_AR_IMP) -o $(out) @$(outbase).rsp\
+ $(NL)$(TAB)$(QUIET)$(RM) -f $(outbase).rsp)
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(flags) $(out) $(filter-out %.h.gch,$(objs)) $(filter-out %.def %.imp %.dll,$(othersrc))
+ $(QUIET)$(TOOL_GXX3OMF_AR) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3OMF_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_GXX3OMF_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_GXX3OMF_LINK_PROGRAM_DEPORD =
+define TOOL_GXX3OMF_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp\
+ $(flags)\
+ -o $(out)\
+ $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(othersrc)\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ -Zmap=$(outbase).map
+ $(QUIET)$(TOOL_GXX3OMF_LD) @$(outbase).rsp
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3OMF_LINK_DLL_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_GXX3OMF_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_GXX3OMF_LINK_DLL_DEPORD =
+define TOOL_GXX3OMF_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp\
+ $(TOOL_GXX3OMF_LDFLAGS.dll)\
+ $(flags)\
+ -o $(out)\
+ $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(othersrc)\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ -Zmap=$(outbase).map
+ $(QUIET)$(TOOL_GXX3OMF_LD) @$(outbase).rsp
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3OMF_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_GXX3OMF_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_GXX3OMF_LINK_SYSMOD_DEPORD =
+define TOOL_GXX3OMF_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp\
+ $(TOOL_GXX3OMF_LDFLAGS.sysmod)\
+ $(flags)\
+ -o $(out)\
+ $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(othersrc)\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ -Zmap=$(outbase).map
+ $(QUIET)$(TOOL_GXX3OMF_LD_SYSMOD) @$(outbase).rsp
+endef
+
diff --git a/kBuild/tools/GXX3PLAIN.kmk b/kBuild/tools/GXX3PLAIN.kmk
new file mode 100644
index 0000000..e337635
--- /dev/null
+++ b/kBuild/tools/GXX3PLAIN.kmk
@@ -0,0 +1,352 @@
+# $Id: GXX3PLAIN.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic GCC v3.2.x or later using the system GCC, any Unix linker and Unix archiver to build C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX3PLAIN := Generic GCC v3.2.x or later using the system GCC, any Unix linker and Unix archiver to build C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_GXX3PLAIN_PREFIX
+ TOOL_GXX3PLAIN_PREFIX :=
+endif
+ifndef TOOL_GXX3PLAIN_SUFFIX
+ TOOL_GXX3PLAIN_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GXX3PLAIN_PREFIX2 ?=
+TOOL_GXX3PLAIN_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_CC ?= $(TOOL_GXX3PLAIN_PREFIX)gcc$(TOOL_GXX3PLAIN_SUFFIX)
+TOOL_GXX3PLAIN_CXX ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
+TOOL_GXX3PLAIN_PCH ?= $(TOOL_GXX3PLAIN_CXX)
+TOOL_GXX3PLAIN_AS ?= $(TOOL_GXX3PLAIN_PREFIX)gcc$(TOOL_GXX3PLAIN_SUFFIX)
+TOOL_GXX3PLAIN_AR ?= $(TOOL_GXX3PLAIN_PREFIX2)ar$(TOOL_GXX3PLAIN_SUFFIX2)
+TOOL_GXX3PLAIN_RANLIB ?= $(TOOL_GXX3PLAIN_PREFIX2)ranlib$(TOOL_GXX3PLAIN_SUFFIX2)
+TOOL_GXX3PLAIN_LD ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
+TOOL_GXX3PLAIN_LD_SYSMOD ?= $(TOOL_GXX3PLAIN_PREFIX2)ld$(TOOL_GXX3PLAIN_SUFFIX2)
+TOOL_GXX3PLAIN_LD_SYSMOD.os2 ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
+TOOL_GXX3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
+TOOL_GXX3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
+ifndef TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GXX3PLAIN_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX3PLAIN_LDFLAGS.dll ?= $(TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GXX3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
+TOOL_GXX3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
+TOOL_GXX3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_GXX3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
+ifndef TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET)
+ TOOL_GXX3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+else
+ TOOL_GXX3PLAIN_LD_SONAME ?= $(TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET))
+endif
+
+# General Properties used by kBuild
+TOOL_GXX3PLAIN_COBJSUFF ?= .o
+TOOL_GXX3PLAIN_CFLAGS ?=
+TOOL_GXX3PLAIN_CFLAGS.debug ?= -g
+TOOL_GXX3PLAIN_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX3PLAIN_CFLAGS.release ?= -O2
+TOOL_GXX3PLAIN_CINCS ?=
+TOOL_GXX3PLAIN_CDEFS ?=
+
+TOOL_GXX3PLAIN_CXXOBJSUFF ?= .o
+TOOL_GXX3PLAIN_CXXFLAGS ?=
+TOOL_GXX3PLAIN_CXXFLAGS.debug ?= -g
+TOOL_GXX3PLAIN_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX3PLAIN_CXXFLAGS.release ?= -O2
+TOOL_GXX3PLAIN_CXXINCS ?=
+TOOL_GXX3PLAIN_CXXDEFS ?=
+
+TOOL_GXX3PLAIN_PCHOBJSUFF ?= .h.gch
+TOOL_GXX3PLAIN_PCHFLAGS ?= $(TOOL_GXX3PLAIN_CXXFLAGS)
+TOOL_GXX3PLAIN_PCHFLAGS.debug ?= $(TOOL_GXX3PLAIN_CXXFLAGS.debug)
+TOOL_GXX3PLAIN_PCHFLAGS.profile ?= $(TOOL_GXX3PLAIN_CXXFLAGS.profile)
+TOOL_GXX3PLAIN_PCHFLAGS.release ?= $(TOOL_GXX3PLAIN_CXXFLAGS.release)
+TOOL_GXX3PLAIN_PCHINCS ?= $(TOOL_GXX3PLAIN_CXXINCS)
+TOOL_GXX3PLAIN_PCHDEFS ?= $(TOOL_GXX3PLAIN_CXXDEFS)
+
+TOOL_GXX3PLAIN_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX3PLAIN_ASFLAGS.debug ?= -g
+TOOL_GXX3PLAIN_ASFLAGS.profile ?= -g
+TOOL_GXX3PLAIN_ASOBJSUFF ?= .o
+
+TOOL_GXX3PLAIN_ARFLAGS ?= cr
+TOOL_GXX3PLAIN_ARLIBSUFF ?= .a
+
+TOOL_GXX3PLAIN_LDFLAGS ?=
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3PLAIN_COMPILE_C_DEPEND =
+TOOL_GXX3PLAIN_COMPILE_C_DEPORD =
+TOOL_GXX3PLAIN_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX3PLAIN_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX3PLAIN_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX3PLAIN_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX3PLAIN_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX3PLAIN_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3PLAIN_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX3PLAIN_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX3PLAIN_COMPILE_CXX_DEPORD =
+TOOL_GXX3PLAIN_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX3PLAIN_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX3PLAIN_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX3PLAIN_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX3PLAIN_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX3PLAIN_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX3PLAIN_COMPILE_PCH_DEPEND =
+TOOL_GXX3PLAIN_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX3PLAIN_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX3PLAIN_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX3PLAIN_COMPILE_AS_OUTPUT =
+TOOL_GXX3PLAIN_COMPILE_AS_DEPEND =
+TOOL_GXX3PLAIN_COMPILE_AS_DEPORD =
+define TOOL_GXX3PLAIN_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX3PLAIN_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3PLAIN_LINK_LIBRARY_OUTPUT =
+TOOL_GXX3PLAIN_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX3PLAIN_LINK_LIBRARY_DEPORD =
+define TOOL_GXX3PLAIN_LINK_LIBRARY_CMDS
+ $(call xargs,$(QUIET)$(TOOL_GXX3PLAIN_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs)))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GXX3PLAIN_AR) x $(abspath $(lib)) \
+ && $(TOOL_GXX3PLAIN_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+ $(QUIET)$(TOOL_GXX3PLAIN_RANLIB) $(out)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3PLAIN_LINK_PROGRAM_OUTPUT =
+TOOL_GXX3PLAIN_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX3PLAIN_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX3PLAIN_LINK_PROGRAM_DEPORD =
+define TOOL_GXX3PLAIN_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GXX3PLAIN_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3PLAIN_LINK_DLL_OUTPUT =
+TOOL_GXX3PLAIN_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX3PLAIN_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX3PLAIN_LINK_DLL_DEPORD =
+define TOOL_GXX3PLAIN_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GXX3PLAIN_LD) $(TOOL_GXX3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GXX3PLAIN_LD_SONAME,$(target),$(out)))\
+ $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# This tool target might not work everywhere, but is provided for the
+# platforms where it works (Solaris, etc).
+#
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX3PLAIN_LINK_SYSMOD_OUTPUT =
+TOOL_GXX3PLAIN_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX3PLAIN_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
+TOOL_GXX3PLAIN_LINK_SYSMOD_DEPORD =
+define TOOL_GXX3PLAIN_LINK_SYSMOD_CMDS
+ $(QUIET)$(if $(TOOL_GXX3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GXX3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GXX3PLAIN_LD_SYSMOD))\
+ $(TOOL_GXX3PLAIN_LDFLAGS_SYSMOD.$(bld_trg)) $(flags) -o $(out) \
+ $(filter-out %.h.gch,$(objs))\
+ $(filter %.def, $(othersrc))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+endef
+
diff --git a/kBuild/tools/GXX42MACHO.kmk b/kBuild/tools/GXX42MACHO.kmk
new file mode 100644
index 0000000..e1b0741
--- /dev/null
+++ b/kBuild/tools/GXX42MACHO.kmk
@@ -0,0 +1,489 @@
+# $Id: GXX42MACHO.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX42MACHO := GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_GXX42MACHO_PREFIX
+ TOOL_GXX42MACHO_PREFIX :=
+endif
+ifndef TOOL_GXX42MACHO_SUFFIX
+ TOOL_GXX42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
+endif
+TOOL_GXX42MACHO_PREFIX2 ?=
+TOOL_GXX42MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX42MACHO_CC ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_CXX ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_PCH ?= $(TOOL_GXX42MACHO_CXX)
+TOOL_GXX42MACHO_OBJC ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_OBJCXX ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_AS ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_LD ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_LD_SYSMOD ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX)
+TOOL_GXX42MACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_GXX42MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_GXX42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+TOOL_GXX42MACHO_AR ?= $(TOOL_GXX42MACHO_PREFIX2)ar$(TOOL_GXX42MACHO_SUFFIX2)
+TOOL_GXX42MACHO_DSYMUTIL ?= $(TOOL_GXX42MACHO_PREFIX2)dsymutil$(TOOL_GXX42MACHO_SUFFIX2)
+TOOL_GXX42MACHO_STRIP ?= $(TOOL_GXX42MACHO_PREFIX2)strip$(TOOL_GXX42MACHO_SUFFIX2)
+TOOL_GXX42MACHO_STRIP_PROGRAM ?= $(TOOL_GXX42MACHO_STRIP) -SXxru
+TOOL_GXX42MACHO_STRIP_DLL ?= $(TOOL_GXX42MACHO_STRIP) -Sxru
+TOOL_GXX42MACHO_STRIP_SYSMOD ?= $(TOOL_GXX42MACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_GXX42MACHO_COBJSUFF ?= .o
+TOOL_GXX42MACHO_CFLAGS ?=
+TOOL_GXX42MACHO_CFLAGS.debug ?= -g
+TOOL_GXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX42MACHO_CFLAGS.release ?= -O2
+TOOL_GXX42MACHO_CINCS ?=
+TOOL_GXX42MACHO_CDEFS ?=
+
+TOOL_GXX42MACHO_CXXOBJSUFF ?= .o
+TOOL_GXX42MACHO_CXXFLAGS ?=
+TOOL_GXX42MACHO_CXXFLAGS.debug ?= -g
+TOOL_GXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX42MACHO_CXXFLAGS.release ?= -O2
+TOOL_GXX42MACHO_CXXINCS ?=
+TOOL_GXX42MACHO_CXXDEFS ?=
+
+TOOL_GXX42MACHO_PCHOBJSUFF ?= .h.gch
+TOOL_GXX42MACHO_PCHFLAGS ?= $(TOOL_GXX42MACHO_CXXFLAGS)
+TOOL_GXX42MACHO_PCHFLAGS.debug ?= $(TOOL_GXX42MACHO_CXXFLAGS.debug)
+TOOL_GXX42MACHO_PCHFLAGS.profile ?= $(TOOL_GXX42MACHO_CXXFLAGS.profile)
+TOOL_GXX42MACHO_PCHFLAGS.release ?= $(TOOL_GXX42MACHO_CXXFLAGS.release)
+TOOL_GXX42MACHO_PCHINCS ?= $(TOOL_GXX42MACHO_CXXINCS)
+TOOL_GXX42MACHO_PCHDEFS ?= $(TOOL_GXX42MACHO_CXXDEFS)
+
+TOOL_GXX42MACHO_OBJCOBJSUFF ?= .o
+TOOL_GXX42MACHO_OBJCFLAGS ?=
+TOOL_GXX42MACHO_OBJCFLAGS.debug ?= -g
+TOOL_GXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_GXX42MACHO_OBJCFLAGS.release?= -O2
+TOOL_GXX42MACHO_OBJCINCS ?=
+TOOL_GXX42MACHO_OBJCDEFS ?=
+
+TOOL_GXX42MACHO_OBJCXXOBJSUFF ?= .o
+TOOL_GXX42MACHO_OBJCXXFLAGS ?=
+TOOL_GXX42MACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_GXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX42MACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_GXX42MACHO_OBJCXXINCS ?=
+TOOL_GXX42MACHO_OBJCXXDEFS ?=
+
+TOOL_GXX42MACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX42MACHO_ASFLAGS.debug ?= -g
+TOOL_GXX42MACHO_ASFLAGS.profile ?= -g
+TOOL_GXX42MACHO_ASOBJSUFF ?= .o
+
+TOOL_GXX42MACHO_ARFLAGS ?= -c -rs
+TOOL_GXX42MACHO_ARLIBSUFF ?= .a
+
+TOOL_GXX42MACHO_LDFLAGS ?=
+TOOL_GXX42MACHO_LDFLAGS.debug ?= -g
+TOOL_GXX42MACHO_LDFLAGS.profile ?= -g
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_GXX42MACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/ \
+ $(1).dSYM/Contents/ \
+ $(1).dSYM/Contents/Resources/ \
+ $(1).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_GXX42MACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX42MACHO_COMPILE_C_DEPEND =
+TOOL_GXX42MACHO_COMPILE_C_DEPORD =
+TOOL_GXX42MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX42MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX42MACHO_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX42MACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX42MACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX42MACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX42MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX42MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX42MACHO_COMPILE_CXX_DEPORD =
+TOOL_GXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX42MACHO_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX42MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX42MACHO_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX42MACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX42MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX42MACHO_COMPILE_PCH_DEPEND =
+TOOL_GXX42MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX42MACHO_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX42MACHO_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX42MACHO_COMPILE_OBJC_DEPEND =
+TOOL_GXX42MACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_GXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_GXX42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX42MACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX42MACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x objective-c \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GXX42MACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_GXX42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_GXX42MACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX42MACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_GXX42MACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_GXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_GXX42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_GXX42MACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX42MACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++ \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GXX42MACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_GXX42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_GXX42MACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX42MACHO_COMPILE_AS_OUTPUT =
+TOOL_GXX42MACHO_COMPILE_AS_DEPEND =
+TOOL_GXX42MACHO_COMPILE_AS_DEPORD =
+define TOOL_GXX42MACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX42MACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX42MACHO_LINK_LIBRARY_OUTPUT =
+TOOL_GXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX42MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_GXX42MACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_GXX42MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GXX42MACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_GXX42MACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
+TOOL_GXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN)
+TOOL_GXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX42MACHO_LINK_PROGRAM_DEPORD =
+define TOOL_GXX42MACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_GXX42MACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GXX42MACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+TOOL_GXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN)
+TOOL_GXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX42MACHO_LINK_DLL_DEPORD =
+define TOOL_GXX42MACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_GXX42MACHO_LD) $(TOOL_GXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_GXX42MACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GXX42MACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+TOOL_GXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN)
+TOOL_GXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX42MACHO_LINK_SYSMOD_DEPORD =
+define TOOL_GXX42MACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_GXX42MACHO_LD_SYSMOD) $(TOOL_GXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GXX42MACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GXX4MACHO.kmk b/kBuild/tools/GXX4MACHO.kmk
new file mode 100644
index 0000000..020d934
--- /dev/null
+++ b/kBuild/tools/GXX4MACHO.kmk
@@ -0,0 +1,445 @@
+# $Id: GXX4MACHO.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_GXX4MACHO_PREFIX
+ TOOL_GXX4MACHO_PREFIX :=
+endif
+ifndef TOOL_GXX4MACHO_SUFFIX
+ TOOL_GXX4MACHO_SUFFIX := $(HOSTSUFF_EXE)
+endif
+TOOL_GXX4MACHO_PREFIX2 ?=
+TOOL_GXX4MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX4MACHO_CC ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_CXX ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_PCH ?= $(TOOL_GXX4MACHO_CXX)
+TOOL_GXX4MACHO_OBJC ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_OBJCXX ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_AS ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_LD ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_LD_SYSMOD ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
+TOOL_GXX4MACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_GXX4MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_GXX4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+TOOL_GXX4MACHO_AR ?= $(TOOL_GXX4MACHO_PREFIX2)ar$(TOOL_GXX4MACHO_SUFFIX2)
+TOOL_GXX4MACHO_DSYMUTIL ?= $(TOOL_GXX4MACHO_PREFIX2)dsymutil$(TOOL_GXX4MACHO_SUFFIX2)
+TOOL_GXX4MACHO_STRIP ?= $(TOOL_GXX4MACHO_PREFIX2)strip$(TOOL_GXX4MACHO_SUFFIX2)
+TOOL_GXX4MACHO_STRIP_PROGRAM ?= $(TOOL_GXX4MACHO_STRIP) -SXxru
+TOOL_GXX4MACHO_STRIP_DLL ?= $(TOOL_GXX4MACHO_STRIP) -Sxru
+TOOL_GXX4MACHO_STRIP_SYSMOD ?= $(TOOL_GXX4MACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_GXX4MACHO_COBJSUFF ?= .o
+TOOL_GXX4MACHO_CFLAGS ?=
+TOOL_GXX4MACHO_CFLAGS.debug ?= -g
+TOOL_GXX4MACHO_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX4MACHO_CFLAGS.release ?= -O2
+TOOL_GXX4MACHO_CINCS ?=
+TOOL_GXX4MACHO_CDEFS ?=
+
+TOOL_GXX4MACHO_CXXOBJSUFF ?= .o
+TOOL_GXX4MACHO_CXXFLAGS ?=
+TOOL_GXX4MACHO_CXXFLAGS.debug ?= -g
+TOOL_GXX4MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX4MACHO_CXXFLAGS.release ?= -O2
+TOOL_GXX4MACHO_CXXINCS ?=
+TOOL_GXX4MACHO_CXXDEFS ?=
+
+TOOL_GXX4MACHO_PCHOBJSUFF ?= .h.gch
+TOOL_GXX4MACHO_PCHFLAGS ?= $(TOOL_GXX4MACHO_CXXFLAGS)
+TOOL_GXX4MACHO_PCHFLAGS.debug ?= $(TOOL_GXX4MACHO_CXXFLAGS.debug)
+TOOL_GXX4MACHO_PCHFLAGS.profile ?= $(TOOL_GXX4MACHO_CXXFLAGS.profile)
+TOOL_GXX4MACHO_PCHFLAGS.release ?= $(TOOL_GXX4MACHO_CXXFLAGS.release)
+TOOL_GXX4MACHO_PCHINCS ?= $(TOOL_GXX4MACHO_CXXINCS)
+TOOL_GXX4MACHO_PCHDEFS ?= $(TOOL_GXX4MACHO_CXXDEFS)
+
+TOOL_GXX4MACHO_OBJCOBJSUFF ?= .o
+TOOL_GXX4MACHO_OBJCFLAGS ?=
+TOOL_GXX4MACHO_OBJCFLAGS.debug ?= -g
+TOOL_GXX4MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_GXX4MACHO_OBJCFLAGS.release?= -O2
+TOOL_GXX4MACHO_OBJCINCS ?=
+TOOL_GXX4MACHO_OBJCDEFS ?=
+
+TOOL_GXX4MACHO_OBJCXXOBJSUFF ?= .o
+TOOL_GXX4MACHO_OBJCXXFLAGS ?=
+TOOL_GXX4MACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_GXX4MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX4MACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_GXX4MACHO_OBJCXXINCS ?=
+TOOL_GXX4MACHO_OBJCXXDEFS ?=
+
+TOOL_GXX4MACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX4MACHO_ASFLAGS.debug ?= -g
+TOOL_GXX4MACHO_ASFLAGS.profile ?= -g
+TOOL_GXX4MACHO_ASOBJSUFF ?= .o
+
+TOOL_GXX4MACHO_ARFLAGS ?= -c -rs
+TOOL_GXX4MACHO_ARLIBSUFF ?= .a
+
+TOOL_GXX4MACHO_LDFLAGS ?=
+TOOL_GXX4MACHO_LDFLAGS.debug ?= -g
+TOOL_GXX4MACHO_LDFLAGS.profile ?= -g
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_GXX4MACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/ \
+ $(1).dSYM/Contents/ \
+ $(1).dSYM/Contents/Resources/ \
+ $(1).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_GXX4MACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX4MACHO_COMPILE_C_DEPEND =
+TOOL_GXX4MACHO_COMPILE_C_DEPORD =
+TOOL_GXX4MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX4MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX4MACHO_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX4MACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX4MACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX4MACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX4MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX4MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX4MACHO_COMPILE_CXX_DEPORD =
+TOOL_GXX4MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX4MACHO_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX4MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX4MACHO_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX4MACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX4MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX4MACHO_COMPILE_PCH_DEPEND =
+TOOL_GXX4MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX4MACHO_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX4MACHO_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX4MACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_GXX4MACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_GXX4MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_GXX4MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_GXX4MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_GXX4MACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX4MACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++ \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_GXX4MACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_GXX4MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_GXX4MACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX4MACHO_COMPILE_AS_OUTPUT =
+TOOL_GXX4MACHO_COMPILE_AS_DEPEND =
+TOOL_GXX4MACHO_COMPILE_AS_DEPORD =
+define TOOL_GXX4MACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX4MACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX4MACHO_LINK_LIBRARY_OUTPUT =
+TOOL_GXX4MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX4MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_GXX4MACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_GXX4MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_GXX4MACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_GXX4MACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
+TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GXX4MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
+TOOL_GXX4MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX4MACHO_LINK_PROGRAM_DEPORD =
+define TOOL_GXX4MACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_GXX4MACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GXX4MACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+TOOL_GXX4MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GXX4MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
+TOOL_GXX4MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX4MACHO_LINK_DLL_DEPORD =
+define TOOL_GXX4MACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_GXX4MACHO_LD) $(TOOL_GXX4MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_GXX4MACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GXX4MACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_GXX4MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
+TOOL_GXX4MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX4MACHO_LINK_SYSMOD_DEPORD =
+define TOOL_GXX4MACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_GXX4MACHO_LD_SYSMOD) $(TOOL_GXX4MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_GXX4MACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/GXX64.kmk b/kBuild/tools/GXX64.kmk
new file mode 100644
index 0000000..62ef31a
--- /dev/null
+++ b/kBuild/tools/GXX64.kmk
@@ -0,0 +1,374 @@
+# $Id: GXX64.kmk 3567 2022-06-26 20:00:02Z bird $
+## @file
+# kBuild Tool Config - Generic 64-bit GCC v3.2.x or later using the system GCC, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_GXX64 := Generic 64-bit GCC v3.2.x or later using the system GCC, for building C++ code. \
+ More or less Linux/ELF specfic.
+
+# Tool Specific Properties
+ifndef TOOL_GXX64_PREFIX
+ TOOL_GXX64_PREFIX :=
+endif
+ifndef TOOL_GXX64_SUFFIX
+ TOOL_GXX64_SUFFIX := $(HOSTSUFF_EXE)
+endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX64_PREFIX2 ?= g
+else
+ TOOL_GXX64_PREFIX2 ?=
+endif
+TOOL_GXX64_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_GXX64_PREFIX3 ?=
+TOOL_GXX64_SUFFIX3 ?= $(HOSTSUFF_EXE)
+TOOL_GXX64_CC ?= $(TOOL_GXX64_PREFIX)gcc$(TOOL_GXX64_SUFFIX) -m64
+TOOL_GXX64_CXX ?= $(TOOL_GXX64_PREFIX)g++$(TOOL_GXX64_SUFFIX) -m64
+TOOL_GXX64_PCH ?= $(TOOL_GXX64_CXX)
+TOOL_GXX64_AS ?= $(TOOL_GXX64_PREFIX)gcc$(TOOL_GXX64_SUFFIX) -m64
+TOOL_GXX64_AR ?= $(TOOL_GXX64_PREFIX2)ar$(TOOL_GXX64_SUFFIX2)
+TOOL_GXX64_LD ?= $(TOOL_GXX64_PREFIX)g++$(TOOL_GXX64_SUFFIX) -m64
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX64_LD_SYSMOD ?= $(TOOL_GXX64_PREFIX3)ld$(TOOL_GXX64_SUFFIX3)
+else
+ TOOL_GXX64_LD_SYSMOD ?= $(TOOL_GXX64_PREFIX2)ld$(TOOL_GXX64_SUFFIX2)
+endif
+ifndef TOOL_GXX64_LDFLAGS.$(KBUILD_TARGET)
+ TOOL_GXX64_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX64_LDFLAGS.dll ?= $(TOOL_GXX64_LDFLAGS.$(KBUILD_TARGET))
+endif
+TOOL_GXX64_LDFLAGS.sysmod ?= -r -m elf_x86_64$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
+TOOL_GXX64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GXX64_LD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GXX64_LD_MAP ?=
+endif
+ifeq ($(KBUILD_TARGET),os2)
+ TOOL_GXX64_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+ TOOL_GXX64_LD_SYSMOD_MAP ?=
+endif
+TOOL_GXX64_OBJCOPY ?= $(TOOL_GXX64_PREFIX2)objcopy$(TOOL_GXX64_SUFFIX2)
+
+# General Properties used by kBuild
+TOOL_GXX64_COBJSUFF ?= .o
+TOOL_GXX64_CFLAGS ?=
+TOOL_GXX64_CFLAGS.debug ?= -g
+TOOL_GXX64_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX64_CFLAGS.release ?= -O2
+TOOL_GXX64_CINCS ?=
+TOOL_GXX64_CDEFS ?=
+
+TOOL_GXX64_CXXOBJSUFF ?= .o
+TOOL_GXX64_CXXFLAGS ?=
+TOOL_GXX64_CXXFLAGS.debug ?= -g
+TOOL_GXX64_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_GXX64_CXXFLAGS.release ?= -O2
+TOOL_GXX64_CXXINCS ?=
+TOOL_GXX64_CXXDEFS ?=
+
+TOOL_GXX64_PCHOBJSUFF ?= .h.gch
+TOOL_GXX64_PCHFLAGS ?= $(TOOL_GXX64_CXXFLAGS)
+TOOL_GXX64_PCHFLAGS.debug ?= $(TOOL_GXX64_CXXFLAGS.debug)
+TOOL_GXX64_PCHFLAGS.profile ?= $(TOOL_GXX64_CXXFLAGS.profile)
+TOOL_GXX64_PCHFLAGS.release ?= $(TOOL_GXX64_CXXFLAGS.release)
+TOOL_GXX64_PCHINCS ?= $(TOOL_GXX64_CXXINCS)
+TOOL_GXX64_PCHDEFS ?= $(TOOL_GXX64_CXXDEFS)
+
+TOOL_GXX64_ASFLAGS ?= -x assembler-with-cpp
+TOOL_GXX64_ASFLAGS.debug ?= -g
+TOOL_GXX64_ASFLAGS.profile ?= -g
+TOOL_GXX64_ASOBJSUFF ?= .o
+
+TOOL_GXX64_ARFLAGS ?= cr
+TOOL_GXX64_ARLIBSUFF ?= .a
+
+TOOL_GXX64_LDFLAGS ?=
+TOOL_GXX64_LDFLAGS.debug ?= -g
+TOOL_GXX64_LDFLAGS.profile ?= -g
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX64_COMPILE_C_DEPEND =
+TOOL_GXX64_COMPILE_C_DEPORD =
+TOOL_GXX64_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_GXX64_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX64_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_GXX64_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX64_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX64_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_GXX64_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX64_COMPILE_CXX_DEPORD =
+TOOL_GXX64_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_GXX64_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_GXX64_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_GXX64_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_GXX64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_GXX64_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_GXX64_COMPILE_PCH_DEPEND =
+TOOL_GXX64_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_GXX64_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_GXX64_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_GXX64_COMPILE_AS_OUTPUT =
+TOOL_GXX64_COMPILE_AS_DEPEND =
+TOOL_GXX64_COMPILE_AS_DEPORD =
+define TOOL_GXX64_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_GXX64_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX64_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_GXX64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX64_LINK_LIBRARY_DEPORD =
+define TOOL_GXX64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(filter-out %.h.gch,$(objs)), 'ADDMOD $(o)') \
+ $(foreach o,$(othersrc), 'ADDLIB $(o)')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GXX64_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX64_LINK_PROGRAM_OUTPUT =
+TOOL_GXX64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX64_LINK_PROGRAM_DEPORD =
+define TOOL_GXX64_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_GXX64_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX64_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX64_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX64_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX64_LINK_DLL_OUTPUT =
+TOOL_GXX64_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX64_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX64_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX64_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX64_LINK_DLL_DEPORD =
+define TOOL_GXX64_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_GXX64_LD) $(TOOL_GXX64_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX64_LD_SONAME,$(target),$(out)))\
+ $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX64_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX64_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX64_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_GXX64_LINK_SYSMOD_OUTPUT =
+TOOL_GXX64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
+TOOL_GXX64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX64_LINK_SYSMOD_DEPORD =
+define TOOL_GXX64_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_GXX64_LD_SYSMOD) $(TOOL_GXX64_LDFLAGS.sysmod) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
+ $(call TOOL_GXX64_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_GXX64_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(QUIET)$(CHMOD) a-x $(outbase).debug
+ $(QUIET)$(TOOL_GXX64_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/JWASM.kmk b/kBuild/tools/JWASM.kmk
new file mode 100644
index 0000000..39393eb
--- /dev/null
+++ b/kBuild/tools/JWASM.kmk
@@ -0,0 +1,63 @@
+# $Id: JWASM.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - JWasm
+#
+
+#
+# Copyright (c) 2012-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+TOOL_JWASM := JWasm - MASM clone based on the Open Watcom assembler.
+
+# Tool Specific Properties
+ifndef TOOL_JWASM_AS
+ TOOL_JWASM_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/jwasm/*/jwasm$(HOSTSUFF_EXE))))
+ ifeq ($(TOOL_JWASM_AS),)
+ TOOL_JWASM_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/jwasm/*/jwasm$(HOSTSUFF_EXE))))
+ endif
+endif
+ifeq ($(TOOL_JWASM_AS),)
+ TOOL_JWASM_AS := $(firstword $(which ml$(HOSTSUFF_EXE)) jwasm$(HOSTSUFF_EXE))
+endif
+
+# General Properties used by kBuild
+TOOL_JWASM_ASFLAGS ?= -X -nologo
+
+TOOL_JWASM_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_JWASM_COMPILE_AS_DEPEND =
+TOOL_JWASM_COMPILE_AS_DEPORD =
+define TOOL_JWASM_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_JWASM_AS) -c \
+ $(strip $(flags)) \
+ $(addprefix -D,$(defs)) \
+ $(addprefix -I,$(incs)) \
+ -Fo$(obj) \
+ -Fl$(outbase).lst \
+ $(source)
+endef
+
diff --git a/kBuild/tools/LLVMGCC42MACHO.kmk b/kBuild/tools/LLVMGCC42MACHO.kmk
new file mode 100644
index 0000000..a63b0a7
--- /dev/null
+++ b/kBuild/tools/LLVMGCC42MACHO.kmk
@@ -0,0 +1,461 @@
+# $Id: LLVMGCC42MACHO.kmk 3579 2023-01-05 01:53:41Z bird $
+## @file
+# kBuild Tool Config - LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_LLVMGCC42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O.
+
+# Tool Specific Properties
+ifndef TOOL_LLVMGCC42MACHO_PREFIX
+ TOOL_LLVMGCC42MACHO_PREFIX := llvm-
+endif
+ifndef TOOL_LLVMGCC42MACHO_SUFFIX
+ TOOL_LLVMGCC42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
+endif
+TOOL_LLVMGCC42MACHO_PREFIX2 ?=
+TOOL_LLVMGCC42MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_LLVMGCC42MACHO_CC ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_CXX ?= $(TOOL_LLVMGCC42MACHO_PREFIX)g++$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_OBJC ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_OBJCXX ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_AS ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_LD ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX)
+TOOL_LLVMGCC42MACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_LLVMGCC42MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_LLVMGCC42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+TOOL_LLVMGCC42MACHO_AR ?= $(TOOL_LLVMGCC42MACHO_PREFIX2)ar$(TOOL_LLVMGCC42MACHO_SUFFIX2)
+TOOL_LLVMGCC42MACHO_DSYMUTIL ?= $(TOOL_LLVMGCC42MACHO_PREFIX2)dsymutil$(TOOL_LLVMGCC42MACHO_SUFFIX2)
+TOOL_LLVMGCC42MACHO_STRIP ?= $(TOOL_LLVMGCC42MACHO_PREFIX2)strip$(TOOL_LLVMGCC42MACHO_SUFFIX2)
+TOOL_LLVMGCC42MACHO_STRIP_PROGRAM ?= $(TOOL_LLVMGCC42MACHO_STRIP) -SXxru
+TOOL_LLVMGCC42MACHO_STRIP_DLL ?= $(TOOL_LLVMGCC42MACHO_STRIP) -Sxru
+TOOL_LLVMGCC42MACHO_STRIP_SYSMOD ?= $(TOOL_LLVMGCC42MACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_LLVMGCC42MACHO_COBJSUFF ?= .o
+TOOL_LLVMGCC42MACHO_CFLAGS ?=
+TOOL_LLVMGCC42MACHO_CFLAGS.debug ?= -g
+TOOL_LLVMGCC42MACHO_CFLAGS.profile ?= -g -O2 #-pg
+TOOL_LLVMGCC42MACHO_CFLAGS.release ?= -O2
+TOOL_LLVMGCC42MACHO_CINCS ?=
+TOOL_LLVMGCC42MACHO_CDEFS ?=
+
+TOOL_LLVMGCC42MACHO_CXXOBJSUFF ?= .o
+TOOL_LLVMGCC42MACHO_CXXFLAGS ?=
+TOOL_LLVMGCC42MACHO_CXXFLAGS.debug ?= -g
+TOOL_LLVMGCC42MACHO_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_LLVMGCC42MACHO_CXXFLAGS.release ?= -O2
+TOOL_LLVMGCC42MACHO_CXXINCS ?=
+TOOL_LLVMGCC42MACHO_CXXDEFS ?=
+
+TOOL_LLVMGCC42MACHO_OBJCOBJSUFF ?= .o
+TOOL_LLVMGCC42MACHO_OBJCFLAGS ?=
+TOOL_LLVMGCC42MACHO_OBJCFLAGS.debug ?= -g
+TOOL_LLVMGCC42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_LLVMGCC42MACHO_OBJCFLAGS.release?= -O2
+TOOL_LLVMGCC42MACHO_OBJCINCS ?=
+TOOL_LLVMGCC42MACHO_OBJCDEFS ?=
+
+TOOL_LLVMGCC42MACHO_OBJCXXOBJSUFF ?= .o
+TOOL_LLVMGCC42MACHO_OBJCXXFLAGS ?=
+TOOL_LLVMGCC42MACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_LLVMGCC42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_LLVMGCC42MACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_LLVMGCC42MACHO_OBJCXXINCS ?=
+TOOL_LLVMGCC42MACHO_OBJCXXDEFS ?=
+
+TOOL_LLVMGCC42MACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_LLVMGCC42MACHO_ASFLAGS.debug ?= -g
+TOOL_LLVMGCC42MACHO_ASFLAGS.profile ?= -g
+TOOL_LLVMGCC42MACHO_ASOBJSUFF ?= .o
+
+TOOL_LLVMGCC42MACHO_ARFLAGS ?= -c -rs
+TOOL_LLVMGCC42MACHO_ARLIBSUFF ?= .a
+
+TOOL_LLVMGCC42MACHO_LDFLAGS ?=
+TOOL_LLVMGCC42MACHO_LDFLAGS.debug ?= -g
+TOOL_LLVMGCC42MACHO_LDFLAGS.profile ?= -g
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/ \
+ $(1).dSYM/Contents/ \
+ $(1).dSYM/Contents/Resources/ \
+ $(1).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGCC42MACHO_COMPILE_C_DEPEND =
+TOOL_LLVMGCC42MACHO_COMPILE_C_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_C_USES_KOBJCACHE = 1
+TOOL_LLVMGCC42MACHO_COMPILE_C_OUTPUT = $(outbase).i
+define TOOL_LLVMGCC42MACHO_COMPILE_C_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_LLVMGCC42MACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGCC42MACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_C_OUTPUT =
+define TOOL_LLVMGCC42MACHO_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KUSE_OBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGCC42MACHO_COMPILE_CXX_DEPEND =
+TOOL_LLVMGCC42MACHO_COMPILE_CXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1
+TOOL_LLVMGCC42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii
+define TOOL_LLVMGCC42MACHO_COMPILE_CXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_LLVMGCC42MACHO_CXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGCC42MACHO_CXX) -c\
+ $(flags) -fpreprocessed -x c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_CXX_OUTPUT =
+define TOOL_LLVMGCC42MACHO_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGCC42MACHO_COMPILE_OBJC_DEPEND =
+TOOL_LLVMGCC42MACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_LLVMGCC42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_LLVMGCC42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_LLVMGCC42MACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGCC42MACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x cbjective-c\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_LLVMGCC42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_LLVMGCC42MACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGCC42MACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++\
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_LLVMGCC42MACHO_COMPILE_AS_OUTPUT =
+TOOL_LLVMGCC42MACHO_COMPILE_AS_DEPEND =
+TOOL_LLVMGCC42MACHO_COMPILE_AS_DEPORD =
+define TOOL_LLVMGCC42MACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGCC42MACHO_LINK_LIBRARY_OUTPUT =
+TOOL_LLVMGCC42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_LLVMGCC42MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_LLVMGCC42MACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_LLVMGCC42MACHO_AR) $(flags) $(out),$(objs)))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_LLVMGCC42MACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_LLVMGCC42MACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGCC42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
+TOOL_LLVMGCC42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_LLVMGCC42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN)
+TOOL_LLVMGCC42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_LLVMGCC42MACHO_LINK_PROGRAM_DEPORD =
+define TOOL_LLVMGCC42MACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGCC42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+TOOL_LLVMGCC42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_LLVMGCC42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN)
+TOOL_LLVMGCC42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_LLVMGCC42MACHO_LINK_DLL_DEPORD =
+define TOOL_LLVMGCC42MACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_LD) $(TOOL_LLVMGCC42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_LLVMGCC42MACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGCC42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+TOOL_LLVMGCC42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_LLVMGCC42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN)
+TOOL_LLVMGCC42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_LLVMGCC42MACHO_LINK_SYSMOD_DEPORD =
+define TOOL_LLVMGCC42MACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_LD_SYSMOD) $(TOOL_LLVMGCC42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_LLVMGCC42MACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/LLVMGXX42MACHO.kmk b/kBuild/tools/LLVMGXX42MACHO.kmk
new file mode 100644
index 0000000..df7e286
--- /dev/null
+++ b/kBuild/tools/LLVMGXX42MACHO.kmk
@@ -0,0 +1,490 @@
+# $Id: LLVMGXX42MACHO.kmk 3580 2023-01-05 02:16:42Z bird $
+## @file
+# kBuild Tool Config - LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_LLVMGXX42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
+
+# Tool Specific Properties
+ifndef TOOL_LLVMGXX42MACHO_PREFIX
+ TOOL_LLVMGXX42MACHO_PREFIX := llvm-
+endif
+ifndef TOOL_LLVMGXX42MACHO_SUFFIX
+ TOOL_LLVMGXX42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
+endif
+TOOL_LLVMGXX42MACHO_PREFIX2 ?=
+TOOL_LLVMGXX42MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
+TOOL_LLVMGXX42MACHO_CC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_CXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_PCH ?= $(TOOL_LLVMGXX42MACHO_CXX)
+TOOL_LLVMGXX42MACHO_OBJC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_OBJCXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_AS ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_LD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
+TOOL_LLVMGXX42MACHO_LDFLAGS.dll ?= -dynamiclib
+TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_LLVMGXX42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+TOOL_LLVMGXX42MACHO_AR ?= $(TOOL_LLVMGXX42MACHO_PREFIX2)ar$(TOOL_LLVMGXX42MACHO_SUFFIX2)
+TOOL_LLVMGXX42MACHO_DSYMUTIL ?= $(TOOL_LLVMGXX42MACHO_PREFIX2)dsymutil$(TOOL_LLVMGXX42MACHO_SUFFIX2)
+TOOL_LLVMGXX42MACHO_STRIP ?= $(TOOL_LLVMGXX42MACHO_PREFIX2)strip$(TOOL_LLVMGXX42MACHO_SUFFIX2)
+TOOL_LLVMGXX42MACHO_STRIP_PROGRAM ?= $(TOOL_LLVMGXX42MACHO_STRIP) -SXxru
+TOOL_LLVMGXX42MACHO_STRIP_DLL ?= $(TOOL_LLVMGXX42MACHO_STRIP) -Sxru
+TOOL_LLVMGXX42MACHO_STRIP_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_STRIP) -Sru
+
+# General Properties used by kBuild
+TOOL_LLVMGXX42MACHO_COBJSUFF ?= .o
+TOOL_LLVMGXX42MACHO_CFLAGS ?=
+TOOL_LLVMGXX42MACHO_CFLAGS.debug ?= -g
+TOOL_LLVMGXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg
+TOOL_LLVMGXX42MACHO_CFLAGS.release ?= -O2
+TOOL_LLVMGXX42MACHO_CINCS ?=
+TOOL_LLVMGXX42MACHO_CDEFS ?=
+
+TOOL_LLVMGXX42MACHO_CXXOBJSUFF ?= .o
+TOOL_LLVMGXX42MACHO_CXXFLAGS ?=
+TOOL_LLVMGXX42MACHO_CXXFLAGS.debug ?= -g
+TOOL_LLVMGXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_LLVMGXX42MACHO_CXXFLAGS.release ?= -O2
+TOOL_LLVMGXX42MACHO_CXXINCS ?=
+TOOL_LLVMGXX42MACHO_CXXDEFS ?=
+
+TOOL_LLVMGXX42MACHO_PCHOBJSUFF ?= .h.gch
+TOOL_LLVMGXX42MACHO_PCHFLAGS ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS)
+TOOL_LLVMGXX42MACHO_PCHFLAGS.debug ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.debug)
+TOOL_LLVMGXX42MACHO_PCHFLAGS.profile ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.profile)
+TOOL_LLVMGXX42MACHO_PCHFLAGS.release ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.release)
+TOOL_LLVMGXX42MACHO_PCHINCS ?= $(TOOL_LLVMGXX42MACHO_CXXINCS)
+TOOL_LLVMGXX42MACHO_PCHDEFS ?= $(TOOL_LLVMGXX42MACHO_CXXDEFS)
+
+TOOL_LLVMGXX42MACHO_OBJCOBJSUFF ?= .o
+TOOL_LLVMGXX42MACHO_OBJCFLAGS ?=
+TOOL_LLVMGXX42MACHO_OBJCFLAGS.debug ?= -g
+TOOL_LLVMGXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
+TOOL_LLVMGXX42MACHO_OBJCFLAGS.release?= -O2
+TOOL_LLVMGXX42MACHO_OBJCINCS ?=
+TOOL_LLVMGXX42MACHO_OBJCDEFS ?=
+
+TOOL_LLVMGXX42MACHO_OBJCXXOBJSUFF ?= .o
+TOOL_LLVMGXX42MACHO_OBJCXXFLAGS ?=
+TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.debug ?= -g
+TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
+TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.release ?= -O2
+TOOL_LLVMGXX42MACHO_OBJCXXINCS ?=
+TOOL_LLVMGXX42MACHO_OBJCXXDEFS ?=
+
+TOOL_LLVMGXX42MACHO_ASFLAGS ?= -x assembler-with-cpp
+TOOL_LLVMGXX42MACHO_ASFLAGS.debug ?= -g
+TOOL_LLVMGXX42MACHO_ASFLAGS.profile ?= -g
+TOOL_LLVMGXX42MACHO_ASOBJSUFF ?= .o
+
+TOOL_LLVMGXX42MACHO_ARFLAGS ?= -c -rs
+TOOL_LLVMGXX42MACHO_ARLIBSUFF ?= .a
+
+TOOL_LLVMGXX42MACHO_LDFLAGS ?=
+TOOL_LLVMGXX42MACHO_LDFLAGS.debug ?= -g
+TOOL_LLVMGXX42MACHO_LDFLAGS.profile ?= -g
+
+
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole output filename.
+# @param 2 The output filename sans suffix.
+TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN = \
+ $(1).dSYM/ \
+ $(1).dSYM/Contents/ \
+ $(1).dSYM/Contents/Resources/ \
+ $(1).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
+
+##
+# Calculate the files in the debug bundle.
+# @param 1 The whole linker output filename.
+# @param 2 The linker output filename sans suffix.
+# @param 3 The desired install name (no dir slash).
+# @remarks The Info.plist has some reference to the original name, but gdb
+# does not care and only check for a symbol file in the DWARF
+# directory with the same name as the debugged module.
+TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN= \
+ $(3).dSYM/ \
+ $(3).dSYM/Contents/ \
+ $(3).dSYM/Contents/Resources/ \
+ $(3).dSYM/Contents/Resources/DWARF/ \
+ $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
+ $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGXX42MACHO_COMPILE_C_DEPEND =
+TOOL_LLVMGXX42MACHO_COMPILE_C_DEPORD =
+TOOL_LLVMGXX42MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
+TOOL_LLVMGXX42MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_LLVMGXX42MACHO_COMPILE_C_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).i\
+ $(TOOL_LLVMGXX42MACHO_CC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGXX42MACHO_CC) -c\
+ $(flags) -fpreprocessed -x c\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGXX42MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
+TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
+TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPORD =
+TOOL_LLVMGXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
+define TOOL_LLVMGXX42MACHO_COMPILE_CXX_CMDS
+if "$(use_objcache)" != ""
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_LLVMGXX42MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
+ ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGXX42MACHO_CXX) -c\
+ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
+ -o $(obj)\
+ -
+else
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
+ ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
+ $(abspath $(source))
+endif
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Precompile C++ header.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGXX42MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
+TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPEND =
+TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
+define TOOL_LLVMGXX42MACHO_COMPILE_PCH_CMDS
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_PCH) -c\
+ $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Compile Objective-C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPEND =
+TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_LLVMGXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
+TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
+define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).ii\
+ $(TOOL_LLVMGXX42MACHO_OBJC) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGXX42MACHO_OBJC) -c\
+ $(flags) -fpreprocessed -x objective-c \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT =
+define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Objective-C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPEND =
+TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPORD =
+ifdef KBUILD_USE_KOBJCACHE
+TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
+TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
+define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
+ --kObjCache-cpp $(outbase).mii\
+ $(TOOL_LLVMGXX42MACHO_OBJCXX) -E -o -\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ $(abspath $(source))\
+ --kObjCache-cc $(obj)\
+ $(TOOL_LLVMGXX42MACHO_OBJCXX) -c\
+ $(flags) -fpreprocessed -x objective-c++ \
+ -o $(obj)\
+ -
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+else # !KBUILD_USE_KOBJCACHE
+TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT =
+define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJCXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_LLVMGXX42MACHO_COMPILE_AS_OUTPUT =
+TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPEND =
+TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPORD =
+define TOOL_LLVMGXX42MACHO_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGXX42MACHO_LINK_LIBRARY_OUTPUT =
+TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_LLVMGXX42MACHO_LINK_LIBRARY_CMDS
+ $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
+ $(foreach lib,$(othersrc)\
+ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
+ $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
+ && $(TOOL_LLVMGXX42MACHO_AR) -x $(abspath $(lib)) \
+ && $(RM_EXT) -f ./__.SYMDEF* \
+ && $(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out) *) \
+ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
+ $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
+TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
+TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPORD =
+define TOOL_LLVMGXX42MACHO_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_PROGRAM) $(out)
+ endif
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_LLVMGXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
+TOOL_LLVMGXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_LLVMGXX42MACHO_LINK_DLL_DEPORD =
+define TOOL_LLVMGXX42MACHO_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+ $(call TOOL_LLVMGXX42MACHO_LD_SONAME,$(target),$(out))\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_DLL) $(out)
+ endif
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
+TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
+TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPORD =
+define TOOL_LLVMGXX42MACHO_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_LD_SYSMOD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
+ -filelist $(outbase).rsp\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
+ ifeq ($(ld_debug),split)
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
+ $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_SYSMOD) $(out)
+ endif
+endef
+
diff --git a/kBuild/tools/MASM510.kmk b/kBuild/tools/MASM510.kmk
new file mode 100644
index 0000000..3726b36
--- /dev/null
+++ b/kBuild/tools/MASM510.kmk
@@ -0,0 +1,97 @@
+# $Id: MASM510.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MASM v5.10
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_MASM510 := Microsoft Macro Assembler v5.10
+
+# Tool Specific Properties
+ifndef TOOL_MASM510_AS
+ TOOL_MASM510_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/masm/v5.10*/masm$(HOSTSUFF_EXE))))
+ ifeq ($(TOOL_MASM510_AS),)
+ TOOL_MASM510_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/masm/v5.10*/masm$(HOSTSUFF_EXE))))
+ endif
+ ifeq ($(TOOL_MASM510_AS),)
+ TOOL_MASM510_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/base/tools/masm$(HOSTSUFF_EXE))))
+ endif
+ ifeq ($(TOOL_MASM510_AS),)
+ TOOL_MASM510_AS := $(firstword $(rsort $(wildcard \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/video/tools/os2.386/lx.386/bin/masm$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/base32/tools/os2.386/bin/masm$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/base32/tools/os2.386/lx.386/bin/masm$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/print/tools/os2.386/lx.386/bin/masm$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/wpshell/tools/os2.386/lx.386/bin/masm$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/mme/tools/os2.386/lx.386/bin/masm$(HOSTSUFF_EXE) \
+ )))
+ endif
+ ifneq ($(TOOL_MASM510_AS),)
+ TOOL_MASM510_AS := $(TOOL_MASM510_AS)
+ endif
+endif
+ifeq ($(TOOL_MASM510_AS),)
+ TOOL_MASM510_AS := $(firstword $(which masm$(HOSTSUFF_EXE)) path/notfound/masm$(HOSTSUFF_EXE))
+endif
+
+# General Properties used by kBuild
+TOOL_MASM510_ASFLAGS ?= -t -z -Zd -Zi -t
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+# @remarks MASM v5.10 has severe length limitations in several places and will respond with
+# crashing when these are exceeded. Thus, we use MASM and INCLUDE to avoid exceeding
+# the command line length (and the MASM length).
+# The closing of file handles and zapping of environment is to make sure it doesn't
+# mess up due handles left behind by some device init or because the env is too big.
+TOOL_MASM510_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_MASM510_COMPILE_AS_DEPEND =
+TOOL_MASM510_COMPILE_AS_DEPORD =
+define TOOL_MASM510_COMPILE_AS_CMDS
+ $(QUIET)$(REDIRECT) \
+ -c3 -c4 -c5 -c6 -c7 -c8 -c9 -c10 -c11 -c12 -c13 -c14 -c15 -c16 -c17 -c18 -c19 -Z \
+ -E 'MASM=$(addprefix -D, $(subst /,\,$(defs)))' \
+ -E 'INCLUDE=$(subst $(SP),,$(addsuffix ;,$(subst /,\,$(incs))))' \
+ -- \
+ $(subst /,\\,$(TOOL_MASM510_AS)) $(strip $(flags)) '$(subst /,\,$(source),$(obj),$(outbase).lst);'
+endef
+
diff --git a/kBuild/tools/MASM600.kmk b/kBuild/tools/MASM600.kmk
new file mode 100644
index 0000000..502ffc9
--- /dev/null
+++ b/kBuild/tools/MASM600.kmk
@@ -0,0 +1,77 @@
+# $Id: MASM600.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MASM v6.00
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_MASM600 := Microsoft Macro Assembler v6.00
+
+# Tool Specific Properties
+ifndef TOOL_MASM600_AS
+ TOOL_MASM600_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/masm/v6.00*/binp/ml$(HOSTSUFF_EXE))))
+ ifeq ($(TOOL_MASM600_AS),)
+ TOOL_MASM600_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/masm/v6.00*/binp/ml$(HOSTSUFF_EXE))))
+ endif
+ ifeq ($(TOOL_MASM600_AS),)
+ TOOL_MASM600_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/toolkits/masm60/binp/ml$(HOSTSUFF_EXE))))
+ endif
+ ifeq ($(TOOL_MASM600_AS),)
+ if1of ($(USER) $(USERNAME) $(LOGNAME), bird)
+ TOOL_MASM600_AS := $(wildcard D:/dev/DDK/*/toolkits/masm60/binp/ML.EXE)
+ endif
+ endif
+endif
+ifeq ($(TOOL_MASM600_AS),)
+ TOOL_MASM600_AS := $(firstword $(which ml$(HOSTSUFF_EXE)) path/notfound/ml$(HOSTSUFF_EXE))
+endif
+
+# General Properties used by kBuild
+TOOL_MASM600_ASFLAGS ?= /nologo
+
+
+##
+# @remarks MASM v5.10 has serious trouble, so play safe with v6.00 as well.
+# See MASM510.kmk for details.
+TOOL_MASM600_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_MASM600_COMPILE_AS_DEPEND =
+TOOL_MASM600_COMPILE_AS_DEPORD =
+define TOOL_MASM600_COMPILE_AS_CMDS
+ $(QUIET)$(REDIRECT) \
+ -c3 -c4 -c5 -c6 -c7 -c8 -c9 -c10 -c11 -c12 -c13 -c14 -c15 -c16 -c17 -c18 -c19 -Z \
+ -E 'INCLUDE=$(subst $(SP),,$(addsuffix ;,$(subst /,\,$(incs))))' \
+ -- \
+ $(subst /,\\,$(TOOL_MASM600_AS)) -c \
+ $(strip $(flags)) \
+ $(addprefix -D,$(defs)) \
+ -Fo$(subst /,\\,$(obj)) \
+ -Fl$(subst /,\\,$(outbase).lst) \
+ $(subst /,\\,$(source))
+endef
+
diff --git a/kBuild/tools/MASM610.kmk b/kBuild/tools/MASM610.kmk
new file mode 100644
index 0000000..2c780a2
--- /dev/null
+++ b/kBuild/tools/MASM610.kmk
@@ -0,0 +1,66 @@
+# $Id: MASM610.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MASM v6.10
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_MASM610 := Microsoft Macro Assembler v6.10
+
+# Tool Specific Properties
+ifndef TOOL_MASM610_AS
+ TOOL_MASM610_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/masm/v6.10*/binp/ml$(HOSTSUFF_EXE))))
+ ifeq ($(TOOL_MASM610_AS),)
+ TOOL_MASM610_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/masm/v6.10*/binp/ml$(HOSTSUFF_EXE))))
+ endif
+endif
+ifeq ($(TOOL_MASM610_AS),)
+ TOOL_MASM610_AS := $(firstword $(which ml$(HOSTSUFF_EXE)) path/notfound/ml$(HOSTSUFF_EXE))
+endif
+
+# General Properties used by kBuild
+TOOL_MASM610_ASFLAGS ?= /nologo
+
+
+TOOL_MASM610_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_MASM610_COMPILE_AS_DEPEND =
+TOOL_MASM610_COMPILE_AS_DEPORD =
+define TOOL_MASM610_COMPILE_AS_CMDS
+ $(QUIET)$(REDIRECT) \
+ -E 'INCLUDE=$(subst $(SP),,$(addsuffix ;,$(subst /,\,$(incs))))' \
+ -E 'MASM=' -E 'ML=' \
+ -- \
+ $(subst /,\\,$(TOOL_MASM610_AS)) -c \
+ $(strip $(flags)) \
+ $(addprefix -D,$(defs)) \
+ -Fo$(subst /,\\,$(obj)) \
+ -Fl$(subst /,\\,$(outbase).lst) \
+ $(subst /,\\,$(source))
+endef
+
diff --git a/kBuild/tools/MASM6PLUS.kmk b/kBuild/tools/MASM6PLUS.kmk
new file mode 100644
index 0000000..d0226d1
--- /dev/null
+++ b/kBuild/tools/MASM6PLUS.kmk
@@ -0,0 +1,75 @@
+# $Id: MASM6PLUS.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MASM v6 and later.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_MASM6PLUS := Microsoft Macro Assembler v6 and later.
+
+# Tool Specific Properties
+ifndef TOOL_MASM6PLUS_AS
+ TOOL_MASM6PLUS_AS := $(firstword $(rsort $(wildcard \
+ $(KBUILD_DEVTOOLS_HST)/masm/*/bin$(if $(eq $(KBUILD_HOST),os2),p,)/ml$(HOSTSUFF_EXE)\
+ )))
+ ifeq ($(TOOL_MASM6PLUS_AS),)
+ TOOL_MASM6PLUS_AS := $(firstword $(rsort $(wildcard \
+ $(KBUILD_DEVTOOLS_HST)/vcc/*/bin/ml$(HOSTSUFF_EXE) \
+ )))
+ endif
+ ifeq ($(TOOL_MASM6PLUS_AS),)
+ TOOL_MASM6PLUS_AS := $(firstword $(rsort $(wildcard \
+ $(KBUILD_DEVTOOLS)/win.x86/vcc/*/bin/ml$(HOSTSUFF_EXE) \
+ )))
+ endif
+endif
+ifeq ($(TOOL_MASM6PLUS_AS),)
+ TOOL_MASM6PLUS_AS := $(firstword $(which ml$(HOSTSUFF_EXE)) path/notfound/ml$(HOSTSUFF_EXE))
+endif
+
+# General Properties used by kBuild
+TOOL_MASM6PLUS_ASFLAGS ?= /nologo
+
+
+TOOL_MASM6PLUS_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_MASM6PLUS_COMPILE_AS_DEPEND =
+TOOL_MASM6PLUS_COMPILE_AS_DEPORD =
+define TOOL_MASM6PLUS_COMPILE_AS_CMDS
+ $(QUIET)$(REDIRECT) \
+ -E 'INCLUDE=$(subst $(SP),,$(addsuffix ;,$(subst /,\,$(incs))))' \
+ -E 'MASM=' -E 'ML=' \
+ -- \
+ $(subst /,\\,$(TOOL_MASM6PLUS_AS)) -c \
+ $(strip $(flags)) \
+ $(addprefix -D,$(defs)) \
+ -Fo$(subst /,\\,$(obj)) \
+ -Fl$(subst /,\\,$(outbase).lst) \
+ $(subst /,\\,$(source))
+endef
+
diff --git a/kBuild/tools/MASM710.kmk b/kBuild/tools/MASM710.kmk
new file mode 100644
index 0000000..b44d1c8
--- /dev/null
+++ b/kBuild/tools/MASM710.kmk
@@ -0,0 +1,69 @@
+# $Id: MASM710.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MASM v7.10
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_MASM710 := Microsoft Macro Assembler v7.10
+
+# Tool Specific Properties
+ifndef TOOL_MASM710_AS
+ TOOL_MASM710_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/masm/v7.10*/binp/ml$(HOSTSUFF_EXE))))
+ ifeq ($(TOOL_MASM710_AS),)
+ TOOL_MASM710_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/masm/v7.10*/binp/ml$(HOSTSUFF_EXE))))
+ endif
+ ifeq ($(TOOL_MASM710_AS),)
+ TOOL_MASM710_AS := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v7*/bin/ml$(HOSTSUFF_EXE))))
+ endif
+endif
+ifeq ($(TOOL_MASM710_AS),)
+ TOOL_MASM710_AS := $(firstword $(which ml$(HOSTSUFF_EXE)) path/notfound/ml$(HOSTSUFF_EXE))
+endif
+
+# General Properties used by kBuild
+TOOL_MASM710_ASFLAGS ?= /nologo
+
+
+TOOL_MASM710_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_MASM710_COMPILE_AS_DEPEND =
+TOOL_MASM710_COMPILE_AS_DEPORD =
+define TOOL_MASM710_COMPILE_AS_CMDS
+ $(QUIET)$(REDIRECT) \
+ -E 'INCLUDE=$(subst $(SP),,$(addsuffix ;,$(subst /,\,$(incs))))' \
+ -E 'MASM=' -E 'ML=' \
+ -- \
+ $(subst /,\\,$(TOOL_MASM710_AS)) -c \
+ $(strip $(flags)) \
+ $(addprefix -D,$(defs)) \
+ -Fo$(subst /,\\,$(obj)) \
+ -Fl$(subst /,\\,$(outbase).lst) \
+ $(subst /,\\,$(source))
+endef
+
diff --git a/kBuild/tools/MINGW32.kmk b/kBuild/tools/MINGW32.kmk
new file mode 100644
index 0000000..0421a81
--- /dev/null
+++ b/kBuild/tools/MINGW32.kmk
@@ -0,0 +1,273 @@
+# $Id: MINGW32.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MinGW32 GCC v3.3+.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifdef TOOL_MINGW32
+$(error Already included (TOOL_MINGW32=$(TOOL_MINGW32)))
+endif
+TOOL_MINGW32 := MinGW32 GCC v3.3+.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_MINGW32
+ PATH_TOOL_MINGW32 := $(wildcard $(KBUILD_DEVTOOLS_HST)/mingw32/v*.*)
+ ifeq ($(PATH_TOOL_MINGW32),)
+ PATH_TOOL_MINGW32 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/mingw32/v*.*)
+ endif
+ ifeq ($(PATH_TOOL_MINGW32),)
+ PATH_TOOL_MINGW32 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/mingw32/v*.*)
+ endif
+ ifneq ($(PATH_TOOL_MINGW32),)
+ PATH_TOOL_MINGW32 := $(lastword $(sort $(PATH_TOOL_MINGW32)))
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_MINGW32 := $(PATH_TOOL_MINGW32)
+endif
+
+# figure out if it's native or needs a win32 launcher
+TOOL_MINGW32_HOSTSUFF_EXE ?= $(HOSTSUFF_EXE)
+ifndef TOOL_MINGW32_PREFIX
+ ifneq ($(PATH_TOOL_MINGW32),)
+ TOOL_MINGW32_PREFIX := $(PATH_TOOL_MINGW32)/bin/
+ else
+ TOOL_MINGW32_PREFIX :=
+ endif
+ ifneq ($(KBUILD_HOST),win)
+ # we're cross compiling either using an emulator (wine/odin) or a cross compiler.
+ ifneq ($(PATH_TOOL_MINGW32),$(subst /win.x86,,$(subst /x86.win,,$(PATH_TOOL_MINGW32))))
+ TOOL_MINGW32_PREFIX := $(EXEC_X86_WIN32) $(TOOL_MINGW32_PREFIX)
+ TOOL_MINGW32_HOSTSUFF_EXE := .exe
+ else
+ TOOL_MINGW32_PREFIX := $(TOOL_MINGW32_PREFIX)i386-mingw32msvc-
+ TOOL_MINGW32_HOSTSUFF_EXE :=
+ TOOL_MINGW32_XCOMPILE := 1
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ TOOL_MINGW32_PREFIX := $(TOOL_MINGW32_PREFIX)
+endif
+
+TOOL_MINGW32_CC ?= $(TOOL_MINGW32_PREFIX)gcc$(TOOL_MINGW32_HOSTSUFF_EXE)
+TOOL_MINGW32_CXX ?= $(TOOL_MINGW32_PREFIX)g++$(TOOL_MINGW32_HOSTSUFF_EXE)
+TOOL_MINGW32_AS ?= $(TOOL_MINGW32_PREFIX)gcc$(TOOL_MINGW32_HOSTSUFF_EXE)
+TOOL_MINGW32_AR ?= $(TOOL_MINGW32_PREFIX)ar$(TOOL_MINGW32_HOSTSUFF_EXE)
+ifndef TOOL_MINGW32_XCOMPILE# The gentoo package doesn't have g++.
+TOOL_MINGW32_LD ?= $(TOOL_MINGW32_PREFIX)g++$(TOOL_MINGW32_HOSTSUFF_EXE)
+else
+TOOL_MINGW32_LD ?= $(TOOL_MINGW32_PREFIX)gcc$(TOOL_MINGW32_HOSTSUFF_EXE)
+endif
+TOOL_MINGW32_DLLWRAP ?= $(TOOL_MINGW32_PREFIX)dllwrap$(TOOL_MINGW32_HOSTSUFF_EXE)
+TOOL_MINGW32_DLLTOOL ?= $(TOOL_MINGW32_PREFIX)dlltool$(TOOL_MINGW32_HOSTSUFF_EXE)
+
+# General Properties used by kBuild
+TOOL_MINGW32_COBJSUFF ?= .o
+TOOL_MINGW32_CFLAGS ?= -g
+TOOL_MINGW32_CFLAGS.debug ?= -O0
+TOOL_MINGW32_CFLAGS.release ?= -O2
+TOOL_MINGW32_CFLAGS.profile ?= -O2 #-pg
+TOOL_MINGW32_CINCS ?=
+TOOL_MINGW32_CDEFS ?=
+
+TOOL_MINGW32_CXXOBJSUFF ?= .o
+TOOL_MINGW32_CXXOBJSUFF ?= .o
+TOOL_MINGW32_CXXFLAGS ?= -g
+TOOL_MINGW32_CXXFLAGS.debug ?= -O0
+TOOL_MINGW32_CXXFLAGS.release ?= -O2
+TOOL_MINGW32_CXXFLAGS.profile ?= -O2 #-pg
+TOOL_MINGW32_CXXINCS ?=
+TOOL_MINGW32_CXXDEFS ?=
+
+TOOL_MINGW32_ASFLAGS ?= -g -x assembler-with-cpp
+TOOL_MINGW32_ASOBJSUFF ?= .o
+
+TOOL_MINGW32_ARFLAGS ?= cr
+TOOL_MINGW32_ARLIBSUFF ?= .a
+
+TOOL_MINGW32_LDFLAGS ?=
+TOOL_MINGW32_LDFLAGS.debug ?= -g
+TOOL_MINGW32_LDFLAGS.release ?= -s
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_MINGW32_COMPILE_C_OUTPUT =
+TOOL_MINGW32_COMPILE_C_DEPEND =
+TOOL_MINGW32_COMPILE_C_DEPORD =
+define TOOL_MINGW32_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_MINGW32_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_MINGW32_COMPILE_CXX_OUTPUT =
+TOOL_MINGW32_COMPILE_CXX_DEPEND =
+TOOL_MINGW32_COMPILE_CXX_DEPORD =
+define TOOL_MINGW32_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_MINGW32_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_MINGW32_COMPILE_AS_OUTPUT =
+TOOL_MINGW32_COMPILE_AS_DEPEND =
+TOOL_MINGW32_COMPILE_AS_DEPORD =
+define TOOL_MINGW32_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_MINGW32_AS) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_MINGW32_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_MINGW32_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_MINGW32_LINK_LIBRARY_DEPORD =
+define TOOL_MINGW32_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(objs), 'ADDMOD $(o)') \
+ $(foreach o,$(othersrc), 'ADDLIB $(o)')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(TOOL_MINGW32_AR) -M < $(out).ar-script
+endef
+
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_MINGW32_LINK_PROGRAM_OUTPUT =
+TOOL_MINGW32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_MINGW32_LINK_PROGRAM_DEPORD =
+define TOOL_MINGW32_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_MINGW32_LD) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_MINGW32_LINK_DLL_OUTPUT =
+TOOL_MINGW32_LINK_DLL_OUTPUT_MAYBE = $(outbase).a $(outbase).exp $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp $(PATH_STAGE_LIB)/$(notdir $(outbase)).a
+## @todo Find a better solution for installing the extra files (.a, .exp, .pdb, etc).
+TOOL_MINGW32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def %.res,$(othersrc))
+TOOL_MINGW32_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+define TOOL_MINGW32_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_MINGW32_DLLWRAP) $(flags)\
+ --dllname=$(out)\
+ --output-exp=$(outbase).exp\
+ --output-lib=$(outbase).a\
+ $(foreach def,$(filter %.def,$(othersrc)), --def $(def))\
+ $(filter %.res,$(othersrc))\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+ $(QUIET)$(CP) $(outbase).exp $(outbase).a $(PATH_STAGE_LIB)/
+endef
+## @todo separate install stuff!
diff --git a/kBuild/tools/MINGWW64.kmk b/kBuild/tools/MINGWW64.kmk
new file mode 100644
index 0000000..5195f22
--- /dev/null
+++ b/kBuild/tools/MINGWW64.kmk
@@ -0,0 +1,273 @@
+# $Id: MINGWW64.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - MinGW-W64.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifdef TOOL_MINGWW64
+$(error Already included (TOOL_MINGWW64=$(TOOL_MINGWW64)))
+endif
+TOOL_MINGWW64 := MinGW-W64 - The incomprehensible 64-bit GCC port to Windows.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_MINGWW64
+ PATH_TOOL_MINGWW64 := $(wildcard $(KBUILD_DEVTOOLS_HST)/mingw-w64/r*)
+ ifeq ($(PATH_TOOL_MINGWW64),)
+ PATH_TOOL_MINGWW64 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/mingw-w64/r*)
+ endif
+ ifeq ($(PATH_TOOL_MINGWW64),)
+ PATH_TOOL_MINGWW64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/mingw-w64/r*)
+ endif
+ ifneq ($(PATH_TOOL_MINGWW64),)
+ PATH_TOOL_MINGWW64 := $(lastword $(sort $(PATH_TOOL_MINGWW64)))
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_MINGWW64 := $(PATH_TOOL_MINGWW64)
+endif
+
+# figure out if it's native or needs a win32 launcher
+TOOL_MINGWW64_HOSTSUFF_EXE ?= $(HOSTSUFF_EXE)
+ifndef TOOL_MINGWW64_PREFIX
+ ifneq ($(PATH_TOOL_MINGWW64),)
+ TOOL_MINGWW64_PREFIX := $(PATH_TOOL_MINGWW64)/bin/
+ else
+ TOOL_MINGWW64_PREFIX :=
+ endif
+ ifneq ($(KBUILD_HOST),win)
+# # we're cross compiling either using an emulator (wine/odin) or a cross compiler.
+# ifneq ($(PATH_TOOL_MINGWW64),$(subst /win.x86,,$(subst /x86.win,,$(PATH_TOOL_MINGWW64))))
+ TOOL_MINGWW64_PREFIX := $(EXEC_X86_WIN32) $(TOOL_MINGWW64_PREFIX)
+ TOOL_MINGWW64_HOSTSUFF_EXE := .exe
+# else
+# TOOL_MINGWW64_PREFIX := $(TOOL_MINGWW64_PREFIX)i386-mingw32msvc-
+# TOOL_MINGWW64_HOSTSUFF_EXE :=
+# TOOL_MINGWW64_XCOMPILE := 1
+# endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ TOOL_MINGWW64_PREFIX := $(TOOL_MINGWW64_PREFIX)
+endif
+
+TOOL_MINGWW64_CC ?= $(TOOL_MINGWW64_PREFIX)gcc$(TOOL_MINGWW64_HOSTSUFF_EXE)
+TOOL_MINGWW64_CXX ?= $(TOOL_MINGWW64_PREFIX)g++$(TOOL_MINGWW64_HOSTSUFF_EXE)
+TOOL_MINGWW64_AS ?= $(TOOL_MINGWW64_PREFIX)gcc$(TOOL_MINGWW64_HOSTSUFF_EXE)
+TOOL_MINGWW64_AR ?= $(TOOL_MINGWW64_PREFIX)ar$(TOOL_MINGWW64_HOSTSUFF_EXE)
+ifndef TOOL_MINGWW64_XCOMPILE# The gentoo package doesn't have g++.
+TOOL_MINGWW64_LD ?= $(TOOL_MINGWW64_PREFIX)g++$(TOOL_MINGWW64_HOSTSUFF_EXE)
+else
+TOOL_MINGWW64_LD ?= $(TOOL_MINGWW64_PREFIX)gcc$(TOOL_MINGWW64_HOSTSUFF_EXE)
+endif
+TOOL_MINGWW64_DLLWRAP ?= $(TOOL_MINGWW64_PREFIX)dllwrap$(TOOL_MINGWW64_HOSTSUFF_EXE)
+TOOL_MINGWW64_DLLTOOL ?= $(TOOL_MINGWW64_PREFIX)dlltool$(TOOL_MINGWW64_HOSTSUFF_EXE)
+
+# General Properties used by kBuild
+TOOL_MINGWW64_COBJSUFF ?= .o
+TOOL_MINGWW64_CFLAGS ?= -g
+TOOL_MINGWW64_CFLAGS.debug ?= -O0
+TOOL_MINGWW64_CFLAGS.release ?= -O2
+TOOL_MINGWW64_CFLAGS.profile ?= -O2 #-pg
+TOOL_MINGWW64_CINCS ?=
+TOOL_MINGWW64_CDEFS ?=
+
+TOOL_MINGWW64_CXXOBJSUFF ?= .o
+TOOL_MINGWW64_CXXOBJSUFF ?= .o
+TOOL_MINGWW64_CXXFLAGS ?= -g
+TOOL_MINGWW64_CXXFLAGS.debug ?= -O0
+TOOL_MINGWW64_CXXFLAGS.release ?= -O2
+TOOL_MINGWW64_CXXFLAGS.profile ?= -O2 #-pg
+TOOL_MINGWW64_CXXINCS ?=
+TOOL_MINGWW64_CXXDEFS ?=
+
+TOOL_MINGWW64_ASFLAGS ?= -g -x assembler-with-cpp
+TOOL_MINGWW64_ASOBJSUFF ?= .o
+
+TOOL_MINGWW64_ARFLAGS ?= cr
+TOOL_MINGWW64_ARLIBSUFF ?= .a
+
+TOOL_MINGWW64_LDFLAGS ?=
+TOOL_MINGWW64_LDFLAGS.debug ?= -g
+TOOL_MINGWW64_LDFLAGS.release ?= -s
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_MINGWW64_COMPILE_C_OUTPUT =
+TOOL_MINGWW64_COMPILE_C_DEPEND =
+TOOL_MINGWW64_COMPILE_C_DEPORD =
+define TOOL_MINGWW64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_MINGWW64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_MINGWW64_COMPILE_CXX_OUTPUT =
+TOOL_MINGWW64_COMPILE_CXX_DEPEND =
+TOOL_MINGWW64_COMPILE_CXX_DEPORD =
+define TOOL_MINGWW64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_MINGWW64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_MINGWW64_COMPILE_AS_OUTPUT =
+TOOL_MINGWW64_COMPILE_AS_DEPEND =
+TOOL_MINGWW64_COMPILE_AS_DEPORD =
+define TOOL_MINGWW64_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_MINGWW64_AS) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_MINGWW64_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_MINGWW64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_MINGWW64_LINK_LIBRARY_DEPORD =
+define TOOL_MINGWW64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(objs), 'ADDMOD $(o)') \
+ $(foreach o,$(othersrc), 'ADDLIB $(o)')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(TOOL_MINGWW64_AR) -M < $(out).ar-script
+endef
+
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_MINGWW64_LINK_PROGRAM_OUTPUT =
+TOOL_MINGWW64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_MINGWW64_LINK_PROGRAM_DEPORD =
+define TOOL_MINGWW64_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_MINGWW64_LD) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_MINGWW64_LINK_DLL_OUTPUT =
+TOOL_MINGWW64_LINK_DLL_OUTPUT_MAYBE = $(outbase).a $(outbase).exp $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp $(PATH_STAGE_LIB)/$(notdir $(outbase)).a
+## @todo Find a better solution for installing the extra files (.a, .exp, .pdb, etc).
+TOOL_MINGWW64_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def %.res,$(othersrc))
+TOOL_MINGWW64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+define TOOL_MINGWW64_LINK_DLL_CMDS
+ $(QUIET)$(REDIRECT) -C "$(dir $(out))" -- $(TOOL_MINGWW64_DLLWRAP) $(flags)\
+ --dllname=$(notdir $(out))\
+ --output-exp=$(outbase).exp\
+ --output-lib=$(outbase).a\
+ $(foreach def,$(filter %.def,$(othersrc)), --def $(def))\
+ $(filter %.res,$(othersrc))\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+ $(QUIET)$(CP) $(outbase).exp $(outbase).a $(PATH_STAGE_LIB)/
+endef
+## @todo separate install stuff!
diff --git a/kBuild/tools/MSLINK510.kmk b/kBuild/tools/MSLINK510.kmk
new file mode 100644
index 0000000..ccf6eb2
--- /dev/null
+++ b/kBuild/tools/MSLINK510.kmk
@@ -0,0 +1,104 @@
+# $Id: MSLINK510.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - Microsoft Link v5.10
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_MSLINK510 := Microsoft Segmented-Executable Linker Version 5.10
+
+# Tool Specific Properties
+ifndef TOOL_MSLINK510_LD
+ TOOL_MSLINK510_LD := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/base/tools/link$(HOSTSUFF_EXE))))
+ ifeq ($(TOOL_MSLINK510_LD),)
+ TOOL_MSLINK510_LD := $(firstword $(rsort $(wildcard \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/video/tools/os2.386/lx.386/bin/link$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/base32/tools/os2.386/bin/link$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/base32/tools/os2.386/lx.386/bin/link$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/print/tools/os2.386/lx.386/bin/link$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/wpshell/tools/os2.386/lx.386/bin/link$(HOSTSUFF_EXE) \
+ $(KBUILD_DEVTOOLS)/os2.x86/ddk/*/mme/tools/os2.386/lx.386/bin/link$(HOSTSUFF_EXE) \
+ )))
+ endif
+ ifneq ($(TOOL_MSLINK510_LD),)
+ TOOL_MSLINK510_LD := $(TOOL_MSLINK510_LD)
+ endif
+endif
+ifeq ($(TOOL_MSLINK510_LD),)
+ TOOL_MSLINK510_LD := $(firstword $(which link$(HOSTSUFF_EXE)) path/notfound/link$(HOSTSUFF_EXE))
+endif
+
+TOOL_MSLINK510_ENV_SETUP = $(REDIRECT) \
+ -Z -E 'LIB=$1' \
+ --
+
+# General Properties used by kBuild
+TOOL_MSLINK510_LDFLAGS ?= /nologo /map:full /linenumbers
+
+TOOL_MSLINK510_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_MSLINK510_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_MSLINK510_LINK_PROGRAM_DEPORD =
+define TOOL_MSLINK510_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp '$(subst $(SP),+' ',$(strip $(subst /,\,$(objs)))),'
+ $(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(out)),'
+ $(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(outbase)).map,'
+ $(QUIET)$(APPEND) -n $(outbase).rsp '$(subst $(SP),+' ',$(strip $(subst /,\,$(libs))))$(if $(filter %.def,$(othersrc)),$(COMMA),;)'
+ $(if $(filter %.def,$(othersrc)),$(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(filter %.def,$(othersrc)));',)
+ $(QUIET)$(call TOOL_MSLINK510_ENV_SETUP,$(subst $(SP),;,$(libpath))) \
+ $(TOOL_MSLINK510_LD) $(flags) '@$(subst /,\,$(outbase).rsp)'
+endef
+
+
+TOOL_MSLINK510_LINK_DLL_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_MSLINK510_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_MSLINK510_LINK_DLL_DEPORD =
+define TOOL_MSLINK510_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp '$(subst $(SP),+' ',$(strip $(subst /,\,$(objs)))),'
+ $(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(out)),'
+ $(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(outbase)).map,'
+ $(QUIET)$(APPEND) -n $(outbase).rsp '$(subst $(SP),+' ',$(strip $(subst /,\,$(libs))))$(if $(filter %.def,$(othersrc)),$(COMMA),;)'
+ $(if $(filter %.def,$(othersrc)),$(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(filter %.def,$(othersrc)));',)
+ $(QUIET)$(call TOOL_MSLINK510_ENV_SETUP,$(subst $(SP),;,$(libpath))) \
+ $(TOOL_MSLINK510_LD) $(flags) '@$(subst /,\,$(outbase).rsp)'
+endef
+
+
+TOOL_MSLINK510_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_MSLINK510_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_MSLINK510_LINK_SYSMOD_DEPORD =
+define TOOL_MSLINK510_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -n $(outbase).rsp '$(subst $(SP),+' ',$(strip $(subst /,\,$(objs)))),'
+ $(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(out)),'
+ $(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(outbase)).map,'
+ $(QUIET)$(APPEND) -n $(outbase).rsp '$(subst $(SP),+' ',$(strip $(subst /,\,$(libs))))$(if $(filter %.def,$(othersrc)),$(COMMA),;)'
+ $(if $(filter %.def,$(othersrc)),$(QUIET)$(APPEND) $(outbase).rsp '$(subst /,\,$(filter %.def,$(othersrc)));',)
+ $(QUIET)$(call TOOL_MSLINK510_ENV_SETUP,$(subst $(SP),;,$(libpath))) \
+ $(TOOL_MSLINK510_LD) $(flags) '@$(subst /,\,$(outbase).rsp)'
+endef
+
diff --git a/kBuild/tools/NASM.kmk b/kBuild/tools/NASM.kmk
new file mode 100644
index 0000000..d42aec5
--- /dev/null
+++ b/kBuild/tools/NASM.kmk
@@ -0,0 +1,97 @@
+# $Id: NASM.kmk 3520 2021-12-18 13:39:52Z bird $
+## @file
+# kBuild Tool Config - Netwide Assembler v0.98+.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_NASM := Netwide Assembler v0.98+
+
+# Tool Specific Properties
+ifndef PATH_TOOL_NASM
+ PATH_TOOL_NASM := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
+ if "$(PATH_TOOL_NASM)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
+ PATH_TOOL_NASM := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_NASM := $(PATH_TOOL_NASM)
+endif
+
+ifneq ($(PATH_TOOL_NASM),)
+ TOOL_NASM_AS ?= $(PATH_TOOL_NASM)/nasm$(HOSTSUFF_EXE)
+else
+ TOOL_NASM_AS ?= nasm$(HOSTSUFF_EXE)
+endif
+
+# kSubmit
+ifdef TOOL_NASM_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ TOOL_NASM_KSUBMIT ?= kmk_builtin_kSubmit $1 --
+ endif
+endif
+
+# General Properties used by kBuild
+TOOL_NASM_ASFLAGS ?=
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_NASM_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_NASM_COMPILE_AS_DEPEND =
+TOOL_NASM_COMPILE_AS_DEPORD =
+define TOOL_NASM_COMPILE_AS_CMDS
+ifdef TOOL_NASM_KSUBMIT
+ $(QUIET)$(call TOOL_NASM_KSUBMIT, -C $(PATH_OUT_BASE)) $(TOOL_NASM_AS)\
+ $(flags) $(qaddsuffix sh,/,$(qaddprefix ,-i, $(incs))) $(qaddprefix sh,-D, $(defs))\
+ -l $(outbase).lst\
+ -o $(obj)\
+ -MD "$(dep)" -MP\
+ $(qabspath sh,$(source))
+else
+ $(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) -- $(TOOL_NASM_AS)\
+ $(flags) $(qaddsuffix sh,/,$(qaddprefix ,-i, $(incs))) $(qaddprefix sh,-D, $(defs))\
+ -l $(outbase).lst\
+ -o $(obj)\
+ -MD "$(dep)" -MP\
+ $(qabspath sh,$(source))
+endif
+endef
+
diff --git a/kBuild/tools/OPENWATCOM-16.kmk b/kBuild/tools/OPENWATCOM-16.kmk
new file mode 100644
index 0000000..341ba20
--- /dev/null
+++ b/kBuild/tools/OPENWATCOM-16.kmk
@@ -0,0 +1,208 @@
+# $Id: OPENWATCOM-16.kmk 3578 2023-01-05 00:42:25Z bird $
+## @file
+# kBuild Tool Config - Open Watcom v1.4 and later, 16-bit targets.
+#
+# @remarks wrc is untested, so are DLLs, and programs.
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_OPENWATCOM-16 = Open Watcom v1.4 and later - 16-bit targets.
+TOOL_OPENWATCOM-16_EXTENDS = OPENWATCOM
+TOOL_OPENWATCOM-16_ASFLAGS.win ?= -bt=windows
+TOOL_OPENWATCOM-16_CFLAGS.win ?= -bt=windows
+TOOL_OPENWATCOM-16_CXXFLAGS.win ?= -bt=windows
+TOOL_OPENWATCOM-16_RCFLAGS.win ?= -bt=windows
+TOOL_OPENWATCOM-16_LDFLAGS.win ?= -bt=windows
+
+
+TOOL_OPENWATCOM-16_COMPILE_AS_DEPEND =
+TOOL_OPENWATCOM-16_COMPILE_AS_DEPORD =
+TOOL_OPENWATCOM-16_COMPILE_AS_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_AS_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM-16_COMPILE_AS_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_AS) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
+define TOOL_OPENWATCOM-16_COMPILE_AS_CMDS
+ $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AS) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
+
+TOOL_OPENWATCOM-16_COMPILE_C_DEPEND =
+TOOL_OPENWATCOM-16_COMPILE_C_DEPORD =
+TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM-16_COMPILE_C_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CC16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
+define TOOL_OPENWATCOM-16_COMPILE_C_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CC16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
+
+TOOL_OPENWATCOM-16_COMPILE_CXX_DEPEND =
+TOOL_OPENWATCOM-16_COMPILE_CXX_DEPORD =
+TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CXX16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
+define TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CXX16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
+
+TOOL_OPENWATCOM-16_COMPILE_RC_OUTPUT =
+TOOL_OPENWATCOM-16_COMPILE_RC_DEPEND =
+TOOL_OPENWATCOM-16_COMPILE_RC_DEPORD =
+define TOOL_OPENWATCOM-16_COMPILE_RC_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) -r\
+ $(flags) \
+ $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \
+ $(qaddprefix sh,-d, $(defs))\
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+
+TOOL_OPENWATCOM-16_LINK_LIBRARY_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_OPENWATCOM-16_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_OPENWATCOM-16_LINK_LIBRARY_DEPORD =
+define TOOL_OPENWATCOM-16_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(objs) $(othersrc)),'+"$(obj)"')
+ $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AR) $(flags) $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) @$(outbase).rsp
+endef
+
+TOOL_OPENWATCOM-16_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map
+TOOL_OPENWATCOM-16_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).sym
+TOOL_OPENWATCOM-16_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM-16_LINK_PROGRAM_DEPORD =
+define TOOL_OPENWATCOM-16_LINK_PROGRAM_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_OPENWATCOM_LD16) \
+ $(flags) \
+ -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
+TOOL_OPENWATCOM-16_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).map
+TOOL_OPENWATCOM-16_LINK_DLL_OUTPUT_MAYBE = $(outbase).sym
+TOOL_OPENWATCOM-16_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM-16_LINK_DLL_DEPORD =
+define TOOL_OPENWATCOM-16_LINK_DLL_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_OPENWATCOM_LD16) \
+ $(flags) \
+ -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
+TOOL_OPENWATCOM-16_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map
+TOOL_OPENWATCOM-16_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).sym
+TOOL_OPENWATCOM-16_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM-16_LINK_SYSMOD_DEPORD =
+define TOOL_OPENWATCOM-16_LINK_SYSMOD_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_OPENWATCOM_LD16) \
+ $(flags) \
+ -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
diff --git a/kBuild/tools/OPENWATCOM-WL.kmk b/kBuild/tools/OPENWATCOM-WL.kmk
new file mode 100644
index 0000000..1aafda5
--- /dev/null
+++ b/kBuild/tools/OPENWATCOM-WL.kmk
@@ -0,0 +1,83 @@
+# $Id: OPENWATCOM-WL.kmk 3306 2020-01-15 01:16:43Z bird $
+## @file
+# kBuild Tool Config - Open Watcom v1.4 and later, using wlink.
+#
+# @remarks wrc is untested, so are DLLs, and programs.
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_OPENWATCOM-WL = Open Watcom v1.4 and later, using wlink.
+TOOL_OPENWATCOM-WL_EXTENDS = OPENWATCOM
+TOOL_OPENWATCOM-WL_LDFLAGS ?= Option Quiet
+TOOL_OPENWATCOM-WL_LDFLAGS.dos ?= $(NO_SUCH_VARIABLE)
+TOOL_OPENWATCOM-WL_LDFLAGS.linux ?= $(NO_SUCH_VARIABLE)
+TOOL_OPENWATCOM-WL_LDFLAGS.nt ?= $(NO_SUCH_VARIABLE)
+TOOL_OPENWATCOM-WL_LDFLAGS.os2 ?= $(NO_SUCH_VARIABLE)
+TOOL_OPENWATCOM-WL_LDFLAGS.win ?= $(NO_SUCH_VARIABLE)
+
+
+TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).sym
+TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD =
+define TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(if $(flags),'$(flags)',) \
+ 'Name $(call TOOL_OPENWATCOM_FIX_SLASHES_SQ,$(out)$(if $(suffix $(out)),,.))' \
+ 'Option Map=$(call TOOL_OPENWATCOM_FIX_SLASHES_SQ,$(outbase)).map' \
+ $(foreach p,$(call TOOL_OPENWATCOM_FIX_SLASHES_SQ,$(libpath)),'LIBPath $p') \
+ $(foreach o,$(call TOOL_OPENWATCOM_FIX_SLASHES_SQ,$(filter-out %.res,$(objs)) $(othersrc)),'$(if $(filter %.lib %.a,$l),LIB,)File $o') \
+ $(foreach l,$(call TOOL_OPENWATCOM_FIX_SLASHES_SQ,$(libs)),'Library $l')
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) \
+ $(TOOL_OPENWATCOM_WLINK) @$(outbase).rsp
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
+TOOL_OPENWATCOM-WL_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS)
+TOOL_OPENWATCOM-WL_LINK_DLL_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE)
+TOOL_OPENWATCOM-WL_LINK_DLL_DEPEND = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND)
+TOOL_OPENWATCOM-WL_LINK_DLL_DEPORD = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD)
+TOOL_OPENWATCOM-WL_LINK_DLL_CMDS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS)
+
+TOOL_OPENWATCOM-WL_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS)
+TOOL_OPENWATCOM-WL_LINK_SYSMOD_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE)
+TOOL_OPENWATCOM-WL_LINK_SYSMOD_DEPEND = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND)
+TOOL_OPENWATCOM-WL_LINK_SYSMOD_DEPORD = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD)
+TOOL_OPENWATCOM-WL_LINK_SYSMOD_CMDS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS)
+
+TOOL_OPENWATCOM-WL_LINK_MISCBIN_OUTPUT_MAYBE_PRECIOUS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS)
+TOOL_OPENWATCOM-WL_LINK_MISCBIN_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE)
+TOOL_OPENWATCOM-WL_LINK_MISCBIN_DEPEND = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND)
+TOOL_OPENWATCOM-WL_LINK_MISCBIN_DEPORD = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD)
+TOOL_OPENWATCOM-WL_LINK_MISCBIN_CMDS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS)
+
diff --git a/kBuild/tools/OPENWATCOM.kmk b/kBuild/tools/OPENWATCOM.kmk
new file mode 100644
index 0000000..20116c9
--- /dev/null
+++ b/kBuild/tools/OPENWATCOM.kmk
@@ -0,0 +1,387 @@
+# $Id: OPENWATCOM.kmk 3578 2023-01-05 00:42:25Z bird $
+## @file
+# kBuild Tool Config - Open Watcom v1.4 and later.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_OPENWATCOM = Open Watcom v1.4 and later (generic)
+
+ifeq ($(PATH_TOOL_OPENWATCOM),)
+ ifeq ($(PATH_TOOL_OPENWATCOM),)
+ PATH_TOOL_OPENWATCOM := $(wildcard $(KBUILD_DEVTOOLS_HST)/openwatcom/v*)
+ endif
+ ifeq ($(PATH_TOOL_OPENWATCOM),)
+ PATH_TOOL_OPENWATCOM := $(wildcard $(KBUILD_DEVTOOLS_TRG)/openwatcom/v*)
+ endif
+ ifeq ($(PATH_TOOL_OPENWATCOM),)
+ PATH_TOOL_OPENWATCOM := $(wildcard $(KBUILD_DEVTOOLS)/common/openwatcom/v*)
+ endif
+ ifeq ($(PATH_TOOL_OPENWATCOM)$(KBUILD_HOST),os2)
+ if1of ($(USER) $(USERNAME) $(LOGNAME), bird)
+ PATH_TOOL_OPENWATCOM := $(wildcard d:/dev/Watcom/v1.*)
+ endif
+ endif
+ PATH_TOOL_OPENWATCOM := $(firstword $(sort $(PATH_TOOL_OPENWATCOM)))
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_OPENWATCOM := $(PATH_TOOL_OPENWATCOM)
+endif
+
+# Clear the feature indicator if not available on the current host.
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+ ifneq ($(KBUILD_HOST),win)
+ override TOOL_OPENWATCOM_USE_KSUBMIT :=
+ endif
+endif
+
+ifneq ($(PATH_TOOL_OPENWATCOM),)
+ TOOL_OPENWATCOM_PATHLESS := no
+
+ ifeq ($(KBUILD_HOST),darwin)
+ PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binosx
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
+ -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
+ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
+ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ else ifeq ($(KBUILD_HOST),freebsd)
+ PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binfbsd
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
+ -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
+ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
+ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ else ifeq ($(KBUILD_HOST),linux)
+ PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binl
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
+ -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
+ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
+ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ else ifeq ($(KBUILD_HOST),os2)
+ PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binp
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
+ -E 'BEGINLIBPATH=$(PATH_TOOL_OPENWATCOM)/binp/dll;$(BEGINLIBPATH)' \
+ -E 'LIBPATHSTRICT=T' \
+ -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw;$(PATH)' \
+ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
+ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ else ifeq ($(KBUILD_HOST),solaris)
+ PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binsol
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
+ -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
+ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
+ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ else
+ PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binnt
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(if-expr defined(TOOL_OPENWATCOM_USE_KSUBMIT),kmk_builtin_kSubmit --32-bit,$(REDIRECT)) \
+ -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw;$(PATH)' \
+ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
+ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ endif
+
+ TOOL_OPENWATCOM_CC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc386$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_CC16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_CXX ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp386$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_CXX16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_AS ?= $(PATH_TOOL_OPENWATCOM_BIN)/wasm$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_AR ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlib$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_RC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wrc$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_LD ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl386$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_LD16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_WLINK ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlink$(HOSTSUFF_EXE)
+
+else
+ # Pathless, relies on the environment.
+ TOOL_OPENWATCOM_PATHLESS :=
+ TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ TOOL_OPENWATCOM_CC ?= wcc386$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_CC16 ?= wcc$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_CXX ?= wpp386$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_CXX16 ?= wpp$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_AS ?= wasm$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_AR ?= wlib$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_RC ?= wrc$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_LD ?= wcl386$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_LD16 ?= wcl$(HOSTSUFF_EXE)
+ TOOL_OPENWATCOM_WLINK ?= wlink$(HOSTSUFF_EXE)
+
+endif
+
+if $(KBUILD_KMK_REVISION) >= 2747
+ TOOL_OPENWATCOM_ENV_SETUP_BD ?= $(call TOOL_OPENWATCOM_ENV_SETUP,$1, --wcc-brain-damage $2)
+else
+ TOOL_OPENWATCOM_ENV_SETUP_BD ?= $(call TOOL_OPENWATCOM_ENV_SETUP,$1,$2)
+endif
+
+
+# Functions for changing slashes (SQ = single quoted).
+if1of ($(KBUILD_HOST), os2 win)
+ TOOL_OPENWATCOM_FIX_SLASHES = $(subst /,\\,$1)
+ TOOL_OPENWATCOM_FIX_SLASHES_SQ = $(subst /,\,$1)
+else
+ TOOL_OPENWATCOM_FIX_SLASHES = $1
+ TOOL_OPENWATCOM_FIX_SLASHES_SQ = $1
+endif
+
+# General Properties used by kBuild
+TOOL_OPENWATCOM_ASOBJSUFF ?= .obj
+TOOL_OPENWATCOM_ASFLAGS ?= -zq
+TOOL_OPENWATCOM_ASFLAGS.dos ?= -bt=dos
+TOOL_OPENWATCOM_ASFLAGS.os2 ?= -bt=os2
+TOOL_OPENWATCOM_ASFLAGS.win ?= -bt=nt
+
+TOOL_OPENWATCOM_COBJSUFF ?= .obj
+TOOL_OPENWATCOM_CFLAGS ?= -zq
+TOOL_OPENWATCOM_CFLAGS.dos ?= -bt=dos
+TOOL_OPENWATCOM_CFLAGS.os2 ?= -bt=os2
+TOOL_OPENWATCOM_CFLAGS.win ?= -bt=nt
+ifdef PATH_TOOL_OPENWATCOM
+ TOOL_OPENWATCOM_CINCS ?= $(PATH_TOOL_OPENWATCOM)/h
+endif
+
+TOOL_OPENWATCOM_CXXOBJSUFF ?= .obj
+TOOL_OPENWATCOM_CXXFLAGS ?= -zq
+TOOL_OPENWATCOM_CXXFLAGS.dos ?= -bt=dos
+TOOL_OPENWATCOM_CXXFLAGS.os2 ?= -bt=os2
+TOOL_OPENWATCOM_CXXFLAGS.win ?= -bt=nt
+ifdef PATH_TOOL_OPENWATCOM
+ TOOL_OPENWATCOM_CXXINCS ?= $(PATH_TOOL_OPENWATCOM)/h
+endif
+
+TOOL_OPENWATCOM_RCOBJSUFF ?= .res
+TOOL_OPENWATCOM_RCFLAGS ?= -r
+TOOL_OPENWATCOM_RCFLAGS.os2 ?= -bt=os2
+TOOL_OPENWATCOM_RCFLAGS.win ?= -bt=nt
+ifdef PATH_TOOL_OPENWATCOM
+ TOOL_OPENWATCOM_RCINCS ?= $(PATH_TOOL_OPENWATCOM)/h
+endif
+
+TOOL_OPENWATCOM_ARFLAGS ?= -q
+TOOL_OPENWATCOM_ARLIBSUFF ?= .lib
+
+TOOL_OPENWATCOM_LDFLAGS ?= -zq -y
+TOOL_OPENWATCOM_LDFLAGS.dos ?= -bt=dos
+TOOL_OPENWATCOM_LDFLAGS.os2 ?= -bt=os2
+TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
+
+
+TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
+TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
+TOOL_OPENWATCOM_COMPILE_AS_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_AS_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM_COMPILE_AS_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_AS) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
+define TOOL_OPENWATCOM_COMPILE_AS_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AS) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
+
+
+TOOL_OPENWATCOM_COMPILE_C_DEPEND =
+TOOL_OPENWATCOM_COMPILE_C_DEPORD =
+TOOL_OPENWATCOM_COMPILE_C_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_C_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM_COMPILE_C_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CC) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
+define TOOL_OPENWATCOM_COMPILE_C_CMDS
+ $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CC) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
+
+TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
+TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
+TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT_MAYBE = $(obj).err
+ifdef TOOL_OPENWATCOM_USE_KSUBMIT
+define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,, -P $(DEP_OBJ_INT) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)") \
+ $(TOOL_OPENWATCOM_CXX) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+else
+define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_CXX) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
+endef
+endif
+
+TOOL_OPENWATCOM_COMPILE_RC_OUTPUT =
+TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
+TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
+define TOOL_OPENWATCOM_COMPILE_RC_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) -r\
+ $(flags) \
+ $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
+endef
+
+TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT_MAYBE_PRECIOUS = $(outbase).rsp
+TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD =
+define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(objs) $(filter-out %.imp,$(othersrc))),'+"$(obj)"')
+ $(if $(filter %.imp,$(othersrc)),$(SED) \
+ -e 's/;.*$(DOLLAR)$(DOLLAR)//g' \
+ -e 's/^[[:space:]][[:space:]]*//g' \
+ -e 's/[[:space:]][[:space:]]*$(DOLLAR)$(DOLLAR)//g' \
+ -e '/^[[:space:]]*$(DOLLAR)$(DOLLAR)/d' \
+ -e 's/[[:space:]][[:space:]]*/ /g' \
+ -e 's/\([^ ][^ ]*\) \([^ ][^ ]*\) \([^ ][^ ]*\) \([^ ][^ ]*\).*/++\1.\2.\3/' \
+ $(filter %.imp,$(othersrc)) \
+ --append $(outbase).rsp \
+ )
+ $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP_BD) $(TOOL_OPENWATCOM_AR) $(flags) $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) @$(outbase).rsp
+endef
+
+TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map
+TOOL_OPENWATCOM_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM_LINK_PROGRAM_DEPORD =
+define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_OPENWATCOM_LD) \
+ $(flags) \
+ -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
+TOOL_OPENWATCOM_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).map
+TOOL_OPENWATCOM_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM_LINK_DLL_DEPORD =
+define TOOL_OPENWATCOM_LINK_DLL_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_OPENWATCOM_LD) \
+ $(flags) \
+ -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
+TOOL_OPENWATCOM_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map
+TOOL_OPENWATCOM_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_OPENWATCOM_LINK_SYSMOD_DEPORD =
+define TOOL_OPENWATCOM_LINK_SYSMOD_CMDS
+ $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_OPENWATCOM_LD) \
+ $(flags) \
+ -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
+ $(TOOL_OPENWATCOM_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
+ $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
+endef
+
diff --git a/kBuild/tools/StandardDTrace.kmk b/kBuild/tools/StandardDTrace.kmk
new file mode 100644
index 0000000..ec0d397
--- /dev/null
+++ b/kBuild/tools/StandardDTrace.kmk
@@ -0,0 +1,54 @@
+# $Id: StandardDTrace.kmk 3497 2021-03-31 19:36:02Z bird $
+## @file
+# Standard DTrace tool.
+#
+
+#
+# Copyright (c) 2012-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_StandardDTrace := Standard DTrace or similar.
+TOOL_StandardDTrace_DTRACE := dtrace
+
+TOOL_StandardDTrace_DTRACE_HDR_FLAGS := -h
+define TOOL_StandardDTrace_DTRACE_HDR_CMDS
+ $(QUIET)$(TOOL_StandardDTrace_DTRACE) $(flags) \
+ -o "$(out)" -s "$(source)"
+endef
+
+TOOL_StandardDTrace_DTRACE_OBJ_NOT_NEEDED := darwin
+TOOL_StandardDTrace_DTRACE_OBJ_FLAGS := -G
+# Note! We have to exclude gcc style precompiled headers here as they are automatically
+# added to the list of object files (see func_kbuild_source_one in kbuild.c).
+define TOOL_StandardDTrace_DTRACE_OBJ_CMDS
+ $(QUIET)$(TOOL_StandardDTrace_DTRACE) \
+ $(if-expr $(intersects $(bld_trg_arch),$(KBUILD_ARCHES_64)),-64,-32) \
+ $(flags) \
+ -o "$(out)" -s "$(source)" \
+ $$(filter-out %-dtrace-object-format.o %.h.gch, $$($(target)_2_OBJS))
+endef
+
diff --git a/kBuild/tools/TAR.kmk b/kBuild/tools/TAR.kmk
new file mode 100644
index 0000000..f23a302
--- /dev/null
+++ b/kBuild/tools/TAR.kmk
@@ -0,0 +1,75 @@
+# $Id: TAR.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - tar unpacker.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_TAR := tar unpacker.
+
+# Tool Specific Properties
+ifndef TOOL_TAR_TAR
+ TOOL_TAR_TAR := $(wildcard $(KBUILD_DEVTOOLS_HST)/tar/v*/tar$(HOSTSUFF_EXE))
+ ifeq ($(TOOL_TAR_TAR),)
+ TOOL_TAR_TAR := $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/tar$(HOSTSUFF_EXE))
+ endif
+ ifneq ($(TOOL_TAR_TAR),)
+ TOOL_TAR_TAR := $(lastword $(sort $(TOOL_TAR_TAR)))
+ else
+ TOOL_TAR_TAR := tar$(HOSTSUFF_EXE)
+ endif
+else
+ TOOL_TAR_TAR := $(TOOL_TAR_TAR)
+endif
+TOOL_TAR_UNPACK ?= $(TOOL_TAR_TAR)
+
+# General Properties used by kBuild
+TOOL_TAR_UNPACKFLAGS ?=
+
+## UNPACK one file.
+# @param $(target) Normalized main target name.
+# @param $(archive) The file to unpack.
+# @param $(flags) Flags.
+# @param $(inst) Where to unpack it.
+# @param $(out) Where to write the file list.
+TOOL_TAR_UNPACK_OUTPUT =
+TOOL_TAR_UNPACK_DEPEND =
+TOOL_TAR_UNPACK_DEPORD =
+ifeq ($(KBUILD_HOST),win) # hacking with buggy unxutils on windows. it doesn't like driver letters.
+define TOOL_TAR_UNPACK_CMDS
+ $(QUIET)$(TOOL_TAR_UNPACK) -x $(flags) -C $(subst G:,,$(inst)) -f $(archive)
+ $(QUIET)$(TOOL_TAR_UNPACK) -t $(filter-out -v --verbose,$(flags)) -f $(archive) > $(out)
+endef
+else
+define TOOL_TAR_UNPACK_CMDS
+ $(QUIET)$(TOOL_TAR_UNPACK) -x $(flags) -C $(inst) -f $(archive)
+ $(QUIET)$(TOOL_TAR_UNPACK) -t $(filter-out -v --verbose,$(flags)) -f $(archive) > $(out)
+endef
+endif
+
diff --git a/kBuild/tools/TARBZ2.kmk b/kBuild/tools/TARBZ2.kmk
new file mode 100644
index 0000000..7542f01
--- /dev/null
+++ b/kBuild/tools/TARBZ2.kmk
@@ -0,0 +1,37 @@
+# $Id: TARBZ2.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - tar.bz2 unpacker.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_TARBZ2 := tar.bz2 unpacker.
+TOOL_TARBZ2_EXTENDS = TAR
+TOOL_TARBZ2_UNPACKFLAGS ?= -j
+
diff --git a/kBuild/tools/TARGZ.kmk b/kBuild/tools/TARGZ.kmk
new file mode 100644
index 0000000..2277ca0
--- /dev/null
+++ b/kBuild/tools/TARGZ.kmk
@@ -0,0 +1,37 @@
+# $Id: TARGZ.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - tar.gz unpacker.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_TARGZ := tar.gz unpacker.
+TOOL_TARGZ_EXTENDS = TAR
+TOOL_TARGZ_UNPACKFLAGS ?= -z
+
diff --git a/kBuild/tools/VAC308.kmk b/kBuild/tools/VAC308.kmk
new file mode 100644
index 0000000..d2ba849
--- /dev/null
+++ b/kBuild/tools/VAC308.kmk
@@ -0,0 +1,206 @@
+# $Id: VAC308.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - VisualAge for C++ v3.08.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VAC308 := VisualAge for C++ v3.08
+
+# Determin VAC308 location.
+ifndef PATH_TOOL_VAC308
+ PATH_TOOL_VAC308 := $(wildcard $(KBUILD_DEVTOOLS_HST)/vac/v3.0.8*)
+ ifeq ($(PATH_TOOL_VAC308),)
+ PATH_TOOL_VAC308 := $(wildcard $(KBUILD_DEVTOOLS_HST)/vac/v308*)
+ endif
+ ifeq ($(PATH_TOOL_VAC308),)
+ PATH_TOOL_VAC308 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/vac/v3.0.8*)
+ ifeq ($(PATH_TOOL_VAC308),)
+ PATH_TOOL_VAC308 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/vac/v308*)
+ endif
+ endif
+ ifeq ($(PATH_TOOL_VAC308),)
+ PATH_TOOL_VAC308 := $(firstword $(rsort $(PATH_TOOL_VAC308)))
+ endif
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VAC308 := $(PATH_TOOL_VAC308)
+endif
+ifneq ($(PATH_TOOL_VAC308),)
+ TOOL_VAC308_PATHLESS :=
+
+ PATH_TOOL_VAC308_BIN ?= $(PATH_TOOL_VAC308)/bin
+ PATH_TOOL_VAC308_LIB ?= $(PATH_TOOL_VAC308)/lib
+ PATH_TOOL_VAC308_INC ?= $(PATH_TOOL_VAC308)/include
+ PATH_TOOL_VAC308_DLL ?= $(PATH_TOOL_VAC308)/dll
+ PATH_TOOL_VAC308_HELP ?= $(PATH_TOOL_VAC308)/help
+ PATH_TOOL_VAC308_LOCALE ?= $(PATH_TOOL_VAC308)/locale
+
+ TOOL_VAC308_ENV_SETUP ?= $(REDIRECT) \
+ -E 'BEGINLIBPATH=$(PATH_TOOL_VAC308_DLL);$(BEGINLIBPATH)' \
+ -E 'DPATH=$(PATH_TOOL_VAC308_LOCALE);$(PATH_TOOL_VAC308_HELP);$(DPATH)' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 \
+ --
+ TOOL_VAC308_CC ?= $(PATH_TOOL_VAC308_BIN)/icc$(HOSTSUFF_EXE)
+ TOOL_VAC308_CXX ?= $(PATH_TOOL_VAC308_BIN)/icc$(HOSTSUFF_EXE)
+ TOOL_VAC308_AR ?= $(PATH_TOOL_VAC308_BIN)/ilib$(HOSTSUFF_EXE)
+ TOOL_VAC308_LD ?= $(PATH_TOOL_VAC308_BIN)/icc$(HOSTSUFF_EXE)
+ TOOL_VAC308_RC ?= $(PATH_TOOL_VAC308_BIN)/rc$(HOSTSUFF_EXE)
+
+else
+ # Pathless, relies on the environment.
+ TOOL_VAC308_PATHLESS := yes
+ TOOL_VAC308_ENV_SETUP ?= $(REDIRECT) \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 \
+ --
+ TOOL_VAC308_CC ?= icc$(HOSTSUFF_EXE)
+ TOOL_VAC308_CXX ?= icc$(HOSTSUFF_EXE)
+ TOOL_VAC308_AR ?= ilib$(HOSTSUFF_EXE)
+ TOOL_VAC308_LD ?= icc$(HOSTSUFF_EXE)
+ TOOL_VAC308_RC ?= rc$(HOSTSUFF_EXE)
+
+endif
+
+# More tool specific properties.
+# Note: implib isn't really a part of VAC308.
+TOOL_VAC308_IMP ?= implib$(HOSTSUFF_EXE)
+TOOL_VAC308_IMPFLAGS ?= /nologo /noignorecase
+
+# General Properties used by kBuild
+TOOL_VAC308_COBJSUFF ?= .obj
+TOOL_VAC308_CFLAGS ?= -Q+
+TOOL_VAC308_CFLAGS.debug ?= -Ti+
+TOOL_VAC308_CFLAGS.release ?= -O
+TOOL_VAC308_CINCS ?= $(PATH_TOOL_VAC308_INC)
+TOOL_VAC308_CDEFS ?=
+
+TOOL_VAC308_CXXOBJSUFF ?= .obj
+TOOL_VAC308_CXXFLAGS ?= -Q+
+TOOL_VAC308_CXXFLAGS.debug ?= -Ti
+TOOL_VAC308_CXXFLAGS.release ?= -O
+TOOL_VAC308_CXXINCS ?= $(PATH_TOOL_VAC308_INC)
+TOOL_VAC308_CXXDEFS ?=
+
+TOOL_VAC308_RCOBJSUFF ?= .res
+TOOL_VAC308_RCFLAGS ?= -n
+TOOL_VAC308_RCINCS ?=
+TOOL_VAC308_RCDEFS ?=
+
+TOOL_VAC308_ARFLAGS ?= /nologo /noignorecase
+TOOL_VAC308_ARLIBSUFF ?= .lib
+
+TOOL_VAC308_LDFLAGS ?= -Q+
+TOOL_VAC308_LDFLAGS.debug ?= -Ti+
+
+
+
+TOOL_VAC308_COMPILE_C_DEPEND =
+TOOL_VAC308_COMPILE_C_DEPORD =
+TOOL_VAC308_COMPILE_C_OUTPUT = $(obj).ii
+define TOOL_VAC308_COMPILE_C_CMDS
+ $(QUIET) $(call TOOL_VAC308_ENV_SETUP) $(TOOL_VAC308_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fo$(obj)\
+ $(abspath $(source))
+ $(QUIET) $(call TOOL_VAC308_ENV_SETUP,,-wo $(obj).ii) $(TOOL_VAC308_CC) -P+ -Pd+ \
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(abspath $(source))
+ $(QUIET)$(DEP_PRE) -f -s -o $(dep) -t $(obj) $(obj).ii
+endef
+
+TOOL_VAC308_COMPILE_CXX_DEPEND =
+TOOL_VAC308_COMPILE_CXX_DEPORD =
+TOOL_VAC308_COMPILE_CXX_OUTPUT = $(obj).ii
+define TOOL_VAC308_COMPILE_CXX_CMDS
+ $(QUIET) $(call TOOL_VAC308_ENV_SETUP) $(TOOL_VAC308_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fo$(obj)\
+ $(abspath $(source))
+ $(QUIET) $(call TOOL_VAC308_ENV_SETUP,,-wo $(obj).ii) $(TOOL_VAC308_CXX) -P+ -Pd+ \
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(abspath $(source))
+ $(QUIET)$(DEP_PRE) -f -s -o $(dep) -t $(obj) $(obj).ii
+endef
+
+TOOL_VAC308_COMPILE_RC_OUTPUT =
+TOOL_VAC308_COMPILE_RC_DEPEND =
+TOOL_VAC308_COMPILE_RC_DEPORD =
+define TOOL_VAC308_COMPILE_RC_CMDS
+ $(QUIET) $(call TOOL_VAC308_ENV_SETUP) $(TOOL_VAC308_RC) -r\
+ $(flags) $(addprefix -i, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
+ $(subst /,\\,$(abspath $(source))) \
+ $(obj)
+endef
+
+TOOL_VAC308_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
+TOOL_VAC308_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VAC308_LINK_LIBRARY_DEPORD =
+define TOOL_VAC308_LINK_LIBRARY_CMDS
+ $(if $(strip $(othersrc)),\
+ $(QUIET)$(call TOOL_VAC308_ENV_SETUP) \
+ $(TOOL_VAC308_IMP) $(TOOL_VAC308_IMPFLAGS) $(subst /,\\,$(out)) $(subst /,\\,$(othersrc)) )
+ $(if $(strip $(objs)),$(QUIET)$(call TOOL_VAC308_ENV_SETUP) \
+ $(TOOL_VAC308_AR) $(flags) $(subst /,\\,$(out)) $(foreach obj,$(subst /,\\,$(objs)),+"$(obj)") ";" )
+endef
+
+TOOL_VAC308_LINK_PROGRAM_OUTPUT = $(outbase).map
+TOOL_VAC308_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VAC308_LINK_PROGRAM_DEPORD =
+define TOOL_VAC308_LINK_PROGRAM_CMDS
+ $(QUIET)$(call TOOL_VAC308_ENV_SETUP,$(subst ;$(SP),;,$(foreach one,$(libpath),$(one);))) \
+ $(TOOL_VAC308_LD) $(flags) -Fe$(out) -Fm$(outbase).map $(filter-out %.res,$(objs)) $(libs) $(othersrc)
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_VAC308_ENV_SETUP) \
+ $(TOOL_VAC308_RC) $(filter %.res,$(objs)) $(out))
+endef
+
+TOOL_VAC308_LINK_DLL_OUTPUT = $(outbase).map
+TOOL_VAC308_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VAC308_LINK_DLL_DEPORD =
+define TOOL_VAC308_LINK_DLL_CMDS
+ $(QUIET)$(call TOOL_VAC308_ENV_SETUP,$(subst ;$(SP),;,$(foreach one,$(libpath),$(one);))) \
+ $(TOOL_VAC308_LD) /B"/DLL" $(flags) -Fe$(out) -Fm$(outbase).map $(filter-out %.res,$(objs)) $(libs) $(othersrc)
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_VAC308_ENV_SETUP) \
+ $(TOOL_VAC308_RC) $(filter %.res,$(objs)) $(out))
+endef
+
+TOOL_VAC308_LINK_SYSMOD_OUTPUT = $(outbase).map
+TOOL_VAC308_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VAC308_LINK_SYSMOD_DEPORD =
+define TOOL_VAC308_LINK_SYSMOD_CMDS
+ $(QUIET)$(call TOOL_VAC308_ENV_SETUP,$(subst ;$(SP),;,$(foreach one,$(libpath),$(one);))) \
+ $(TOOL_VAC308_LD) $(flags) -Fe$(out) -Fm$(outbase).map $(filter-out %.res,$(objs)) $(libs) $(othersrc)
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_VAC308_ENV_SETUP) \
+ $(TOOL_VAC308_RC) $(filter %.res,$(objs)) $(out))
+endef
+
diff --git a/kBuild/tools/VCC100.kmk b/kBuild/tools/VCC100.kmk
new file mode 100644
index 0000000..f746f22
--- /dev/null
+++ b/kBuild/tools/VCC100.kmk
@@ -0,0 +1,431 @@
+# $Id: VCC100.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC100 := Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting $(KBUILD_TARGET).
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC100
+ PATH_TOOL_VCC100 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/vcc/v10*)
+ ifeq ($(PATH_TOOL_VCC100),)
+ PATH_TOOL_VCC100 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v10*)
+ endif
+ ifeq ($(PATH_TOOL_VCC100),)
+ PATH_TOOL_VCC100 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v10*)
+ endif
+ ifeq ($(PATH_TOOL_VCC100),)
+ PATH_TOOL_VCC100 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v10*)
+ endif
+ ifeq ($(PATH_TOOL_VCC100),)
+ PATH_TOOL_VCC100 := $(lastword $(sort $(PATH_TOOL_VCC100)))
+ endif
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC100 := $(PATH_TOOL_VCC100)
+endif
+ifneq ($(PATH_TOOL_VCC100),)
+ ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
+ PATH_TOOL_VCC100_BIN.amd64 ?= $(PATH_TOOL_VCC100)/bin/amd64
+ else
+ PATH_TOOL_VCC100_BIN.amd64 ?= $(PATH_TOOL_VCC100)/bin/x86_amd64
+ endif
+ PATH_TOOL_VCC100_BIN.x86 ?= $(PATH_TOOL_VCC100)/bin
+ PATH_TOOL_VCC100_BIN ?= $(PATH_TOOL_VCC100_BIN.$(KBUILD_TARGET_ARCH))
+ PATH_TOOL_VCC100_LIB.amd64 ?= $(PATH_TOOL_VCC100)/lib/amd64
+ PATH_TOOL_VCC100_LIB.x86 ?= $(PATH_TOOL_VCC100)/lib
+ PATH_TOOL_VCC100_LIB ?= $(PATH_TOOL_VCC100_LIB.$(KBUILD_TARGET_ARCH))
+ PATH_TOOL_VCC100_INC ?= $(PATH_TOOL_VCC100)/include
+ PATH_TOOL_VCC100_ATLMFC ?= $(PATH_TOOL_VCC100X86)/atlmfc
+ PATH_TOOL_VCC100_ATLMFC_INC ?= $(PATH_TOOL_VCC100_ATLMFC)/include
+ PATH_TOOL_VCC100_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC100_ATLMFC)/lib
+ PATH_TOOL_VCC100_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC100_ATLMFC)/lib/amd64
+ PATH_TOOL_VCC100_ATLMFC_LIB ?= $(PATH_TOOL_VCC100_ATLMFC_LIB.$(KBUILD_TARGET_ARCH))
+ TOOL_VCC100_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/cl.exe
+ TOOL_VCC100_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/cl.exe
+ TOOL_VCC100_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/ml64.exe
+ TOOL_VCC100_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/lib.exe
+ TOOL_VCC100_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/link.exe
+ TOOL_VCC100_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/dumpbin.exe
+ TOOL_VCC100_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100_BIN)/editbin.exe
+else
+ # Pathless, relies on the environment.
+ TOOL_VCC100_CC ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC100_CXX ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC100_AS ?= $(EXEC_X86_WIN32) ml64.exe
+ TOOL_VCC100_AR ?= $(EXEC_X86_WIN32) lib.exe
+ TOOL_VCC100_LD ?= $(EXEC_X86_WIN32) link.exe
+ TOOL_VCC100_DUMPBIN ?= $(EXEC_X86_WIN32) dumpbin.exe
+ TOOL_VCC100_EDITBIN ?= $(EXEC_X86_WIN32) editbin.exe
+endif
+TOOL_VCC100_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC100_RC_CACHED)
+TOOL_VCC100_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC100_MT_CACHED)
+
+# The following in duplicated in VCC100.kmk and VCC100X86.kmk.
+TOOL_VCC100_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC100_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC100_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Disabled fast DEP_IDB based dependencies.
+#VCC100_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC100_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC100_COBJSUFF ?= .obj
+TOOL_VCC100_CFLAGS ?= -TC -nologo -Zi
+TOOL_VCC100_CFLAGS.debug ?=
+TOOL_VCC100_CFLAGS.dbgopt ?= -O2
+TOOL_VCC100_CFLAGS.release ?= -O2
+TOOL_VCC100_CFLAGS.profile ?= -O2
+TOOL_VCC100_CINCS ?= $(PATH_TOOL_VCC100_INC)
+TOOL_VCC100_CDEFS ?=
+
+TOOL_VCC100_CXXOBJSUFF ?= .obj
+TOOL_VCC100_CXXFLAGS ?= -TP -nologo -Zi
+TOOL_VCC100_CXXFLAGS.debug ?=
+TOOL_VCC100_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC100_CXXFLAGS.release ?= -O2
+TOOL_VCC100_CXXFLAGS.profile ?= -O2
+TOOL_VCC100_CXXINCS ?= $(PATH_TOOL_VCC100_INC) $(PATH_TOOL_VCC100_ATLMFC_INC)
+TOOL_VCC100_CXXDEFS ?=
+
+TOOL_VCC100_ASOBJSUFF ?= .obj
+
+TOOL_VCC100_RCOBJSUFF ?= .res
+TOOL_VCC100_RCINCS ?= $(PATH_TOOL_VCC100_INC) $(PATH_TOOL_VCC100_ATLMFC_INC)
+
+TOOL_VCC100_ARFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC100_ARFLAGS.x86 ?= -machine:x86
+TOOL_VCC100_ARFLAGS ?= -nologo
+TOOL_VCC100_ARLIBSUFF ?= .lib
+
+TOOL_VCC100_LDFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC100_LDFLAGS.x86 ?= -machine:x86
+TOOL_VCC100_LDFLAGS ?= -nologo
+TOOL_VCC100_LDFLAGS.debug ?= -debug
+TOOL_VCC100_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC100_LDFLAGS.profile ?= -debug
+TOOL_VCC100_LDFLAGS.release ?=
+TOOL_VCC100_LIBPATH.amd64 ?= $(PATH_TOOL_VCC100_LIB.amd64) $(PATH_TOOL_VCC100_ATLMFC_LIB.amd64)
+TOOL_VCC100_LIBPATH.x86 ?= $(PATH_TOOL_VCC100_LIB.x86) $(PATH_TOOL_VCC100_ATLMFC_LIB.x86)
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100_COMPILE_C_DEPEND =
+TOOL_VCC100_COMPILE_C_DEPORD =
+TOOL_VCC100_COMPILE_C_OUTPUT =
+TOOL_VCC100_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC100_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC100_PDB, $(outbase)-obj,idb)
+define TOOL_VCC100_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC100_COMPILE_CXX_DEPORD =
+TOOL_VCC100_COMPILE_CXX_OUTPUT =
+TOOL_VCC100_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC100_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC100_PDB, $(outbase)-obj,idb))
+define TOOL_VCC100_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE),)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+endef
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC100-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC100-PCH_EXTENDS := VCC100
+TOOL_VCC100-PCH_CXXOBJSUFF := .obj
+TOOL_VCC100-PCH_CXXINCS = $(TOOL_VCC100_CXXINCS)
+TOOL_VCC100-PCH_CXXFLAGS.debug = $(TOOL_VCC100_CXXFLAGS.debug)
+TOOL_VCC100-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC100_CXXFLAGS.dbgopt)
+TOOL_VCC100-PCH_CXXFLAGS.release = $(TOOL_VCC100_CXXFLAGS.release)
+TOOL_VCC100-PCH_CXXFLAGS.profile = $(TOOL_VCC100_CXXFLAGS.profile)
+TOOL_VCC100-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC100-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC100-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC100-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC100_KSUBMIT
+ define TOOL_VCC100-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC100_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100_COMPILE_RC_OUTPUT =
+TOOL_VCC100_COMPILE_RC_DEPEND =
+TOOL_VCC100_COMPILE_RC_DEPORD =
+define TOOL_VCC100_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC100_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC100_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC100_LINK_LIBRARY_DEPORD =
+TOOL_VCC100_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC100_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC100_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC100_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100_LINK_PROGRAM_DEPORD =
+TOOL_VCC100_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC100_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC100_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC100_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC100_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC100_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC100_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC100_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC100_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100_LINK_SYSMOD_DEPORD =
+TOOL_VCC100_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC100_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC100_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC100AMD64.kmk b/kBuild/tools/VCC100AMD64.kmk
new file mode 100644
index 0000000..ffa16ff
--- /dev/null
+++ b/kBuild/tools/VCC100AMD64.kmk
@@ -0,0 +1,456 @@
+# $Id: VCC100AMD64.kmk 3313 2020-03-16 02:31:38Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC100AMD64 := Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC100AMD64
+ PATH_TOOL_VCC100AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v10*)
+ ifeq ($(PATH_TOOL_VCC100AMD64),)
+ PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100)
+ endif
+ ifeq ($(PATH_TOOL_VCC100AMD64),)
+ PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100X86)
+ endif
+ ifeq ($(PATH_TOOL_VCC100AMD64),)
+ PATH_TOOL_VCC100AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v10*)
+ endif
+ ifneq ($(PATH_TOOL_VCC100AMD64),)
+ PATH_TOOL_VCC100AMD64 := $(lastword $(sort $(PATH_TOOL_VCC100AMD64)))
+ else
+ $(warning kBuild: PATH_TOOL_VCC100AMD64 cannot be determined!)
+ PATH_TOOL_VCC100AMD64 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v10
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100AMD64)
+endif
+ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
+PATH_TOOL_VCC100AMD64_BIN ?= $(PATH_TOOL_VCC100AMD64)/bin/amd64
+else
+PATH_TOOL_VCC100AMD64_BIN ?= $(PATH_TOOL_VCC100AMD64)/bin/x86_amd64
+endif
+PATH_TOOL_VCC100AMD64_LIB ?= $(PATH_TOOL_VCC100AMD64)/lib/amd64
+PATH_TOOL_VCC100AMD64_INC ?= $(PATH_TOOL_VCC100AMD64)/include
+PATH_TOOL_VCC100AMD64_ATLMFC ?= $(PATH_TOOL_VCC100AMD64)/atlmfc
+PATH_TOOL_VCC100AMD64_ATLMFC_INC ?= $(PATH_TOOL_VCC100AMD64_ATLMFC)/include
+PATH_TOOL_VCC100AMD64_ATLMFC_LIB ?= $(PATH_TOOL_VCC100AMD64_ATLMFC)/lib/amd64
+TOOL_VCC100AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/cl.exe
+TOOL_VCC100AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/cl.exe
+TOOL_VCC100AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/ml64.exe
+#TOOL_VCC100AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/lib.exe - just an exec wrapper for the below
+TOOL_VCC100AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/link.exe /LIB
+TOOL_VCC100AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/link.exe
+TOOL_VCC100AMD64_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/dumpbin.exe
+TOOL_VCC100AMD64_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/editbin.exe
+TOOL_VCC100AMD64_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC100_RC_CACHED)
+TOOL_VCC100AMD64_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC100_MT_CACHED)
+ifdef TOOL_VCC100AMD64_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(PATH_TOOL_VCC100AMD64_BIN),-9),x86_amd64)
+ TOOL_VCC100AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ if $(KBUILD_KMK_REVISION) > 3311
+ TOOL_VCC100AMD64_KSUBMIT_SPECIAL_ENV = -s "_MSPDBSRV_ENDPOINT_=kBuild_vcc10_amd64_@@AUTHENTICATION_ID@@_$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),common,@@PROCESS_GROUP@@)"
+ endif
+ TOOL_VCC100AMD64_KSUBMIT_DD = $(TOOL_VCC100AMD64_KSUBMIT) $(TOOL_VCC100AMD64_KSUBMIT_SPECIAL_ENV) --
+ else
+ # "fatal error C1902: Program database manager mismatch; please check your installation" when mixing with the 32-bit compiler.
+ #TOOL_VCC100AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ #TOOL_VCC100AMD64_KSUBMIT_DD = $(TOOL_VCC100AMD64_KSUBMIT) --
+ endif
+ endif
+endif
+
+# The following in duplicated in VCC100.kmk and VCC100X86.kmk.
+TOOL_VCC100_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC100_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC100_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Disabled fast DEP_IDB based dependencies.
+#VCC100AMD64_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC100AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC100AMD64_COBJSUFF ?= .obj
+TOOL_VCC100AMD64_CFLAGS ?= -TC -nologo -Zi
+TOOL_VCC100AMD64_CFLAGS.debug ?=
+TOOL_VCC100AMD64_CFLAGS.dbgopt ?= -O2
+TOOL_VCC100AMD64_CFLAGS.release ?= -O2
+TOOL_VCC100AMD64_CFLAGS.profile ?= -O2
+TOOL_VCC100AMD64_CINCS ?= $(PATH_TOOL_VCC100AMD64_INC)
+TOOL_VCC100AMD64_CDEFS ?=
+
+TOOL_VCC100AMD64_CXXOBJSUFF ?= .obj
+TOOL_VCC100AMD64_CXXFLAGS ?= -TP -nologo -Zi
+TOOL_VCC100AMD64_CXXFLAGS.debug ?=
+TOOL_VCC100AMD64_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC100AMD64_CXXFLAGS.release ?= -O2
+TOOL_VCC100AMD64_CXXFLAGS.profile ?= -O2
+TOOL_VCC100AMD64_CXXINCS ?= $(PATH_TOOL_VCC100AMD64_INC) $(PATH_TOOL_VCC100AMD64_ATLMFC_INC)
+TOOL_VCC100AMD64_CXXDEFS ?=
+
+TOOL_VCC100AMD64_ASOBJSUFF ?= .obj
+
+TOOL_VCC100AMD64_RCOBJSUFF ?= .res
+TOOL_VCC100AMD64_RCINCS ?= $(PATH_TOOL_VCC100AMD64_INC) $(PATH_TOOL_VCC100AMD64_ATLMFC_INC)
+
+TOOL_VCC100AMD64_ARFLAGS ?= -nologo -machine:amd64
+TOOL_VCC100AMD64_ARLIBSUFF ?= .lib
+
+TOOL_VCC100AMD64_LDFLAGS ?= -nologo -machine:amd64
+TOOL_VCC100AMD64_LDFLAGS.debug ?= -debug
+TOOL_VCC100AMD64_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC100AMD64_LDFLAGS.profile ?= -debug
+TOOL_VCC100AMD64_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100AMD64_COMPILE_C_DEPEND =
+TOOL_VCC100AMD64_COMPILE_C_DEPORD =
+TOOL_VCC100AMD64_COMPILE_C_OUTPUT =
+TOOL_VCC100AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC100AMD64_KSUBMIT
+ TOOL_VCC100AMD64_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC100AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) $(TOOL_VCC100AMD64_KSUBMIT_SPECIAL_ENV) \
+ -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100AMD64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC100AMD64_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100AMD64_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC100AMD64_COMPILE_CXX_DEPORD =
+TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT =
+TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC100AMD64_KSUBMIT
+ TOOL_VCC100AMD64_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) $(TOOL_VCC100AMD64_KSUBMIT_SPECIAL_ENV) \
+ -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj) -- $(TOOL_VCC100AMD64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE),)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE),)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC100AMD64_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC100AMD64-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC100AMD64-PCH_EXTENDS := VCC100AMD64
+TOOL_VCC100AMD64-PCH_CXXOBJSUFF := .obj
+TOOL_VCC100AMD64-PCH_CXXINCS = $(TOOL_VCC100AMD64_CXXINCS)
+TOOL_VCC100AMD64-PCH_CXXFLAGS.debug = $(TOOL_VCC100AMD64_CXXFLAGS.debug)
+TOOL_VCC100AMD64-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC100AMD64_CXXFLAGS.dbgopt)
+TOOL_VCC100AMD64-PCH_CXXFLAGS.release = $(TOOL_VCC100AMD64_CXXFLAGS.release)
+TOOL_VCC100AMD64-PCH_CXXFLAGS.profile = $(TOOL_VCC100AMD64_CXXFLAGS.profile)
+TOOL_VCC100AMD64-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC100AMD64-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC100AMD64-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC100AMD64-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC100AMD64_KSUBMIT
+ define TOOL_VCC100AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT) --no-pch-caching $(TOOL_VCC100AMD64_KSUBMIT_SPECIAL_ENV) \
+ -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100AMD64_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC100AMD64_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC100AMD64_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100AMD64_COMPILE_RC_DEPEND =
+TOOL_VCC100AMD64_COMPILE_RC_DEPORD =
+TOOL_VCC100AMD64_COMPILE_RC_OUTPUT =
+define TOOL_VCC100AMD64_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC100AMD64_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC100AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC100AMD64_LINK_LIBRARY_DEPORD =
+TOOL_VCC100AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC100AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC100AMD64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT_DD) $(TOOL_VCC100AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC100AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100AMD64_LINK_PROGRAM_DEPORD =
+TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100AMD64_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT_DD) $(TOOL_VCC100AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC100AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC100AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC100AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC100AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC100AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100AMD64_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT_DD) $(TOOL_VCC100AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC100AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100AMD64_LINK_SYSMOD_DEPORD =
+TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100AMD64_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100AMD64_KSUBMIT_DD) $(TOOL_VCC100AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC100X86.kmk b/kBuild/tools/VCC100X86.kmk
new file mode 100644
index 0000000..9ce86ed
--- /dev/null
+++ b/kBuild/tools/VCC100X86.kmk
@@ -0,0 +1,448 @@
+# $Id: VCC100X86.kmk 3313 2020-03-16 02:31:38Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC100X86 := Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting x86.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC100X86
+ PATH_TOOL_VCC100X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v10*)
+ ifeq ($(PATH_TOOL_VCC100X86),)
+ PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100)
+ endif
+ ifeq ($(PATH_TOOL_VCC100X86),)
+ PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100AMD64)
+ endif
+ ifeq ($(PATH_TOOL_VCC100X86),)
+ PATH_TOOL_VCC100X86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v10*)
+ endif
+ ifeq ($(PATH_TOOL_VCC100X86),)
+ PATH_TOOL_VCC100X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v10*)
+ endif
+ ifneq ($(PATH_TOOL_VCC100X86),)
+ PATH_TOOL_VCC100X86 := $(lastword $(sort $(PATH_TOOL_VCC100X86)))
+ else
+ $(warning kBuild: PATH_TOOL_VCC100X86 cannot be determined!)
+ PATH_TOOL_VCC100X86 := $(KBUILD_DEVTOOLS)/x86.win/vcc/v10
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100X86)
+endif
+PATH_TOOL_VCC100X86_BIN ?= $(PATH_TOOL_VCC100X86)/bin
+PATH_TOOL_VCC100X86_LIB ?= $(PATH_TOOL_VCC100X86)/lib
+PATH_TOOL_VCC100X86_INC ?= $(PATH_TOOL_VCC100X86)/include
+PATH_TOOL_VCC100X86_ATLMFC ?= $(PATH_TOOL_VCC100X86)/atlmfc
+PATH_TOOL_VCC100X86_ATLMFC_INC ?= $(PATH_TOOL_VCC100X86_ATLMFC)/include
+PATH_TOOL_VCC100X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC100X86_ATLMFC)/lib
+TOOL_VCC100X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/cl.exe
+TOOL_VCC100X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/cl.exe
+TOOL_VCC100X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/ml.exe
+#TOOL_VCC100X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/lib.exe - just an exec wrapper for the below
+TOOL_VCC100X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/link.exe /LIB
+TOOL_VCC100X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/link.exe
+TOOL_VCC100X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/dumpbin.exe
+TOOL_VCC100X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100X86_BIN)/editbin.exe
+TOOL_VCC100X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC100_RC_CACHED)
+TOOL_VCC100X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC100_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC100_MT_CACHED)
+ifdef TOOL_VCC100X86_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ TOOL_VCC100X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ if $(KBUILD_KMK_REVISION) > 3311
+ TOOL_VCC100X86_KSUBMIT_SPECIAL_ENV = -s "_MSPDBSRV_ENDPOINT_=kBuild_vcc10_x86_@@AUTHENTICATION_ID@@_$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),common,@@PROCESS_GROUP@@)"
+ endif
+ TOOL_VCC100X86_KSUBMIT_DD = $(TOOL_VCC100X86_KSUBMIT) $(TOOL_VCC100X86_KSUBMIT_SPECIAL_ENV) --
+ endif
+endif
+
+# The following in duplicated in VCC100.kmk and VCC100X86.kmk.
+TOOL_VCC100_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC100_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC100_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Disabled fast DEP_IDB based dependencies.
+#VCC100X86_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC100X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC100X86_COBJSUFF ?= .obj
+TOOL_VCC100X86_CFLAGS ?= -TC -nologo -Zi
+TOOL_VCC100X86_CFLAGS.debug ?=
+TOOL_VCC100X86_CFLAGS.dbgopt ?= -O2
+TOOL_VCC100X86_CFLAGS.release ?= -O2
+TOOL_VCC100X86_CFLAGS.profile ?= -O2
+TOOL_VCC100X86_CINCS ?= $(PATH_TOOL_VCC100X86_INC)
+TOOL_VCC100X86_CDEFS ?=
+
+TOOL_VCC100X86_CXXOBJSUFF ?= .obj
+TOOL_VCC100X86_CXXFLAGS ?= -TP -nologo -Zi
+TOOL_VCC100X86_CXXFLAGS.debug ?=
+TOOL_VCC100X86_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC100X86_CXXFLAGS.release ?= -O2
+TOOL_VCC100X86_CXXFLAGS.profile ?= -O2
+TOOL_VCC100X86_CXXINCS ?= $(PATH_TOOL_VCC100X86_INC) $(PATH_TOOL_VCC100X86_ATLMFC_INC)
+TOOL_VCC100X86_CXXDEFS ?=
+
+TOOL_VCC100X86_ASOBJSUFF ?= .obj
+
+TOOL_VCC100X86_RCOBJSUFF ?= .res
+TOOL_VCC100X86_RCINCS ?= $(PATH_TOOL_VCC100X86_INC) $(PATH_TOOL_VCC100X86_ATLMFC_INC)
+
+TOOL_VCC100X86_ARFLAGS ?= -nologo
+TOOL_VCC100X86_ARLIBSUFF ?= .lib
+
+TOOL_VCC100X86_LDFLAGS ?= -nologo -machine:x86
+TOOL_VCC100X86_LDFLAGS.debug ?= -debug
+TOOL_VCC100X86_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC100X86_LDFLAGS.profile ?= -debug
+TOOL_VCC100X86_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100X86_COMPILE_C_DEPEND =
+TOOL_VCC100X86_COMPILE_C_DEPORD =
+TOOL_VCC100X86_COMPILE_C_OUTPUT =
+TOOL_VCC100X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC100X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC100X86_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC100X86_KSUBMIT
+ TOOL_VCC100X86_COMPILE_C_DONT_PURGE_OUTPUT = 1 # speed
+ define TOOL_VCC100X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT) $(TOOL_VCC100X86_KSUBMIT_SPECIAL_ENV) \
+ -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100X86_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC100X86_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC100X86_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC100X86_COMPILE_CXX_DEPORD =
+TOOL_VCC100X86_COMPILE_CXX_OUTPUT =
+TOOL_VCC100X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC100X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC100X86_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC100X86_KSUBMIT
+ TOOL_VCC100X86_COMPILE_CXX_DONT_PURGE_OUTPUT = 1 # speed
+ define TOOL_VCC100X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT) $(TOOL_VCC100X86_KSUBMIT_SPECIAL_ENV) \
+ -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100X86_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE),)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100X86_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE),)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC100X86_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC100X86-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC100X86-PCH_EXTENDS := VCC100X86
+TOOL_VCC100X86-PCH_CXXOBJSUFF := .obj
+TOOL_VCC100X86-PCH_CXXINCS = $(TOOL_VCC100X86_CXXINCS)
+TOOL_VCC100X86-PCH_CXXFLAGS.debug = $(TOOL_VCC100X86_CXXFLAGS.debug)
+TOOL_VCC100X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC100X86_CXXFLAGS.dbgopt)
+TOOL_VCC100X86-PCH_CXXFLAGS.release = $(TOOL_VCC100X86_CXXFLAGS.release)
+TOOL_VCC100X86-PCH_CXXFLAGS.profile = $(TOOL_VCC100X86_CXXFLAGS.profile)
+TOOL_VCC100X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC100X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC100X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC100X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC100X86_KSUBMIT
+ define TOOL_VCC100X86-PCH_COMPILE_CXX_CMDS
+ $(RM) -f -- "$($(target)_1_VCC_COMMON_OBJ_PDB)"
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT) --no-pch-caching $(TOOL_VCC100X86_KSUBMIT_SPECIAL_ENV) \
+ -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC100X86_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC100X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC100X86_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC100X86_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC100X86_COMPILE_RC_DEPEND =
+TOOL_VCC100X86_COMPILE_RC_DEPORD =
+TOOL_VCC100X86_COMPILE_RC_OUTPUT =
+define TOOL_VCC100X86_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC100X86_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC100X86_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC100X86_LINK_LIBRARY_DEPORD =
+TOOL_VCC100X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC100X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC100X86_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT_DD) $(TOOL_VCC100X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC100X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100X86_LINK_PROGRAM_DEPORD =
+TOOL_VCC100X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC100X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC100X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100X86_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT_DD) $(TOOL_VCC100X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC100X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC100X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC100X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC100X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC100X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100X86_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT_DD) $(TOOL_VCC100X86_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC100X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC100X86_LINK_SYSMOD_DEPORD =
+TOOL_VCC100X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC100X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC100X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC100X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC100X86_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC100X86_KSUBMIT_DD) $(TOOL_VCC100X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC100X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC120.kmk b/kBuild/tools/VCC120.kmk
new file mode 100644
index 0000000..ffe15ad
--- /dev/null
+++ b/kBuild/tools/VCC120.kmk
@@ -0,0 +1,432 @@
+# $Id: VCC120.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC120 := Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting $(KBUILD_TARGET).
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC120
+ PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/vcc/v12*)
+ ifeq ($(PATH_TOOL_VCC120),)
+ PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v12*)
+ endif
+ ifeq ($(PATH_TOOL_VCC120),)
+ PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v12*)
+ endif
+ ifeq ($(PATH_TOOL_VCC120),)
+ PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v12*)
+ endif
+ ifeq ($(PATH_TOOL_VCC120),)
+ PATH_TOOL_VCC120 := $(lastword $(sort $(PATH_TOOL_VCC120)))
+ endif
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC120 := $(PATH_TOOL_VCC120)
+endif
+ifneq ($(PATH_TOOL_VCC120),)
+ if "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64" && exists("$(PATH_TOOL_VCC120AMD64)/bin/amd64") # Missing in express edition.
+ PATH_TOOL_VCC120_BIN.amd64 ?= $(PATH_TOOL_VCC120)/bin/amd64
+ else
+ PATH_TOOL_VCC120_BIN.amd64 ?= $(PATH_TOOL_VCC120)/bin/x86_amd64
+ endif
+ PATH_TOOL_VCC120_BIN.x86 ?= $(PATH_TOOL_VCC120)/bin
+ PATH_TOOL_VCC120_BIN ?= $(PATH_TOOL_VCC120_BIN.$(KBUILD_TARGET_ARCH))
+ PATH_TOOL_VCC120_LIB.amd64 ?= $(PATH_TOOL_VCC120)/lib/amd64
+ PATH_TOOL_VCC120_LIB.x86 ?= $(PATH_TOOL_VCC120)/lib
+ PATH_TOOL_VCC120_LIB ?= $(PATH_TOOL_VCC120_LIB.$(KBUILD_TARGET_ARCH))
+ PATH_TOOL_VCC120_INC ?= $(PATH_TOOL_VCC120)/include
+ PATH_TOOL_VCC120_ATLMFC ?= $(PATH_TOOL_VCC120X86)/atlmfc
+ PATH_TOOL_VCC120_ATLMFC_INC ?= $(PATH_TOOL_VCC120_ATLMFC)/include
+ PATH_TOOL_VCC120_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC120_ATLMFC)/lib
+ PATH_TOOL_VCC120_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC120_ATLMFC)/lib/amd64
+ PATH_TOOL_VCC120_ATLMFC_LIB ?= $(PATH_TOOL_VCC120_ATLMFC_LIB.$(KBUILD_TARGET_ARCH))
+ TOOL_VCC120_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/cl.exe
+ TOOL_VCC120_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/cl.exe
+ TOOL_VCC120_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/ml64.exe
+ TOOL_VCC120_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/lib.exe
+ TOOL_VCC120_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/link.exe
+ TOOL_VCC120_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/dumpbin.exe
+ TOOL_VCC120_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/editbin.exe
+else
+ # Pathless, relies on the environment.
+ TOOL_VCC120_CC ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC120_CXX ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC120_AS ?= $(EXEC_X86_WIN32) ml64.exe
+ TOOL_VCC120_AR ?= $(EXEC_X86_WIN32) lib.exe
+ TOOL_VCC120_LD ?= $(EXEC_X86_WIN32) link.exe
+ TOOL_VCC120_DUMPBIN ?= $(EXEC_X86_WIN32) dumpbin.exe
+ TOOL_VCC120_EDITBIN ?= $(EXEC_X86_WIN32) editbin.exe
+endif
+TOOL_VCC120_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC120_RC_CACHED)
+TOOL_VCC120_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC120_MT_CACHED)
+
+# The following in duplicated in VCC120.kmk and VCC120X86.kmk.
+TOOL_VCC120_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC120_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC120_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Disabled fast DEP_IDB based dependencies.
+#VCC120_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC120_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC120_COBJSUFF ?= .obj
+TOOL_VCC120_CFLAGS ?= -TC -nologo -Zi
+TOOL_VCC120_CFLAGS.debug ?=
+TOOL_VCC120_CFLAGS.dbgopt ?= -O2
+TOOL_VCC120_CFLAGS.release ?= -O2
+TOOL_VCC120_CFLAGS.profile ?= -O2
+TOOL_VCC120_CINCS ?= $(PATH_TOOL_VCC120_INC)
+TOOL_VCC120_CDEFS ?=
+
+TOOL_VCC120_CXXOBJSUFF ?= .obj
+TOOL_VCC120_CXXFLAGS ?= -TP -nologo -Zi
+TOOL_VCC120_CXXFLAGS.debug ?=
+TOOL_VCC120_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC120_CXXFLAGS.release ?= -O2
+TOOL_VCC120_CXXFLAGS.profile ?= -O2
+TOOL_VCC120_CXXINCS ?= $(PATH_TOOL_VCC120_INC) $(PATH_TOOL_VCC120_ATLMFC_INC)
+TOOL_VCC120_CXXDEFS ?=
+
+TOOL_VCC120_ASOBJSUFF ?= .obj
+
+TOOL_VCC120_RCOBJSUFF ?= .res
+TOOL_VCC120_RCINCS ?= $(PATH_TOOL_VCC120_INC) $(PATH_TOOL_VCC120_ATLMFC_INC)
+
+TOOL_VCC120_ARFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC120_ARFLAGS.x86 ?= -machine:x86
+TOOL_VCC120_ARFLAGS ?= -nologo
+TOOL_VCC120_ARLIBSUFF ?= .lib
+
+TOOL_VCC120_LDFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC120_LDFLAGS.x86 ?= -machine:x86
+TOOL_VCC120_LDFLAGS ?= -nologo
+TOOL_VCC120_LDFLAGS.debug ?= -debug
+TOOL_VCC120_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC120_LDFLAGS.profile ?= -debug
+TOOL_VCC120_LDFLAGS.release ?=
+TOOL_VCC120_LIBPATH.amd64 ?= $(PATH_TOOL_VCC120_LIB.amd64) $(PATH_TOOL_VCC120_ATLMFC_LIB.amd64)
+TOOL_VCC120_LIBPATH.x86 ?= $(PATH_TOOL_VCC120_LIB.x86) $(PATH_TOOL_VCC120_ATLMFC_LIB.x86)
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120_COMPILE_C_DEPEND =
+TOOL_VCC120_COMPILE_C_DEPORD =
+TOOL_VCC120_COMPILE_C_OUTPUT =
+TOOL_VCC120_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC120_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120_PDB, $(outbase)-obj,idb)
+define TOOL_VCC120_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC120_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC120_COMPILE_CXX_DEPORD =
+TOOL_VCC120_COMPILE_CXX_OUTPUT =
+TOOL_VCC120_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC120_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120_PDB, $(outbase)-obj,idb))
+define TOOL_VCC120_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC120_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+endef
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC120-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC120-PCH_EXTENDS := VCC120
+TOOL_VCC120-PCH_CXXOBJSUFF := .obj
+TOOL_VCC120-PCH_CXXINCS = $(TOOL_VCC120_CXXINCS)
+TOOL_VCC120-PCH_CXXFLAGS = $(TOOL_VCC120_CXXFLAGS) -FS
+TOOL_VCC120-PCH_CXXFLAGS.debug = $(TOOL_VCC120_CXXFLAGS.debug)
+TOOL_VCC120-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC120_CXXFLAGS.dbgopt)
+TOOL_VCC120-PCH_CXXFLAGS.release = $(TOOL_VCC120_CXXFLAGS.release)
+TOOL_VCC120-PCH_CXXFLAGS.profile = $(TOOL_VCC120_CXXFLAGS.profile)
+TOOL_VCC120-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC120-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC120-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC120-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC120_KSUBMIT
+ define TOOL_VCC120-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC120_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC120_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC120_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120_COMPILE_RC_OUTPUT =
+TOOL_VCC120_COMPILE_RC_DEPEND =
+TOOL_VCC120_COMPILE_RC_DEPORD =
+define TOOL_VCC120_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC120_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC120_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC120_LINK_LIBRARY_DEPORD =
+TOOL_VCC120_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC120_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC120_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC120_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120_LINK_PROGRAM_DEPORD =
+TOOL_VCC120_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC120_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC120_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC120_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC120_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC120_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC120_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC120_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC120_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120_LINK_SYSMOD_DEPORD =
+TOOL_VCC120_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC120_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC120_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC120AMD64.kmk b/kBuild/tools/VCC120AMD64.kmk
new file mode 100644
index 0000000..48dc41e
--- /dev/null
+++ b/kBuild/tools/VCC120AMD64.kmk
@@ -0,0 +1,465 @@
+# $Id: VCC120AMD64.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting AMD64.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC120AMD64 := Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting AMD64
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC120AMD64
+ PATH_TOOL_VCC120AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v12*)
+ ifeq ($(PATH_TOOL_VCC120AMD64),)
+ PATH_TOOL_VCC120AMD64 := $(PATH_TOOL_VCC120)
+ endif
+ ifeq ($(PATH_TOOL_VCC120AMD64),)
+ PATH_TOOL_VCC120AMD64 := $(PATH_TOOL_VCC120X86)
+ endif
+ ifeq ($(PATH_TOOL_VCC120AMD64),)
+ PATH_TOOL_VCC120AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v12*)
+ endif
+ ifneq ($(PATH_TOOL_VCC120AMD64),)
+ PATH_TOOL_VCC120AMD64 := $(lastword $(sort $(PATH_TOOL_VCC120AMD64)))
+ else
+ $(warning kBuild: PATH_TOOL_VCC120AMD64 cannot be determined!)
+ PATH_TOOL_VCC120AMD64 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v12
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC120AMD64 := $(PATH_TOOL_VCC120AMD64)
+endif
+if "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64" && exists("$(PATH_TOOL_VCC120AMD64)/bin/amd64") # Missing in express edition.
+PATH_TOOL_VCC120AMD64_BIN ?= $(PATH_TOOL_VCC120AMD64)/bin/amd64
+#$(error works now: $(PATH_TOOL_VCC120AMD64)/bin/amd64)
+else
+#$(error no joy: $(PATH_TOOL_VCC120AMD64)/bin/amd64)
+PATH_TOOL_VCC120AMD64_BIN_DLL ?= $(PATH_TOOL_VCC120AMD64)/bin
+PATH_TOOL_VCC120AMD64_BIN ?= $(PATH_TOOL_VCC120AMD64)/bin/x86_amd64
+endif
+PATH_TOOL_VCC120AMD64_LIB ?= $(PATH_TOOL_VCC120AMD64)/lib/amd64
+PATH_TOOL_VCC120AMD64_INC ?= $(PATH_TOOL_VCC120AMD64)/include
+PATH_TOOL_VCC120AMD64_ATLMFC ?= $(PATH_TOOL_VCC120AMD64)/atlmfc
+PATH_TOOL_VCC120AMD64_ATLMFC_INC ?= $(PATH_TOOL_VCC120AMD64_ATLMFC)/include
+PATH_TOOL_VCC120AMD64_ATLMFC_LIB ?= $(PATH_TOOL_VCC120AMD64_ATLMFC)/lib/amd64
+TOOL_VCC120AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/cl.exe
+TOOL_VCC120AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/cl.exe
+TOOL_VCC120AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/ml64.exe
+#TOOL_VCC120AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/lib.exe - just an exec wrapper for the below
+TOOL_VCC120AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/link.exe /LIB
+TOOL_VCC120AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/link.exe
+TOOL_VCC120AMD64_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/dumpbin.exe
+TOOL_VCC120AMD64_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120AMD64_BIN)/editbin.exe
+TOOL_VCC120AMD64_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC120_RC_CACHED)
+TOOL_VCC120AMD64_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC120_MT_CACHED)
+ifdef TOOL_VCC120AMD64_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(PATH_TOOL_VCC120AMD64_BIN),-9),x86_amd64)
+ TOOL_VCC120AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ ifdef PATH_TOOL_VCC120AMD64_BIN_DLL
+ TOOL_VCC120AMD64_KSUBMIT += --prepend 'PATH=$(PATH_TOOL_VCC120AMD64_BIN_DLL)$(HOST_PATH_SEP)'
+ endif
+ TOOL_VCC120AMD64_KSUBMIT_DD = $(TOOL_VCC120AMD64_KSUBMIT) --
+ else
+ # "fatal error C1902: Program database manager mismatch; please check your installation" when mixing with the 32-bit compiler.
+ #TOOL_VCC120AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ #TOOL_VCC120AMD64_KSUBMIT_DD = $(TOOL_VCC120AMD64_KSUBMIT) --
+ endif
+ endif
+else ifdef PATH_TOOL_VCC120AMD64_BIN_DLL
+ TOOL_VCC120AMD64_KSUBMIT_DD = $(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120AMD64_BIN_DLL)$(HOST_PATH_SEP)' --
+endif
+
+# The following in duplicated in VCC120.kmk and VCC120X86.kmk.
+TOOL_VCC120_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC120_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC120_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Disabled fast DEP_IDB based dependencies.
+#VCC120AMD64_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC120AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC120AMD64_COBJSUFF ?= .obj
+TOOL_VCC120AMD64_CFLAGS ?= -TC -nologo -Zi
+TOOL_VCC120AMD64_CFLAGS.debug ?=
+TOOL_VCC120AMD64_CFLAGS.dbgopt ?= -O2
+TOOL_VCC120AMD64_CFLAGS.release ?= -O2
+TOOL_VCC120AMD64_CFLAGS.profile ?= -O2
+TOOL_VCC120AMD64_CINCS ?= $(PATH_TOOL_VCC120AMD64_INC)
+TOOL_VCC120AMD64_CDEFS ?=
+
+TOOL_VCC120AMD64_CXXOBJSUFF ?= .obj
+TOOL_VCC120AMD64_CXXFLAGS ?= -TP -nologo -Zi
+TOOL_VCC120AMD64_CXXFLAGS.debug ?=
+TOOL_VCC120AMD64_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC120AMD64_CXXFLAGS.release ?= -O2
+TOOL_VCC120AMD64_CXXFLAGS.profile ?= -O2
+TOOL_VCC120AMD64_CXXINCS ?= $(PATH_TOOL_VCC120AMD64_INC) $(PATH_TOOL_VCC120AMD64_ATLMFC_INC)
+TOOL_VCC120AMD64_CXXDEFS ?=
+
+TOOL_VCC120AMD64_ASOBJSUFF ?= .obj
+
+TOOL_VCC120AMD64_RCOBJSUFF ?= .res
+TOOL_VCC120AMD64_RCINCS ?= $(PATH_TOOL_VCC120AMD64_INC) $(PATH_TOOL_VCC120AMD64_ATLMFC_INC)
+
+TOOL_VCC120AMD64_ARFLAGS ?= -nologo -machine:amd64
+TOOL_VCC120AMD64_ARLIBSUFF ?= .lib
+
+TOOL_VCC120AMD64_LDFLAGS ?= -nologo -machine:amd64
+TOOL_VCC120AMD64_LDFLAGS.debug ?= -debug
+TOOL_VCC120AMD64_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC120AMD64_LDFLAGS.profile ?= -debug
+TOOL_VCC120AMD64_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120AMD64_COMPILE_C_DEPEND =
+TOOL_VCC120AMD64_COMPILE_C_DEPORD =
+TOOL_VCC120AMD64_COMPILE_C_OUTPUT =
+TOOL_VCC120AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC120AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120AMD64_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC120AMD64_KSUBMIT
+ TOOL_VCC120AMD64_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC120AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120AMD64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120AMD64_COMPILE_C_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120AMD64_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120AMD64_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120AMD64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC120AMD64_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120AMD64_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC120AMD64_COMPILE_CXX_DEPORD =
+TOOL_VCC120AMD64_COMPILE_CXX_OUTPUT =
+TOOL_VCC120AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC120AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120AMD64_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC120AMD64_KSUBMIT
+ TOOL_VCC120AMD64_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC120AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120AMD64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120AMD64_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120AMD64_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120AMD64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC120AMD64_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC120AMD64-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC120AMD64-PCH_EXTENDS := VCC120AMD64
+TOOL_VCC120AMD64-PCH_CXXOBJSUFF := .obj
+TOOL_VCC120AMD64-PCH_CXXINCS = $(TOOL_VCC120AMD64_CXXINCS)
+TOOL_VCC120AMD64-PCH_CXXFLAGS = $(TOOL_VCC120AMD64_CXXFLAGS) -FS
+TOOL_VCC120AMD64-PCH_CXXFLAGS.debug = $(TOOL_VCC120AMD64_CXXFLAGS.debug)
+TOOL_VCC120AMD64-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC120AMD64_CXXFLAGS.dbgopt)
+TOOL_VCC120AMD64-PCH_CXXFLAGS.release = $(TOOL_VCC120AMD64_CXXFLAGS.release)
+TOOL_VCC120AMD64-PCH_CXXFLAGS.profile = $(TOOL_VCC120AMD64_CXXFLAGS.profile)
+TOOL_VCC120AMD64-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC120AMD64-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC120AMD64-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC120AMD64-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC120AMD64_KSUBMIT
+ define TOOL_VCC120AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120AMD64_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120AMD64_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120AMD64_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120AMD64_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC120AMD64_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120AMD64_COMPILE_RC_DEPEND =
+TOOL_VCC120AMD64_COMPILE_RC_DEPORD =
+TOOL_VCC120AMD64_COMPILE_RC_OUTPUT =
+## @todo Fix kmk_redirect so we can use it for setting PATH without spawning a shell or two
+define TOOL_VCC120AMD64_COMPILE_RC_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120AMD64_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120AMD64_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120AMD64_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC120AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC120AMD64_LINK_LIBRARY_DEPORD =
+TOOL_VCC120AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC120AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC120AMD64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT_DD) $(TOOL_VCC120AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC120AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120AMD64_LINK_PROGRAM_DEPORD =
+TOOL_VCC120AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC120AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC120AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120AMD64_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT_DD) $(TOOL_VCC120AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC120AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC120AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC120AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC120AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC120AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120AMD64_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT_DD) $(TOOL_VCC120AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC120AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120AMD64_LINK_SYSMOD_DEPORD =
+TOOL_VCC120AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC120AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC120AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120AMD64_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120AMD64_KSUBMIT_DD) $(TOOL_VCC120AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC120X86.kmk b/kBuild/tools/VCC120X86.kmk
new file mode 100644
index 0000000..7b4b48a
--- /dev/null
+++ b/kBuild/tools/VCC120X86.kmk
@@ -0,0 +1,465 @@
+# $Id: VCC120X86.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC120X86 := Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting x86.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC120X86
+ PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v12*)
+ ifeq ($(PATH_TOOL_VCC120X86),)
+ PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120)
+ endif
+ ifeq ($(PATH_TOOL_VCC120X86),)
+ PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120AMD64)
+ endif
+ ifeq ($(PATH_TOOL_VCC120X86),)
+ PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v12*)
+ endif
+ ifeq ($(PATH_TOOL_VCC120X86),)
+ PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v12*)
+ endif
+ ifneq ($(PATH_TOOL_VCC120X86),)
+ PATH_TOOL_VCC120X86 := $(lastword $(sort $(PATH_TOOL_VCC120X86)))
+ else
+ $(warning kBuild: PATH_TOOL_VCC120X86 cannot be determined!)
+ PATH_TOOL_VCC120X86 := $(KBUILD_DEVTOOLS)/x86.win/vcc/v12
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120X86)
+endif
+
+if "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64" && exists("$(PATH_TOOL_VCC120AMD64)/bin/amd64_x86") # Missing in express edition.
+ PATH_TOOL_VCC120X86_BIN_DLL ?= $(PATH_TOOL_VCC120X86)/bin/amd64
+ PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120X86)/bin/amd64_x86
+else
+ PATH_TOOL_VCC120X86_BIN_DLL ?=
+ PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120X86)/bin
+endif
+PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120X86)/bin
+PATH_TOOL_VCC120X86_LIB ?= $(PATH_TOOL_VCC120X86)/lib
+PATH_TOOL_VCC120X86_INC ?= $(PATH_TOOL_VCC120X86)/include
+PATH_TOOL_VCC120X86_ATLMFC ?= $(PATH_TOOL_VCC120X86)/atlmfc
+PATH_TOOL_VCC120X86_ATLMFC_INC ?= $(PATH_TOOL_VCC120X86_ATLMFC)/include
+PATH_TOOL_VCC120X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC120X86_ATLMFC)/lib
+TOOL_VCC120X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/cl.exe
+TOOL_VCC120X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/cl.exe
+TOOL_VCC120X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/ml.exe
+#TOOL_VCC120X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/lib.exe - just an exec wrapper for the below
+TOOL_VCC120X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/link.exe /LIB
+TOOL_VCC120X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/link.exe
+TOOL_VCC120X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/dumpbin.exe
+TOOL_VCC120X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/editbin.exe
+TOOL_VCC120X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC120_RC_CACHED)
+TOOL_VCC120X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC120_MT_CACHED)
+ifdef TOOL_VCC120X86_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ if "$(substr $(PATH_TOOL_VCC120X86_BIN),-10)" == "/amd64_x86"
+ TOOL_VCC120X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC120X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC120X86_BIN_DLL
+ TOOL_VCC120X86_KSUBMIT += --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)'
+ endif
+ TOOL_VCC120X86_KSUBMIT_DD = $(TOOL_VCC120X86_KSUBMIT) --
+ endif
+else ifdef PATH_TOOL_VCC120X86_BIN_DLL
+ TOOL_VCC120X86_KSUBMIT_DD = $(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' --
+endif
+
+# The following in duplicated in VCC120.kmk and VCC120X86.kmk.
+TOOL_VCC120_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC120_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC120_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Disabled fast DEP_IDB based dependencies.
+#VCC120X86_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC120X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC120X86_COBJSUFF ?= .obj
+TOOL_VCC120X86_CFLAGS ?= -TC -nologo -Zi
+TOOL_VCC120X86_CFLAGS.debug ?=
+TOOL_VCC120X86_CFLAGS.dbgopt ?= -O2
+TOOL_VCC120X86_CFLAGS.release ?= -O2
+TOOL_VCC120X86_CFLAGS.profile ?= -O2
+TOOL_VCC120X86_CINCS ?= $(PATH_TOOL_VCC120X86_INC)
+TOOL_VCC120X86_CDEFS ?=
+
+TOOL_VCC120X86_CXXOBJSUFF ?= .obj
+TOOL_VCC120X86_CXXFLAGS ?= -TP -nologo -Zi
+TOOL_VCC120X86_CXXFLAGS.debug ?=
+TOOL_VCC120X86_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC120X86_CXXFLAGS.release ?= -O2
+TOOL_VCC120X86_CXXFLAGS.profile ?= -O2
+TOOL_VCC120X86_CXXINCS ?= $(PATH_TOOL_VCC120X86_INC) $(PATH_TOOL_VCC120X86_ATLMFC_INC)
+TOOL_VCC120X86_CXXDEFS ?=
+
+TOOL_VCC120X86_ASOBJSUFF ?= .obj
+
+TOOL_VCC120X86_RCOBJSUFF ?= .res
+TOOL_VCC120X86_RCINCS ?= $(PATH_TOOL_VCC120X86_INC) $(PATH_TOOL_VCC120X86_ATLMFC_INC)
+
+TOOL_VCC120X86_ARFLAGS ?= -nologo -machine:x86
+TOOL_VCC120X86_ARLIBSUFF ?= .lib
+
+TOOL_VCC120X86_LDFLAGS ?= -nologo -machine:x86
+TOOL_VCC120X86_LDFLAGS.debug ?= -debug
+TOOL_VCC120X86_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC120X86_LDFLAGS.profile ?= -debug
+TOOL_VCC120X86_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120X86_COMPILE_C_DEPEND =
+TOOL_VCC120X86_COMPILE_C_DEPORD =
+TOOL_VCC120X86_COMPILE_C_OUTPUT =
+TOOL_VCC120X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC120X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120X86_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC120X86_KSUBMIT
+ TOOL_VCC120X86_COMPILE_C_DONT_PURGE_OUTPUT = 1 # speed
+ define TOOL_VCC120X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120X86_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120X86_COMPILE_C_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120X86_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC120X86_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC120X86_COMPILE_CXX_DEPORD =
+TOOL_VCC120X86_COMPILE_CXX_OUTPUT =
+TOOL_VCC120X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC120X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120X86_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC120X86_KSUBMIT
+ TOOL_VCC120X86_COMPILE_CXX_DONT_PURGE_OUTPUT = 1 # speed
+ define TOOL_VCC120X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120X86_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120X86_COMPILE_CXX_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120X86_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC120X86_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC120X86-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC120X86-PCH_EXTENDS := VCC120X86
+TOOL_VCC120X86-PCH_CXXOBJSUFF := .obj
+TOOL_VCC120X86-PCH_CXXINCS = $(TOOL_VCC120X86_CXXINCS)
+TOOL_VCC120X86-PCH_CXXFLAGS = $(TOOL_VCC120X86_CXXFLAGS) -FS
+TOOL_VCC120X86-PCH_CXXFLAGS.debug = $(TOOL_VCC120X86_CXXFLAGS.debug)
+TOOL_VCC120X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC120X86_CXXFLAGS.dbgopt)
+TOOL_VCC120X86-PCH_CXXFLAGS.release = $(TOOL_VCC120X86_CXXFLAGS.release)
+TOOL_VCC120X86-PCH_CXXFLAGS.profile = $(TOOL_VCC120X86_CXXFLAGS.profile)
+TOOL_VCC120X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC120X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC120X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC120X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC120X86_KSUBMIT
+ define TOOL_VCC120X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC120X86_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC120X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120X86_CXX) -c -Yc\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC120X86_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC120X86_COMPILE_RC_DEPEND =
+TOOL_VCC120X86_COMPILE_RC_DEPORD =
+TOOL_VCC120X86_COMPILE_RC_OUTPUT =
+## @todo Fix kmk_redirect so we can use it for setting PATH without spawning a shell or two
+define TOOL_VCC120X86_COMPILE_RC_CMDS
+ $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
+ ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,) $(TOOL_VCC120X86_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC120X86_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC120X86_LINK_LIBRARY_DEPORD =
+TOOL_VCC120X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC120X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC120X86_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC120X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120X86_LINK_PROGRAM_DEPORD =
+TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120X86_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC120X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC120X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC120X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC120X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC120X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120X86_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC120X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC120X86_LINK_SYSMOD_DEPORD =
+TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC120X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC120X86_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC140.kmk b/kBuild/tools/VCC140.kmk
new file mode 100644
index 0000000..6c222a7
--- /dev/null
+++ b/kBuild/tools/VCC140.kmk
@@ -0,0 +1,555 @@
+# $Id: VCC140.kmk 3343 2020-05-20 14:34:15Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), default target.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC140 := Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting $(KBUILD_TARGET).
+
+ifndef INCLUDED_WIN_COMMON_KMK
+ include $(KBUILD_PATH)/win-common.kmk
+endif
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC140
+ PATH_TOOL_VCC140 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.amd64/vcc/v14.0*/)))
+ ifeq ($(PATH_TOOL_VCC140),)
+ PATH_TOOL_VCC140 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.0*/)))
+ endif
+ ifeq ($(PATH_TOOL_VCC140),)
+ PATH_TOOL_VCC140 := $(PATH_TOOL_VCC140X86)
+ endif
+ ifeq ($(PATH_TOOL_VCC140),)
+ PATH_TOOL_VCC140 := $(PATH_TOOL_VCC140)
+ endif
+ ifeq ($(PATH_TOOL_VCC140),)
+ PATH_TOOL_VCC140 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.0*)))
+ ifeq ($(PATH_TOOL_VCC140),)
+ ## @todo Not sure it was placed in the 14.0 directory originally, maybe that's just what 2017 and 2019 does?
+ PATH_TOOL_VCC140 := $(firstfile $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
+ , $(rsortfiles $(qwildcard ,$(progfilesdir)/Microsoft\ Visual\ Studio\ 14.0/VC))))
+ ifeq ($(PATH_TOOL_VCC140),)
+ $(warning kBuild: PATH_TOOL_VCC140 cannot be determined!)
+ PATH_TOOL_VCC140 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v140
+ endif
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC140 := $(PATH_TOOL_VCC140)
+endif
+
+ifndef PATH_TOOL_VCC140_BASE_BIN
+PATH_TOOL_VCC140_BASE_BIN := $(PATH_TOOL_VCC140)/bin
+endif
+ifndef PATH_TOOL_VCC140_HOST_BIN
+ ifeq ($(KBUILD_HOST_ARCH),amd64)
+PATH_TOOL_VCC140_HOST_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/amd64
+ else if1of ($(KBUILD_HOST_ARCH), arm32 arm64)
+PATH_TOOL_VCC140_HOST_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/arm
+ else
+PATH_TOOL_VCC140_HOST_BIN := $(PATH_TOOL_VCC140_BASE_BIN)
+ endif
+endif
+ifndef PATH_TOOL_VCC140_BIN
+ ifeq ($(KBUILD_HOST_ARCH),$(KBUILD_TARGET_ARCH))
+PATH_TOOL_VCC140_BIN := $(PATH_TOOL_VCC140_HOST_BIN)
+ else
+PATH_TOOL_VCC140_BIN := $(PATH_TOOL_VCC140_BIN)/$(KBUILD_HOST_ARCH)_$(KBUILD_TARGET_ARCH)
+ endif
+endif
+PATH_TOOL_VCC140_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC140_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC140_HOST_DLL_BIN
+PATH_TOOL_VCC140_HOST_DLL_BIN := $(PATH_TOOL_VCC140_HOST_BIN)
+endif
+ifndef PATH_TOOL_VCC140_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC140_HOST_DLL_BIN),$(PATH_TOOL_VCC140_BIN))
+PATH_TOOL_VCC140_DLL_BIN := $(PATH_TOOL_VCC140_HOST_DLL_BIN)
+ endif
+endif
+
+PATH_TOOL_VCC140_LIB.amd64 ?= $(PATH_TOOL_VCC140)/lib/amd64
+PATH_TOOL_VCC140_LIB.arm32 ?= $(PATH_TOOL_VCC140)/lib/arm
+PATH_TOOL_VCC140_LIB.x86 ?= $(PATH_TOOL_VCC140)/lib
+
+PATH_TOOL_VCC140_ONECORE_LIB.amd64 ?= $(PATH_TOOL_VCC140)/lib/onecore/amd64
+PATH_TOOL_VCC140_ONECORE_LIB.arm32 ?= $(PATH_TOOL_VCC140)/lib/onecore/arm
+PATH_TOOL_VCC140_ONECORE_LIB.x86 ?= $(PATH_TOOL_VCC140)/lib/onecore
+
+PATH_TOOL_VCC140_INC ?= $(PATH_TOOL_VCC140)/include
+
+PATH_TOOL_VCC140_ATLMFC ?= $(PATH_TOOL_VCC140)/atlmfc
+PATH_TOOL_VCC140_ATLMFC_INC ?= $(PATH_TOOL_VCC140_ATLMFC)/include
+PATH_TOOL_VCC140_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC140_ATLMFC)/lib
+PATH_TOOL_VCC140_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC140_ATLMFC)/lib/amd64
+PATH_TOOL_VCC140_ATLMFC_LIB.arm32 ?= $(PATH_TOOL_VCC140_ATLMFC)/lib/arm
+
+TOOL_VCC140_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/cl.exe
+TOOL_VCC140_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/cl.exe
+ifeq ($(KBUILD_TARGET_ARCH),x86)
+TOOL_VCC140_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/ml.exe
+else
+TOOL_VCC140_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/ml64.exe
+endif
+#TOOL_VCC140_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC140_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/link.exe /LIB
+TOOL_VCC140_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/link.exe
+TOOL_VCC140_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/dumpbin.exe
+TOOL_VCC140_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/editbin.exe
+
+TOOL_VCC140_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC140_RC_CACHED)
+TOOL_VCC140_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC140_MT_CACHED)
+
+undefine TOOL_VCC140_USE_KSUBMIT # for now
+ifdef TOOL_VCC140_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC140_BIN)),-3),64/)
+ TOOL_VCC140_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC140_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC140_DLL_BIN
+ TOOL_VCC140_KSUBMIT := $(TOOL_VCC140_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140_DLL_BIN));"
+ endif
+ TOOL_VCC140_KSUBMIT_DD := $(TOOL_VCC140_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC140_DLL_BIN
+ TOOL_VCC140_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC140_KSUBMIT_DD
+ TOOL_VCC140_KSUBMIT_DD := $(TOOL_VCC140_SETUP_ENV)
+ endif
+endif
+
+
+## Helper for finding rc.exe and mt.exe in the SDK.
+TOOL_VCC140_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(qfirstfile sh,\
+ $(if-expr defined(PATH_SDK_WINSDK10_BIN) , $(qwildcard ,$(PATH_SDK_WINSDK10_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(qwildcard ,$(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(qwildcard ,$(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC140_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC140_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC140_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+#
+# Try find the redist directory.
+#
+ifndef PATH_TOOL_VCC140_REDIST
+PATH_TOOL_VCC140_REDIST := $(PATH_TOOL_VCC140)/redist
+endif
+PATH_TOOL_VCC140_REDIST_DEBUG ?= $(PATH_TOOL_VCC140_REDIST)/debug_nonredist
+
+## Updates may add more msvcp140_[0-9].dll images as the product matures.
+# This helper locates them (can differ between archs).
+# @param 1 Redist subdirectory.
+# @param 2 The DLL basename (no suffix).
+# @param 3 The VCC architecture name (for constructing the path).
+FN_TOOL_VCC140_FIND_DLLS = $(2).dll \
+ $(sortfiles $(qnotdir ,$(qwildcard ,$(PATH_TOOL_VCC140_REDIST)/$(3)/$(1)/$(2)_?.dll)))
+
+TOOL_VCC140_REDIST_CRT_SUBDIR := Microsoft.VC140.CRT
+TOOL_VCC140_REDIST_DEBUG_CRT_SUBDIR := Microsoft.VC140.DebugCRT
+
+TOOL_VCC140_REDIST_CRT_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vcruntime140,x86)
+TOOL_VCC140_REDIST_CRT_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vcruntime140,x64)
+TOOL_VCC140_REDIST_CRT_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vcruntime140,arm)
+TOOL_VCC140_REDIST_CRT_DLLS = $(TOOL_VCC140_REDIST_CRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC140_REDIST_CONCRT_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),concrt140,x86)
+TOOL_VCC140_REDIST_CONCRT_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),concrt140,x64)
+TOOL_VCC140_REDIST_CONCRT_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),concrt140,arm)
+TOOL_VCC140_REDIST_CONCRT_DLLS = $(TOOL_VCC140_REDIST_CONCRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC140_REDIST_CPP_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),msvcp140,x86)
+TOOL_VCC140_REDIST_CPP_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),msvcp140,x64)
+TOOL_VCC140_REDIST_CPP_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),msvcp140,arm)
+TOOL_VCC140_REDIST_CPP_DLLS = $(TOOL_VCC140_REDIST_CPP_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC140_REDIST_WINRT_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vccorlib140,x86)
+TOOL_VCC140_REDIST_WINRT_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vccorlib140,x64)
+TOOL_VCC140_REDIST_WINRT_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vccorlib140,arm)
+TOOL_VCC140_REDIST_WINRT_DLLS = $(TOOL_VCC140_REDIST_WINRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC140_REDIST_CXXAMP_SUBDIR := Microsoft.VC140.CXXAMP
+TOOL_VCC140_REDIST_MFC_SUBDIR := Microsoft.VC140.MFC
+TOOL_VCC140_REDIST_MFCLOC_SUBDIR := Microsoft.VC140.MFCLOC
+TOOL_VCC140_REDIST_OPENMP_SUBDIR := Microsoft.VC140.OpenMP
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC140_COBJSUFF ?= .obj
+TOOL_VCC140_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC140_CFLAGS.debug ?=
+TOOL_VCC140_CFLAGS.dbgopt ?= -O2
+TOOL_VCC140_CFLAGS.release ?= -O2
+TOOL_VCC140_CFLAGS.profile ?= -O2
+TOOL_VCC140_CINCS ?= $(PATH_TOOL_VCC140_INC)
+TOOL_VCC140_CDEFS ?=
+
+TOOL_VCC140_CXXOBJSUFF ?= .obj
+TOOL_VCC140_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC140_CXXFLAGS.debug ?=
+TOOL_VCC140_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC140_CXXFLAGS.release ?= -O2
+TOOL_VCC140_CXXFLAGS.profile ?= -O2
+TOOL_VCC140_CXXINCS ?= $(PATH_TOOL_VCC140_INC) $(PATH_TOOL_VCC140_ATLMFC_INC)
+TOOL_VCC140_CXXDEFS ?=
+
+TOOL_VCC140_ASOBJSUFF ?= .obj
+
+TOOL_VCC140_RCOBJSUFF ?= .res
+TOOL_VCC140_RCINCS ?= $(PATH_TOOL_VCC140_INC) $(PATH_TOOL_VCC140_ATLMFC_INC)
+
+TOOL_VCC140_ARFLAGS ?= -nologo
+TOOL_VCC140_ARFLAGS.x86 ?= -machine:x86
+TOOL_VCC140_ARFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC140_ARFLAGS.arm32 ?= -machine:arm
+TOOL_VCC140_ARLIBSUFF ?= .lib
+
+TOOL_VCC140_LDFLAGS ?= -nologo
+TOOL_VCC140_LDFLAGS.x86 ?= -machine:x86
+TOOL_VCC140_LDFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC140_LDFLAGS.arm32 ?= -machine:arm
+TOOL_VCC140_LDFLAGS.debug ?= -debug
+TOOL_VCC140_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC140_LDFLAGS.profile ?= -debug
+TOOL_VCC140_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140_COMPILE_C_DEPEND =
+TOOL_VCC140_COMPILE_C_DEPORD =
+TOOL_VCC140_COMPILE_C_OUTPUT =
+TOOL_VCC140_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC140_KSUBMIT
+ TOOL_VCC140_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC140_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC140_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC140_SETUP_ENV) $(TOOL_VCC140_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC140_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC140_COMPILE_CXX_DEPORD =
+TOOL_VCC140_COMPILE_CXX_OUTPUT =
+TOOL_VCC140_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC140_KSUBMIT
+ TOOL_VCC140_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC140_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC140_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC140_SETUP_ENV) $(TOOL_VCC140_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC140_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC140-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC140-PCH_EXTENDS := VCC140
+TOOL_VCC140-PCH_CXXOBJSUFF := .obj
+TOOL_VCC140-PCH_CXXINCS = $(TOOL_VCC140_CXXINCS)
+TOOL_VCC140-PCH_CXXFLAGS = $(TOOL_VCC140_CXXFLAGS) -FS
+TOOL_VCC140-PCH_CXXFLAGS.debug = $(TOOL_VCC140_CXXFLAGS.debug)
+TOOL_VCC140-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC140_CXXFLAGS.dbgopt)
+TOOL_VCC140-PCH_CXXFLAGS.release = $(TOOL_VCC140_CXXFLAGS.release)
+TOOL_VCC140-PCH_CXXFLAGS.profile = $(TOOL_VCC140_CXXFLAGS.profile)
+TOOL_VCC140-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC140-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC140-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC140-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC140_KSUBMIT
+ define TOOL_VCC140-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC140_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC140_SETUP_ENV) $(TOOL_VCC140_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC140_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140_COMPILE_RC_DEPEND =
+TOOL_VCC140_COMPILE_RC_DEPORD =
+TOOL_VCC140_COMPILE_RC_OUTPUT =
+define TOOL_VCC140_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC140_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC140_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC140_LINK_LIBRARY_DEPORD =
+TOOL_VCC140_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC140_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC140_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC140_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140_LINK_PROGRAM_DEPORD =
+TOOL_VCC140_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC140_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC140_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC140_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC140_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC140_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC140_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC140_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC140_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140_LINK_SYSMOD_DEPORD =
+TOOL_VCC140_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC140_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC140_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC140AMD64.kmk b/kBuild/tools/VCC140AMD64.kmk
new file mode 100644
index 0000000..9e35463
--- /dev/null
+++ b/kBuild/tools/VCC140AMD64.kmk
@@ -0,0 +1,458 @@
+# $Id: VCC140AMD64.kmk 3343 2020-05-20 14:34:15Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting AMD64.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef TOOL_VCC140
+ include $(KBUILD_PATH)/tools/VCC140.kmk
+endif
+
+TOOL_VCC140AMD64 := Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting AMD64
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC140AMD64_BIN
+ ifeq ($(KBUILD_HOST_ARCH),amd64)
+PATH_TOOL_VCC140AMD64_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/amd64
+ else
+PATH_TOOL_VCC140AMD64_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/x86_amd64
+ endif
+else
+PATH_TOOL_VCC140AMD64_BIN := $(PATH_TOOL_VCC140AMD64_BIN)
+endif
+PATH_TOOL_VCC140AMD64_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC140AMD64_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC140AMD64_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC140_HOST_DLL_BIN),$(PATH_TOOL_VCC140AMD64_BIN))
+PATH_TOOL_VCC140AMD64_DLL_BIN := $(PATH_TOOL_VCC140_HOST_DLL_BIN)
+ endif
+endif
+
+ifndef PATH_TOOL_VCC140AMD64_LIB
+PATH_TOOL_VCC140AMD64_LIB := $(PATH_TOOL_VCC140_LIB.amd64)
+endif
+ifndef PATH_TOOL_VCC140_ONECORE_LIB
+PATH_TOOL_VCC140_ONECORE_LIB := $(PATH_TOOL_VCC140_ONECORE_LIB.amd64)
+endif
+
+ifndef PATH_TOOL_VCC140AMD64_INC
+PATH_TOOL_VCC140AMD64_INC := $(PATH_TOOL_VCC140_INC)
+endif
+
+ifndef PATH_TOOL_VCC140AMD64_ATLMFC_INC
+PATH_TOOL_VCC140AMD64_ATLMFC_INC := $(PATH_TOOL_VCC140_ATLMFC_INC.amd64)
+endif
+ifndef PATH_TOOL_VCC140AMD64_ATLMFC_LIB
+PATH_TOOL_VCC140AMD64_ATLMFC_LIB := $(PATH_TOOL_VCC140_ATLMFC_LIB.amd64)
+endif
+
+TOOL_VCC140AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/cl.exe
+TOOL_VCC140AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/cl.exe
+TOOL_VCC140AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/ml64.exe
+#TOOL_VCC140AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC140AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/link.exe /LIB
+TOOL_VCC140AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/link.exe
+TOOL_VCC140AMD64_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/dumpbin.exe
+TOOL_VCC140AMD64_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/editbin.exe
+
+TOOL_VCC140AMD64_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC140_RC_CACHED)
+TOOL_VCC140AMD64_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC140_MT_CACHED)
+
+undefine TOOL_VCC140AMD64_USE_KSUBMIT # for now
+ifdef TOOL_VCC140AMD64_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC140AMD64_BIN)),-3),64/)
+ TOOL_VCC140AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC140AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC140AMD64_DLL_BIN
+ TOOL_VCC140AMD64_KSUBMIT := $(TOOL_VCC140AMD64_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140AMD64_DLL_BIN));"
+ endif
+ TOOL_VCC140AMD64_KSUBMIT_DD := $(TOOL_VCC140AMD64_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC140AMD64_DLL_BIN
+ TOOL_VCC140AMD64_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140AMD64_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC140AMD64_KSUBMIT_DD
+ TOOL_VCC140AMD64_KSUBMIT_DD := $(TOOL_VCC140AMD64_SETUP_ENV)
+ endif
+endif
+
+# Redist (more stuff in VCC140.kmk).
+PATH_TOOL_VCC140AMD64_REDIST ?= $(PATH_TOOL_VCC140_REDIST)/x64
+PATH_TOOL_VCC140AMD64_REDIST_CRT = $(PATH_TOOL_VCC140AMD64_REDIST)/$(TOOL_VCC140_REDIST_CRT_SUBDIR)
+PATH_TOOL_VCC140AMD64_REDIST_DEBUG ?= $(PATH_TOOL_VCC140_REDIST_DEBUG)/x64
+PATH_TOOL_VCC140AMD64_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC140AMD64_REDIST_DEBUG)/$(TOOL_VCC140_REDIST_CRT_SUBDIR)
+TOOL_VCC140AMD64_REDIST_CRT_DLLS = $(TOOL_VCC140_REDIST_CRT_DLLS.amd64)
+TOOL_VCC140AMD64_REDIST_CONCRT_DLLS = $(TOOL_VCC140_REDIST_CONCRT_DLLS.amd64)
+TOOL_VCC140AMD64_REDIST_CPP_DLLS = $(TOOL_VCC140_REDIST_CPP_DLLS.amd64)
+TOOL_VCC140AMD64_REDIST_WINRT_DLLS = $(TOOL_VCC140_REDIST_WINRT_DLLS.amd64)
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC140AMD64_COBJSUFF ?= .obj
+TOOL_VCC140AMD64_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC140AMD64_CFLAGS.debug ?=
+TOOL_VCC140AMD64_CFLAGS.dbgopt ?= -O2
+TOOL_VCC140AMD64_CFLAGS.release ?= -O2
+TOOL_VCC140AMD64_CFLAGS.profile ?= -O2
+TOOL_VCC140AMD64_CINCS ?= $(PATH_TOOL_VCC140AMD64_INC)
+TOOL_VCC140AMD64_CDEFS ?=
+
+TOOL_VCC140AMD64_CXXOBJSUFF ?= .obj
+TOOL_VCC140AMD64_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC140AMD64_CXXFLAGS.debug ?=
+TOOL_VCC140AMD64_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC140AMD64_CXXFLAGS.release ?= -O2
+TOOL_VCC140AMD64_CXXFLAGS.profile ?= -O2
+TOOL_VCC140AMD64_CXXINCS ?= $(PATH_TOOL_VCC140AMD64_INC) $(PATH_TOOL_VCC140AMD64_ATLMFC_INC)
+TOOL_VCC140AMD64_CXXDEFS ?=
+
+TOOL_VCC140AMD64_ASOBJSUFF ?= .obj
+
+TOOL_VCC140AMD64_RCOBJSUFF ?= .res
+TOOL_VCC140AMD64_RCINCS ?= $(PATH_TOOL_VCC140AMD64_INC) $(PATH_TOOL_VCC140AMD64_ATLMFC_INC)
+
+TOOL_VCC140AMD64_ARFLAGS ?= -nologo -machine:amd64
+TOOL_VCC140AMD64_ARLIBSUFF ?= .lib
+
+TOOL_VCC140AMD64_LDFLAGS ?= -nologo -machine:amd64
+TOOL_VCC140AMD64_LDFLAGS.debug ?= -debug
+TOOL_VCC140AMD64_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC140AMD64_LDFLAGS.profile ?= -debug
+TOOL_VCC140AMD64_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140AMD64_COMPILE_C_DEPEND =
+TOOL_VCC140AMD64_COMPILE_C_DEPORD =
+TOOL_VCC140AMD64_COMPILE_C_OUTPUT =
+TOOL_VCC140AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC140AMD64_KSUBMIT
+ TOOL_VCC140AMD64_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC140AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140AMD64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC140AMD64_SETUP_ENV)$(TOOL_VCC140AMD64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC140AMD64_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140AMD64_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC140AMD64_COMPILE_CXX_DEPORD =
+TOOL_VCC140AMD64_COMPILE_CXX_OUTPUT =
+TOOL_VCC140AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC140AMD64_KSUBMIT
+ TOOL_VCC140AMD64_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC140AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140AMD64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC140AMD64_SETUP_ENV)$(TOOL_VCC140AMD64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC140AMD64_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC140AMD64-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC140AMD64-PCH_EXTENDS := VCC140AMD64
+TOOL_VCC140AMD64-PCH_CXXOBJSUFF := .obj
+TOOL_VCC140AMD64-PCH_CXXINCS = $(TOOL_VCC140AMD64_CXXINCS)
+TOOL_VCC140AMD64-PCH_CXXFLAGS = $(TOOL_VCC140AMD64_CXXFLAGS)
+TOOL_VCC140AMD64-PCH_CXXFLAGS.debug = $(TOOL_VCC140AMD64_CXXFLAGS.debug)
+TOOL_VCC140AMD64-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC140AMD64_CXXFLAGS.dbgopt)
+TOOL_VCC140AMD64-PCH_CXXFLAGS.release = $(TOOL_VCC140AMD64_CXXFLAGS.release)
+TOOL_VCC140AMD64-PCH_CXXFLAGS.profile = $(TOOL_VCC140AMD64_CXXFLAGS.profile)
+TOOL_VCC140AMD64-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC140AMD64-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC140AMD64-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC140AMD64-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC140AMD64_KSUBMIT
+ define TOOL_VCC140AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140AMD64_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR),-FI$($(target)_PCH_HDR),)\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC140AMD64_SETUP_ENV)$(TOOL_VCC140AMD64_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR),-FI$($(target)_PCH_HDR),)\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC140AMD64_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140AMD64_COMPILE_RC_DEPEND =
+TOOL_VCC140AMD64_COMPILE_RC_DEPORD =
+TOOL_VCC140AMD64_COMPILE_RC_OUTPUT =
+define TOOL_VCC140AMD64_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC140AMD64_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC140AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC140AMD64_LINK_LIBRARY_DEPORD =
+TOOL_VCC140AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC140AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC140AMD64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC140AMD64_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140AMD64_LINK_PROGRAM_DEPORD =
+TOOL_VCC140AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC140AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC140AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140AMD64_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC140AMD64_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC140AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC140AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC140AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC140AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140AMD64_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC140AMD64_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140AMD64_LINK_SYSMOD_DEPORD =
+TOOL_VCC140AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC140AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC140AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140AMD64_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC140X86.kmk b/kBuild/tools/VCC140X86.kmk
new file mode 100644
index 0000000..7c0e5a2
--- /dev/null
+++ b/kBuild/tools/VCC140X86.kmk
@@ -0,0 +1,458 @@
+# $Id: VCC140X86.kmk 3343 2020-05-20 14:34:15Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef TOOL_VCC140
+ include $(KBUILD_PATH)/tools/VCC140.kmk
+endif
+
+TOOL_VCC140X86 := Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting x86
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC140X86_BIN
+ ifeq ($(KBUILD_HOST_ARCH),amd64)
+PATH_TOOL_VCC140X86_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/amd64_x86
+ else
+PATH_TOOL_VCC140X86_BIN := $(PATH_TOOL_VCC140_BASE_BIN)
+ endif
+else
+PATH_TOOL_VCC140X86_BIN := $(PATH_TOOL_VCC140X86_BIN)
+endif
+PATH_TOOL_VCC140X86_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC140X86_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC140X86_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC140_HOST_DLL_BIN),$(PATH_TOOL_VCC140X86_BIN))
+PATH_TOOL_VCC140X86_DLL_BIN := $(PATH_TOOL_VCC140_HOST_DLL_BIN)
+ endif
+endif
+
+ifndef PATH_TOOL_VCC140X86_LIB
+PATH_TOOL_VCC140X86_LIB := $(PATH_TOOL_VCC140_LIB.x86)
+endif
+ifndef PATH_TOOL_VCC140_ONECORE_LIB
+PATH_TOOL_VCC140_ONECORE_LIB := $(PATH_TOOL_VCC140_ONECORE_LIB.x86)
+endif
+
+ifndef PATH_TOOL_VCC140X86_INC
+PATH_TOOL_VCC140X86_INC := $(PATH_TOOL_VCC140_INC)
+endif
+
+ifndef PATH_TOOL_VCC140X86_ATLMFC_INC
+PATH_TOOL_VCC140X86_ATLMFC_INC := $(PATH_TOOL_VCC140_ATLMFC_INC.x86)
+endif
+ifndef PATH_TOOL_VCC140X86_ATLMFC_LIB
+PATH_TOOL_VCC140X86_ATLMFC_LIB := $(PATH_TOOL_VCC140_ATLMFC_LIB.x86)
+endif
+
+TOOL_VCC140X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/cl.exe
+TOOL_VCC140X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/cl.exe
+TOOL_VCC140X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/ml.exe
+#TOOL_VCC140X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC140X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/link.exe /LIB
+TOOL_VCC140X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/link.exe
+TOOL_VCC140X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/dumpbin.exe
+TOOL_VCC140X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140X86_BIN_QSH)/editbin.exe
+
+TOOL_VCC140X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC140_RC_CACHED)
+TOOL_VCC140X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC140_MT_CACHED)
+
+undefine TOOL_VCC140X86_USE_KSUBMIT # for now
+ifdef TOOL_VCC140X86_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC140X86_BIN)),-3),64/)
+ TOOL_VCC140X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC140X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC140X86_DLL_BIN
+ TOOL_VCC140X86_KSUBMIT := $(TOOL_VCC140X86_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140X86_DLL_BIN));"
+ endif
+ TOOL_VCC140X86_KSUBMIT_DD := $(TOOL_VCC140X86_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC140X86_DLL_BIN
+ TOOL_VCC140X86_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140X86_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC140X86_KSUBMIT_DD
+ TOOL_VCC140X86_KSUBMIT_DD := $(TOOL_VCC140X86_SETUP_ENV)
+ endif
+endif
+
+# Redist (more stuff in VCC140.kmk).
+PATH_TOOL_VCC140X86_REDIST ?= $(PATH_TOOL_VCC140_REDIST)/x86
+PATH_TOOL_VCC140X86_REDIST_CRT = $(PATH_TOOL_VCC140X86_REDIST)/$(TOOL_VCC140_REDIST_CRT_SUBDIR)
+PATH_TOOL_VCC140X86_REDIST_DEBUG ?= $(PATH_TOOL_VCC140_REDIST_DEBUG)/x86
+PATH_TOOL_VCC140X86_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC140X86_REDIST_DEBUG)/$(TOOL_VCC140_REDIST_CRT_SUBDIR)
+TOOL_VCC140X64_REDIST_CRT_DLLS = $(TOOL_VCC140_REDIST_CRT_DLLS.x86)
+TOOL_VCC140X64_REDIST_CONCRT_DLLS = $(TOOL_VCC140_REDIST_CONCRT_DLLS.x86)
+TOOL_VCC140X64_REDIST_CPP_DLLS = $(TOOL_VCC140_REDIST_CPP_DLLS.x86)
+TOOL_VCC140X64_REDIST_WINRT_DLLS = $(TOOL_VCC140_REDIST_WINRT_DLLS.x86)
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC140X86_COBJSUFF ?= .obj
+TOOL_VCC140X86_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC140X86_CFLAGS.debug ?=
+TOOL_VCC140X86_CFLAGS.dbgopt ?= -O2
+TOOL_VCC140X86_CFLAGS.release ?= -O2
+TOOL_VCC140X86_CFLAGS.profile ?= -O2
+TOOL_VCC140X86_CINCS ?= $(PATH_TOOL_VCC140X86_INC)
+TOOL_VCC140X86_CDEFS ?=
+
+TOOL_VCC140X86_CXXOBJSUFF ?= .obj
+TOOL_VCC140X86_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC140X86_CXXFLAGS.debug ?=
+TOOL_VCC140X86_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC140X86_CXXFLAGS.release ?= -O2
+TOOL_VCC140X86_CXXFLAGS.profile ?= -O2
+TOOL_VCC140X86_CXXINCS ?= $(PATH_TOOL_VCC140X86_INC) $(PATH_TOOL_VCC140X86_ATLMFC_INC)
+TOOL_VCC140X86_CXXDEFS ?=
+
+TOOL_VCC140X86_ASOBJSUFF ?= .obj
+
+TOOL_VCC140X86_RCOBJSUFF ?= .res
+TOOL_VCC140X86_RCINCS ?= $(PATH_TOOL_VCC140X86_INC) $(PATH_TOOL_VCC140X86_ATLMFC_INC)
+
+TOOL_VCC140X86_ARFLAGS ?= -nologo -machine:x86
+TOOL_VCC140X86_ARLIBSUFF ?= .lib
+
+TOOL_VCC140X86_LDFLAGS ?= -nologo -machine:x86
+TOOL_VCC140X86_LDFLAGS.debug ?= -debug
+TOOL_VCC140X86_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC140X86_LDFLAGS.profile ?= -debug
+TOOL_VCC140X86_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140X86_COMPILE_C_DEPEND =
+TOOL_VCC140X86_COMPILE_C_DEPORD =
+TOOL_VCC140X86_COMPILE_C_OUTPUT =
+TOOL_VCC140X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC140X86_KSUBMIT
+ TOOL_VCC140X86_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC140X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140X86_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC140X86_SETUP_ENV)$(TOOL_VCC140X86_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC140X86_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC140X86_COMPILE_CXX_DEPORD =
+TOOL_VCC140X86_COMPILE_CXX_OUTPUT =
+TOOL_VCC140X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC140X86_KSUBMIT
+ TOOL_VCC140X86_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC140X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140X86_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC140X86_SETUP_ENV)$(TOOL_VCC140X86_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC140X86_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC140X86-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC140X86-PCH_EXTENDS := VCC140X86
+TOOL_VCC140X86-PCH_CXXOBJSUFF := .obj
+TOOL_VCC140X86-PCH_CXXINCS = $(TOOL_VCC140X86_CXXINCS)
+TOOL_VCC140X86-PCH_CXXFLAGS = $(TOOL_VCC140X86_CXXFLAGS) -FS
+TOOL_VCC140X86-PCH_CXXFLAGS.debug = $(TOOL_VCC140X86_CXXFLAGS.debug)
+TOOL_VCC140X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC140X86_CXXFLAGS.dbgopt)
+TOOL_VCC140X86-PCH_CXXFLAGS.release = $(TOOL_VCC140X86_CXXFLAGS.release)
+TOOL_VCC140X86-PCH_CXXFLAGS.profile = $(TOOL_VCC140X86_CXXFLAGS.profile)
+TOOL_VCC140X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC140X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC140X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC140X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC140X86_KSUBMIT
+ define TOOL_VCC140X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC140X86_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR),-FI$($(target)_PCH_HDR),)\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC140X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC140X86_SETUP_ENV)$(TOOL_VCC140X86_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR),-FI$($(target)_PCH_HDR),)\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC140X86_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC140X86_COMPILE_RC_DEPEND =
+TOOL_VCC140X86_COMPILE_RC_DEPORD =
+TOOL_VCC140X86_COMPILE_RC_OUTPUT =
+define TOOL_VCC140X86_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC140X86_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC140X86_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC140X86_LINK_LIBRARY_DEPORD =
+TOOL_VCC140X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC140X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC140X86_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT_DD) $(TOOL_VCC140X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC140X86_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140X86_LINK_PROGRAM_DEPORD =
+TOOL_VCC140X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC140X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC140X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140X86_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT_DD) $(TOOL_VCC140X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC140X86_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC140X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC140X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC140X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC140X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140X86_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT_DD) $(TOOL_VCC140X86_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC140X86_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC140X86_LINK_SYSMOD_DEPORD =
+TOOL_VCC140X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC140X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC140X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC140X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC140X86_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC140X86_KSUBMIT_DD) $(TOOL_VCC140X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC140X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC140X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC141.kmk b/kBuild/tools/VCC141.kmk
new file mode 100644
index 0000000..d7b19d7
--- /dev/null
+++ b/kBuild/tools/VCC141.kmk
@@ -0,0 +1,557 @@
+# $Id: VCC141.kmk 3342 2020-05-20 14:33:53Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.1 (aka Visual 2017 and MSC v19.10), default target.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC141 := Visual C++ 14.1 (aka Visual 2017 and MSC v19.1), targeting $(KBUILD_TARGET).
+
+ifndef INCLUDED_WIN_COMMON_KMK
+ include $(KBUILD_PATH)/win-common.kmk
+endif
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC141
+ PATH_TOOL_VCC141 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.amd64/vcc/v14.1*/Tools/MSVC/14.1?.*)))
+ ifeq ($(PATH_TOOL_VCC141),)
+ PATH_TOOL_VCC141 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.1*/Tools/MSVC/14.1?.*)))
+ endif
+ ifeq ($(PATH_TOOL_VCC141),)
+ PATH_TOOL_VCC141 := $(PATH_TOOL_VCC141X86)
+ endif
+ ifeq ($(PATH_TOOL_VCC141),)
+ PATH_TOOL_VCC141 := $(PATH_TOOL_VCC141)
+ endif
+ ifeq ($(PATH_TOOL_VCC141),)
+ PATH_TOOL_VCC141 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.1*/Tools/MSVC/14.1?.*)))
+ ifeq ($(PATH_TOOL_VCC141),)
+ PATH_TOOL_VCC141 := $(firstfile $(foreach ver,2017 2019,$(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
+ , $(rsortfiles $(qwildcard ,$(progfilesdir)/Microsoft\ Visual\ Studio/$(ver)/BuildTools/VC/Tools/MSVC/14.1?.*)))))
+ ifeq ($(PATH_TOOL_VCC141),)
+ $(warning kBuild: PATH_TOOL_VCC141 cannot be determined!)
+ PATH_TOOL_VCC141 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v141
+ endif
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC141 := $(PATH_TOOL_VCC141)
+endif
+
+ifndef PATH_TOOL_VCC141_BASE_BIN
+PATH_TOOL_VCC141_BASE_BIN := $(PATH_TOOL_VCC141)/bin
+endif
+ifndef PATH_TOOL_VCC141_HOST_BIN
+PATH_TOOL_VCC141_HOST_BIN := $(PATH_TOOL_VCC141_BASE_BIN)/Host$(WINCMN_MAP_ARCH.$(KBUILD_HOST_ARCH))
+endif
+ifndef PATH_TOOL_VCC141_BIN
+PATH_TOOL_VCC141_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))
+endif
+PATH_TOOL_VCC141_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC141_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC141_HOST_DLL_BIN
+PATH_TOOL_VCC141_HOST_DLL_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/$(WINCMN_MAP_ARCH.$(KBUILD_HOST_ARCH))
+endif
+ifndef PATH_TOOL_VCC141_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC141_HOST_DLL_BIN),$(PATH_TOOL_VCC141_BIN))
+PATH_TOOL_VCC141_DLL_BIN := $(PATH_TOOL_VCC141_HOST_DLL_BIN)
+ endif
+endif
+
+PATH_TOOL_VCC141_LIB.amd64 ?= $(PATH_TOOL_VCC141)/lib/x64
+PATH_TOOL_VCC141_LIB.arm32 ?= $(PATH_TOOL_VCC141)/lib/arm
+PATH_TOOL_VCC141_LIB.arm64 ?= $(PATH_TOOL_VCC141)/lib/arm64
+PATH_TOOL_VCC141_LIB.x86 ?= $(PATH_TOOL_VCC141)/lib/x86
+
+PATH_TOOL_VCC141_ONECORE_LIB.amd64 ?= $(PATH_TOOL_VCC141)/lib/onecore/x64
+PATH_TOOL_VCC141_ONECORE_LIB.arm32 ?= $(PATH_TOOL_VCC141)/lib/onecore/arm
+PATH_TOOL_VCC141_ONECORE_LIB.arm64 ?= $(PATH_TOOL_VCC141)/lib/onecore/arm64
+PATH_TOOL_VCC141_ONECORE_LIB.x86 ?= $(PATH_TOOL_VCC141)/lib/onecore/x86
+
+PATH_TOOL_VCC141_INC ?= $(PATH_TOOL_VCC141)/include
+
+PATH_TOOL_VCC141_ATLMFC ?= $(PATH_TOOL_VCC141)/atlmfc
+PATH_TOOL_VCC141_ATLMFC_INC ?= $(PATH_TOOL_VCC141_ATLMFC)/include
+PATH_TOOL_VCC141_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC141_ATLMFC)/lib/x86
+PATH_TOOL_VCC141_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC141_ATLMFC)/lib/x64
+
+TOOL_VCC141_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/cl.exe
+TOOL_VCC141_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/cl.exe
+ifeq ($(KBUILD_TARGET_ARCH),x86)
+TOOL_VCC141_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/ml.exe
+else
+TOOL_VCC141_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/ml64.exe
+endif
+#TOOL_VCC141_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC141_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/link.exe /LIB
+TOOL_VCC141_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/link.exe
+TOOL_VCC141_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/dumpbin.exe
+TOOL_VCC141_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/editbin.exe
+
+TOOL_VCC141_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC141_RC_CACHED)
+TOOL_VCC141_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC141_MT_CACHED)
+
+undefine TOOL_VCC141_USE_KSUBMIT # for now
+ifdef TOOL_VCC141_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC141_BIN)),-3),64/)
+ TOOL_VCC141_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC141_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC141_DLL_BIN
+ TOOL_VCC141_KSUBMIT := $(TOOL_VCC141_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141_DLL_BIN));"
+ endif
+ TOOL_VCC141_KSUBMIT_DD := $(TOOL_VCC141_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC141_DLL_BIN
+ TOOL_VCC141_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC141_KSUBMIT_DD
+ TOOL_VCC141_KSUBMIT_DD := $(TOOL_VCC141_SETUP_ENV)
+ endif
+endif
+
+
+## Helper for finding rc.exe and mt.exe in the SDK.
+TOOL_VCC141_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(qfirstfile sh,\
+ $(if-expr defined(PATH_SDK_WINSDK10_BIN) , $(qwildcard ,$(PATH_SDK_WINSDK10_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(qwildcard ,$(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(qwildcard ,$(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC141_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC141_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC141_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+#
+# Try find the redist directory. A little complicated as the build number
+# doesn't necessarily match that of the compiler.
+#
+ifeq ($(tolower $(substr $(qdir u,$(PATH_TOOL_VCC141)), -12)),/tools/msvc/)
+PATH_TOOL_VCC141_REDIST ?= $(firstfile $(qwildcard ,$(substr $(qdir ,$(PATH_TOOL_VCC141)), 1, -12)/Redist/MSVC/14.1*))
+else
+PATH_TOOL_VCC141_REDIST ?= $(qabspath ,$(firstfile $(qwildcard ,\
+ $(PATH_TOOL_VCC141)/Redist \
+ $(PATH_TOOL_VCC141)/../Redist \
+ $(PATH_TOOL_VCC141)/../../Redist \
+ $(PATH_TOOL_VCC141)/../../../Redist \
+ $(PATH_TOOL_VCC141)/../../../../Redist)))
+endif
+PATH_TOOL_VCC141_REDIST_DEBUG ?= $(PATH_TOOL_VCC141_REDIST)/debug_nonredist
+
+## Updates may add more msvcp140_[0-9].dll images as the product matures.
+# This helper locates them (can differ between archs).
+# @param 1 Redist subdirectory.
+# @param 2 The DLL basename (no suffix).
+# @param 3 The VCC architecture name (for constructing the path).
+FN_TOOL_VCC141_FIND_DLLS = $(2).dll \
+ $(sortfiles $(qnotdir ,$(qwildcard ,$(PATH_TOOL_VCC141_REDIST)/$(3)/$(1)/$(2)_?.dll)))
+
+TOOL_VCC141_REDIST_CRT_SUBDIR := Microsoft.VC141.CRT
+TOOL_VCC141_REDIST_DEBUG_CRT_SUBDIR := Microsoft.VC141.DebugCRT
+
+TOOL_VCC141_REDIST_CRT_DLLS.x86 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vcruntime140,x86)
+TOOL_VCC141_REDIST_CRT_DLLS.amd64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vcruntime140,x64)
+TOOL_VCC141_REDIST_CRT_DLLS.arm32 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vcruntime140,arm)
+TOOL_VCC141_REDIST_CRT_DLLS.arm64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vcruntime140,arm64)
+TOOL_VCC141_REDIST_CRT_DLLS = $(TOOL_VCC141_REDIST_CRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC141_REDIST_CONCRT_DLLS.x86 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),concrt140,x86)
+TOOL_VCC141_REDIST_CONCRT_DLLS.amd64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),concrt140,x64)
+TOOL_VCC141_REDIST_CONCRT_DLLS.arm32 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),concrt140,arm)
+TOOL_VCC141_REDIST_CONCRT_DLLS.arm64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),concrt140,arm64)
+TOOL_VCC141_REDIST_CONCRT_DLLS = $(TOOL_VCC141_REDIST_CONCRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC141_REDIST_CPP_DLLS.x86 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),msvcp140,x86)
+TOOL_VCC141_REDIST_CPP_DLLS.amd64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),msvcp140,x64)
+TOOL_VCC141_REDIST_CPP_DLLS.arm32 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),msvcp140,arm)
+TOOL_VCC141_REDIST_CPP_DLLS.arm64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),msvcp140,arm64)
+TOOL_VCC141_REDIST_CPP_DLLS = $(TOOL_VCC141_REDIST_CPP_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC141_REDIST_WINRT_DLLS.x86 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vccorlib140,x86)
+TOOL_VCC141_REDIST_WINRT_DLLS.amd64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vccorlib140,x64)
+TOOL_VCC141_REDIST_WINRT_DLLS.arm32 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vccorlib140,arm)
+TOOL_VCC141_REDIST_WINRT_DLLS.arm64 = $(call FN_TOOL_VCC141_FIND_DLLS,$(TOOL_VCC141_REDIST_CRT_SUBDIR),vccorlib140,arm64)
+TOOL_VCC141_REDIST_WINRT_DLLS = $(TOOL_VCC141_REDIST_WINRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC141_REDIST_CXXAMP_SUBDIR := Microsoft.VC141.CXXAMP
+TOOL_VCC141_REDIST_MFC_SUBDIR := Microsoft.VC141.MFC
+TOOL_VCC141_REDIST_MFCLOC_SUBDIR := Microsoft.VC141.MFCLOC
+TOOL_VCC141_REDIST_OPENMP_SUBDIR := Microsoft.VC141.OpenMP
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC141_COBJSUFF ?= .obj
+TOOL_VCC141_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC141_CFLAGS.debug ?=
+TOOL_VCC141_CFLAGS.dbgopt ?= -O2
+TOOL_VCC141_CFLAGS.release ?= -O2
+TOOL_VCC141_CFLAGS.profile ?= -O2
+TOOL_VCC141_CINCS ?= $(PATH_TOOL_VCC141_INC)
+TOOL_VCC141_CDEFS ?=
+
+TOOL_VCC141_CXXOBJSUFF ?= .obj
+TOOL_VCC141_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC141_CXXFLAGS.debug ?=
+TOOL_VCC141_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC141_CXXFLAGS.release ?= -O2
+TOOL_VCC141_CXXFLAGS.profile ?= -O2
+TOOL_VCC141_CXXINCS ?= $(PATH_TOOL_VCC141_INC) $(PATH_TOOL_VCC141_ATLMFC_INC)
+TOOL_VCC141_CXXDEFS ?=
+
+TOOL_VCC141_ASOBJSUFF ?= .obj
+
+TOOL_VCC141_RCOBJSUFF ?= .res
+TOOL_VCC141_RCINCS ?= $(PATH_TOOL_VCC141_INC) $(PATH_TOOL_VCC141_ATLMFC_INC)
+
+TOOL_VCC141_ARFLAGS ?= -nologo
+TOOL_VCC141_ARFLAGS.x86 ?= -machine:x86
+TOOL_VCC141_ARFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC141_ARFLAGS.arm32 ?= -machine:arm
+TOOL_VCC141_ARLIBSUFF ?= .lib
+
+TOOL_VCC141_LDFLAGS ?= -nologo
+TOOL_VCC141_LDFLAGS.x86 ?= -machine:x86
+TOOL_VCC141_LDFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC141_LDFLAGS.arm32 ?= -machine:arm
+TOOL_VCC141_LDFLAGS.debug ?= -debug
+TOOL_VCC141_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC141_LDFLAGS.profile ?= -debug
+TOOL_VCC141_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141_COMPILE_C_DEPEND =
+TOOL_VCC141_COMPILE_C_DEPORD =
+TOOL_VCC141_COMPILE_C_OUTPUT =
+TOOL_VCC141_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC141_KSUBMIT
+ TOOL_VCC141_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC141_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC141_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC141_SETUP_ENV) $(TOOL_VCC141_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC141_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC141_COMPILE_CXX_DEPORD =
+TOOL_VCC141_COMPILE_CXX_OUTPUT =
+TOOL_VCC141_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC141_KSUBMIT
+ TOOL_VCC141_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC141_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC141_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC141_SETUP_ENV) $(TOOL_VCC141_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC141_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC141-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC141-PCH_EXTENDS := VCC141
+TOOL_VCC141-PCH_CXXOBJSUFF := .obj
+TOOL_VCC141-PCH_CXXINCS = $(TOOL_VCC141_CXXINCS)
+TOOL_VCC141-PCH_CXXFLAGS = $(TOOL_VCC141_CXXFLAGS) -FS
+TOOL_VCC141-PCH_CXXFLAGS.debug = $(TOOL_VCC141_CXXFLAGS.debug)
+TOOL_VCC141-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC141_CXXFLAGS.dbgopt)
+TOOL_VCC141-PCH_CXXFLAGS.release = $(TOOL_VCC141_CXXFLAGS.release)
+TOOL_VCC141-PCH_CXXFLAGS.profile = $(TOOL_VCC141_CXXFLAGS.profile)
+TOOL_VCC141-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC141-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC141-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC141-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC141_KSUBMIT
+ define TOOL_VCC141-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC141_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC141_SETUP_ENV) $(TOOL_VCC141_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC141_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141_COMPILE_RC_DEPEND =
+TOOL_VCC141_COMPILE_RC_DEPORD =
+TOOL_VCC141_COMPILE_RC_OUTPUT =
+define TOOL_VCC141_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC141_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC141_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC141_LINK_LIBRARY_DEPORD =
+TOOL_VCC141_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC141_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC141_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC141_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141_LINK_PROGRAM_DEPORD =
+TOOL_VCC141_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC141_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC141_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC141_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC141_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC141_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC141_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC141_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC141_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141_LINK_SYSMOD_DEPORD =
+TOOL_VCC141_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC141_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC141_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC141AMD64.kmk b/kBuild/tools/VCC141AMD64.kmk
new file mode 100644
index 0000000..94cf413
--- /dev/null
+++ b/kBuild/tools/VCC141AMD64.kmk
@@ -0,0 +1,459 @@
+# $Id: VCC141AMD64.kmk 3346 2020-05-22 20:56:11Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.1 (aka Visual 2017 and MSC v19.10), targeting AMD64.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef TOOL_VCC141
+ include $(KBUILD_PATH)/tools/VCC141.kmk
+endif
+
+TOOL_VCC141AMD64 := Visual C++ 14.1 (aka Visual 2017 and MSC v19.1), targeting AMD64
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC141AMD64
+ PATH_TOOL_VCC141AMD64 := $(PATH_TOOL_VCC141)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC141AMD64 := $(PATH_TOOL_VCC141AMD64)
+endif
+
+ifndef PATH_TOOL_VCC141AMD64_BIN
+PATH_TOOL_VCC141AMD64_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/x64
+else
+PATH_TOOL_VCC141AMD64_BIN := $(PATH_TOOL_VCC141AMD64_BIN)
+endif
+PATH_TOOL_VCC141AMD64_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC141AMD64_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC141AMD64_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC141_HOST_DLL_BIN),$(PATH_TOOL_VCC141AMD64_BIN))
+PATH_TOOL_VCC141AMD64_DLL_BIN := $(PATH_TOOL_VCC141_HOST_DLL_BIN)
+ endif
+endif
+
+ifndef PATH_TOOL_VCC141AMD64_LIB
+PATH_TOOL_VCC141AMD64_LIB := $(PATH_TOOL_VCC141_LIB.amd64)
+endif
+ifndef PATH_TOOL_VCC141_ONECORE_LIB
+PATH_TOOL_VCC141_ONECORE_LIB := $(PATH_TOOL_VCC141_ONECORE_LIB.amd64)
+endif
+
+ifndef PATH_TOOL_VCC141AMD64_INC
+PATH_TOOL_VCC141AMD64_INC := $(PATH_TOOL_VCC141_INC)
+endif
+
+ifndef PATH_TOOL_VCC141AMD64_ATLMFC_INC
+PATH_TOOL_VCC141AMD64_ATLMFC_INC := $(PATH_TOOL_VCC141_ATLMFC_INC.amd64)
+endif
+ifndef PATH_TOOL_VCC141AMD64_ATLMFC_LIB
+PATH_TOOL_VCC141AMD64_ATLMFC_LIB := $(PATH_TOOL_VCC141_ATLMFC_LIB.amd64)
+endif
+
+TOOL_VCC141AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/cl.exe
+TOOL_VCC141AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/cl.exe
+TOOL_VCC141AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/ml64.exe
+#TOOL_VCC141AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC141AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/link.exe /LIB
+TOOL_VCC141AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/link.exe
+TOOL_VCC141AMD64_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/dumpbin.exe
+TOOL_VCC141AMD64_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141AMD64_BIN_QSH)/editbin.exe
+
+TOOL_VCC141AMD64_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC141_RC_CACHED)
+TOOL_VCC141AMD64_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC141_MT_CACHED)
+
+undefine TOOL_VCC141AMD64_USE_KSUBMIT # for now
+ifdef TOOL_VCC141AMD64_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC141AMD64_BIN)),-3),64/)
+ TOOL_VCC141AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC141AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC141AMD64_DLL_BIN
+ TOOL_VCC141AMD64_KSUBMIT := $(TOOL_VCC141AMD64_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141AMD64_DLL_BIN));"
+ endif
+ TOOL_VCC141AMD64_KSUBMIT_DD := $(TOOL_VCC141AMD64_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC141AMD64_DLL_BIN
+ TOOL_VCC141AMD64_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141AMD64_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC141AMD64_KSUBMIT_DD
+ TOOL_VCC141AMD64_KSUBMIT_DD := $(TOOL_VCC141AMD64_SETUP_ENV)
+ endif
+endif
+
+# Redist (more stuff in VCC141.kmk).
+PATH_TOOL_VCC141AMD64_REDIST ?= $(PATH_TOOL_VCC141_REDIST)/x64
+PATH_TOOL_VCC141AMD64_REDIST_CRT = $(PATH_TOOL_VCC141AMD64_REDIST)/$(TOOL_VCC141_REDIST_CRT_SUBDIR)
+PATH_TOOL_VCC141AMD64_REDIST_DEBUG ?= $(PATH_TOOL_VCC141_REDIST_DEBUG)/x64
+PATH_TOOL_VCC141AMD64_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC141AMD64_REDIST_DEBUG)/$(TOOL_VCC141_REDIST_CRT_SUBDIR)
+TOOL_VCC141AMD64_REDIST_CRT_DLLS = $(TOOL_VCC141_REDIST_CRT_DLLS.amd64)
+TOOL_VCC141AMD64_REDIST_CONCRT_DLLS = $(TOOL_VCC141_REDIST_CONCRT_DLLS.amd64)
+TOOL_VCC141AMD64_REDIST_CPP_DLLS = $(TOOL_VCC141_REDIST_CPP_DLLS.amd64)
+TOOL_VCC141AMD64_REDIST_WINRT_DLLS = $(TOOL_VCC141_REDIST_WINRT_DLLS.amd64)
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC141AMD64_COBJSUFF ?= .obj
+TOOL_VCC141AMD64_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC141AMD64_CFLAGS.debug ?=
+TOOL_VCC141AMD64_CFLAGS.dbgopt ?= -O2
+TOOL_VCC141AMD64_CFLAGS.release ?= -O2
+TOOL_VCC141AMD64_CFLAGS.profile ?= -O2
+TOOL_VCC141AMD64_CINCS ?= $(PATH_TOOL_VCC141AMD64_INC)
+TOOL_VCC141AMD64_CDEFS ?=
+
+TOOL_VCC141AMD64_CXXOBJSUFF ?= .obj
+TOOL_VCC141AMD64_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC141AMD64_CXXFLAGS.debug ?=
+TOOL_VCC141AMD64_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC141AMD64_CXXFLAGS.release ?= -O2
+TOOL_VCC141AMD64_CXXFLAGS.profile ?= -O2
+TOOL_VCC141AMD64_CXXINCS ?= $(PATH_TOOL_VCC141AMD64_INC) $(PATH_TOOL_VCC141AMD64_ATLMFC_INC)
+TOOL_VCC141AMD64_CXXDEFS ?=
+
+TOOL_VCC141AMD64_ASOBJSUFF ?= .obj
+
+TOOL_VCC141AMD64_RCOBJSUFF ?= .res
+TOOL_VCC141AMD64_RCINCS ?= $(PATH_TOOL_VCC141AMD64_INC) $(PATH_TOOL_VCC141AMD64_ATLMFC_INC)
+
+TOOL_VCC141AMD64_ARFLAGS ?= -nologo -machine:amd64
+TOOL_VCC141AMD64_ARLIBSUFF ?= .lib
+
+TOOL_VCC141AMD64_LDFLAGS ?= -nologo -machine:amd64
+TOOL_VCC141AMD64_LDFLAGS.debug ?= -debug
+TOOL_VCC141AMD64_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC141AMD64_LDFLAGS.profile ?= -debug
+TOOL_VCC141AMD64_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141AMD64_COMPILE_C_DEPEND =
+TOOL_VCC141AMD64_COMPILE_C_DEPORD =
+TOOL_VCC141AMD64_COMPILE_C_OUTPUT =
+TOOL_VCC141AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC141AMD64_KSUBMIT
+ TOOL_VCC141AMD64_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC141AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141AMD64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC141AMD64_SETUP_ENV)$(TOOL_VCC141AMD64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC141AMD64_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141AMD64_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC141AMD64_COMPILE_CXX_DEPORD =
+TOOL_VCC141AMD64_COMPILE_CXX_OUTPUT =
+TOOL_VCC141AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC141AMD64_KSUBMIT
+ TOOL_VCC141AMD64_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC141AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141AMD64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC141AMD64_SETUP_ENV)$(TOOL_VCC141AMD64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC141AMD64_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC141AMD64-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC141AMD64-PCH_EXTENDS := VCC141AMD64
+TOOL_VCC141AMD64-PCH_CXXOBJSUFF := .obj
+TOOL_VCC141AMD64-PCH_CXXINCS = $(TOOL_VCC141AMD64_CXXINCS)
+TOOL_VCC141AMD64-PCH_CXXFLAGS = $(TOOL_VCC141AMD64_CXXFLAGS) -FS
+TOOL_VCC141AMD64-PCH_CXXFLAGS.debug = $(TOOL_VCC141AMD64_CXXFLAGS.debug)
+TOOL_VCC141AMD64-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC141AMD64_CXXFLAGS.dbgopt)
+TOOL_VCC141AMD64-PCH_CXXFLAGS.release = $(TOOL_VCC141AMD64_CXXFLAGS.release)
+TOOL_VCC141AMD64-PCH_CXXFLAGS.profile = $(TOOL_VCC141AMD64_CXXFLAGS.profile)
+TOOL_VCC141AMD64-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC141AMD64-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC141AMD64-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC141AMD64-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC141AMD64_KSUBMIT
+ define TOOL_VCC141AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141AMD64_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC141AMD64_SETUP_ENV)$(TOOL_VCC141AMD64_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC141AMD64_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141AMD64_COMPILE_RC_DEPEND =
+TOOL_VCC141AMD64_COMPILE_RC_DEPORD =
+TOOL_VCC141AMD64_COMPILE_RC_OUTPUT =
+define TOOL_VCC141AMD64_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC141AMD64_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC141AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC141AMD64_LINK_LIBRARY_DEPORD =
+TOOL_VCC141AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC141AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC141AMD64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT_DD) $(TOOL_VCC141AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC141AMD64_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141AMD64_LINK_PROGRAM_DEPORD =
+TOOL_VCC141AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC141AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC141AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141AMD64_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT_DD) $(TOOL_VCC141AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC141AMD64_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC141AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC141AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC141AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC141AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141AMD64_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT_DD) $(TOOL_VCC141AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC141AMD64_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141AMD64_LINK_SYSMOD_DEPORD =
+TOOL_VCC141AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC141AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC141AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141AMD64_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141AMD64_KSUBMIT_DD) $(TOOL_VCC141AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC141X86.kmk b/kBuild/tools/VCC141X86.kmk
new file mode 100644
index 0000000..8210f40
--- /dev/null
+++ b/kBuild/tools/VCC141X86.kmk
@@ -0,0 +1,459 @@
+# $Id: VCC141X86.kmk 3346 2020-05-22 20:56:11Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.1 (aka Visual 2017 and MSC v19.10), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef TOOL_VCC141
+ include $(KBUILD_PATH)/tools/VCC141.kmk
+endif
+
+TOOL_VCC141X86 := Visual C++ 14.1 (aka Visual 2017 and MSC v19.1), targeting x86
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC141X86
+ PATH_TOOL_VCC141X86 := $(PATH_TOOL_VCC141)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC141X86 := $(PATH_TOOL_VCC141X86)
+endif
+
+ifndef PATH_TOOL_VCC141X86_BIN
+PATH_TOOL_VCC141X86_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/x86
+else
+PATH_TOOL_VCC141X86_BIN := $(PATH_TOOL_VCC141X86_BIN)
+endif
+PATH_TOOL_VCC141X86_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC141X86_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC141X86_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC141_HOST_DLL_BIN),$(PATH_TOOL_VCC141X86_BIN))
+PATH_TOOL_VCC141X86_DLL_BIN := $(PATH_TOOL_VCC141_HOST_DLL_BIN)
+ endif
+endif
+
+ifndef PATH_TOOL_VCC141X86_LIB
+PATH_TOOL_VCC141X86_LIB := $(PATH_TOOL_VCC141_LIB.x86)
+endif
+ifndef PATH_TOOL_VCC141_ONECORE_LIB
+PATH_TOOL_VCC141_ONECORE_LIB := $(PATH_TOOL_VCC141_ONECORE_LIB.x86)
+endif
+
+ifndef PATH_TOOL_VCC141X86_INC
+PATH_TOOL_VCC141X86_INC := $(PATH_TOOL_VCC141_INC)
+endif
+
+ifndef PATH_TOOL_VCC141X86_ATLMFC_INC
+PATH_TOOL_VCC141X86_ATLMFC_INC := $(PATH_TOOL_VCC141_ATLMFC_INC.x86)
+endif
+ifndef PATH_TOOL_VCC141X86_ATLMFC_LIB
+PATH_TOOL_VCC141X86_ATLMFC_LIB := $(PATH_TOOL_VCC141_ATLMFC_LIB.x86)
+endif
+
+TOOL_VCC141X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/cl.exe
+TOOL_VCC141X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/cl.exe
+TOOL_VCC141X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/ml.exe
+#TOOL_VCC141X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC141X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/link.exe /LIB
+TOOL_VCC141X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/link.exe
+TOOL_VCC141X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/dumpbin.exe
+TOOL_VCC141X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/editbin.exe
+
+TOOL_VCC141X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC141_RC_CACHED)
+TOOL_VCC141X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC141_MT_CACHED)
+
+undefine TOOL_VCC141X86_USE_KSUBMIT # for now
+ifdef TOOL_VCC141X86_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC141X86_BIN)),-3),64/)
+ TOOL_VCC141X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ else
+ TOOL_VCC141X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ endif
+ ifdef PATH_TOOL_VCC141X86_DLL_BIN
+ TOOL_VCC141X86_KSUBMIT := $(TOOL_VCC141X86_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141X86_DLL_BIN));"
+ endif
+ TOOL_VCC141X86_KSUBMIT_DD := $(TOOL_VCC141X86_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC141X86_DLL_BIN
+ TOOL_VCC141X86_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141X86_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC141X86_KSUBMIT_DD
+ TOOL_VCC141X86_KSUBMIT_DD := $(TOOL_VCC141X86_SETUP_ENV)
+ endif
+endif
+
+# Redist (more stuff in VCC141.kmk).
+PATH_TOOL_VCC141X86_REDIST ?= $(PATH_TOOL_VCC141_REDIST)/x86
+PATH_TOOL_VCC141X86_REDIST_CRT = $(PATH_TOOL_VCC141X86_REDIST)/$(TOOL_VCC141_REDIST_CRT_SUBDIR)
+PATH_TOOL_VCC141X86_REDIST_DEBUG ?= $(PATH_TOOL_VCC141_REDIST_DEBUG)/x86
+PATH_TOOL_VCC141X86_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC141X86_REDIST_DEBUG)/$(TOOL_VCC141_REDIST_CRT_SUBDIR)
+TOOL_VCC141X64_REDIST_CRT_DLLS = $(TOOL_VCC141_REDIST_CRT_DLLS.x86)
+TOOL_VCC141X64_REDIST_CONCRT_DLLS = $(TOOL_VCC141_REDIST_CONCRT_DLLS.x86)
+TOOL_VCC141X64_REDIST_CPP_DLLS = $(TOOL_VCC141_REDIST_CPP_DLLS.x86)
+TOOL_VCC141X64_REDIST_WINRT_DLLS = $(TOOL_VCC141_REDIST_WINRT_DLLS.x86)
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC141X86_COBJSUFF ?= .obj
+TOOL_VCC141X86_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC141X86_CFLAGS.debug ?=
+TOOL_VCC141X86_CFLAGS.dbgopt ?= -O2
+TOOL_VCC141X86_CFLAGS.release ?= -O2
+TOOL_VCC141X86_CFLAGS.profile ?= -O2
+TOOL_VCC141X86_CINCS ?= $(PATH_TOOL_VCC141X86_INC)
+TOOL_VCC141X86_CDEFS ?=
+
+TOOL_VCC141X86_CXXOBJSUFF ?= .obj
+TOOL_VCC141X86_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC141X86_CXXFLAGS.debug ?=
+TOOL_VCC141X86_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC141X86_CXXFLAGS.release ?= -O2
+TOOL_VCC141X86_CXXFLAGS.profile ?= -O2
+TOOL_VCC141X86_CXXINCS ?= $(PATH_TOOL_VCC141X86_INC) $(PATH_TOOL_VCC141X86_ATLMFC_INC)
+TOOL_VCC141X86_CXXDEFS ?=
+
+TOOL_VCC141X86_ASOBJSUFF ?= .obj
+
+TOOL_VCC141X86_RCOBJSUFF ?= .res
+TOOL_VCC141X86_RCINCS ?= $(PATH_TOOL_VCC141X86_INC) $(PATH_TOOL_VCC141X86_ATLMFC_INC)
+
+TOOL_VCC141X86_ARFLAGS ?= -nologo -machine:x86
+TOOL_VCC141X86_ARLIBSUFF ?= .lib
+
+TOOL_VCC141X86_LDFLAGS ?= -nologo -machine:x86
+TOOL_VCC141X86_LDFLAGS.debug ?= -debug
+TOOL_VCC141X86_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC141X86_LDFLAGS.profile ?= -debug
+TOOL_VCC141X86_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141X86_COMPILE_C_DEPEND =
+TOOL_VCC141X86_COMPILE_C_DEPORD =
+TOOL_VCC141X86_COMPILE_C_OUTPUT =
+TOOL_VCC141X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC141X86_KSUBMIT
+ TOOL_VCC141X86_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC141X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141X86_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC141X86_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC141X86_COMPILE_CXX_DEPORD =
+TOOL_VCC141X86_COMPILE_CXX_OUTPUT =
+TOOL_VCC141X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC141X86_KSUBMIT
+ TOOL_VCC141X86_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC141X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141X86_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC141X86_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC141X86-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC141X86-PCH_EXTENDS := VCC141X86
+TOOL_VCC141X86-PCH_CXXOBJSUFF := .obj
+TOOL_VCC141X86-PCH_CXXINCS = $(TOOL_VCC141X86_CXXINCS)
+TOOL_VCC141X86-PCH_CXXFLAGS = $(TOOL_VCC141X86_CXXFLAGS) -FS
+TOOL_VCC141X86-PCH_CXXFLAGS.debug = $(TOOL_VCC141X86_CXXFLAGS.debug)
+TOOL_VCC141X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC141X86_CXXFLAGS.dbgopt)
+TOOL_VCC141X86-PCH_CXXFLAGS.release = $(TOOL_VCC141X86_CXXFLAGS.release)
+TOOL_VCC141X86-PCH_CXXFLAGS.profile = $(TOOL_VCC141X86_CXXFLAGS.profile)
+TOOL_VCC141X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC141X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC141X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC141X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC141X86_KSUBMIT
+ define TOOL_VCC141X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC141X86_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC141X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC141X86_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC141X86_COMPILE_RC_DEPEND =
+TOOL_VCC141X86_COMPILE_RC_DEPORD =
+TOOL_VCC141X86_COMPILE_RC_OUTPUT =
+define TOOL_VCC141X86_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC141X86_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC141X86_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC141X86_LINK_LIBRARY_DEPORD =
+TOOL_VCC141X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC141X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC141X86_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC141X86_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141X86_LINK_PROGRAM_DEPORD =
+TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141X86_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC141X86_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC141X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC141X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC141X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC141X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141X86_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC141X86_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC141X86_LINK_SYSMOD_DEPORD =
+TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC141X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC141X86_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC142.kmk b/kBuild/tools/VCC142.kmk
new file mode 100644
index 0000000..b30ee00
--- /dev/null
+++ b/kBuild/tools/VCC142.kmk
@@ -0,0 +1,561 @@
+# $Id: VCC142.kmk 3553 2022-01-29 02:59:56Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.2 (aka Visual 2019 and MSC v19.20), default target.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC142 := Visual C++ 14.2 (aka Visual 2019 and MSC v19.20), targeting $(KBUILD_TARGET).
+
+ifndef INCLUDED_WIN_COMMON_KMK
+ include $(KBUILD_PATH)/win-common.kmk
+endif
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC142
+ PATH_TOOL_VCC142 := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.amd64/vcc/v14.2*/Tools/MSVC/14.2?.*)))
+ ifeq ($(PATH_TOOL_VCC142),)
+ PATH_TOOL_VCC142 := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.2*/Tools/MSVC/14.2?.*)))
+ endif
+ ifeq ($(PATH_TOOL_VCC142),)
+ PATH_TOOL_VCC142 := $(PATH_TOOL_VCC142X86)
+ endif
+ ifeq ($(PATH_TOOL_VCC142),)
+ PATH_TOOL_VCC142 := $(PATH_TOOL_VCC142)
+ endif
+ ifeq ($(PATH_TOOL_VCC142),)
+ PATH_TOOL_VCC142 := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.2*/Tools/MSVC/14.2?.*)))
+ ifeq ($(PATH_TOOL_VCC142),)
+ PATH_TOOL_VCC142 := $(firstfile $(foreach ver,2019,$(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
+ , $(rversortfiles $(qwildcard ,$(progfilesdir)/Microsoft\ Visual\ Studio/$(ver)/BuildTools/VC/Tools/MSVC/14.2?.*)))))
+ ifeq ($(PATH_TOOL_VCC142),)
+ $(warning kBuild: PATH_TOOL_VCC142 cannot be determined!)
+ PATH_TOOL_VCC142 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v142
+ endif
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC142 := $(PATH_TOOL_VCC142)
+endif
+
+ifndef PATH_TOOL_VCC142_BASE_BIN
+PATH_TOOL_VCC142_BASE_BIN := $(PATH_TOOL_VCC142)/bin
+endif
+ifndef PATH_TOOL_VCC142_HOST_BIN
+PATH_TOOL_VCC142_HOST_BIN := $(PATH_TOOL_VCC142_BASE_BIN)/Host$(WINCMN_MAP_ARCH.$(KBUILD_HOST_ARCH))
+endif
+ifndef PATH_TOOL_VCC142_BIN
+PATH_TOOL_VCC142_BIN := $(PATH_TOOL_VCC142_HOST_BIN)/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))
+endif
+PATH_TOOL_VCC142_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC142_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC142_HOST_DLL_BIN
+PATH_TOOL_VCC142_HOST_DLL_BIN := $(PATH_TOOL_VCC142_HOST_BIN)/$(WINCMN_MAP_ARCH.$(KBUILD_HOST_ARCH))
+endif
+ifndef PATH_TOOL_VCC142_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC142_HOST_DLL_BIN),$(PATH_TOOL_VCC142_BIN))
+PATH_TOOL_VCC142_DLL_BIN := $(PATH_TOOL_VCC142_HOST_DLL_BIN)
+ endif
+endif
+
+PATH_TOOL_VCC142_LIB.amd64 ?= $(PATH_TOOL_VCC142)/lib/x64
+PATH_TOOL_VCC142_LIB.arm32 ?= $(PATH_TOOL_VCC142)/lib/arm
+PATH_TOOL_VCC142_LIB.arm64 ?= $(PATH_TOOL_VCC142)/lib/arm64
+PATH_TOOL_VCC142_LIB.x86 ?= $(PATH_TOOL_VCC142)/lib/x86
+
+PATH_TOOL_VCC142_ONECORE_LIB.amd64 ?= $(PATH_TOOL_VCC142)/lib/onecore/x64
+PATH_TOOL_VCC142_ONECORE_LIB.arm32 ?= $(PATH_TOOL_VCC142)/lib/onecore/arm
+PATH_TOOL_VCC142_ONECORE_LIB.arm64 ?= $(PATH_TOOL_VCC142)/lib/onecore/arm64
+PATH_TOOL_VCC142_ONECORE_LIB.x86 ?= $(PATH_TOOL_VCC142)/lib/onecore/x86
+
+PATH_TOOL_VCC142_INC ?= $(PATH_TOOL_VCC142)/include
+
+PATH_TOOL_VCC142_ATLMFC ?= $(PATH_TOOL_VCC142)/atlmfc
+PATH_TOOL_VCC142_ATLMFC_INC ?= $(PATH_TOOL_VCC142_ATLMFC)/include
+PATH_TOOL_VCC142_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC142_ATLMFC)/lib/x86
+PATH_TOOL_VCC142_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC142_ATLMFC)/lib/x64
+
+TOOL_VCC142_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/cl.exe
+TOOL_VCC142_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/cl.exe
+ifeq ($(KBUILD_TARGET_ARCH),x86)
+TOOL_VCC142_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/ml.exe
+else
+TOOL_VCC142_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/ml64.exe
+endif
+#TOOL_VCC142_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC142_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/link.exe /LIB
+TOOL_VCC142_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/link.exe
+TOOL_VCC142_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/dumpbin.exe
+TOOL_VCC142_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142_BIN_QSH)/editbin.exe
+
+TOOL_VCC142_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC142_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC142_RC_CACHED)
+TOOL_VCC142_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC142_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC142_MT_CACHED)
+
+ifdef TOOL_VCC142_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifeq ($(findstring /HostX86/,$(PATH_TOOL_VCC142AMD64_BIN)),/HostX86/)
+ TOOL_VCC142_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ else
+ TOOL_VCC142_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ endif
+ ifdef PATH_TOOL_VCC142_DLL_BIN
+ TOOL_VCC142_KSUBMIT := $(TOOL_VCC142_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC142_DLL_BIN));"
+ endif
+ TOOL_VCC142_KSUBMIT_DD := $(TOOL_VCC142_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC142_DLL_BIN
+ TOOL_VCC142_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC142_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC142_KSUBMIT_DD
+ TOOL_VCC142_KSUBMIT_DD := $(TOOL_VCC142_SETUP_ENV)
+ endif
+endif
+
+
+## Helper for finding rc.exe and mt.exe in the SDK.
+TOOL_VCC142_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(qfirstfile sh,\
+ $(if-expr defined(PATH_SDK_WINSDK10_BIN) , $(qwildcard ,$(PATH_SDK_WINSDK10_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(qwildcard ,$(PATH_SDK_WINPSDK71_BIN)/$2)) \
+ $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(qwildcard ,$(PATH_SDK_WINPSDK_BIN)/$2)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
+ $1))
+TOOL_VCC142_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC142_FN_FIND_SDK_TOOL_SUB),)$($3)
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC142_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+#
+# Try find the redist directory. A little complicated as the build number
+# doesn't necessarily match that of the compiler.
+#
+ifeq ($(tolower $(substr $(qdir u,$(PATH_TOOL_VCC142)), -12)),/tools/msvc/)
+PATH_TOOL_VCC142_REDIST ?= $(firstfile $(qwildcard ,$(substr $(qdir ,$(PATH_TOOL_VCC142)), 1, -12)/Redist/MSVC/14.2*))
+else
+PATH_TOOL_VCC142_REDIST ?= $(qabspath ,$(firstfile $(qwildcard ,\
+ $(PATH_TOOL_VCC142)/Redist \
+ $(PATH_TOOL_VCC142)/../Redist \
+ $(PATH_TOOL_VCC142)/../../Redist \
+ $(PATH_TOOL_VCC142)/../../../Redist \
+ $(PATH_TOOL_VCC142)/../../../../Redist)))
+endif
+PATH_TOOL_VCC142_REDIST_DEBUG ?= $(PATH_TOOL_VCC142_REDIST)/debug_nonredist
+
+## Updates may add more msvcp140_[0-9].dll images as the product matures.
+# This helper locates them (can differ between archs).
+# @param 1 Redist subdirectory.
+# @param 2 The DLL basename (no suffix).
+# @param 3 The VCC architecture name (for constructing the path).
+FN_TOOL_VCC142_FIND_DLLS = $(2).dll \
+ $(versortfiles $(qnotdir ,$(qwildcard ,$(PATH_TOOL_VCC142_REDIST)/$(3)/$(1)/$(2)_?.dll)))
+
+TOOL_VCC142_REDIST_CRT_SUBDIR := Microsoft.VC142.CRT
+TOOL_VCC142_REDIST_DEBUG_CRT_SUBDIR := Microsoft.VC142.DebugCRT
+
+TOOL_VCC142_REDIST_CRT_DLLS.x86 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vcruntime140,x86)
+TOOL_VCC142_REDIST_CRT_DLLS.amd64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vcruntime140,x64)
+TOOL_VCC142_REDIST_CRT_DLLS.arm32 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vcruntime140,arm)
+TOOL_VCC142_REDIST_CRT_DLLS.arm64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vcruntime140,arm64)
+TOOL_VCC142_REDIST_CRT_DLLS = $(TOOL_VCC142_REDIST_CRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC142_REDIST_CONCRT_DLLS.x86 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),concrt140,x86)
+TOOL_VCC142_REDIST_CONCRT_DLLS.amd64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),concrt140,x64)
+TOOL_VCC142_REDIST_CONCRT_DLLS.arm32 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),concrt140,arm)
+TOOL_VCC142_REDIST_CONCRT_DLLS.arm64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),concrt140,arm64)
+TOOL_VCC142_REDIST_CONCRT_DLLS = $(TOOL_VCC142_REDIST_CONCRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC142_REDIST_CPP_DLLS.x86 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),msvcp140,x86)
+TOOL_VCC142_REDIST_CPP_DLLS.amd64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),msvcp140,x64)
+TOOL_VCC142_REDIST_CPP_DLLS.arm32 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),msvcp140,arm)
+TOOL_VCC142_REDIST_CPP_DLLS.arm64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),msvcp140,arm64)
+TOOL_VCC142_REDIST_CPP_DLLS = $(TOOL_VCC142_REDIST_CPP_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC142_REDIST_WINRT_DLLS.x86 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vccorlib140,x86)
+TOOL_VCC142_REDIST_WINRT_DLLS.amd64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vccorlib140,x64)
+TOOL_VCC142_REDIST_WINRT_DLLS.arm32 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vccorlib140,arm)
+TOOL_VCC142_REDIST_WINRT_DLLS.arm64 = $(call FN_TOOL_VCC142_FIND_DLLS,$(TOOL_VCC142_REDIST_CRT_SUBDIR),vccorlib140,arm64)
+TOOL_VCC142_REDIST_WINRT_DLLS = $(TOOL_VCC142_REDIST_WINRT_DLLS.$(KBUILD_TARGET_ARCH))
+
+TOOL_VCC142_REDIST_CXXAMP_SUBDIR := Microsoft.VC142.CXXAMP
+TOOL_VCC142_REDIST_MFC_SUBDIR := Microsoft.VC142.MFC
+TOOL_VCC142_REDIST_MFCLOC_SUBDIR := Microsoft.VC142.MFCLOC
+TOOL_VCC142_REDIST_OPENMP_SUBDIR := Microsoft.VC142.OpenMP
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC142_COBJSUFF ?= .obj
+TOOL_VCC142_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC142_CFLAGS.debug ?=
+TOOL_VCC142_CFLAGS.dbgopt ?= -O2
+TOOL_VCC142_CFLAGS.release ?= -O2
+TOOL_VCC142_CFLAGS.profile ?= -O2
+TOOL_VCC142_CINCS ?= $(PATH_TOOL_VCC142_INC)
+TOOL_VCC142_CDEFS ?=
+
+TOOL_VCC142_CXXOBJSUFF ?= .obj
+TOOL_VCC142_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC142_CXXFLAGS.debug ?=
+TOOL_VCC142_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC142_CXXFLAGS.release ?= -O2
+TOOL_VCC142_CXXFLAGS.profile ?= -O2
+TOOL_VCC142_CXXINCS ?= $(PATH_TOOL_VCC142_INC) $(PATH_TOOL_VCC142_ATLMFC_INC)
+TOOL_VCC142_CXXDEFS ?=
+
+TOOL_VCC142_ASOBJSUFF ?= .obj
+
+TOOL_VCC142_RCOBJSUFF ?= .res
+TOOL_VCC142_RCINCS ?= $(PATH_TOOL_VCC142_INC) $(PATH_TOOL_VCC142_ATLMFC_INC)
+
+TOOL_VCC142_ARFLAGS ?= -nologo
+TOOL_VCC142_ARFLAGS.x86 ?= -machine:x86
+TOOL_VCC142_ARFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC142_ARFLAGS.arm32 ?= -machine:arm
+TOOL_VCC142_ARLIBSUFF ?= .lib
+
+TOOL_VCC142_LDFLAGS ?= -nologo
+TOOL_VCC142_LDFLAGS.x86 ?= -machine:x86
+TOOL_VCC142_LDFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC142_LDFLAGS.arm32 ?= -machine:arm
+TOOL_VCC142_LDFLAGS.debug ?= -debug
+TOOL_VCC142_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC142_LDFLAGS.profile ?= -debug
+TOOL_VCC142_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+# @note The -d1scalableinclude- option disables include directory caching as the cache goes
+# stale in kWorker. Besides, kWorker does it's own caching, so it is not necessary.
+TOOL_VCC142_COMPILE_C_DEPEND =
+TOOL_VCC142_COMPILE_C_DEPORD =
+TOOL_VCC142_COMPILE_C_OUTPUT =
+TOOL_VCC142_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC142_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC142_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC142_KSUBMIT
+ TOOL_VCC142_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC142_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC142_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142_CC) -c -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC142_SETUP_ENV)$(TOOL_VCC142_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC142_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+# @note The -d1scalableinclude- option disables include directory caching as the cache goes
+# stale in kWorker. Besides, kWorker does it's own caching, so it is not necessary.
+# ('-d1' means it's passed to c1.dll/c1xx.dll and 'scalableinclude-' is the actual option.)
+TOOL_VCC142_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC142_COMPILE_CXX_DEPORD =
+TOOL_VCC142_COMPILE_CXX_OUTPUT =
+TOOL_VCC142_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC142_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC142_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC142_KSUBMIT
+ TOOL_VCC142_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC142_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC142_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142_CXX) -c -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC142_SETUP_ENV)$(TOOL_VCC142_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC142_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC142-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC142-PCH_EXTENDS := VCC142
+TOOL_VCC142-PCH_CXXOBJSUFF := .obj
+TOOL_VCC142-PCH_CXXINCS = $(TOOL_VCC142_CXXINCS)
+TOOL_VCC142-PCH_CXXFLAGS = $(TOOL_VCC142_CXXFLAGS) -FS
+TOOL_VCC142-PCH_CXXFLAGS.debug = $(TOOL_VCC142_CXXFLAGS.debug)
+TOOL_VCC142-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC142_CXXFLAGS.dbgopt)
+TOOL_VCC142-PCH_CXXFLAGS.release = $(TOOL_VCC142_CXXFLAGS.release)
+TOOL_VCC142-PCH_CXXFLAGS.profile = $(TOOL_VCC142_CXXFLAGS.profile)
+TOOL_VCC142-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC142-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC142-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC142-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC142_KSUBMIT
+ define TOOL_VCC142-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC142_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142_CXX) -c -Yc -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC142_SETUP_ENV)$(TOOL_VCC142_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC142_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC142_COMPILE_RC_DEPEND =
+TOOL_VCC142_COMPILE_RC_DEPORD =
+TOOL_VCC142_COMPILE_RC_OUTPUT =
+define TOOL_VCC142_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC142_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC142_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC142_LINK_LIBRARY_DEPORD =
+TOOL_VCC142_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC142_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC142_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142_KSUBMIT_DD) $(TOOL_VCC142_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC142_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142_LINK_PROGRAM_DEPORD =
+TOOL_VCC142_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC142_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC142_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142_KSUBMIT_DD) $(TOOL_VCC142_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC142_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC142_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC142_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC142_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC142_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142_KSUBMIT_DD) $(TOOL_VCC142_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC142_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142_LINK_SYSMOD_DEPORD =
+TOOL_VCC142_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC142_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC142_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142_KSUBMIT_DD) $(TOOL_VCC142_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC142AMD64.kmk b/kBuild/tools/VCC142AMD64.kmk
new file mode 100644
index 0000000..cd2bfc6
--- /dev/null
+++ b/kBuild/tools/VCC142AMD64.kmk
@@ -0,0 +1,463 @@
+# $Id: VCC142AMD64.kmk 3370 2020-06-10 10:45:05Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.2 (aka Visual 2019 and MSC v19.20), targeting AMD64.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef TOOL_VCC142
+ include $(KBUILD_PATH)/tools/VCC142.kmk
+endif
+
+TOOL_VCC142AMD64 := Visual C++ 14.2 (aka Visual 2019 and MSC v19.20), targeting AMD64
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC142AMD64
+ PATH_TOOL_VCC142AMD64 := $(PATH_TOOL_VCC142)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC142AMD64 := $(PATH_TOOL_VCC142AMD64)
+endif
+
+ifndef PATH_TOOL_VCC142AMD64_BIN
+PATH_TOOL_VCC142AMD64_BIN := $(PATH_TOOL_VCC142_HOST_BIN)/x64
+else
+PATH_TOOL_VCC142AMD64_BIN := $(PATH_TOOL_VCC142AMD64_BIN)
+endif
+PATH_TOOL_VCC142AMD64_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC142AMD64_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC142AMD64_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC142_HOST_DLL_BIN),$(PATH_TOOL_VCC142AMD64_BIN))
+PATH_TOOL_VCC142AMD64_DLL_BIN := $(PATH_TOOL_VCC142_HOST_DLL_BIN)
+ endif
+endif
+
+ifndef PATH_TOOL_VCC142AMD64_LIB
+PATH_TOOL_VCC142AMD64_LIB := $(PATH_TOOL_VCC142_LIB.amd64)
+endif
+ifndef PATH_TOOL_VCC142_ONECORE_LIB
+PATH_TOOL_VCC142_ONECORE_LIB := $(PATH_TOOL_VCC142_ONECORE_LIB.amd64)
+endif
+
+ifndef PATH_TOOL_VCC142AMD64_INC
+PATH_TOOL_VCC142AMD64_INC := $(PATH_TOOL_VCC142_INC)
+endif
+
+ifndef PATH_TOOL_VCC142AMD64_ATLMFC_INC
+PATH_TOOL_VCC142AMD64_ATLMFC_INC := $(PATH_TOOL_VCC142_ATLMFC_INC.amd64)
+endif
+ifndef PATH_TOOL_VCC142AMD64_ATLMFC_LIB
+PATH_TOOL_VCC142AMD64_ATLMFC_LIB := $(PATH_TOOL_VCC142_ATLMFC_LIB.amd64)
+endif
+
+TOOL_VCC142AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/cl.exe
+TOOL_VCC142AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/cl.exe
+TOOL_VCC142AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/ml64.exe
+#TOOL_VCC142AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC142AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/link.exe /LIB
+TOOL_VCC142AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/link.exe
+TOOL_VCC142AMD64_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/dumpbin.exe
+TOOL_VCC142AMD64_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142AMD64_BIN_QSH)/editbin.exe
+
+TOOL_VCC142AMD64_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC142_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC142_RC_CACHED)
+TOOL_VCC142AMD64_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC142_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC142_MT_CACHED)
+
+ifdef TOOL_VCC142AMD64_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifeq ($(findstring /HostX86/,$(PATH_TOOL_VCC142AMD64_BIN)),/HostX86/)
+ TOOL_VCC142AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ else
+ TOOL_VCC142AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ endif
+ ifdef PATH_TOOL_VCC142AMD64_DLL_BIN
+ TOOL_VCC142AMD64_KSUBMIT := $(TOOL_VCC142AMD64_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC142AMD64_DLL_BIN));"
+ endif
+ TOOL_VCC142AMD64_KSUBMIT_DD := $(TOOL_VCC142AMD64_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC142AMD64_DLL_BIN
+ TOOL_VCC142AMD64_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC142AMD64_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC142AMD64_KSUBMIT_DD
+ TOOL_VCC142AMD64_KSUBMIT_DD := $(TOOL_VCC142AMD64_SETUP_ENV)
+ endif
+endif
+
+# Redist (more stuff in VCC142.kmk).
+PATH_TOOL_VCC142AMD64_REDIST ?= $(PATH_TOOL_VCC142_REDIST)/x64
+PATH_TOOL_VCC142AMD64_REDIST_CRT = $(PATH_TOOL_VCC142AMD64_REDIST)/$(TOOL_VCC142_REDIST_CRT_SUBDIR)
+PATH_TOOL_VCC142AMD64_REDIST_DEBUG ?= $(PATH_TOOL_VCC142_REDIST_DEBUG)/x64
+PATH_TOOL_VCC142AMD64_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC142AMD64_REDIST_DEBUG)/$(TOOL_VCC142_REDIST_CRT_SUBDIR)
+TOOL_VCC142AMD64_REDIST_CRT_DLLS = $(TOOL_VCC142_REDIST_CRT_DLLS.amd64)
+TOOL_VCC142AMD64_REDIST_CONCRT_DLLS = $(TOOL_VCC142_REDIST_CONCRT_DLLS.amd64)
+TOOL_VCC142AMD64_REDIST_CPP_DLLS = $(TOOL_VCC142_REDIST_CPP_DLLS.amd64)
+TOOL_VCC142AMD64_REDIST_WINRT_DLLS = $(TOOL_VCC142_REDIST_WINRT_DLLS.amd64)
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC142AMD64_COBJSUFF ?= .obj
+TOOL_VCC142AMD64_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC142AMD64_CFLAGS.debug ?=
+TOOL_VCC142AMD64_CFLAGS.dbgopt ?= -O2
+TOOL_VCC142AMD64_CFLAGS.release ?= -O2
+TOOL_VCC142AMD64_CFLAGS.profile ?= -O2
+TOOL_VCC142AMD64_CINCS ?= $(PATH_TOOL_VCC142AMD64_INC)
+TOOL_VCC142AMD64_CDEFS ?=
+
+TOOL_VCC142AMD64_CXXOBJSUFF ?= .obj
+TOOL_VCC142AMD64_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC142AMD64_CXXFLAGS.debug ?=
+TOOL_VCC142AMD64_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC142AMD64_CXXFLAGS.release ?= -O2
+TOOL_VCC142AMD64_CXXFLAGS.profile ?= -O2
+TOOL_VCC142AMD64_CXXINCS ?= $(PATH_TOOL_VCC142AMD64_INC) $(PATH_TOOL_VCC142AMD64_ATLMFC_INC)
+TOOL_VCC142AMD64_CXXDEFS ?=
+
+TOOL_VCC142AMD64_ASOBJSUFF ?= .obj
+
+TOOL_VCC142AMD64_RCOBJSUFF ?= .res
+TOOL_VCC142AMD64_RCINCS ?= $(PATH_TOOL_VCC142AMD64_INC) $(PATH_TOOL_VCC142AMD64_ATLMFC_INC)
+
+TOOL_VCC142AMD64_ARFLAGS ?= -nologo -machine:amd64
+TOOL_VCC142AMD64_ARLIBSUFF ?= .lib
+
+TOOL_VCC142AMD64_LDFLAGS ?= -nologo -machine:amd64
+TOOL_VCC142AMD64_LDFLAGS.debug ?= -debug
+TOOL_VCC142AMD64_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC142AMD64_LDFLAGS.profile ?= -debug
+TOOL_VCC142AMD64_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+# @note The -d1scalableinclude- option disables include directory caching as the cache goes
+# stale in kWorker. Besides, kWorker does it's own caching, so it is not necessary.
+TOOL_VCC142AMD64_COMPILE_C_DEPEND =
+TOOL_VCC142AMD64_COMPILE_C_DEPORD =
+TOOL_VCC142AMD64_COMPILE_C_OUTPUT =
+TOOL_VCC142AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC142_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC142_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC142AMD64_KSUBMIT
+ TOOL_VCC142AMD64_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC142AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142AMD64_CC) -c -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC142AMD64_SETUP_ENV)$(TOOL_VCC142AMD64_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC142AMD64_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+# @note The -d1scalableinclude- option disables include directory caching as the cache goes
+# stale in kWorker. Besides, kWorker does it's own caching, so it is not necessary.
+# ('-d1' means it's passed to c1.dll/c1xx.dll and 'scalableinclude-' is the actual option.)
+TOOL_VCC142AMD64_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC142AMD64_COMPILE_CXX_DEPORD =
+TOOL_VCC142AMD64_COMPILE_CXX_OUTPUT =
+TOOL_VCC142AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC142_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC142_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC142AMD64_KSUBMIT
+ TOOL_VCC142AMD64_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC142AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142AMD64_CXX) -c -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC142AMD64_SETUP_ENV)$(TOOL_VCC142AMD64_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC142AMD64_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC142AMD64-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC142AMD64-PCH_EXTENDS := VCC142AMD64
+TOOL_VCC142AMD64-PCH_CXXOBJSUFF := .obj
+TOOL_VCC142AMD64-PCH_CXXINCS = $(TOOL_VCC142AMD64_CXXINCS)
+TOOL_VCC142AMD64-PCH_CXXFLAGS = $(TOOL_VCC142AMD64_CXXFLAGS) -FS
+TOOL_VCC142AMD64-PCH_CXXFLAGS.debug = $(TOOL_VCC142AMD64_CXXFLAGS.debug)
+TOOL_VCC142AMD64-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC142AMD64_CXXFLAGS.dbgopt)
+TOOL_VCC142AMD64-PCH_CXXFLAGS.release = $(TOOL_VCC142AMD64_CXXFLAGS.release)
+TOOL_VCC142AMD64-PCH_CXXFLAGS.profile = $(TOOL_VCC142AMD64_CXXFLAGS.profile)
+TOOL_VCC142AMD64-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC142AMD64-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC142AMD64-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC142AMD64-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC142AMD64_KSUBMIT
+ define TOOL_VCC142AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142AMD64_CXX) -c -Yc -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142AMD64-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC142AMD64_SETUP_ENV)$(TOOL_VCC142AMD64_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC142AMD64_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC142AMD64_COMPILE_RC_DEPEND =
+TOOL_VCC142AMD64_COMPILE_RC_DEPORD =
+TOOL_VCC142AMD64_COMPILE_RC_OUTPUT =
+define TOOL_VCC142AMD64_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC142AMD64_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC142AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC142AMD64_LINK_LIBRARY_DEPORD =
+TOOL_VCC142AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC142AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC142AMD64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT_DD) $(TOOL_VCC142AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC142AMD64_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142AMD64_LINK_PROGRAM_DEPORD =
+TOOL_VCC142AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC142AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC142AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142AMD64_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT_DD) $(TOOL_VCC142AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC142AMD64_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC142AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC142AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC142AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC142AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142AMD64_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT_DD) $(TOOL_VCC142AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC142AMD64_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142AMD64_LINK_SYSMOD_DEPORD =
+TOOL_VCC142AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC142AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC142AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142AMD64_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142AMD64_KSUBMIT_DD) $(TOOL_VCC142AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142AMD64_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC142X86.kmk b/kBuild/tools/VCC142X86.kmk
new file mode 100644
index 0000000..8720fe6
--- /dev/null
+++ b/kBuild/tools/VCC142X86.kmk
@@ -0,0 +1,463 @@
+# $Id: VCC142X86.kmk 3370 2020-06-10 10:45:05Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 14.2 (aka Visual 2019 and MSC v19.20), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef TOOL_VCC142
+ include $(KBUILD_PATH)/tools/VCC142.kmk
+endif
+
+TOOL_VCC142X86 := Visual C++ 14.2 (aka Visual 2019 and MSC v19.20), targeting x86
+
+#
+# Tool Specific Properties
+#
+ifndef PATH_TOOL_VCC142X86
+ PATH_TOOL_VCC142X86 := $(PATH_TOOL_VCC142)
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC142X86 := $(PATH_TOOL_VCC142X86)
+endif
+
+ifndef PATH_TOOL_VCC142X86_BIN
+PATH_TOOL_VCC142X86_BIN := $(PATH_TOOL_VCC142_HOST_BIN)/x86
+else
+PATH_TOOL_VCC142X86_BIN := $(PATH_TOOL_VCC142X86_BIN)
+endif
+PATH_TOOL_VCC142X86_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC142X86_BIN))
+
+# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
+ifndef PATH_TOOL_VCC142X86_DLL_BIN
+ ifneq ($(PATH_TOOL_VCC142_HOST_DLL_BIN),$(PATH_TOOL_VCC142X86_BIN))
+PATH_TOOL_VCC142X86_DLL_BIN := $(PATH_TOOL_VCC142_HOST_DLL_BIN)
+ endif
+endif
+
+ifndef PATH_TOOL_VCC142X86_LIB
+PATH_TOOL_VCC142X86_LIB := $(PATH_TOOL_VCC142_LIB.x86)
+endif
+ifndef PATH_TOOL_VCC142_ONECORE_LIB
+PATH_TOOL_VCC142_ONECORE_LIB := $(PATH_TOOL_VCC142_ONECORE_LIB.x86)
+endif
+
+ifndef PATH_TOOL_VCC142X86_INC
+PATH_TOOL_VCC142X86_INC := $(PATH_TOOL_VCC142_INC)
+endif
+
+ifndef PATH_TOOL_VCC142X86_ATLMFC_INC
+PATH_TOOL_VCC142X86_ATLMFC_INC := $(PATH_TOOL_VCC142_ATLMFC_INC.x86)
+endif
+ifndef PATH_TOOL_VCC142X86_ATLMFC_LIB
+PATH_TOOL_VCC142X86_ATLMFC_LIB := $(PATH_TOOL_VCC142_ATLMFC_LIB.x86)
+endif
+
+TOOL_VCC142X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/cl.exe
+TOOL_VCC142X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/cl.exe
+TOOL_VCC142X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/ml.exe
+#TOOL_VCC142X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/lib.exe - just an exec wrapper for the below
+TOOL_VCC142X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/link.exe /LIB
+TOOL_VCC142X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/link.exe
+TOOL_VCC142X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/dumpbin.exe
+TOOL_VCC142X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC142X86_BIN_QSH)/editbin.exe
+
+TOOL_VCC142X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC142_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC142_RC_CACHED)
+TOOL_VCC142X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC142_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC142_MT_CACHED)
+
+ifdef TOOL_VCC142X86_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ ifeq ($(findstring /HostX86/,$(PATH_TOOL_VCC142X86_BIN)),/HostX86/)
+ TOOL_VCC142X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
+ else
+ TOOL_VCC142X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
+ endif
+ ifdef PATH_TOOL_VCC142X86_DLL_BIN
+ TOOL_VCC142X86_KSUBMIT := $(TOOL_VCC142X86_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC142X86_DLL_BIN));"
+ endif
+ TOOL_VCC142X86_KSUBMIT_DD := $(TOOL_VCC142X86_KSUBMIT) --
+ endif
+endif
+ifdef PATH_TOOL_VCC142X86_DLL_BIN
+ TOOL_VCC142X86_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC142X86_DLL_BIN));" --$(SP)
+ ifndef TOOL_VCC142X86_KSUBMIT_DD
+ TOOL_VCC142X86_KSUBMIT_DD := $(TOOL_VCC142X86_SETUP_ENV)
+ endif
+endif
+
+# Redist (more stuff in VCC142.kmk).
+PATH_TOOL_VCC142X86_REDIST ?= $(PATH_TOOL_VCC142_REDIST)/x86
+PATH_TOOL_VCC142X86_REDIST_CRT = $(PATH_TOOL_VCC142X86_REDIST)/$(TOOL_VCC142_REDIST_CRT_SUBDIR)
+PATH_TOOL_VCC142X86_REDIST_DEBUG ?= $(PATH_TOOL_VCC142_REDIST_DEBUG)/x86
+PATH_TOOL_VCC142X86_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC142X86_REDIST_DEBUG)/$(TOOL_VCC142_REDIST_CRT_SUBDIR)
+TOOL_VCC142X64_REDIST_CRT_DLLS = $(TOOL_VCC142_REDIST_CRT_DLLS.x86)
+TOOL_VCC142X64_REDIST_CONCRT_DLLS = $(TOOL_VCC142_REDIST_CONCRT_DLLS.x86)
+TOOL_VCC142X64_REDIST_CPP_DLLS = $(TOOL_VCC142_REDIST_CPP_DLLS.x86)
+TOOL_VCC142X64_REDIST_WINRT_DLLS = $(TOOL_VCC142_REDIST_WINRT_DLLS.x86)
+
+
+#
+# Properties used by kBuild
+#
+TOOL_VCC142X86_COBJSUFF ?= .obj
+TOOL_VCC142X86_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
+TOOL_VCC142X86_CFLAGS.debug ?=
+TOOL_VCC142X86_CFLAGS.dbgopt ?= -O2
+TOOL_VCC142X86_CFLAGS.release ?= -O2
+TOOL_VCC142X86_CFLAGS.profile ?= -O2
+TOOL_VCC142X86_CINCS ?= $(PATH_TOOL_VCC142X86_INC)
+TOOL_VCC142X86_CDEFS ?=
+
+TOOL_VCC142X86_CXXOBJSUFF ?= .obj
+TOOL_VCC142X86_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
+TOOL_VCC142X86_CXXFLAGS.debug ?=
+TOOL_VCC142X86_CXXFLAGS.dbgopt ?= -O2
+TOOL_VCC142X86_CXXFLAGS.release ?= -O2
+TOOL_VCC142X86_CXXFLAGS.profile ?= -O2
+TOOL_VCC142X86_CXXINCS ?= $(PATH_TOOL_VCC142X86_INC) $(PATH_TOOL_VCC142X86_ATLMFC_INC)
+TOOL_VCC142X86_CXXDEFS ?=
+
+TOOL_VCC142X86_ASOBJSUFF ?= .obj
+
+TOOL_VCC142X86_RCOBJSUFF ?= .res
+TOOL_VCC142X86_RCINCS ?= $(PATH_TOOL_VCC142X86_INC) $(PATH_TOOL_VCC142X86_ATLMFC_INC)
+
+TOOL_VCC142X86_ARFLAGS ?= -nologo -machine:x86
+TOOL_VCC142X86_ARLIBSUFF ?= .lib
+
+TOOL_VCC142X86_LDFLAGS ?= -nologo -machine:x86
+TOOL_VCC142X86_LDFLAGS.debug ?= -debug
+TOOL_VCC142X86_LDFLAGS.dbgopt ?= -debug
+TOOL_VCC142X86_LDFLAGS.profile ?= -debug
+TOOL_VCC142X86_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+# @note The -d1scalableinclude- option disables include directory caching as the cache goes
+# stale in kWorker. Besides, kWorker does it's own caching, so it is not necessary.
+TOOL_VCC142X86_COMPILE_C_DEPEND =
+TOOL_VCC142X86_COMPILE_C_DEPORD =
+TOOL_VCC142X86_COMPILE_C_OUTPUT =
+TOOL_VCC142X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC142_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC142_PDB, $(outbase)-obj,idb)
+ifdef TOOL_VCC142X86_KSUBMIT
+ TOOL_VCC142X86_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC142X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142X86_CC) -c -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC142X86_SETUP_ENV)$(TOOL_VCC142X86_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC142X86_KSUBMIT
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+# @note The -d1scalableinclude- option disables include directory caching as the cache goes
+# stale in kWorker. Besides, kWorker does it's own caching, so it is not necessary.
+# ('-d1' means it's passed to c1.dll/c1xx.dll and 'scalableinclude-' is the actual option.)
+TOOL_VCC142X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
+TOOL_VCC142X86_COMPILE_CXX_DEPORD =
+TOOL_VCC142X86_COMPILE_CXX_OUTPUT =
+TOOL_VCC142X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
+ ,,$(call TOOL_VCC142_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC142_PDB, $(outbase)-obj,idb))
+ifdef TOOL_VCC142X86_KSUBMIT
+ TOOL_VCC142X86_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
+ define TOOL_VCC142X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142X86_CXX) -c -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC142X86_SETUP_ENV)$(TOOL_VCC142X86_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ $(if-expr defined($(target)_PCH_HDR)\
+ ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
+ -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
+ endef
+endif # !TOOL_VCC142X86_KSUBMIT
+
+
+#
+# Helper tool for creating the precompiled C++ header.
+#
+# It only have the C++ compile bits and it's purpose is to skip bits
+# related _1_VCC_PCH_FILE and add -Yc.
+#
+TOOL_VCC142X86-PCH := Helper for creating precompiled header using CXX handling.
+TOOL_VCC142X86-PCH_EXTENDS := VCC142X86
+TOOL_VCC142X86-PCH_CXXOBJSUFF := .obj
+TOOL_VCC142X86-PCH_CXXINCS = $(TOOL_VCC142X86_CXXINCS)
+TOOL_VCC142X86-PCH_CXXFLAGS = $(TOOL_VCC142X86_CXXFLAGS) -FS
+TOOL_VCC142X86-PCH_CXXFLAGS.debug = $(TOOL_VCC142X86_CXXFLAGS.debug)
+TOOL_VCC142X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC142X86_CXXFLAGS.dbgopt)
+TOOL_VCC142X86-PCH_CXXFLAGS.release = $(TOOL_VCC142X86_CXXFLAGS.release)
+TOOL_VCC142X86-PCH_CXXFLAGS.profile = $(TOOL_VCC142X86_CXXFLAGS.profile)
+TOOL_VCC142X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
+TOOL_VCC142X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
+TOOL_VCC142X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+TOOL_VCC142X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
+ifdef TOOL_VCC142X86_KSUBMIT
+ define TOOL_VCC142X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
+ -- $(TOOL_VCC142X86_CXX) -c -Yc -d1scalableinclude-\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ endef
+else
+ define TOOL_VCC142X86-PCH_COMPILE_CXX_CMDS
+ $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
+ $(QUIET)$(TOOL_VCC142X86_SETUP_ENV)$(TOOL_VCC142X86_CXX) -c -Yc\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Fp$($(target)_1_VCC_PCH_FILE) \
+ -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
+ -Fo$(obj)\
+ -TP \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
+
+ endef
+endif # !TOOL_VCC142X86_KSUBMIT
+
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC142X86_COMPILE_RC_DEPEND =
+TOOL_VCC142X86_COMPILE_RC_DEPORD =
+TOOL_VCC142X86_COMPILE_RC_OUTPUT =
+define TOOL_VCC142X86_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC142X86_RC) \
+ $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC142X86_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC142X86_LINK_LIBRARY_DEPORD =
+TOOL_VCC142X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC142X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC142X86_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
+ $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT_DD) $(TOOL_VCC142X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC142X86_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142X86_LINK_PROGRAM_DEPORD =
+TOOL_VCC142X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC142X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC142X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142X86_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT_DD) $(TOOL_VCC142X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC142X86_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC142X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC142X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC142X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
+TOOL_VCC142X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142X86_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT_DD) $(TOOL_VCC142X86_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+ $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
+ $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC142X86_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC142X86_LINK_SYSMOD_DEPORD =
+TOOL_VCC142X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC142X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC142X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC142X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC142X86_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
+ $(QUIET)$(TOOL_VCC142X86_KSUBMIT_DD) $(TOOL_VCC142X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(qaddprefix sh,/LIBPATH:,$(libpath)) \
+ @$(outbase).rsp
+ifndef TOOL_VCC142X86_NO_AUTO_MANIFEST
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC142X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
+endef
+
diff --git a/kBuild/tools/VCC70.kmk b/kBuild/tools/VCC70.kmk
new file mode 100644
index 0000000..8e6e1d0
--- /dev/null
+++ b/kBuild/tools/VCC70.kmk
@@ -0,0 +1,366 @@
+# $Id: VCC70.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC70 := Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC70
+ PATH_TOOL_VCC70 := $(firstword $(wildcard \
+ $(KBUILD_DEVTOOLS)/win.x86/vcc/v7 \
+ $(KBUILD_DEVTOOLS)/x86.win32/vcc/v7 \
+ $(KBUILD_DEVTOOLS)/x86.win32/vcc70) )
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC70 := $(PATH_TOOL_VCC70)
+endif
+ifneq ($(PATH_TOOL_VCC70),)
+ PATH_TOOL_VCC70_BIN ?= $(PATH_TOOL_VCC70)/bin
+ PATH_TOOL_VCC70_LIB ?= $(PATH_TOOL_VCC70)/lib
+ PATH_TOOL_VCC70_INC ?= $(PATH_TOOL_VCC70)/include
+ PATH_TOOL_VCC70_ATLMFC ?= $(PATH_TOOL_VCC70)/atlmfc
+ PATH_TOOL_VCC70_ATLMFC_INC ?= $(PATH_TOOL_VCC70_ATLMFC)/include
+ PATH_TOOL_VCC70_ATLMFC_LIB ?= $(PATH_TOOL_VCC70_ATLMFC)/lib
+ TOOL_VCC70_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/cl.exe
+ TOOL_VCC70_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/cl.exe
+ TOOL_VCC70_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/ml.exe
+ TOOL_VCC70_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/rc.exe
+ TOOL_VCC70_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/lib.exe
+ TOOL_VCC70_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/link.exe
+else
+ # Pathless, relies on the environment.
+ TOOL_VCC70_CC ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC70_CXX ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC70_AS ?= $(EXEC_X86_WIN32) ml.exe
+ TOOL_VCC70_RC ?= $(EXEC_X86_WIN32) rc.exe
+ TOOL_VCC70_AR ?= $(EXEC_X86_WIN32) lib.exe
+ TOOL_VCC70_LD ?= $(EXEC_X86_WIN32) link.exe
+endif
+## Disabled fast DEP_IDB based dependencies.
+#VCC70_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+# General Properties used by kBuild
+TOOL_VCC70_COBJSUFF ?= .obj
+TOOL_VCC70_CFLAGS ?= -TC -c -nologo
+TOOL_VCC70_CFLAGS.debug ?= -Od -Zi
+TOOL_VCC70_CFLAGS.release ?= -O2
+TOOL_VCC70_CFLAGS.profile ?= -O2
+TOOL_VCC70_CINCS ?= $(PATH_TOOL_VCC70_INC)
+TOOL_VCC70_CDEFS ?=
+
+TOOL_VCC70_CXXOBJSUFF ?= .obj
+TOOL_VCC70_CXXFLAGS ?= -TP -c -nologo
+TOOL_VCC70_CXXFLAGS.debug ?= -Od -Zi
+TOOL_VCC70_CXXFLAGS.release ?= -O2
+TOOL_VCC70_CXXFLAGS.profile ?= -O2
+TOOL_VCC70_CXXINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
+TOOL_VCC70_CXXDEFS ?=
+
+TOOL_VCC70_ASOBJSUFF ?= .obj
+
+TOOL_VCC70_RCOBJSUFF ?= .res
+TOOL_VCC70_RCINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
+
+TOOL_VCC70_ARFLAGS ?= -nologo
+TOOL_VCC70_ARLIBSUFF ?= .lib
+
+TOOL_VCC70_LDFLAGS ?= -nologo
+TOOL_VCC70_LDFLAGS.debug ?= -debug
+TOOL_VCC70_LDFLAGS.release ?=
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC70_COMPILE_C_DONT_PURGE_OUTPUT =
+TOOL_VCC70_COMPILE_C_DEPEND =
+TOOL_VCC70_COMPILE_C_DEPORD =
+#ifdef KBUILD_USE_KOBJCACHE
+#TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).i
+#TOOL_VCC70_COMPILE_C_USESES_KOBJCACHE = 1
+#define TOOL_VCC70_COMPILE_C_CMDS
+# $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).i \
+# $(TOOL_VCC70_CC) -E \
+# $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+# $(subst /,\\,$(abspath $(source))) \
+# --kObjCache-cc $(obj) \
+# $(TOOL_VCC70_CC) -c -TC\
+# $(flags) \
+# -Fd$(outbase)-obj.pdb \
+# -FD\
+# -Fo$(obj)\
+# $(subst /,\\,$(outbase).i)
+# $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
+#endef
+#else # !KBUILD_USE_KOBJCACHE
+TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
+TOOL_VCC70_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC70_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC70_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
+endef
+#endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC70_COMPILE_CXX_DONT_PURGE_OUTPUT =
+TOOL_VCC70_COMPILE_CXX_DEPEND =
+TOOL_VCC70_COMPILE_CXX_DEPORD =
+#ifdef KBUILD_USE_KOBJCACHE
+#TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).ii
+#TOOL_VCC70_COMPILE_CXX_USES_KOBJCACHE = 1
+#define TOOL_VCC70_COMPILE_CXX_CMDS
+# $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).ii \
+# $(TOOL_VCC70_CC) -E \
+# $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+# $(subst /,\\,$(abspath $(source))) \
+# --kObjCache-cc $(obj) \
+# $(TOOL_VCC70_CC) -c -TP\
+# $(flags) \
+# -Fd$(outbase)-obj.pdb \
+# -FD\
+# -Fo$(obj)\
+# $(subst /,\\,$(outbase).ii)
+# $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
+#endef
+#else # !KBUILD_USE_KOBJCACHE
+TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
+TOOL_VCC70_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC70_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC70_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
+endef
+#endif # !KBUILD_USE_KOBJCACHE
+
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC70_COMPILE_RC_OUTPUT =
+TOOL_VCC70_COMPILE_RC_DEPEND =
+TOOL_VCC70_COMPILE_RC_DEPORD =
+define TOOL_VCC70_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC70_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC70_LINK_LIBRARY_DEPORD =
+TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC70_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC70_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC70_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk
+TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC70_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC70_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC70_LINK_PROGRAM_DEPORD =
+define TOOL_VCC70_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC70_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC70_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk
+TOOL_VCC70_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp $(outbase).map $(outbase).rsp
+TOOL_VCC70_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC70_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+define TOOL_VCC70_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC70_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk
+TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC70_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC70_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC70_LINK_SYSMOD_DEPORD =
+define TOOL_VCC70_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC70_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+endef
+
diff --git a/kBuild/tools/VCC80.kmk b/kBuild/tools/VCC80.kmk
new file mode 100644
index 0000000..07f72f4
--- /dev/null
+++ b/kBuild/tools/VCC80.kmk
@@ -0,0 +1,361 @@
+# $Id: VCC80.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET).
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC80 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET).
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC80
+ PATH_TOOL_VCC80 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/vcc/v8*)
+ ifeq ($(PATH_TOOL_VCC80),)
+ PATH_TOOL_VCC80 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
+ endif
+ ifeq ($(PATH_TOOL_VCC80),)
+ PATH_TOOL_VCC80 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v8*)
+ endif
+ ifeq ($(PATH_TOOL_VCC80),)
+ PATH_TOOL_VCC80 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v8*)
+ endif
+ ifeq ($(PATH_TOOL_VCC80),)
+ PATH_TOOL_VCC80 := $(lastword $(sort $(PATH_TOOL_VCC80)))
+ endif
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC80 := $(PATH_TOOL_VCC80)
+endif
+ifneq ($(PATH_TOOL_VCC80),)
+ ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
+ PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/amd64
+ else
+ PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/x86_amd64
+ endif
+ PATH_TOOL_VCC80_BIN.x86 ?= $(PATH_TOOL_VCC80)/bin
+ PATH_TOOL_VCC80_BIN ?= $(PATH_TOOL_VCC80_BIN.$(KBUILD_TARGET_ARCH))
+ PATH_TOOL_VCC80_LIB.amd64 ?= $(PATH_TOOL_VCC80)/lib/amd64
+ PATH_TOOL_VCC80_LIB.x86 ?= $(PATH_TOOL_VCC80)/lib
+ PATH_TOOL_VCC80_LIB ?= $(PATH_TOOL_VCC80_LIB.$(KBUILD_TARGET_ARCH))
+ PATH_TOOL_VCC80_INC ?= $(PATH_TOOL_VCC80)/include
+ PATH_TOOL_VCC80_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
+ PATH_TOOL_VCC80_ATLMFC_INC ?= $(PATH_TOOL_VCC80_ATLMFC)/include
+ PATH_TOOL_VCC80_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib
+ PATH_TOOL_VCC80_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib/amd64
+ PATH_TOOL_VCC80_ATLMFC_LIB ?= $(PATH_TOOL_VCC80_ATLMFC_LIB.$(KBUILD_TARGET_ARCH))
+ TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
+ TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
+ TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/ml64.exe
+ TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN.x86)/rc.exe
+ TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/lib.exe
+ TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/link.exe
+ TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN.x86)/mt.exe
+else
+ # Pathless, relies on the environment.
+ TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) cl.exe
+ TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) ml64.exe
+ TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) rc.exe
+ TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) lib.exe
+ TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) link.exe
+ TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) mt.exe
+endif
+## Disabled fast DEP_IDB based dependencies.
+#VCC80_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC80_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+TOOL_VCC80_COBJSUFF ?= .obj
+TOOL_VCC80_CFLAGS ?= -TC -c -nologo
+TOOL_VCC80_CFLAGS.debug ?= -Od -Zi
+TOOL_VCC80_CFLAGS.release ?= -O2
+TOOL_VCC80_CFLAGS.profile ?= -O2
+TOOL_VCC80_CINCS ?= $(PATH_TOOL_VCC80_INC)
+TOOL_VCC80_CDEFS ?=
+
+TOOL_VCC80_CXXOBJSUFF ?= .obj
+TOOL_VCC80_CXXFLAGS ?= -TP -c -nologo
+TOOL_VCC80_CXXFLAGS.debug ?= -Od -Zi
+TOOL_VCC80_CXXFLAGS.release ?= -O2
+TOOL_VCC80_CXXFLAGS.profile ?= -O2
+TOOL_VCC80_CXXINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
+TOOL_VCC80_CXXDEFS ?=
+
+TOOL_VCC80_ASOBJSUFF ?= .obj
+
+TOOL_VCC80_RCOBJSUFF ?= .res
+TOOL_VCC80_RCINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
+
+TOOL_VCC80_ARFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC80_ARFLAGS.x86 ?= -machine:x86
+TOOL_VCC80_ARFLAGS ?= -nologo
+TOOL_VCC80_ARLIBSUFF ?= .lib
+
+TOOL_VCC80_LDFLAGS.amd64 ?= -machine:amd64
+TOOL_VCC80_LDFLAGS.x86 ?= -machine:x86
+TOOL_VCC80_LDFLAGS ?= -nologo
+TOOL_VCC80_LDFLAGS.debug ?= -debug
+TOOL_VCC80_LDFLAGS.release ?=
+TOOL_VCC80_LIBPATH.amd64 ?= $(PATH_TOOL_VCC80_LIB.amd64) $(PATH_TOOL_VCC80_ATLMFC_LIB.amd64)
+TOOL_VCC80_LIBPATH.x86 ?= $(PATH_TOOL_VCC80_LIB.x86) $(PATH_TOOL_VCC80_ATLMFC_LIB.x86)
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80_COMPILE_C_DEPEND =
+TOOL_VCC80_COMPILE_C_DEPORD =
+TOOL_VCC80_COMPILE_C_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
+TOOL_VCC80_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC80_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC80_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80_COMPILE_CXX_DEPEND =
+TOOL_VCC80_COMPILE_CXX_DEPORD =
+TOOL_VCC80_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
+TOOL_VCC80_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC80_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC80_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
+endef
+
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80_COMPILE_RC_OUTPUT =
+TOOL_VCC80_COMPILE_RC_DEPEND =
+TOOL_VCC80_COMPILE_RC_DEPORD =
+define TOOL_VCC80_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC80_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC80_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC80_LINK_LIBRARY_DEPORD =
+TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC80_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC80_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80_LINK_PROGRAM_DEPORD =
+TOOL_VCC80_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC80_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC80_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC80_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest
+TOOL_VCC80_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC80_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80_LINK_SYSMOD_DEPORD =
+TOOL_VCC80_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC80_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC80_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endef
+
diff --git a/kBuild/tools/VCC80AMD64.kmk b/kBuild/tools/VCC80AMD64.kmk
new file mode 100644
index 0000000..ba0b27f
--- /dev/null
+++ b/kBuild/tools/VCC80AMD64.kmk
@@ -0,0 +1,338 @@
+# $Id: VCC80AMD64.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting AMD64.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC80AMD64 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting AMD64.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC80AMD64
+ PATH_TOOL_VCC80AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
+ ifeq ($(PATH_TOOL_VCC80AMD64),)
+ PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80)
+ endif
+ ifeq ($(PATH_TOOL_VCC80AMD64),)
+ PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80X86)
+ endif
+ ifeq ($(PATH_TOOL_VCC80AMD64),)
+ PATH_TOOL_VCC80AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
+ endif
+ ifneq ($(PATH_TOOL_VCC80AMD64),)
+ PATH_TOOL_VCC80AMD64 := $(lastword $(sort $(PATH_TOOL_VCC80AMD64)))
+ else
+ $(warning kBuild: PATH_TOOL_VCC80AMD64 cannot be determined!)
+ PATH_TOOL_VCC80AMD64 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v8
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80AMD64)
+endif
+ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
+PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/amd64
+else
+PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/x86_amd64
+endif
+PATH_TOOL_VCC80AMD64_LIB ?= $(PATH_TOOL_VCC80AMD64)/lib/amd64
+PATH_TOOL_VCC80AMD64_INC ?= $(PATH_TOOL_VCC80AMD64)/include
+PATH_TOOL_VCC80AMD64_ATLMFC ?= $(PATH_TOOL_VCC80AMD64)/atlmfc
+PATH_TOOL_VCC80AMD64_ATLMFC_INC ?= $(PATH_TOOL_VCC80AMD64_ATLMFC)/include
+PATH_TOOL_VCC80AMD64_ATLMFC_LIB ?= $(PATH_TOOL_VCC80AMD64_ATLMFC)/lib/amd64
+TOOL_VCC80AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
+TOOL_VCC80AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
+TOOL_VCC80AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/ml64.exe
+TOOL_VCC80AMD64_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../rc.exe
+TOOL_VCC80AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/lib.exe
+TOOL_VCC80AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/link.exe
+TOOL_VCC80AMD64_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../mt.exe
+## Disabled fast DEP_IDB based dependencies.
+#VCC80AMD64_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC80AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+TOOL_VCC80AMD64_COBJSUFF ?= .obj
+TOOL_VCC80AMD64_CFLAGS ?= -TC -c -nologo
+TOOL_VCC80AMD64_CFLAGS.debug ?= -Od -Zi
+TOOL_VCC80AMD64_CFLAGS.release ?= -O2
+TOOL_VCC80AMD64_CFLAGS.profile ?= -O2
+TOOL_VCC80AMD64_CINCS ?= $(PATH_TOOL_VCC80AMD64_INC)
+TOOL_VCC80AMD64_CDEFS ?=
+
+TOOL_VCC80AMD64_CXXOBJSUFF ?= .obj
+TOOL_VCC80AMD64_CXXFLAGS ?= -TP -c -nologo
+TOOL_VCC80AMD64_CXXFLAGS.debug ?= -Od -Zi
+TOOL_VCC80AMD64_CXXFLAGS.release ?= -O2
+TOOL_VCC80AMD64_CXXFLAGS.profile ?= -O2
+TOOL_VCC80AMD64_CXXINCS ?= $(PATH_TOOL_VCC80AMD64_INC) $(PATH_TOOL_VCC80AMD64_ATLMFC_INC)
+TOOL_VCC80AMD64_CXXDEFS ?=
+
+TOOL_VCC80AMD64_ASOBJSUFF ?= .obj
+
+TOOL_VCC80AMD64_RCOBJSUFF ?= .res
+TOOL_VCC80AMD64_RCINCS ?= $(PATH_TOOL_VCC80AMD64_INC) $(PATH_TOOL_VCC80AMD64_ATLMFC_INC)
+
+TOOL_VCC80AMD64_ARFLAGS ?= -nologo -machine:amd64
+TOOL_VCC80AMD64_ARLIBSUFF ?= .lib
+
+TOOL_VCC80AMD64_LDFLAGS ?= -nologo -machine:amd64
+TOOL_VCC80AMD64_LDFLAGS.debug ?= -debug
+TOOL_VCC80AMD64_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80AMD64_COMPILE_C_DEPEND =
+TOOL_VCC80AMD64_COMPILE_C_DEPORD =
+TOOL_VCC80AMD64_COMPILE_C_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
+TOOL_VCC80AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC80AMD64_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC80AMD64_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80AMD64_COMPILE_CXX_DEPEND =
+TOOL_VCC80AMD64_COMPILE_CXX_DEPORD =
+TOOL_VCC80AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
+TOOL_VCC80AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC80AMD64_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC80AMD64_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
+endef
+
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80AMD64_COMPILE_RC_DEPEND =
+TOOL_VCC80AMD64_COMPILE_RC_DEPORD =
+TOOL_VCC80AMD64_COMPILE_RC_OUTPUT =
+define TOOL_VCC80AMD64_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC80AMD64_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC80AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC80AMD64_LINK_LIBRARY_DEPORD =
+TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC80AMD64_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC80AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80AMD64_LINK_PROGRAM_DEPORD =
+TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80AMD64_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC80AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC80AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC80AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest
+TOOL_VCC80AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
+TOOL_VCC80AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80AMD64_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC80AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80AMD64_LINK_SYSMOD_DEPORD =
+TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80AMD64_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endef
+
diff --git a/kBuild/tools/VCC80X86.kmk b/kBuild/tools/VCC80X86.kmk
new file mode 100644
index 0000000..853052b
--- /dev/null
+++ b/kBuild/tools/VCC80X86.kmk
@@ -0,0 +1,340 @@
+# $Id: VCC80X86.kmk 3303 2020-01-14 15:09:44Z bird $
+## @file
+# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_VCC80X86 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
+
+# Tool Specific Properties
+ifndef PATH_TOOL_VCC80X86
+ PATH_TOOL_VCC80X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
+ ifeq ($(PATH_TOOL_VCC80X86),)
+ PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80)
+ endif
+ ifeq ($(PATH_TOOL_VCC80X86),)
+ PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80AMD64)
+ endif
+ ifeq ($(PATH_TOOL_VCC80X86),)
+ PATH_TOOL_VCC80X86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v8*)
+ endif
+ ifeq ($(PATH_TOOL_VCC80X86),)
+ PATH_TOOL_VCC80X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v8*)
+ endif
+ ifneq ($(PATH_TOOL_VCC80X86),)
+ PATH_TOOL_VCC80X86 := $(lastword $(sort $(PATH_TOOL_VCC80X86)))
+ else
+ $(warning kBuild: PATH_TOOL_VCC80X86 cannot be determined!)
+ PATH_TOOL_VCC80X86 := $(KBUILD_DEVTOOLS)/x86.win/vcc/v8
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80X86)
+endif
+PATH_TOOL_VCC80X86_BIN ?= $(PATH_TOOL_VCC80X86)/bin
+PATH_TOOL_VCC80X86_LIB ?= $(PATH_TOOL_VCC80X86)/lib
+PATH_TOOL_VCC80X86_INC ?= $(PATH_TOOL_VCC80X86)/include
+PATH_TOOL_VCC80X86_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
+PATH_TOOL_VCC80X86_ATLMFC_INC ?= $(PATH_TOOL_VCC80X86_ATLMFC)/include
+PATH_TOOL_VCC80X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC80X86_ATLMFC)/lib
+TOOL_VCC80X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
+TOOL_VCC80X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
+TOOL_VCC80X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/ml.exe
+TOOL_VCC80X86_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/rc.exe
+TOOL_VCC80X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/lib.exe
+TOOL_VCC80X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/link.exe
+TOOL_VCC80X86_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/mt.exe
+## Disabled fast DEP_IDB based dependencies.
+#VCC80X86_OLD_DEPS = 1
+
+## Constructs the correct .pdb name (the name is lowercased).
+# @param $(1) Base name, no extention.
+# @param $(2) The extension.
+TOOL_VCC80X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
+
+
+# General Properties used by kBuild
+TOOL_VCC80X86_COBJSUFF ?= .obj
+TOOL_VCC80X86_CFLAGS ?= -TC -c -nologo
+TOOL_VCC80X86_CFLAGS.debug ?= -Zi
+TOOL_VCC80X86_CFLAGS.release ?= -O2
+TOOL_VCC80X86_CFLAGS.profile ?= -O2
+TOOL_VCC80X86_CINCS ?= $(PATH_TOOL_VCC80X86_INC)
+TOOL_VCC80X86_CDEFS ?=
+
+TOOL_VCC80X86_CXXOBJSUFF ?= .obj
+TOOL_VCC80X86_CXXFLAGS ?= -TP -c -nologo
+TOOL_VCC80X86_CXXFLAGS.debug ?= -Zi
+TOOL_VCC80X86_CXXFLAGS.release ?= -O2
+TOOL_VCC80X86_CXXFLAGS.profile ?= -O2
+TOOL_VCC80X86_CXXINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
+TOOL_VCC80X86_CXXDEFS ?=
+
+TOOL_VCC80X86_ASOBJSUFF ?= .obj
+
+TOOL_VCC80X86_RCOBJSUFF ?= .res
+TOOL_VCC80X86_RCINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
+
+TOOL_VCC80X86_ARFLAGS ?= -nologo
+TOOL_VCC80X86_ARLIBSUFF ?= .lib
+
+TOOL_VCC80X86_LDFLAGS ?= -nologo -machine:x86
+TOOL_VCC80X86_LDFLAGS.debug ?= -debug
+TOOL_VCC80X86_LDFLAGS.release ?=
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80X86_COMPILE_C_DEPEND =
+TOOL_VCC80X86_COMPILE_C_DEPORD =
+TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
+TOOL_VCC80X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC80X86_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_VCC80X86_CC) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80X86_COMPILE_CXX_DEPEND =
+TOOL_VCC80X86_COMPILE_CXX_DEPORD =
+TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
+TOOL_VCC80X86_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
+define TOOL_VCC80X86_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_VCC80X86_CXX) -c\
+ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+ -Fd$(outbase)-obj.pdb \
+ -FD\
+ -Fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
+endef
+
+## @todo configure the assembler template.
+
+## Compile resource source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_VCC80X86_COMPILE_RC_DEPEND =
+TOOL_VCC80X86_COMPILE_RC_DEPORD =
+TOOL_VCC80X86_COMPILE_RC_OUTPUT =
+define TOOL_VCC80X86_COMPILE_RC_CMDS
+ $(QUIET)$(TOOL_VCC80X86_RC) \
+ $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
+ /fo$(obj)\
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
+TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_VCC80X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
+define TOOL_VCC80X86_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs) \
+ $(filter-out %.def,$(othersrc))) \
+ $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
+TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80X86_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endef
+
+
+## Link DLL.
+# @param $(target) Normalized main target name.
+# @param $(out) DLL name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
+TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
+TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest
+TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp $(outbase).map $(outbase).rsp
+TOOL_VCC80X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80X86_LINK_DLL_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
+ /OUT:$(out) \
+ /IMPLIB:$(outbase).lib \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ /DLL \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+ $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
+$(eval _DIRS += $(PATH_STAGE_LIB))
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
+TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
+TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
+TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
+TOOL_VCC80X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
+define TOOL_VCC80X86_LINK_SYSMOD_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(foreach arg,\
+ $(subst /,\\,$(objs)) \
+ $(subst /,\\,$(libs)) \
+ ,\"$(arg)\")
+ $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
+ /OUT:$(out) \
+ /MAPINFO:EXPORTS /INCREMENTAL:NO \
+ /MAP:$(outbase).map \
+ $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
+ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
+ $(foreach p,$(libpath), /LIBPATH:$(p)) \
+ @$(outbase).rsp
+ $(QUIET)$(TEST) -f $(out).manifest -- \
+ $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endef
+
diff --git a/kBuild/tools/WATCOMC11C-16.kmk b/kBuild/tools/WATCOMC11C-16.kmk
new file mode 100644
index 0000000..9c3ac2f
--- /dev/null
+++ b/kBuild/tools/WATCOMC11C-16.kmk
@@ -0,0 +1,150 @@
+# $Id: WATCOMC11C-16.kmk 3578 2023-01-05 00:42:25Z bird $
+## @file
+# kBuild Tool Config - Watcom C v11.0c, 16-bit targets.
+#
+# @remarks wrc is untested, so are DLLs, and programs.
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_WATCOMC11C-16 = Watcom C/C++ v11.0c - 16-bit targets.
+TOOL_WATCOMC11C-16_EXTENDS = WATCOMC11C
+TOOL_WATCOMC11C-16_ASFLAGS.win ?= -bt=windows
+TOOL_WATCOMC11C-16_CFLAGS.win ?= -bt=windows
+TOOL_WATCOMC11C-16_CXXFLAGS.win ?= -bt=windows
+TOOL_WATCOMC11C-16_RCFLAGS.win ?= -bt=windows
+TOOL_WATCOMC11C-16_LDFLAGS.win ?= -bt=windows
+
+TOOL_WATCOMC11C-16_COMPILE_C_DEPEND =
+TOOL_WATCOMC11C-16_COMPILE_C_DEPORD =
+TOOL_WATCOMC11C-16_COMPILE_C_OUTPUT = $(obj).err
+define TOOL_WATCOMC11C-16_COMPILE_C_CMDS
+ $(QUIET) $(call TOOL_WATCOMC11C_ENV_SETUP_BD) $(TOOL_WATCOMC11C_CC16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(subst /,\\,$(obj)) \
+ -fr=$(subst /,\\,$(obj)).err \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(APPEND) -n $(obj).err
+## @todo dependencies
+endef
+
+TOOL_WATCOMC11C-16_COMPILE_CXX_DEPEND =
+TOOL_WATCOMC11C-16_COMPILE_CXX_DEPORD =
+TOOL_WATCOMC11C-16_COMPILE_CXX_OUTPUT = $(obj).err
+define TOOL_WATCOMC11C-16_COMPILE_CXX_CMDS
+ $(QUIET) $(call TOOL_WATCOMC11C_ENV_SETUP_BD) $(TOOL_WATCOMC11C_CXX16) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(subst /,\\,$(obj)) \
+ -fr=$(subst /,\\,$(obj)).err \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(APPEND) -n $(obj).err
+## @todo dependencies
+endef
+
+TOOL_WATCOMC11C-16_COMPILE_RC_OUTPUT =
+TOOL_WATCOMC11C-16_COMPILE_RC_DEPEND =
+TOOL_WATCOMC11C-16_COMPILE_RC_DEPORD =
+define TOOL_WATCOMC11C-16_COMPILE_RC_CMDS
+ $(QUIET) $(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) -r\
+ $(flags) \
+ $(addprefix -i=, $(subst /,\\,$(incs))) \
+ $(qaddprefix sh,-d, $(defs))\
+ -fo=$(subst /,\\,$(obj)) \
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+TOOL_WATCOMC11C-16_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
+TOOL_WATCOMC11C-16_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_WATCOMC11C-16_LINK_LIBRARY_DEPORD =
+define TOOL_WATCOMC11C-16_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"')
+ $(QUIET)$(TOOL_WATCOMC11C_ENV_SETUP_BD) $(TOOL_WATCOMC11C_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp
+endef
+
+TOOL_WATCOMC11C-16_LINK_PROGRAM_OUTPUT = $(outbase).map
+TOOL_WATCOMC11C-16_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C-16_LINK_PROGRAM_DEPORD =
+define TOOL_WATCOMC11C-16_LINK_PROGRAM_CMDS
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_WATCOMC11C_LD16) \
+ $(flags) \
+ -fe=$(subst /,\\,$(out)) \
+ -fm=$(subst /,\\,$(outbase).map) \
+ $(subst /,\\,$(filter-out %.res,$(objs))) \
+ $(subst /,\\,$(libs)) \
+ $(subst /,\\,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
+TOOL_WATCOMC11C-16_LINK_DLL_OUTPUT = $(outbase).map
+TOOL_WATCOMC11C-16_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C-16_LINK_DLL_DEPORD =
+define TOOL_WATCOMC11C-16_LINK_DLL_CMDS
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_WATCOMC11C_LD16) \
+ $(flags) \
+ -fe=$(subst /,\\,$(out)) \
+ -fm=$(subst /,\\,$(outbase).map) \
+ $(subst /,\\,$(filter-out %.res,$(objs))) \
+ $(subst /,\\,$(libs)) \
+ $(subst /,\\,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
+TOOL_WATCOMC11C-16_LINK_SYSMOD_OUTPUT = $(outbase).map
+TOOL_WATCOMC11C-16_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C-16_LINK_SYSMOD_DEPORD =
+define TOOL_WATCOMC11C-16_LINK_SYSMOD_CMDS
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_WATCOMC11C_LD16) \
+ $(flags) \
+ -fe=$(subst /,\\,$(out)) \
+ -fm=$(subst /,\\,$(outbase).map) \
+ $(subst /,\\,$(filter-out %.res,$(objs))) \
+ $(subst /,\\,$(libs)) \
+ $(subst /,\\,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
diff --git a/kBuild/tools/WATCOMC11C-WL.kmk b/kBuild/tools/WATCOMC11C-WL.kmk
new file mode 100644
index 0000000..a48a562
--- /dev/null
+++ b/kBuild/tools/WATCOMC11C-WL.kmk
@@ -0,0 +1,79 @@
+# $Id: WATCOMC11C-WL.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - Watcom C/C++ v11.0c, using wlink.
+#
+# @remarks wrc is untested, so are DLLs, and programs.
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_WATCOMC11C-WL = Watcom C/C++ v11.0c, using wlink.
+TOOL_WATCOMC11C-WL_EXTENDS = WATCOMC11C
+TOOL_WATCOMC11C-WL_LDFLAGS ?= Option Quiet
+TOOL_WATCOMC11C-WL_LDFLAGS.dos ?= $(NO_SUCH_VARIABLE)
+TOOL_WATCOMC11C-WL_LDFLAGS.linux ?= $(NO_SUCH_VARIABLE)
+TOOL_WATCOMC11C-WL_LDFLAGS.nt ?= $(NO_SUCH_VARIABLE)
+TOOL_WATCOMC11C-WL_LDFLAGS.os2 ?= $(NO_SUCH_VARIABLE)
+TOOL_WATCOMC11C-WL_LDFLAGS.win ?= $(NO_SUCH_VARIABLE)
+
+
+TOOL_WATCOMC11C-WL_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp
+TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPORD =
+define TOOL_WATCOMC11C-WL_LINK_PROGRAM_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp \
+ $(if $(flags),'$(flags)',) \
+ 'Name $(subst /,\,$(out)$(if $(suffix $(out)),,.))' \
+ 'Option Map=$(subst /,\,$(outbase)).map' \
+ $(foreach p,$(subst /,\,$(libpath)),'LIBPath $p') \
+ $(foreach o,$(subst /,\,$(filter-out %.res,$(objs)) $(othersrc)),'$(if $(filter %.lib %.a,$l),LIB,)File $o') \
+ $(foreach l,$(subst /,\,$(libs)),'Library $l')
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD) \
+ $(TOOL_WATCOMC11C_WLINK) @$(outbase).rsp
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
+TOOL_WATCOMC11C-WL_LINK_DLL_OUTPUT = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_OUTPUT)
+TOOL_WATCOMC11C-WL_LINK_DLL_DEPEND = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPEND)
+TOOL_WATCOMC11C-WL_LINK_DLL_DEPORD = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPORD)
+TOOL_WATCOMC11C-WL_LINK_DLL_CMDS = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_CMDS)
+
+TOOL_WATCOMC11C-WL_LINK_SYSMOD_OUTPUT = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_OUTPUT)
+TOOL_WATCOMC11C-WL_LINK_SYSMOD_DEPEND = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPEND)
+TOOL_WATCOMC11C-WL_LINK_SYSMOD_DEPORD = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPORD)
+TOOL_WATCOMC11C-WL_LINK_SYSMOD_CMDS = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_CMDS)
+
+TOOL_WATCOMC11C-WL_LINK_MISCBIN_OUTPUT = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_OUTPUT)
+TOOL_WATCOMC11C-WL_LINK_MISCBIN_DEPEND = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPEND)
+TOOL_WATCOMC11C-WL_LINK_MISCBIN_DEPORD = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_DEPORD)
+TOOL_WATCOMC11C-WL_LINK_MISCBIN_CMDS = $(TOOL_WATCOMC11C-WL_LINK_PROGRAM_CMDS)
+
diff --git a/kBuild/tools/WATCOMC11C.kmk b/kBuild/tools/WATCOMC11C.kmk
new file mode 100644
index 0000000..af28023
--- /dev/null
+++ b/kBuild/tools/WATCOMC11C.kmk
@@ -0,0 +1,265 @@
+# $Id: WATCOMC11C.kmk 3578 2023-01-05 00:42:25Z bird $
+## @file
+# kBuild Tool Config - Watcom C v11.0c
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_WATCOMC11C = Watcom C/C++ v11.0c (generic)
+
+ifeq ($(PATH_TOOL_WATCOMC11C),)
+ ifeq ($(PATH_TOOL_WATCOMC11C),)
+ PATH_TOOL_WATCOMC11C := $(wildcard $(KBUILD_DEVTOOLS_HST)/watcom/v11.0c*)
+ endif
+ ifeq ($(PATH_TOOL_WATCOMC11C),)
+ PATH_TOOL_WATCOMC11C := $(wildcard $(KBUILD_DEVTOOLS_TRG)/watcom/v11.0c*)
+ endif
+ ifeq ($(PATH_TOOL_WATCOMC11C),)
+ PATH_TOOL_WATCOMC11C := $(wildcard $(KBUILD_DEVTOOLS)/common/watcom/v11.0c*)
+ endif
+ ifeq ($(PATH_TOOL_WATCOMC11C)$(KBUILD_HOST),os2)
+ if1of ($(USER) $(USERNAME) $(LOGNAME), bird)
+ PATH_TOOL_WATCOMC11C := $(wildcard d:/dev/Watcom/v11.0c*)
+ endif
+ endif
+ PATH_TOOL_WATCOMC11C := $(firstword $(sort $(PATH_TOOL_WATCOMC11C)))
+ # if not found, we'll enter 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_WATCOMC11C := $(PATH_TOOL_WATCOMC11C)
+endif
+
+ifneq ($(PATH_TOOL_WATCOMC11C),)
+ TOOL_WATCOMC11C_PATHLESS := no
+
+ ifeq ($(KBUILD_HOST),os2)
+ PATH_TOOL_WATCOMC11C_BIN = $(PATH_TOOL_WATCOMC11C)/binp
+ PATH_TOOL_WATCOMC11C_BIN2 = $(PATH_TOOL_WATCOMC11C)/binw
+ TOOL_WATCOMC11C_ENV_SETUP ?= $(REDIRECT) \
+ -E 'BEGINLIBPATH=$(PATH_TOOL_WATCOMC11C)/binp/dll;$(BEGINLIBPATH)' \
+ -E 'LIBPATHSTRICT=T' \
+ -E 'PATH=$(PATH_TOOL_WATCOMC11C_BIN);$(PATH_TOOL_WATCOMC11C_BIN2)' \
+ -E 'WATCOM=$(PATH_TOOL_WATCOMC11C)' \
+ -E 'EDPATH=$(PATH_TOOL_WATCOMC11C)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ else
+ PATH_TOOL_WATCOMC11C_BIN = $(PATH_TOOL_WATCOMC11C)/binnt
+ PATH_TOOL_WATCOMC11C_BIN2 = $(PATH_TOOL_WATCOMC11C_BIN)
+ TOOL_WATCOMC11C_ENV_SETUP ?= $(REDIRECT) \
+ -E 'PATH=$(PATH_TOOL_WATCOMC11C_BIN);$(PATH_TOOL_WATCOMC11C)/binw' \
+ -E 'WATCOM=$(PATH_TOOL_WATCOMC11C)' \
+ -E 'EDPATH=$(PATH_TOOL_WATCOMC11C)/EDDAT' \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ endif
+
+ TOOL_WATCOMC11C_CC ?= $(PATH_TOOL_WATCOMC11C_BIN)/wcc386$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_CC16 ?= $(PATH_TOOL_WATCOMC11C_BIN)/wcc$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_CXX ?= $(PATH_TOOL_WATCOMC11C_BIN)/wpp386$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_CXX16 ?= $(PATH_TOOL_WATCOMC11C_BIN)/wpp$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_AS ?= $(PATH_TOOL_WATCOMC11C_BIN)/wasm$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_AR ?= $(PATH_TOOL_WATCOMC11C_BIN)/wlib$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_RC ?= $(PATH_TOOL_WATCOMC11C_BIN2)/wrc$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_LD ?= $(PATH_TOOL_WATCOMC11C_BIN2)/wcl386$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_LD16 ?= $(PATH_TOOL_WATCOMC11C_BIN2)/wcl$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_WLINK ?= $(PATH_TOOL_WATCOMC11C_BIN2)/wlink$(HOSTSUFF_EXE)
+
+else
+ # Pathless, relies on the environment.
+ TOOL_WATCOMC11C_PATHLESS :=
+ TOOL_WATCOMC11C_ENV_SETUP ?= $(REDIRECT) \
+ -E 'LIB=$1' \
+ -E 'INCLUDE=' \
+ $2 --
+ TOOL_WATCOMC11C_CC ?= wcc386$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_CC16 ?= wcc$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_CXX ?= wpp386$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_CXX16 ?= wpp$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_AS ?= wasm$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_AR ?= wlib$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_RC ?= wrc$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_LD ?= wcl386$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_LD16 ?= wcl$(HOSTSUFF_EXE)
+ TOOL_WATCOMC11C_WLINK ?= wcl$(HOSTSUFF_EXE)
+
+endif
+
+if $(KBUILD_KMK_REVISION) >= 2747
+ TOOL_WATCOMC11C_ENV_SETUP_BD ?= $(call TOOL_WATCOMC11C_ENV_SETUP,$1,$2 --wcc-brain-damage)
+else
+ TOOL_WATCOMC11C_ENV_SETUP_BD ?= $(call TOOL_WATCOMC11C_ENV_SETUP,$1,$2)
+endif
+
+
+# General Properties used by kBuild
+TOOL_WATCOMC11C_COBJSUFF ?= .obj
+TOOL_WATCOMC11C_CFLAGS ?= -zq
+TOOL_WATCOMC11C_CFLAGS.dos ?= -bt=dos
+TOOL_WATCOMC11C_CFLAGS.os2 ?= -bt=os2
+TOOL_WATCOMC11C_CFLAGS.win ?= -bt=nt
+ifdef PATH_TOOL_WATCOMC11C
+ TOOL_WATCOMC11C_CINCS ?= $(PATH_TOOL_WATCOMC11C)/h
+endif
+
+TOOL_WATCOMC11C_CXXOBJSUFF ?= .obj
+TOOL_WATCOMC11C_CXXFLAGS ?= -zq
+TOOL_WATCOMC11C_CXXFLAGS.dos ?= -bt=dos
+TOOL_WATCOMC11C_CXXFLAGS.os2 ?= -bt=os2
+TOOL_WATCOMC11C_CXXFLAGS.win ?= -bt=nt
+ifdef PATH_TOOL_WATCOMC11C
+ TOOL_WATCOMC11C_CXXINCS ?= $(PATH_TOOL_WATCOMC11C)/h
+endif
+
+TOOL_WATCOMC11C_RCOBJSUFF ?= .res
+TOOL_WATCOMC11C_RCFLAGS ?= -r
+ifdef PATH_TOOL_WATCOMC11C
+ TOOL_WATCOMC11C_RCINCS ?= $(PATH_TOOL_WATCOMC11C)/h
+endif
+
+TOOL_WATCOMC11C_ARFLAGS ?= -q
+TOOL_WATCOMC11C_ARLIBSUFF ?= .lib
+
+TOOL_WATCOMC11C_LDFLAGS ?= -zq -y
+TOOL_WATCOMC11C_LDFLAGS.dos ?= -bt=dos
+TOOL_WATCOMC11C_LDFLAGS.os2 ?= -bt=os2
+TOOL_WATCOMC11C_LDFLAGS.win ?= -bt=nt
+
+
+TOOL_WATCOMC11C_COMPILE_C_DEPEND =
+TOOL_WATCOMC11C_COMPILE_C_DEPORD =
+TOOL_WATCOMC11C_COMPILE_C_OUTPUT = $(obj).err
+define TOOL_WATCOMC11C_COMPILE_C_CMDS
+ $(QUIET) $(call TOOL_WATCOMC11C_ENV_SETUP_BD) $(TOOL_WATCOMC11C_CC) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(subst /,\\,$(obj)) \
+ -fr=$(subst /,\\,$(obj)).err \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(APPEND) -n $(obj).err
+## @todo dependencies
+endef
+
+TOOL_WATCOMC11C_COMPILE_CXX_DEPEND =
+TOOL_WATCOMC11C_COMPILE_CXX_DEPORD =
+TOOL_WATCOMC11C_COMPILE_CXX_OUTPUT = $(obj).err
+define TOOL_WATCOMC11C_COMPILE_CXX_CMDS
+ $(QUIET) $(call TOOL_WATCOMC11C_ENV_SETUP_BD) $(TOOL_WATCOMC11C_CXX) \
+ $(flags) \
+ $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(subst /,\\,$(obj)) \
+ -fr=$(subst /,\\,$(obj)).err \
+ $(subst /,\\,$(abspath $(source)))
+ $(QUIET)$(APPEND) -n $(obj).err
+## @todo dependencies
+endef
+
+TOOL_WATCOMC11C_COMPILE_RC_OUTPUT =
+TOOL_WATCOMC11C_COMPILE_RC_DEPEND =
+TOOL_WATCOMC11C_COMPILE_RC_DEPORD =
+define TOOL_WATCOMC11C_COMPILE_RC_CMDS
+ $(QUIET) $(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) -r\
+ $(flags) \
+ $(addprefix -i=, $(subst /,\\,$(incs))) \
+ $(qaddprefix sh,-d, $(defs)) \
+ -fo=$(subst /,\\,$(obj)) \
+ $(subst /,\\,$(abspath $(source)))
+endef
+
+TOOL_WATCOMC11C_LINK_LIBRARY_OUTPUT = $(outbase).rsp
+TOOL_WATCOMC11C_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_WATCOMC11C_LINK_LIBRARY_DEPORD =
+define TOOL_WATCOMC11C_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"')
+ $(QUIET)$(TOOL_WATCOMC11C_ENV_SETUP_BD) $(TOOL_WATCOMC11C_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp
+endef
+
+TOOL_WATCOMC11C_LINK_PROGRAM_OUTPUT = $(outbase).map
+TOOL_WATCOMC11C_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C_LINK_PROGRAM_DEPORD =
+define TOOL_WATCOMC11C_LINK_PROGRAM_CMDS
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_WATCOMC11C_LD) \
+ $(flags) \
+ -fe=$(subst /,\\,$(out)) \
+ -fm=$(subst /,\\,$(outbase).map) \
+ $(subst /,\\,$(filter-out %.res,$(objs))) \
+ $(subst /,\\,$(libs)) \
+ $(subst /,\\,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
+TOOL_WATCOMC11C_LINK_DLL_OUTPUT = $(outbase).map
+TOOL_WATCOMC11C_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C_LINK_DLL_DEPORD =
+define TOOL_WATCOMC11C_LINK_DLL_CMDS
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_WATCOMC11C_LD) \
+ $(flags) \
+ -fe=$(subst /,\\,$(out)) \
+ -fm=$(subst /,\\,$(outbase).map) \
+ $(subst /,\\,$(filter-out %.res,$(objs))) \
+ $(subst /,\\,$(libs)) \
+ $(subst /,\\,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
+TOOL_WATCOMC11C_LINK_SYSMOD_OUTPUT = $(outbase).map
+TOOL_WATCOMC11C_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
+TOOL_WATCOMC11C_LINK_SYSMOD_DEPORD =
+define TOOL_WATCOMC11C_LINK_SYSMOD_CMDS
+ $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP_BD,$(subst $(SP),,$(addsuffix ;,$(libpath))),-C $(dir $(out))) \
+ $(TOOL_WATCOMC11C_LD) \
+ $(flags) \
+ -fe=$(subst /,\\,$(out)) \
+ -fm=$(subst /,\\,$(outbase).map) \
+ $(subst /,\\,$(filter-out %.res,$(objs))) \
+ $(subst /,\\,$(libs)) \
+ $(subst /,\\,$(othersrc))
+ $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_WATCOMC11C_ENV_SETUP) \
+ $(TOOL_WATCOMC11C_RC) \
+ $(filter -bt=%,$(flags)) \
+ /fe=$(subst /,\\,$(out)) \
+ $(subst /,\\,$(filter %.res,$(objs))))
+endef
+
+
diff --git a/kBuild/tools/WGET.kmk b/kBuild/tools/WGET.kmk
new file mode 100644
index 0000000..de159af
--- /dev/null
+++ b/kBuild/tools/WGET.kmk
@@ -0,0 +1,66 @@
+# $Id: WGET.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - wget fetchers.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_WGET := wget fetcher.
+
+# Tool Specific Properties
+ifndef TOOL_WGET_FETCH
+ TOOL_WGET_FETCH := $(wildcard $(KBUILD_DEVTOOLS_HST)/wget/v*/wget$(HOSTSUFF_EXE))
+ ifneq ($(TOOL_WGET_FETCH),)
+ TOOL_WGET_FETCH := $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/wget$(HOSTSUFF_EXE))
+ endif
+ ifneq ($(TOOL_WGET_FETCH),)
+ TOOL_WGET_FETCH := $(lastword $(sort $(TOOL_WGET_FETCH)))
+ else
+ TOOL_WGET_FETCH := wget$(HOSTSUFF_EXE)
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ TOOL_WGET_FETCH := $(TOOL_WGET_FETCH)
+endif
+
+# General Properties used by kBuild
+TOOL_WGET_FETCHFLAGS ?= --passive-ftp -t 5 -T 60
+
+## Fetch one file.
+# @param $(target) Normalized main target name.
+# @param $(source) The URI of the file.
+# @param $(flags) Flags.
+# @param $(out) The output file
+TOOL_WGET_FETCH_OUTPUT =
+TOOL_WGET_FETCH_DEPEND =
+TOOL_WGET_FETCH_DEPORD =
+define TOOL_WGET_FETCH_CMDS
+ $(QUIET)$(TOOL_WGET_FETCH) $(flags) -P $(dir $(out)) $(source)
+endef
+
diff --git a/kBuild/tools/XGCCAMD64LINUX.kmk b/kBuild/tools/XGCCAMD64LINUX.kmk
new file mode 100644
index 0000000..5a27837
--- /dev/null
+++ b/kBuild/tools/XGCCAMD64LINUX.kmk
@@ -0,0 +1,283 @@
+# $Id: XGCCAMD64LINUX.kmk 3579 2023-01-05 01:53:41Z bird $
+## @file
+# kBuild Tool Config - GCC Cross compiler for AMD64+Linux.
+#
+
+#
+# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_XGCCAMD64LINUX := GCC Cross compiler for AMD64+Linux.
+
+# Tool Specific Properties
+TOOL_XGCCAMD64LINUX_SUFFIX ?= $(HOSTSUFF_EXE)
+ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),linux.amd64)
+ # not x-compile, use the default gcc.
+ TOOL_XGCCAMD64LINUX_PREFIX := $(TOOL_XGCCAMD64LINUX_PREFIX)
+else # x-compile:
+ # find the latest xgcc build.
+ ifndef TOOL_XGCCAMD64LINUX_PREFIX
+ TOOL_XGCCAMD64LINUX_PREFIX := x86_64-unknown-linux-gnu-
+ ifndef PATH_TOOL_XGCCAMD64LINUX
+ PATH_TOOL_XGCCAMD64LINUX := $(sort $(wildcard $(KBUILD_DEVTOOLS_HST)/x86_64-unknown-linux-gnu/*))
+ ifeq ($(PATH_TOOL_XGCCAMD64LINUX),)
+ ifeq ($(filter-out win.amd64,$(KBUILD_HOST).$(KBUILD_HOST_ARCH)),) # these can use the windows build.
+ TOOL_XGCCAMD64LINUX_EXEC_PREFIX ?= $(EXEC_X86_WIN32)
+ TOOL_XGCCAMD64LINUX_SUFFIX := .exe
+ PATH_TOOL_XGCCAMD64LINUX := $(sort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/*))
+ ifeq ($(PATH_TOOL_XGCCAMD64LINUX),)
+ PATH_TOOL_XGCCAMD64LINUX := $(sort $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/x86_64-unknown-linux-gnu/*))
+ endif
+ endif
+ endif
+ ifneq ($(PATH_TOOL_XGCCAMD64LINUX),)
+ PATH_TOOL_XGCCAMD64LINUX := $(call lastword,$(PATH_TOOL_XGCCAMD64LINUX))
+ endif
+ endif # !PATH_TOOL_XGCCAMD64LINUX
+ ifneq ($(PATH_TOOL_XGCCAMD64LINUX),)
+ TOOL_XGCCAMD64LINUX_PREFIX := $(TOOL_XGCCAMD64LINUX_EXEC_PREFIX) $(PATH_TOOL_XGCCAMD64LINUX)/bin/$(TOOL_XGCCAMD64LINUX_PREFIX)
+ endif
+ else
+ # Resolve any fancy stuff once and for all.
+ TOOL_XGCCAMD64LINUX_PREFIX := $(TOOL_XGCCAMD64LINUX_PREFIX)
+ endif
+endif
+
+TOOL_XGCCAMD64LINUX_PREFIX2 ?= $(TOOL_XGCCAMD64LINUX_PREFIX)
+TOOL_XGCCAMD64LINUX_SUFFIX2 ?= $(TOOL_XGCCAMD64LINUX_SUFFIX)
+TOOL_XGCCAMD64LINUX_CC ?= $(TOOL_XGCCAMD64LINUX_PREFIX)gcc$(TOOL_XGCCAMD64LINUX_SUFFIX)
+TOOL_XGCCAMD64LINUX_CXX ?= $(TOOL_XGCCAMD64LINUX_PREFIX)g++$(TOOL_XGCCAMD64LINUX_SUFFIX)
+TOOL_XGCCAMD64LINUX_AS ?= $(TOOL_XGCCAMD64LINUX_PREFIX)gcc$(TOOL_XGCCAMD64LINUX_SUFFIX)
+TOOL_XGCCAMD64LINUX_AR ?= $(TOOL_XGCCAMD64LINUX_PREFIX2)ar$(TOOL_XGCCAMD64LINUX_SUFFIX2)
+TOOL_XGCCAMD64LINUX_LD ?= $(TOOL_XGCCAMD64LINUX_PREFIX)g++$(TOOL_XGCCAMD64LINUX_SUFFIX)
+TOOL_XGCCAMD64LINUX_LD_SYSMOD ?= $(TOOL_XGCCAMD64LINUX_PREFIX2)ld$(TOOL_XGCCAMD64LINUX_SUFFIX2)
+
+TOOL_XGCCAMD64LINUX_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_XGCCAMD64LINUX_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
+TOOL_XGCCAMD64LINUX_LD_SYSMOD_MAP ?= -Map $(1) --cref
+TOOL_XGCCAMD64LINUX_LDFLAGS.dll ?= -shared
+TOOL_XGCCAMD64LINUX_LDFLAGS.sysmod ?= -r
+
+# General Properties used by kBuild
+TOOL_XGCCAMD64LINUX_COBJSUFF ?= .o
+TOOL_XGCCAMD64LINUX_CFLAGS ?= -g
+TOOL_XGCCAMD64LINUX_CFLAGS.debug ?= -O0
+TOOL_XGCCAMD64LINUX_CFLAGS.release ?= -O2
+TOOL_XGCCAMD64LINUX_CFLAGS.profile ?= -O2 #-pg
+TOOL_XGCCAMD64LINUX_CINCS ?=
+TOOL_XGCCAMD64LINUX_CDEFS ?=
+
+TOOL_XGCCAMD64LINUX_CXXOBJSUFF ?= .o
+TOOL_XGCCAMD64LINUX_CXXOBJSUFF ?= .o
+TOOL_XGCCAMD64LINUX_CXXFLAGS ?= -g
+TOOL_XGCCAMD64LINUX_CXXFLAGS.debug ?= -O0
+TOOL_XGCCAMD64LINUX_CXXFLAGS.release ?= -O2
+TOOL_XGCCAMD64LINUX_CXXFLAGS.profile ?= -O2 #-pg
+TOOL_XGCCAMD64LINUX_CXXINCS ?=
+TOOL_XGCCAMD64LINUX_CXXDEFS ?=
+
+TOOL_XGCCAMD64LINUX_ASFLAGS ?= -g -x assembler-with-cpp
+TOOL_XGCCAMD64LINUX_ASOBJSUFF ?= .o
+
+TOOL_XGCCAMD64LINUX_ARFLAGS ?= cr
+TOOL_XGCCAMD64LINUX_ARLIBSUFF ?= .a
+
+TOOL_XGCCAMD64LINUX_LDFLAGS ?=
+TOOL_XGCCAMD64LINUX_LDFLAGS.debug ?= -g
+TOOL_XGCCAMD64LINUX_LDFLAGS.release ?= -s
+
+
+
+## Compile C source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+#
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_XGCCAMD64LINUX_COMPILE_C_OUTPUT =
+TOOL_XGCCAMD64LINUX_COMPILE_C_DEPEND =
+TOOL_XGCCAMD64LINUX_COMPILE_C_DEPORD =
+define TOOL_XGCCAMD64LINUX_COMPILE_C_CMDS
+ $(QUIET)$(TOOL_XGCCAMD64LINUX_CC) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Compile C++ source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+TOOL_XGCCAMD64LINUX_COMPILE_CXX_OUTPUT =
+TOOL_XGCCAMD64LINUX_COMPILE_CXX_DEPEND =
+TOOL_XGCCAMD64LINUX_COMPILE_CXX_DEPORD =
+define TOOL_XGCCAMD64LINUX_COMPILE_CXX_CMDS
+ $(QUIET)$(TOOL_XGCCAMD64LINUX_CXX) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_XGCCAMD64LINUX_COMPILE_AS_OUTPUT =
+TOOL_XGCCAMD64LINUX_COMPILE_AS_DEPEND =
+TOOL_XGCCAMD64LINUX_COMPILE_AS_DEPORD =
+define TOOL_XGCCAMD64LINUX_COMPILE_AS_CMDS
+ $(QUIET)$(TOOL_XGCCAMD64LINUX_AS) -c\
+ $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
+ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+ -o $(obj)\
+ $(abspath $(source))
+endef
+
+
+## Link library
+# @param $(target) Normalized main target name.
+# @param $(out) Library name.
+# @param $(objs) Object files to put in the library.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_XGCCAMD64LINUX_LINK_LIBRARY_OUTPUT = $(out).ar-script
+TOOL_XGCCAMD64LINUX_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_XGCCAMD64LINUX_LINK_LIBRARY_DEPORD =
+define TOOL_XGCCAMD64LINUX_LINK_LIBRARY_CMDS
+ $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
+ $(QUIET)$(APPEND) -n $(out).ar-script \
+ $(foreach o,$(objs), 'ADDMOD $(o)') \
+ $(foreach o,$(othersrc), 'ADDLIB $(o)')
+ $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
+ $(QUIET)$(APPEND) $(out).ar-script 'END'
+ $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_XGCCAMD64LINUX_AR) -M
+endef
+
+
+## Link program
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_XGCCAMD64LINUX_LINK_PROGRAM_OUTPUT = $(outbase).map
+TOOL_XGCCAMD64LINUX_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_XGCCAMD64LINUX_LINK_PROGRAM_DEPORD =
+define TOOL_XGCCAMD64LINUX_LINK_PROGRAM_CMDS
+ $(QUIET)$(TOOL_XGCCAMD64LINUX_LD) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+ $(call TOOL_XGCCAMD64LINUX_LD_MAP,$(outbase).map)
+endef
+
+
+## Link DLL
+# @param $(target) Normalized main target name.
+# @param $(out) Program name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_XGCCAMD64LINUX_LINK_DLL_OUTPUT = $(outbase).map
+TOOL_XGCCAMD64LINUX_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_XGCCAMD64LINUX_LINK_DLL_DEPORD =
+define TOOL_XGCCAMD64LINUX_LINK_DLL_CMDS
+ $(QUIET)$(TOOL_XGCCAMD64LINUX_LD) $(TOOL_XGCCAMD64LINUX_LDFLAGS.dll) $(flags) -o $(out)\
+ $(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_XGCCAMD64LINUX_LD_SONAME,$(target),$(out)))\
+ $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+ $(call TOOL_XGCCAMD64LINUX_LD_MAP,$(outbase).map)
+endef
+
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param $(target) Normalized main target name.
+# @param $(out) System module name.
+# @param $(objs) Object files to link together.
+# @param $(libs) Libraries to search.
+# @param $(libpath) Library search paths.
+# @param $(flags) Flags.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(othersrc) Unhandled sources.
+# @param $(custom_pre) Custom step invoked before linking.
+# @param $(custom_post) Custom step invoked after linking.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+TOOL_XGCCAMD64LINUX_LINK_SYSMOD_OUTPUT = $(outbase).map
+TOOL_XGCCAMD64LINUX_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_XGCCAMD64LINUX_LINK_SYSMOD_DEPORD =
+define TOOL_XGCCAMD64LINUX_LINK_SYSMOD_CMDS
+ $(QUIET)$(TOOL_XGCCAMD64LINUX_LD_SYSMOD) $(TOOL_XGCCAMD64LINUX_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
+ $(foreach p,$(libpath), -L$(p))\
+ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+ $(call TOOL_XGCCAMD64LINUX_LD_SYSMOD_MAP,$(outbase).map)
+endef
+
diff --git a/kBuild/tools/YACC.kmk b/kBuild/tools/YACC.kmk
new file mode 100644
index 0000000..919dfbf
--- /dev/null
+++ b/kBuild/tools/YACC.kmk
@@ -0,0 +1,50 @@
+# $Id: YACC.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# yacc tool
+#
+
+#
+# Copyright (c) 2009-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_YACC = yacc
+
+ifndef TOOL_YACC_YACC
+TOOL_YACC_YACC := $(firstword $(which byacc$(HOSTSUFF_EXE)) $(which yacc$(HOSTSUFF_EXE)) yacc$(HOSTSUFF_EXE))
+endif
+
+#TOOL_YACC_YACCFLAGS ?=
+TOOL_YACC_YACC_OUTPUT = $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),$(outbase).h$(substr $(suffix $(source)),3),)
+TOOL_YACC_YACC_OUTPUT_MAYBE = $(outbase).tab.c$(substr $(suffix $(source)),3) $(outbase).tab.h$(substr $(suffix $(source)),3)
+TOOL_YACC_YACC_DEPEND =
+TOOL_YACC_YACC_DEPORD =
+define TOOL_YACC_YACC_CMDS
+ $(QUIET)$(TOOL_YACC_YACC) $(flags) -b $(outbase) $(source)
+ $(QUIET)$(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),$(MV) -f -- $(outbase).tab.h$(substr $(suffix $(source)),3) $(outbase).h$(substr $(suffix $(source)),3),)
+ $(QUIET)$(MV) -f -- $(outbase).tab.c$(substr $(suffix $(source)),3) $(out)
+endef
+
diff --git a/kBuild/tools/YASM.kmk b/kBuild/tools/YASM.kmk
new file mode 100644
index 0000000..95c7720
--- /dev/null
+++ b/kBuild/tools/YASM.kmk
@@ -0,0 +1,119 @@
+# $Id: YASM.kmk 3520 2021-12-18 13:39:52Z bird $
+## @file
+# kBuild Tool Config - YASM 0.4.0 or later.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_YASM := YASM v0.4.0+
+
+# Tool Specific Properties
+ifndef PATH_TOOL_YASM
+ PATH_TOOL_YASM := $(sort $(wildcard $(KBUILD_DEVTOOLS_HST)/yasm/v*.*))
+ ifneq ($(PATH_TOOL_YASM),)
+ PATH_TOOL_YASM := $(call lastword,$(PATH_TOOL_YASM))
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_YASM := $(PATH_TOOL_YASM)
+endif
+ifneq ($(PATH_TOOL_YASM),)
+ TOOL_YASM_AS ?= $(PATH_TOOL_YASM)/yasm$(HOSTSUFF_EXE)
+else
+ TOOL_YASM_AS ?= yasm$(HOSTSUFF_EXE)
+endif
+
+# kSubmit
+ifdef TOOL_YASM_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ TOOL_YASM_KSUBMIT ?= kmk_builtin_kSubmit --
+ endif
+endif
+
+# General Properties used by kBuild
+TOOL_YASM_ASFLAGS ?=
+
+
+## Compile Assembly source.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(obj) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions. No -D or something.
+# @param $(incs) Includes. No -I or something.
+# @param $(dirdep) Directory creation dependency.
+# @param $(deps) Other dependencies.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+# @param $(objsuff) Object suffix.
+#
+TOOL_YASM_COMPILE_AS_OUTPUT = $(outbase).lst
+TOOL_YASM_COMPILE_AS_OUTPUT_MAYBE = $(obj).map
+TOOL_YASM_COMPILE_AS_DEPEND =
+TOOL_YASM_COMPILE_AS_DEPORD =
+define TOOL_YASM_COMPILE_AS_CMDS
+ifdef TOOL_YASM_KSUBMIT # yasm 1.3.0 w/ patches.
+ $(QUIET)$(TOOL_YASM_KSUBMIT) $(TOOL_YASM_AS)\
+ $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
+ $(addsuffix /,$(qaddprefix sh,-I, $(incs))) $(qaddprefix sh,-D, $(defs))\
+ -l $(outbase).lst \
+ -o $(obj) \
+ -MD="$(dep)" -MP --makedep-dos2unix-slash\
+ $(abspath $(source))
+else
+ $(QUIET)$(TOOL_YASM_AS)\
+ $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
+ $(addsuffix /,$(qaddprefix sh,-I, $(incs))) $(qaddprefix sh,-D, $(defs))\
+ -l $(outbase).lst\
+ -o $(obj)\
+ $(abspath $(source))
+ $(QUIET)$(REDIRECT) -wo $(dep) -- $(TOOL_YASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
+ $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
+ $(addsuffix /,$(qaddprefix sh,-I, $(incs))) $(qaddprefix sh,-D, $(defs))\
+ -o $(obj)\
+ $(abspath $(source)) \
+ -M
+ if1of ($(KBUILD_HOST), win nt os2)
+ $(QUIET)$(SED) -e 's/\\\(.\)/\/\1/g' --output "$(dep).tmp" "$(dep)"
+ else
+ $(QUIET)$(CP) -f -- "$(dep)" "$(dep).tmp"
+ endif
+ $(QUIET)$(APPEND) -n "$(dep).tmp" "" ""
+ $(QUIET)$(SED) $(if $(intersects $(KBUILD_HOST), win nt os2), -e 's/\\\(.\)/\/\1/g',)\
+ -e 's/^[^ ]*: / /'\
+ -e 's/ *\\$$(DOLLAR)//'\
+ -e 's/^ *//'\
+ -e 's/ */\n/g'\
+ -e 's/ *\([^ \n][^ \n]*\)/\1:\n/g'\
+ --append "$(dep).tmp"\
+ "$(dep)"
+ $(QUIET)$(MV) -f -- "$(dep).tmp" "$(dep)"
+endif
+endef
+
diff --git a/kBuild/tools/ZIP.kmk b/kBuild/tools/ZIP.kmk
new file mode 100644
index 0000000..5dcc82d
--- /dev/null
+++ b/kBuild/tools/ZIP.kmk
@@ -0,0 +1,89 @@
+# $Id: ZIP.kmk 3121 2017-10-31 10:58:59Z bird $
+## @file
+# kBuild Tool Config - The zip/unzip packer/unpacker.
+#
+
+#
+# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+TOOL_ZIP := The zip/unzip packer/unpacker.
+
+# Tool Specific Properties
+ifndef TOOL_ZIP_UNPACK
+ TOOL_ZIP_UNPACK := $(wildcard $(KBUILD_DEVTOOLS_HST)/unzip/v*/unzip$(HOSTSUFF_EXE))
+ ifeq ($(TOOL_ZIP_UNPACK),)
+ TOOL_ZIP_UNPACK := $(wildcard $(KBUILD_DEVTOOLS_HST)/zip/v*/unzip$(HOSTSUFF_EXE))
+ endif
+ ifeq ($(TOOL_ZIP_UNPACK),)
+ TOOL_ZIP_UNPACK := $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/unzip$(HOSTSUFF_EXE))
+ endif
+ ifneq ($(TOOL_ZIP_UNPACK),)
+ TOOL_ZIP_UNPACK := $(lastword $(sort $(TOOL_ZIP_UNPACK)))
+ else
+ TOOL_ZIP_UNPACK := unzip$(HOSTSUFF_EXE)
+ endif
+else
+ TOOL_ZIP_UNPACK := $(TOOL_ZIP_UNPACK)
+endif
+#ifndef TOOL_ZIP_PACK
+# TOOL_ZIP_PACK := $(wildcard $(KBUILD_DEVTOOLS_HST)/zip/v*/zip$(HOSTSUFF_EXE))
+# ifeq ($(TOOL_ZIP_PACK),)
+# TOOL_ZIP_PACK := $(wildcard $(KBUILD_DEVTOOLS_HST)/unzip/v*/zip$(HOSTSUFF_EXE))
+# endif
+# ifeq ($(TOOL_ZIP_PACK),)
+# TOOL_ZIP_PACK := $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/zip$(HOSTSUFF_EXE))
+# endif
+# ifneq ($(TOOL_ZIP_PACK),)
+# TOOL_ZIP_PACK := $(lastword $(sort $(TOOL_ZIP_PACK)))
+# else
+# TOOL_ZIP_PACK := zip$(HOSTSUFF_EXE)
+# endif
+#else
+# TOOL_ZIP_PACK := $(TOOL_ZIP_PACK)
+#endif
+
+# General Properties used by kBuild
+TOOL_ZIP_UNPACKFLAGS ?=
+
+## UNPACK one file.
+# @param $(zipget) Normalized main zipget name.
+# @param $(archive) The file to unpack.
+# @param $(flags) Flags.
+# @param $(inst) Where to unpack it.
+# @param $(out) Where to write the file list.
+TOOL_ZIP_UNPACK_OUTPUT =
+TOOL_ZIP_UNPACK_DEPEND =
+TOOL_ZIP_UNPACK_DEPORD =
+define TOOL_ZIP_UNPACK_CMDS
+ $(QUIET)$(TOOL_ZIP_UNPACK) $(flags) $(archive) -d "$(inst)"
+ $(QUIET)$(TOOL_ZIP_UNPACK) -l $(archive) | $(SED) \
+ -e '/ [0-2][0-9]:[0-6][0-9]/!d' \
+ -e 's/^.* [0-2][0-9]:[0-6][0-9] //' \
+ > $(out)
+endef
+
diff --git a/kBuild/tools/update-c-versions.sh b/kBuild/tools/update-c-versions.sh
new file mode 100755
index 0000000..5ac308a
--- /dev/null
+++ b/kBuild/tools/update-c-versions.sh
@@ -0,0 +1,6 @@
+#/bin/bash -xe
+kmk_sed \
+ -e 's/CLANGXXMACHO/CLANGCCMACHO/g' \
+ -e '/^TOOL_CLANGCCMACHO_LD/s/clang++/clang/' \
+ -e 's/for building C++ code/for building C code/' \
+ --output CLANGCCMACHO.kmk CLANGXXMACHO.kmk
diff --git a/kBuild/units/dtrace.kmk b/kBuild/units/dtrace.kmk
new file mode 100644
index 0000000..9625895
--- /dev/null
+++ b/kBuild/units/dtrace.kmk
@@ -0,0 +1,252 @@
+# $Id: dtrace.kmk 3284 2019-01-05 01:40:31Z bird $
+## @file
+# DTrace unit.
+#
+
+#
+# Copyright (c) 2012-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifdef UNIT_dtrace
+ $(error kBuild: The dtrace unit was included twice!)
+endif
+UNIT_dtrace = dtrace
+
+# Add our target properties.
+PROPS_TOOLS += DTRACETOOL
+PROPS_SINGLE += DTRACETOOL
+PROPS_ACCUMULATE_R += DTRACE_HDR_FLAGS DTRACE_OBJ_FLAGS
+
+# Add ourselves to the default source handlers.
+KBUILD_SRC_HANDLERS += \
+ .d:def_src_handler_dtrace
+
+
+## wrapper the compile command dependency check.
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEP_DTRACE_HDR_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_),$$(commands $(out)),FORCE)
+ _DEP_DTRACE_OBJ_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _DEP_DTRACE_HDR_CMDS =
+ _DEP_DTRACE_OBJ_CMDS =
+endif
+
+
+##
+# Generates the rule for creating a DTrace header from a D source file.
+#
+# @param out The output file.
+# @param cmds The dtrace command(s).
+# @param lots more
+#
+define def_dtrace_hdr_rule
+$(out): \
+ $(deps) \
+ $(value _DEP_DTRACE_HDR_CMDS) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_GENERATE,$(target),$$@,$(source))
+ $$(QUIET)$$(RM) -f -- $(dep) $(out)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+# update globals
+_OUT_FILES += $(out)
+$(target)_2_INTERMEDIATES += $(out)
+
+endef # def_dtrace_hdr_rule
+
+
+##
+# Generates the rule for creating a DTrace object file from a D source file
+# and a bunch of object files.
+#
+# @param out The output file.
+# @param cmds The dtrace command(s).
+# @param lots more
+#
+define def_dtrace_obj_rule
+$(out): \
+ $(deps) \
+ $$$$(filter-out %-dtrace-object-format.o, $$$$($(target)_2_OBJS)) \
+ $(value _DEP_DTRACE_OBJ_CMDS) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_GENERATE,$(target),$$@,$(source) ++)
+ $$(QUIET)$$(RM) -f -- $(dep) $(out)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+# update globals
+_OUT_FILES += $(out)
+$(target)_2_OBJS <= $(out)
+
+endef # def_dtrace_obj_rule
+
+
+##
+# Handler for .d files listed in the SOURCES properties.
+#
+# .d files are transformed into .h that is used when compiling, thus needing
+# to be generated before anything is compiled, and into object files that needs
+# to go into the linking. Mac does not create object files.
+#
+# The step producing the object file requires all the object files with dtrace
+# probes in them as input/output as well, because it adjusts the dtrace symbols
+# from UNDEF to IGNORE. This is really ugly and cannot be expressed in make
+# syntax (prerequisite object files being modified). Fortunately, it works
+# fine because the object files won't be used by anyone else before the dtrace
+# object file exists.
+#
+# @param target The target file.
+# @param source The source file.
+# @param lots more
+# @returns quite a bit.
+define def_src_handler_dtrace
+
+local type := DTRACE
+local tmp := $(kb-src-tool tool)
+ifeq ($(tool),)
+$ (error kBuild: $(target) / $(sources) does not have a (DTRACE) tool defined!)
+endif
+local dtracedir := $($(target)_0_OUTDIR)/dtrace
+
+#
+# The header file first.
+#
+
+# Figure out all the props.
+ifndef TOOL_$(tool)_DTRACE_HDR_CMDS
+$(error kBuild: TOOL_$(tool)_DTRACE_HDR_CMDS isn't defined! target=$(target) source=$(source) )
+endif
+## @todo put the header in a subdir and add this to INCS? Do we have a early per-target hook for this??
+local outbase := $(dtracedir)/dtrace/$(basename $(notdir $(source)))
+local out := $(outbase).h
+local tmp := $(kb-src-prop DTRACE_HDR_FLAGS,flags,left-to-right,)
+local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath))
+local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath))
+local dirdep := $(call DIRDEP,$(dir $(out)))
+
+# Adjust paths if we got a default path.
+ifneq ($(defpath),)
+ local source := $(abspathex $(source),$(defpath))
+endif
+
+# dependency file.
+local dep := $(out)$(SUFF_DEP)
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ $(eval includedep $(dep))
+endif
+
+# call the tool
+local cmds := $(TOOL_$(tool)_DTRACE_HDR_CMDS)
+local deps += $(TOOL_$(tool)_DTRACE_DEPEND) $(source)
+local orderdeps += $(TOOL_$(tool)_DTRACE_DEPORD) $(dirdep)
+
+# generate the rule.
+$(eval $(def_dtrace_hdr_rule))
+
+
+#
+# Adjust the object files and generate one from the D source, if needed.
+#
+ifn1of ($(bld_trg), $(TOOL_$(tool)_DTRACE_OBJ_NOT_NEEDED))
+ # Figure out all the props.
+ ifndef TOOL_$(tool)_DTRACE_OBJ_CMDS
+ $(error kBuild: TOOL_$(tool)_DTRACE_OBJ_CMDS isn't defined! target=$(target) source=$(source) )
+ endif
+ local outbase := $(dtracedir)/$(basename $(notdir $(source)))
+ local out := $(outbase)-dtrace-object-format.o
+ local tmp := $(kb-src-prop DTRACE_OBJ_FLAGS,flags,left-to-right,)
+ local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath))
+ local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath))
+ local dirdep := $(call DIRDEP,$(dir $(out)))
+
+ # Adjust paths if we got a default path.
+ ifneq ($(defpath),)
+ local source := $(abspathex $(source),$(defpath))
+ endif
+
+ # dependency file.
+ local dep := $(out)$(SUFF_DEP)
+ ifndef NO_COMPILE_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ $(eval includedep $(dep))
+ endif
+
+ # call the tool
+ local cmds := $(TOOL_$(tool)_DTRACE_OBJ_CMDS)
+ local deps += $(TOOL_$(tool)_DTRACE_DEPEND) $(source)
+ local orderdeps += $(TOOL_$(tool)_DTRACE_DEPORD) $(dirdep)
+
+ # generate the rule.
+ $(eval $(def_dtrace_obj_rule))
+endif
+
+endef # def_src_handler_dtrace
+
+
+
+#
+# The pre-target hook.
+#
+define def_unit_dtrace_target_pre
+
+local dtracedir := $($(target)_0_OUTDIR)/dtrace
+$(eval $(target)_INCS += $(dtracedir))
+
+endef #def_unit_dtrace_target_pre
+
diff --git a/kBuild/units/gccprecomp.kmk b/kBuild/units/gccprecomp.kmk
new file mode 100644
index 0000000..bf9a49c
--- /dev/null
+++ b/kBuild/units/gccprecomp.kmk
@@ -0,0 +1,67 @@
+# $Id: gccprecomp.kmk 3415 2020-08-20 23:43:33Z bird $
+## @file
+# kBuild Unit - Target Level Precompiled Headers for GNU GCC.
+#
+
+#
+# Copyright (c) 2016-2019 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+UNIT_gccprecomp = Target level precompiled Headers for Visual C++
+
+#
+# Early target processing pass #1.
+#
+# This sets $(target)_1_GCC_PCH_DIR as the include directory for the precompiled
+# header, adding it to BLDDIRS to get a mkdir rule for it, and then calculates the
+# .gch name and stores that in $(target)_1_GCC_PCH_FILE for compile rule dependencies.
+#
+define def_unit_gccprecomp_target_pre
+ $(target)_BLDDIRS += $($(target)_0_OUTDIR)/pch/
+ $(target)_1_GCC_PCH_DIR := $($(target)_0_OUTDIR)/pch/
+ $(target)_1_GCC_PCH_FILE := $($(target)_0_OUTDIR)/pch/$(notdir $($(target)_PCH_HDR)).gch
+endef
+
+#
+# Early target processing pass #2.
+#
+# This sets up a rule for creating the .gch file after qt5 and similar units
+# are done modifying INCS, DEFS and company. The 'tool' variable is defined by
+# footer-pass2-compiling-targets.kmk and is really the LD tool, but that'll
+# have to do for now. The '-PCH' variant of the GCC/LLVM tool, is defined together
+# with $(tool) and allow us to bypass the options and dependencies triggered
+# by _1_VCC_PCH_FILE, _1_VCC_COMMON_OBJ_PDB and _PCH_HDR, and also make sure we
+# don't get circular dependencies by way of kDepObj and the debug info.
+#
+define def_unit_gccprecomp_target_pre_2
+ local source := $($(target)_PCH_HDR)
+ local suff := $(suffix $(source))
+ local type := PCH
+ $(kb-src-one 4)
+endef
+
diff --git a/kBuild/units/lex.kmk b/kBuild/units/lex.kmk
new file mode 100644
index 0000000..d8ec238
--- /dev/null
+++ b/kBuild/units/lex.kmk
@@ -0,0 +1,153 @@
+# $Id: lex.kmk 3284 2019-01-05 01:40:31Z bird $
+## @file
+# lex unit.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifdef UNIT_lex
+ $(error kBuild: The lex unit was included twice!)
+endif
+UNIT_lex = lex
+
+# Add our target properties.
+PROPS_TOOLS += LEXTOOL
+PROPS_SINGLE += LEXTOOL
+PROPS_ACCUMULATE_R += LEXFLAGS
+
+# Add ourselves to the default source handlers.
+KBUILD_SRC_HANDLERS += \
+ .l:def_src_handler_lex
+
+
+## wrapper the compile command dependency check.
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEP_LEX_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _DEP_LEX_CMDS =
+endif
+
+
+##
+# Generates the rules for running flex on a specific source file.
+#
+# @param $(obj) The object file.
+# @param lots more
+define def_lex_rule
+$(out) + $(output_extra) +| $(output_maybe) : \
+ $(deps) \
+ $(value _DEP_LEX_CMDS) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+ $$(QUIET)$$(RM) -f -- $(dep) $(out) $(output_extra) $(output_maybe)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+# update globals
+_OUT_FILES += $(out) $(output_extra) $(output_maybe)
+$(target)_GEN_SOURCES_ += $(out)
+$(target)_2_INTERMEDIATES += $(intermediates)
+
+endef # def_lex_rule
+
+##
+# Handler for .l files listed in the SOURCES properties.
+#
+# .l files are transformed into .c files that then gets compiled by
+# the C compiler.
+#
+# @param target The target file.
+# @param source The source file.
+# @param lots more
+# @returns quite a bit.
+define def_src_handler_lex
+# Figure out all the props.
+local type := LEX
+local tmp := $(kb-src-tool tool)
+ifeq ($(tool),)
+$(error kBuild: $(target) / $(sources) does not a (lex) tool defined!)
+endif
+ifndef TOOL_$(tool)_LEX_CMDS
+$(error kBuild: TOOL_$(tool)_LEX_CMDS isn't defined! target=$(target) source=$(source) )
+endif
+local out := $(kb-obj-base outbase).c
+local tmp := $(kb-src-prop LEXFLAGS,flags,left-to-right,)
+local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath))
+local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath))
+ifdef TOOL_$(tool)_LEX_OUT_FILE # .c/.cpp output depends on flags.
+ local out := $(strip $(TOOL_$(tool)_LEX_OUT_FILE))
+ ifeq ($(out),)
+ local out := $(outbase).c
+ endif
+endif
+local dirdep := $(call DIRDEP,$(dir $(out)))
+
+# Adjust paths if we got a default path.
+ifneq ($(defpath),)
+ local source := $(abspathex $(source),$(defpath))
+endif
+
+# dependency file.
+local dep := $(out)$(SUFF_DEP)
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ $(eval includedep $(dep))
+endif
+
+# call the tool
+local cmds := $(TOOL_$(tool)_LEX_CMDS)
+local output_extra := $(TOOL_$(tool)_LEX_OUTPUT)
+local output_maybe := $(TOOL_$(tool)_LEX_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_LEX_DEPEND) $(source)
+local orderdeps += $(TOOL_$(tool)_LEX_DEPORD) $(dirdep)
+
+# Whether it generates a header file depends on the tool / flags.
+local intermediates := $(filter %.h %.hpp %.h++ %.H,$(output_extra))
+
+# generate the rule.
+$(eval $(def_lex_rule))
+
+endef # def_src_handler_lex
+
+
diff --git a/kBuild/units/qt-Q_OBJECT.sed b/kBuild/units/qt-Q_OBJECT.sed
new file mode 100644
index 0000000..1ac1786
--- /dev/null
+++ b/kBuild/units/qt-Q_OBJECT.sed
@@ -0,0 +1,36 @@
+# $Id: qt-Q_OBJECT.sed 3558 2022-03-02 00:47:18Z bird $
+## @file
+# Qt unit - sed script for checking for Q_OBJECT in a file.
+#
+# This is not very sophisticated, but it helps avoid generating
+# files we don't need. It outputs '1' when Q_OBJECT is found
+# and then quits, allowing us to do $(if $(shell ...),moc_...).
+# is
+#
+
+#
+# Copyright (c) 2008-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+
+/Q_OBJECT/!b skip
+s/^.*$/1/
+q 0
+:skip
+d
diff --git a/kBuild/units/qt3.kmk b/kBuild/units/qt3.kmk
new file mode 100644
index 0000000..809fd72
--- /dev/null
+++ b/kBuild/units/qt3.kmk
@@ -0,0 +1,947 @@
+# $Id: qt3.kmk 3418 2020-08-21 11:02:13Z bird $
+## @file
+# Qt 3.3.x unit.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+ifdef UNIT_qt3
+ $(error kBuild: The qt3 unit was included twice!)
+endif
+UNIT_qt3 = qt3
+
+
+if !defined(UNIT_qt4) && !defined(UNIT_qt5)
+ # Add our target properties (same as qt4 & qt5).
+ PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
+ PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
+endif
+PROPS_SINGLE +=
+PROPS_ACCUMULATE_R += QT_IMAGES
+
+
+#
+# The QT3 SDK.
+#
+# This is implemented here rather than in sdks/QT3.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+## @todo the SDK might actually not be necessary as it turns out... For now it servers
+# a purpose if the host differs from the target, in theory at least.
+SDK_QT3 = Qt3
+
+# SDK Specific Properties
+# PATH_SDK_QT3 - the general location of the Qt3 SDK stuff.
+# PATH_SDK_QT3_INC - the Qt3 include directory.
+# PATH_SDK_QT3_LIB - the Qt3 library directory for KBUILD_TARGET.
+# PATH_SDK_QT3_LIB.amd64 - the Qt3 library directory for AMD64.
+# PATH_SDK_QT3_LIB.x86 - the Qt3 library directory for X86.
+ifndef PATH_SDK_QT3
+ PATH_SDK_QT3 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v3*)))
+ ifeq ($(PATH_SDK_QT3),)
+ # If target == host, try look for Qt in the various platform specific places.
+ ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
+ ifeq ($(KBUILD_TARGET),darwin)
+ # No idea here yet...
+ else ifeq ($(KBUILD_TARGET),os2)
+ # No idea here yet... Check QTDIR perhaps, but for now users have toset PATH_SDK_QT3.
+ else ifeq ($(KBUILD_TARGET),win)
+ # No idea here yet... Check QTDIR perhaps, but for now users have toset PATH_SDK_QT3.
+ else
+ # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT3_LIB* stuff if it doesn't work.
+ # Try find the general location of the thing by looking for the qm2ts program, then try looking for
+ # the moc program in likely and unlikely places save /usr[/local]/bin to avoid mistaking it with Qt4.
+ PATH_SDK_QT3 := $(patsubst %/bin/qm2ts,%,$(firstword $(wildcard \
+ /usr/lib/qt-3.3/bin/qm2ts \
+ /usr/lib64/qt-3.3/bin/qm2ts \
+ /usr/qt/3/bin/qm2ts \
+ $(if $(QTDIR),$(QTDIR)/bin/qm2ts) \
+ /usr/bin/qm2ts \
+ /usr/local/bin/qm2ts \
+ /usr/share/qt3/bin/qm2ts \
+ )))
+ ifeq ($(PATH_SDK_QT3),) # Try with moc, but not in /usr/bin and /usr/local/bin.
+ PATH_SDK_QT3 := $(patsubst %/bin/moc,%,$(firstword $(wildcard \
+ /usr/lib/qt-3.3/bin/moc \
+ /usr/lib64/qt-3.3/bin/moc \
+ /usr/qt/3/bin/moc \
+ /usr/share/qt3/bin/moc \
+ $(if $(QTDIR),$(QTDIR)/bin/moc) \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT3),)
+ # Found something! Export the variable for the benefit of recursive make instances.
+ export PATH_SDK_QT3
+
+ # Determin the include directory.
+ ifeq ($(PATH_SDK_QT3_INC),)
+ PATH_SDK_QT3_INC := $(patsubst %/private/qfiledefs_p.h,%,$(firstword $(wildcard \
+ $(PATH_SDK_QT3)/include/private/qfiledefs_p.h \
+ $(PATH_SDK_QT3)/include/qt3/private/qfiledefs_p.h \
+ /usr/include/qt3/private/qfiledefs_p.h)))
+ ifneq ($(PATH_SDK_QT3_INC),)
+ export PATH_SDK_QT3_INC
+ endif
+ endif
+
+ # Determin the most likely x86 and AMD64 lib directories (only used for making PATH_SDK_QT3_LIB).
+ ifeq ($(PATH_SDK_QT3_LIB.x86),)
+ PATH_SDK_QT3_LIB.x86 := $(patsubst %/libqt-mt$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT3)/lib32/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib32/qt3/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib32/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ /usr/lib32/libqt-mt$(SUFF_DLL) \
+ /usr/lib32/qt3/libqt-mt$(SUFF_DLL) \
+ /usr/lib/i386-linux-gnu/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib32/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib32/qt3/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib32/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/i386-linux-gnu/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/qt3/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/i386-linux-gnu/libqt-mt$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT3_LIB.x86),)
+ export PATH_SDK_QT3_LIB.x86
+ endif
+ endif
+ ifeq ($(PATH_SDK_QT3_LIB.amd64),)
+ PATH_SDK_QT3_LIB.amd64 := $(patsubst %/libqt-mt$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT3)/lib64/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib64/qt3/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib64/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/amd64/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/64/libqt-mt$(SUFF_DLL) \
+ /usr/lib64/libqt-mt$(SUFF_DLL) \
+ /usr/lib64/qt3/libqt-mt$(SUFF_DLL) \
+ /usr/lib64/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ /usr/lib/amd64/libqt-mt$(SUFF_DLL) \
+ /usr/lib/64/libqt-mt$(SUFF_DLL) \
+ /usr/lib/x86_64-linux-gnu/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib64/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib64/qt3/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib64/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/amd64/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/64/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/x86_64-linux-gnu/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/qt3/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/x86_64-linux-gnu/libqt-mt$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT3_LIB.amd64),)
+ export PATH_SDK_QT3_LIB.amd64
+ endif
+ endif
+
+ # Determin the KBUILD_TARGET lib directory.
+ ifeq ($(PATH_SDK_QT3_LIB),)
+ PATH_SDK_QT3_LIB := $(PATH_SDK_QT3_LIB.$(KBUILD_TARGET_ARCH))
+ ifeq ($(PATH_SDK_QT3_LIB),)
+ PATH_SDK_QT3_LIB := $(patsubst %/libqt-mt$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT3)/lib/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/qt3/libqt-mt$(SUFF_DLL) \
+ $(PATH_SDK_QT3)/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ /usr/lib/libqt-mt$(SUFF_DLL) \
+ /usr/lib/qt3/libqt-mt$(SUFF_DLL) \
+ /usr/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/qt3/libqt-mt$(SUFF_DLL) \
+ /usr/local/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT3_LIB),)
+ export PATH_SDK_QT3_LIB
+ endif
+ endif
+ endif
+
+ endif
+ endif # Unices
+ endif
+ # Found it?
+ ifeq ($(PATH_SDK_QT3),)
+ $(warning kBuild: Couldn't find the Qt3 headers and libaries...)
+ PATH_SDK_QT3 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_QT3 := $(PATH_SDK_QT3)
+endif
+
+# Libraries can be in either Frameworks or lib depending on how you
+# build it on the mac. The .dmg installs into Frameworks but builds into lib.
+PATH_SDK_QT3_LIB ?= $(PATH_SDK_QT3)/lib
+PATH_SDK_QT3_INC ?= $(PATH_SDK_QT3)/include
+
+# The bits that kBuild picks up.
+# (nothing here)
+
+
+#
+# The QT3 tool.
+#
+# This is implemented here rather than in tools/QT3.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+TOOL_QT3 = Qt3
+
+# Tool Specific Properties (PATH_TOOL_QT3_BIN and TOOL_QT3_BIN_SUFF)
+# TOOL_QT3_BIN_SUFF - the '-qt3' bit found on debian.
+# PATH_TOOL_QT3_BIN - the directory containing moc, uic, lrelease, lupdate and qm2ts.
+ifndef PATH_TOOL_QT3_BIN
+ PATH_TOOL_QT3_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_BLD)/qt/v3*/bin)))
+ ifeq ($(PATH_TOOL_QT3_BIN),)
+ if1of ($(KBUILD_HOST), win os2)
+ # Sorry, no joy here. Check QTDIR perhaps, but for now users have to set PATH_TOOL_QT3_BIN.
+ else
+ ifdef TOOL_QT3_BIN_SUFF
+ TOOL_QT3_BIN_SUFF := $(TOOL_QT3_BIN_SUFF)
+ endif
+ PATH_TOOL_QT3_BIN := $(patsubst %/qm2ts$(TOOL_QT3_BIN_SUFF),%,$(firstword $(wildcard \
+ /usr/lib/qt-3.3/bin/qm2ts$(TOOL_QT3_BIN_SUFF) \
+ /usr/lib64/qt-3.3/bin/qm2ts$(TOOL_QT3_BIN_SUFF) \
+ /usr/qt/3/bin/qm2ts$(TOOL_QT3_BIN_SUFF) \
+ $(if $(QTDIR),$(QTDIR)/bin/qm2ts$(TOOL_QT3_BIN_SUFF)) \
+ /usr/bin/qm2ts$(TOOL_QT3_BIN_SUFF) \
+ /usr/local/bin/qm2ts$(TOOL_QT3_BIN_SUFF) \
+ /usr/share/qt3/bin/qm2ts$(TOOL_QT3_BIN_SUFF) \
+ )))
+ ifeq ($(PATH_TOOL_QT3_BIN),)
+ # If we couldn't find the qt3 specific tool qm2ts, debian and other skip
+ # this (thanks a bundle). Try with look for 'moc' with a '-qt3' extension,
+ # then for just moc. In the latter case don't search /usr[/local]/bin to
+ # void finding the qt4 tools and messing up.
+ ifeq ($(TOOL_QT3_BIN_SUFF),)
+ PATH_TOOL_QT3_BIN := $(patsubst %/moc-qt3,%,$(firstword $(wildcard \
+ /usr/bin/moc-qt3 \
+ /usr/local/bin/moc-qt3 \
+ /usr/lib/qt-3.3/bin/moc-qt3 \
+ /usr/lib64/qt-3.3/bin/moc-qt3 \
+ /usr/qt/3/bin/moc-qt3 \
+ /usr/share/qt3/bin/moc-qt3 \
+ $(if $(QTDIR),$(QTDIR)/bin/moc-qt3) \
+ )))
+ endif
+ ifneq ($(PATH_TOOL_QT3_BIN),)
+ export TOOL_QT3_BIN_SUFF := -qt3
+ else
+ PATH_TOOL_QT3_BIN := $(patsubst %/moc$(TOOL_QT3_BIN_SUFF),%,$(firstword $(wildcard \
+ /usr/lib/qt-3.3/bin/moc$(TOOL_QT3_BIN_SUFF) \
+ /usr/lib64/qt-3.3/bin/moc$(TOOL_QT3_BIN_SUFF) \
+ /usr/qt/3/bin/moc$(TOOL_QT3_BIN_SUFF) \
+ /usr/share/qt3/bin/moc$(TOOL_QT3_BIN_SUFF) \
+ $(if $(QTDIR),$(QTDIR)/bin/moc$(TOOL_QT3_BIN_SUFF)) \
+ )))
+ endif
+ endif
+ ifneq ($(PATH_TOOL_QT3_BIN),)
+ export PATH_TOOL_QT3_BIN
+ endif
+ endif
+ endif
+ # If not found, we'll enter the 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_QT3_BIN := $(PATH_TOOL_QT3_BIN)
+ TOOL_QT3_BIN_SUFF := $(TOOL_QT3_BIN_SUFF)
+endif
+ifneq ($(PATH_TOOL_QT3_BIN),)
+ ifeq ($(KBUILD_HOST),os2)
+ TOOL_QT3_ENV_SETUP ?= $(REDIRECT) -E 'BEGINLIBPATH=$(PATH_TOOL_QT3_BIN);$(libpath BEGINLIBPATH)' --
+ endif
+ TOOL_QT3_MOC ?= $(TOOL_QT3_ENV_SETUP) $(PATH_TOOL_QT3_BIN)/moc$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT3_UIC ?= $(TOOL_QT3_ENV_SETUP) $(PATH_TOOL_QT3_BIN)/uic$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT3_LRC ?= $(TOOL_QT3_ENV_SETUP) $(PATH_TOOL_QT3_BIN)/lrelease$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT3_LUPDATE ?= $(TOOL_QT3_ENV_SETUP) $(PATH_TOOL_QT3_BIN)/lupdate$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+else
+ # Pathless, relies on the environment.
+ TOOL_QT3_MOC ?= moc$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT3_UIC ?= uic$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT3_LRC ?= lrelease$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT3_LUPDATE ?= lupdate$(TOOL_QT3_BIN_SUFF)$(HOST_SUFF_EXE)
+endif
+
+# General Properties used by kBuild and/or units/qt.kmk
+TOOL_QT3_MOCFLAGS ?=
+TOOL_QT3_UICFLAGS ?=
+TOOL_QT3_LRCFLAGS ?=
+
+
+## MOC a C++ source file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT3_MOC_CPP_DEPEND =
+TOOL_QT3_MOC_CPP_DEPORD =
+TOOL_QT3_MOC_CPP_OUTPUT =
+TOOL_QT3_MOC_CPP_OUTPUT_MAYBE =
+define TOOL_QT3_MOC_CPP_CMDS
+ $(QUIET)$(TOOL_QT3_MOC)\
+ $(flags)\
+ -o $(out)\
+ -i \
+ $(source)
+endef
+
+## MOC a C++ header file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT3_MOC_HPP_DEPEND =
+TOOL_QT3_MOC_HPP_DEPORD =
+TOOL_QT3_MOC_HPP_OUTPUT =
+TOOL_QT3_MOC_HPP_OUTPUT_MAYBE =
+define TOOL_QT3_MOC_HPP_CMDS
+ $(QUIET)$(TOOL_QT3_MOC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+endef
+
+## Compile a Qt user interface file (.ui).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out.cpp) The C++ source file to be generated.
+# @param $(out.h) The C++ header file to be generated.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT3_UIC_UI_DEPEND =
+TOOL_QT3_UIC_UI_DEPORD =
+TOOL_QT3_UIC_UI_OUTPUT =
+TOOL_QT3_UIC_UI_OUTPUT_MAYBE =
+define TOOL_QT3_UIC_UI_CMDS
+ $(QUIET)$(TOOL_QT3_UIC)\
+ $(flags)\
+ -o $(out.h)\
+ $(source)
+ $(QUIET)$(TOOL_QT3_UIC)\
+ $(flags)\
+ -i $(out.h) \
+ -o $(out.cpp)\
+ $(source)
+endef
+
+## Compile a Qt translation file (.ts).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT3_LRC_TS_DEPEND =
+TOOL_QT3_LRC_TS_DEPORD =
+TOOL_QT3_LRC_TS_OUTPUT =
+TOOL_QT3_LRC_TS_OUTPUT_MAYBE =
+define TOOL_QT3_LRC_TS_CMDS
+ $(QUIET)$(TOOL_QT3_LRC)\
+ $(flags)\
+ $(source)\
+ -qm $(out)
+endef
+
+
+
+#
+#
+# Back to the Qt3 unit.
+#
+#
+
+
+## wrapper for the lrelease (LRC) command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT3_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT3_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT3_LRC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt3_target_pre_handle_translation helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt3_target_pre_handle_translation_dx
+
+$(out) + $(more_output) +| $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT3_LRC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT3_LRC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
+$(target)-inst-nls_SOURCES += $(out)
+
+endef # def_unit_qt3_target_pre_handle_translation_dx
+
+##
+# Handle a source file listed in QT_TRANSLATIONS.
+#
+# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
+# to be translated into .qm files that are loadble by Qt.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt3_target_pre_handle_translation
+local type := LRC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
+local out := $(outbase).qm
+local dep := $(out).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_LRC_TS_CMDS
+ $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
+local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
+local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt3_target_pre_handle_translation_dx))
+
+endef # def_unit_qt3_target_pre_handle_translation
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT3_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT3_UIC_CMDS_PREV_),$$(commands $(out.h)),FORCE)
+else
+ _UNIT_QT3_UIC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt3_src_handler_ui helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt3_target_pre_handle_ui_dx
+
+$(out.h) + $(out.cpp) +| $(realout.h) $(realout.cpp) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT3_UIC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,uic,$(target),$(source),$(out.h) $(out.cpp))
+ $(QUIET2)$(RM) -f $(out.h) $(out.cpp) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out.h) $(realout.h)
+ $(QUIET)$(CP) --changed -f $(out.cpp) $(realout.cpp)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT3_UIC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out.h)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout.h)
+$(target)_GEN_SOURCES_ += $(realout.cpp)
+$(target)_CLEAN += $(out.h) $(out.cpp) $(realout.h) $(realout.cpp) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt3_target_pre_handle_ui_dx
+
+##
+# Source handler for .ui sources.
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt3_src_handler_ui
+local type := UIC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
+local out.h := $(outbase).tmp.h
+local out.cpp := $(outbase).tmp.cpp
+local realout.h := $(outbase).h
+local realout.cpp:=$(outbase).cpp
+local dep := $(realout.h).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_UIC_UI_CMDS
+ $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
+local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
+local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt3_target_pre_handle_ui_dx))
+
+endef # def_unit_qt3_src_handler_ui
+
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT3_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT3_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT3_MOC_HPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt3_target_pre_handle_moc_hdr helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt3_target_pre_handle_moc_hdr_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT3_MOC_HPP_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$(realout))
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT3_MOC_HPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCHDRS.
+#
+# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
+# generate a .cpp file for each of them and add it to the generated
+# sources so that it's compiled and linked. (There is an alternative
+# way to do this where the .cpp file is included, this isn't currently
+# supported by this unit.)
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt3_target_pre_handle_moc_hdr
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.cpp
+local realout := $(outbase).cpp
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_HPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt3_target_pre_handle_moc_hdr_dx))
+
+endef # def_unit_qt3_target_pre_handle_moc_hdr
+
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT3_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT3_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT3_MOC_CPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt3_target_pre_handle_moc_src helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt3_target_pre_handle_moc_src_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT3_MOC_CPP_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$(realout))
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT3_MOC_CPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCSRCS.
+#
+# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
+# a .moc file that we're expected to generate here.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt3_target_pre_handle_moc_src
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.moc
+local realout := $(outbase).moc
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_CPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt3_target_pre_handle_moc_src_dx))
+
+endef # def_unit_qt3_target_pre_handle_moc_src
+
+
+##
+# Adds sources containing Q_OBJECT to QT_MOCSRCS.
+define def_unit_qt3_target_pre_cpp_source
+ifneq ($(file-size $(source)),-1)
+ ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
+ $(eval $(target)_QT_MOCSRCS += $(source))
+ endif
+endif
+endef # def_unit_qt3_target_pre_cpp_source
+
+
+##
+# Invoked early in the processing of a target that uses the Qt unit.
+#
+# It will append the qt source handlers to the target (.h, .ui, .ts,
+# .png, .bmp, .gif).
+#
+# It will then check all the C++ sources and check which needs
+# a .moc files and generate rules and dependencies fofor these
+#
+define def_unit_qt3_target_pre
+
+# Make QTTOOL the default for the specific Qt tools instead of TOOL.
+ifneq ($($(target)_QTTOOL),)
+ ifeq ($($(target)_MOCTOOL),)
+ $(target)_MOCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_UICTOOL),)
+ $(target)_UICTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_LRCTOOL),)
+ $(target)_LRCTOOL := $($(target)_QTTOOL)
+ endif
+endif
+
+# Deal with QT_MODULES and QT_PREFIX.
+local qt_prefix := $(firstword \
+ $($(target)_QT_PREFIX.$(bld_trg)) \
+ $($(target)_QT_PREFIX.$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_PREFIX.$(bld_type)) \
+ $($(target)_QT_PREFIX))
+ifeq ($(bld_trg),win)
+ local qt_lib := $(firstword $(wildcard \
+ $(PATH_SDK_QT3_LIB)/dynamic/$(qt_prefix)qt-mt3*$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)qt-mt3*$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/dynamic/$(qt_prefix)qt-mt$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)qt-mt$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/dynamic/$(qt_prefix)Qt3*$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)Qt3*$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/dynamic/$(qt_prefix)Qt*$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)Qt*$(SUFF_LIB) \
+ ) $(PATH_SDK_QT3_LIB)/$(qt_prefix)qt-mt$(SUFF_LIB) )
+ $(eval $(target)_LIBS += $(qt_lib) )
+ ifeq ($(tool_do),LINK_PROGRAM)
+ local qt_main_lib := $(firstword $(wildcard \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)qtmain$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/qtmain$(SUFF_LIB) \
+ ) $(PATH_SDK_QT3_LIB)/$(qt_prefix)qtmain$(SUFF_LIB) )
+ $(eval $(target)_LIBS += $(qt_main_lib) )
+ endif
+else ifeq ($(bld_trg),os2)
+ # This is a real PITA since the dll/lib can be called (almost) anything. :-(
+ local qt_lib := $(firstword $(wildcard \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)*qt3*$(SUFF_LIB) \
+ $(PATH_SDK_QT3_LIB)/$(qt_prefix)*qt*$(SUFF_LIB) \
+ ))
+ ifeq ($(qt_lib),)
+ local qt_prls := $(basename $(wildcard $(PATH_SDK_QT3_LIB)/$(qt_prefix)*.prl))
+ local qt_defs := $(basename $(wildcard $(PATH_SDK_QT3_LIB)/$(qt_prefix)*.def))
+ local qt_dlls := $(basename $(wildcard $(PATH_SDK_QT3_LIB)/$(qt_prefix)*.dll))
+ local qt_libs := $(basename $(wildcard $(PATH_SDK_QT3_LIB)/$(qt_prefix)*.lib))
+ local qt_lib := $(firstword \
+ $(addsuffix .lib,$(filter $(qt_prls), $(filter $(qt_defs), $(filter $(qt_dlls), $(qt_libs))))) \
+ $(PATH_SDK_QT3_LIB)/myqt.lib )
+ endif
+ $(eval $(target)_LIBS += $(qt_lib) )
+else
+ local qt_lib := $(PATH_SDK_QT3_LIB)/lib$(qt_prefix)qt-mt$(SUFF_DLL)
+ $(eval $(target)_LIBS += $(qt_lib) )
+endif
+$(eval $(target)_INCS += $(PATH_SDK_QT3_INC) )
+
+# On Qt3 we will try pickup the QMAKE_PRL_DEFINES listed in the .prl file (in libs).
+local qt_prl := $(firstword $(wildcard \
+ $(patsubst %$(SUFF_DLL),%,$(patsubst %$(SUFF_LIB),%,$(qt_lib))).prl \
+ $(dir $(qt_lib))/$(qt_prefix)qt-mt.prl \
+ $(dir $(qt_lib))/*qt-mt*.prl \
+ $(dir $(qt_lib))/*qt*.prl \
+ ))
+ifneq ($(qt_prl),)
+ include $(qt_prl)
+ $(eval $(target)_DEFS += $(QMAKE_PRL_DEFINES))
+endif
+
+# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
+# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
+ifndef $(target)_QT_MOCSRCS
+ $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
+ $($(target)_SOURCES.$(bld_trg)) \
+ $($(target)_SOURCES.$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_SOURCES.$(bld_type)) \
+ $($(target)_SOURCES) \
+ ), $(evalval def_unit_qt3_target_pre_cpp_source))
+endif
+
+# Install source handlers for .ui files.
+$(target)_SRC_HANDLERS += \
+ .ui:def_unit_qt3_src_handler_ui \
+ .UI:def_unit_qt3_src_handler_ui
+
+# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
+local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtnlsdir) )
+$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir) )
+
+# Calc .ui sources so we can add them to the QT_MOCSRCS and QT_MOCHDRS.
+local ui_sources := $(notdir $(basename $(filter %.ui %.UI, \
+ $($(target)_SOURCES.$(bld_trg)) \
+ $($(target)_SOURCES.$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_SOURCES.$(bld_type)) \
+ $($(target)_SOURCES) \
+ )))
+#$(error ui_sources:=$(ui_sources))
+
+# Deal with QT_MOCSRCS.
+$(foreach source, \
+ $($(target)_QT_MOCSRCS.$(bld_trg)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCSRCS.$(bld_type)) \
+ $($(target)_QT_MOCSRCS) \
+ $(addsuffix .h,$(addprefix $(qtuicdir)/,$(notdir $(basename $(ui_sources))))) \
+ , $(evalvalctx def_unit_qt3_target_pre_handle_moc_src))
+
+# Deal with QT_MOCHDRS.
+$(foreach source, \
+ $($(target)_QT_MOCHDRS.$(bld_trg)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCHDRS.$(bld_type)) \
+ $($(target)_QT_MOCHDRS) \
+ $(addsuffix .h,$(addprefix $(qtuicdir)/,$(notdir $(basename $(ui_sources))))) \
+ , $(evalvalctx def_unit_qt3_target_pre_handle_moc_hdr))
+
+# Deal with QT_TRANSLATIONS.
+# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
+local translations := \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_type)) \
+ $($(target)_QT_TRANSLATIONS)
+ifneq ($(strip $(translations)),)
+ local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
+ $(eval $(expr))
+ ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
+ $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
+ else
+ $(target)-inst-nls_MODE := 0644
+ endif
+ ifdef $(target)_QT_TRANSLATIONS_INST
+ $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
+ endif
+ $(target)-inst-nls_SOURCES :=
+ $(foreach source, $(translations)\
+ , $(evalvalctx def_unit_qt3_target_pre_handle_translation))
+endif
+
+endef # def_unit_qt3_target_pre
+
+
+#
+# Rule for debugging.
+#
+unit-qt3-show-vars:
+ @$(ECHO) 'The Qt3 SDK variables:'
+ @$(ECHO) ' PATH_SDK_QT3 = "$(PATH_SDK_QT3)"'
+ @$(ECHO) ' PATH_SDK_QT3_INC = "$(PATH_SDK_QT3_INC)"'
+ @$(ECHO) ' PATH_SDK_QT3_LIB = "$(PATH_SDK_QT3_LIB)"'
+ @$(ECHO) ' PATH_SDK_QT3_LIB.amd64 = "$(PATH_SDK_QT3_LIB.amd64)"'
+ @$(ECHO) ' PATH_SDK_QT3_LIB.x86 = "$(PATH_SDK_QT3_LIB.x86)"'
+ @$(ECHO) 'The Qt3 TOOL variables:'
+ @$(ECHO) ' PATH_TOOL_QT3_BIN = "$(PATH_TOOL_QT3_BIN)"'
+ @$(ECHO) ' TOOL_QT3_BIN_SUFF = "$(TOOL_QT3_BIN_SUFF)"'
+ @$(ECHO) ' TOOL_QT3_MOC = "$(TOOL_QT3_MOC)"'
+ @$(ECHO) ' TOOL_QT3_UIC = "$(TOOL_QT3_UIC)"'
+ @$(ECHO) ' TOOL_QT3_LRC = "$(TOOL_QT3_LRC)"'
+ @$(ECHO) ' TOOL_QT3_LUPDATE = "$(TOOL_QT3_LUPDATE)"'
+
diff --git a/kBuild/units/qt4.kmk b/kBuild/units/qt4.kmk
new file mode 100644
index 0000000..c92fcf4
--- /dev/null
+++ b/kBuild/units/qt4.kmk
@@ -0,0 +1,1107 @@
+# $Id: qt4.kmk 3284 2019-01-05 01:40:31Z bird $
+## @file
+# Qt 4 unit.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+ifdef UNIT_qt4
+ $(error kBuild: The qt4 unit was included twice!)
+endif
+UNIT_qt4 = qt4
+
+
+if !defined(UNIT_qt3) && !defined(UNIT_qt5)
+ # Add our target properties (same as qt3 & qt5).
+ PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
+ PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
+endif
+PROPS_SINGLE += RCCTOOL QT_INFIX
+PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
+
+
+## @todo use pkg-config?
+
+#
+# The QT4 SDK.
+#
+# This is implemented here rather than in sdks/QT4.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+## @todo the SDK might actually not be necessary as it turns out... For now it servers
+# a purpose if the host differs from the target, in theory at least.
+SDK_QT4 = Qt4
+
+# SDK Specific Properties
+# PATH_SDK_QT4 - The general Qt4 root directory.
+# PATH_SDK_QT4_INC - The include directory.
+# PATH_SDK_QT4_LIB.amd64 - The lib directory for AMD64.
+# PATH_SDK_QT4_LIB.x86 - The lib directory for X86.
+# PATH_SDK_QT4_LIB - The lib directory for KBUILD_TARGET.
+ifndef PATH_SDK_QT4
+ PATH_SDK_QT4 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
+ ifeq ($(PATH_SDK_QT4),)
+ # If target == host, try look for Qt in the various platform specific places.
+ ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
+ ifeq ($(KBUILD_TARGET),darwin)
+ PATH_SDK_QT4 := $(patsubst %/Frameworks/QtCore.framework/Versions/4,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/4)))
+ else ifeq ($(KBUILD_TARGET),win)
+ # No idea here yet...
+ else ifeq ($(KBUILD_TARGET),ose)
+ # No port...
+ else
+ # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT4_LIB* stuff if it doesn't work.
+ # Try find the general root of thing by looking for the qt3to4 program, if not found, then look for rcc.
+ PATH_SDK_QT4 := $(patsubst %/bin/qt3to4-qt4,%,$(firstword $(wildcard \
+ /usr/bin/qt3to4-qt4 \
+ /usr/local/bin/qt3to4-qt4 \
+ /usr/qt/4/bin/qt3to4-qt4 \
+ /usr/share/qt4/bin/qt3to4-qt4 \
+ )))
+ ifeq ($(PATH_SDK_QT4),)
+ PATH_SDK_QT4 := $(patsubst %/bin/qt3to4,%,$(firstword $(wildcard \
+ /usr/bin/qt3to4 \
+ /usr/local/bin/qt3to4 \
+ /usr/qt/4/bin/qt3to4 \
+ /usr/share/qt4/bin/qt3to4 \
+ )))
+ endif
+ ifeq ($(PATH_SDK_QT4),)
+ PATH_SDK_QT4 := $(patsubst %/bin/rcc-qt4,%,$(firstword $(wildcard \
+ /usr/bin/rcc-qt4 \
+ /usr/local/bin/rcc-qt4 \
+ /usr/qt/4/bin/rcc-qt4 \
+ /usr/share/qt4/bin/rcc-qt4 \
+ )))
+ endif
+ ifeq ($(PATH_SDK_QT4),)
+ PATH_SDK_QT4 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
+ /usr/lib/*/qt4/bin/rcc \
+ /usr/bin/rcc \
+ /usr/local/bin/rcc \
+ /usr/qt/4/bin/rcc \
+ /usr/share/qt4/bin/rcc \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT4),)
+ export PATH_SDK_QT4
+
+ # Locate the include files.
+ ifeq ($(PATH_SDK_QT4_INC),)
+ PATH_SDK_QT4_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt4/QtCore/qglobal.h) \
+ $(PATH_SDK_QT4)/include/QtCore/qglobal.h \
+ $(PATH_SDK_QT4)/include/qt4/QtCore/qglobal.h \
+ /usr/include/qt4/QtCore/qtglobal.h \
+ /usr/local/include/qt4/QtCore/qtglobal.h \
+ )))
+ ifneq ($(PATH_SDK_QT4_INC),)
+ export PATH_SDK_QT4_INC
+ endif
+ endif
+
+ # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
+ ifeq ($(PATH_SDK_QT4_LIB.x86),)
+ PATH_SDK_QT4_LIB.x86 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT4)/lib32/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib32/qt4/libQtCore$(SUFF_DLL) \
+ /usr/lib32/libQtCore$(SUFF_DLL) \
+ /usr/lib32/qt4/libQtCore$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/lib/$(type)/libQtCore$(SUFF_DLL)) \
+ /usr/local/lib32/libQtCore$(SUFF_DLL) \
+ /usr/local/lib32/qt4/libQtCore$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/local/lib/$(type)/libQtCore$(SUFF_DLL)) \
+ $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT4_LIB.x86),)
+ export PATH_SDK_QT4_LIB.x86
+ endif
+ endif
+ ifeq ($(PATH_SDK_QT4_LIB.amd64),)
+ PATH_SDK_QT4_LIB.amd64 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT4)/lib64/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib64/qt4/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib/amd64/libQtCore$(SUFF_DLL) \
+ /usr/lib64/libQtCore$(SUFF_DLL) \
+ /usr/lib64/qt4/libQtCore$(SUFF_DLL) \
+ /usr/lib/amd64/libQtCore$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/lib/$(type)/libQtCore$(SUFF_DLL)) \
+ /usr/local/lib64/libQtCore$(SUFF_DLL) \
+ /usr/local/lib64/qt4/libQtCore$(SUFF_DLL) \
+ /usr/local/lib/amd64/libQtCore$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/local/lib/$(type)/libQtCore$(SUFF_DLL)) \
+ $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT4_LIB.amd64),)
+ export PATH_SDK_QT4_LIB.amd64
+ endif
+ endif
+
+ # And finally, the library path for KBUILD_TARGET.
+ ifeq ($(PATH_SDK_QT4_LIB),)
+ PATH_SDK_QT4_LIB := $(PATH_SDK_QT4_LIB.$(KBUILD_TARGET_ARCH))
+ ifeq ($(PATH_SDK_QT4_LIB),)
+ PATH_SDK_QT4_LIB := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
+ $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
+ /usr/lib/libQtCore$(SUFF_DLL) \
+ /usr/lib/qt4/libQtCore$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/lib/$(type)/libQtCore$(SUFF_DLL)) \
+ /usr/local/lib/libQtCore$(SUFF_DLL) \
+ /usr/local/lib/qt4/libQtCore$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/local/lib/$(type)/libQtCore$(SUFF_DLL)) \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT4_LIB),)
+ export PATH_SDK_QT4_LIB
+ endif
+ endif
+
+ endif
+ endif # Unices
+ endif
+ # Found it?
+ ifeq ($(PATH_SDK_QT4),)
+ $(warning kBuild: Couldn't find the Qt4 headers and libaries...)
+ PATH_SDK_QT4 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_QT4 := $(PATH_SDK_QT4)
+endif
+
+# Libraries can be in either Frameworks or lib depending on how you
+# build it on the mac. The .dmg installs into Frameworks but builds into lib.
+ifeq ($(KBUILD_TARGET),darwin)
+ ifndef PATH_SDK_QT4_LIB
+ ifneq ($(wildcard $(PATH_SDK_QT4)/Frameworks),)
+ PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/Frameworks
+ else
+ PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
+ endif
+ endif
+else
+ PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
+ PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
+endif
+
+# The bits that kBuild picks up.
+# (nothing here)
+
+
+#
+# The QT4 tool.
+#
+# This is implemented here rather than in tools/QT4.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+TOOL_QT4 = Qt4
+
+# Tool Specific Properties
+# PATH_TOOL_QT4 - Obsolete.
+# PATH_TOOL_QT4_BIN - The
+# TOOL_QT4_BIN_SUFF -
+if !defined(PATH_TOOL_QT4_BIN) && defined(PATH_TOOL_QT4)
+ PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4)/bin
+endif
+ifndef PATH_TOOL_QT4_BIN
+ PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v4*/bin)))
+ if "$(PATH_TOOL_QT4_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
+ PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v4*/bin)))
+ endif
+ ifeq ($(PATH_TOOL_QT4_BIN),)
+ ifdef TOOL_QT4_BIN_SUFF
+ TOOL_QT4_BIN_SUFF := $(TOOL_QT4_BIN_SUFF)
+ endif
+ # Try looking for moc-$(suffix) first, if specified.
+ ifneq ($(TOOL_QT4_BIN_SUFF),)
+ PATH_TOOL_QT4_BIN := $(patsubst %/moc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/moc$(TOOL_QT4_BIN_SUFF)) \
+ /usr/lib/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
+ /usr/qt/4/bin/moc$(TOOL_QT4_BIN_SUFF) \
+ /usr/share/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
+ /usr/local/bin/moc$(TOOL_QT4_BIN_SUFF) \
+ /usr/bin/moc$(TOOL_QT4_BIN_SUFF) \
+ )))
+ else
+ # No suffix given, so before we check out -qt4 look at qt4 specific locations to avoid choosers and symlinks.
+ PATH_TOOL_QT4_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/moc) \
+ $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt4/bin/moc,) \
+ /usr/lib/qt4/bin/moc \
+ /usr/local/lib/qt4/bin/moc \
+ /usr/qt/4/bin/moc \
+ /usr/local/qt/4/bin/moc \
+ /usr/share/qt4/bin/moc \
+ /usr/local/share/qt4/bin/moc \
+ )))
+ ifeq ($(PATH_TOOL_QT4_BIN),)
+ PATH_TOOL_QT4_BIN := $(patsubst %/moc-qt4,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/moc-qt4) \
+ /usr/lib/qt4/bin/moc-qt4 \
+ /usr/qt/4/bin/moc-qt4 \
+ /usr/share/qt4/bin/moc-qt4 \
+ /usr/local/bin/moc-qt4 \
+ /usr/bin/moc-qt4 \
+ )))
+ ifneq ($(PATH_TOOL_QT4_BIN),)
+ TOOL_QT4_BIN_SUFF := -qt4
+ endif
+ endif
+ endif
+ # If still no go, try looking for qt3to4 and rcc.
+ ifeq ($(PATH_TOOL_QT4_BIN),)
+ PATH_TOOL_QT4_BIN := $(patsubst %/qt3to4,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/qt3to4) \
+ /usr/lib/qt4/bin/qt3to4 \
+ /usr/qt/4/bin/qt3to4 \
+ /usr/share/qt4/bin/qt3to4 \
+ /usr/local/bin/qt3to4 \
+ /usr/bin/qt3to4 \
+ )))
+ endif
+ ifeq ($(PATH_TOOL_QT4_BIN),)
+ PATH_TOOL_QT4_BIN := $(patsubst %/rcc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF)) \
+ /usr/lib/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
+ /usr/qt/4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
+ /usr/share/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
+ /usr/local/bin/rcc$(TOOL_QT4_BIN_SUFF) \
+ /usr/bin/rcc$(TOOL_QT4_BIN_SUFF) \
+ )))
+ endif
+ if "$(PATH_TOOL_QT4_BIN)" == "" && "$(TOOL_QT4_BIN_SUFF)" != ""
+ PATH_TOOL_QT4_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/rcc) \
+ /usr/lib/qt4/bin/rcc \
+ /usr/qt/4/bin/rcc \
+ /usr/share/qt4/bin/rcc \
+ /usr/local/bin/rcc \
+ /usr/bin/rcc \
+ )))
+ endif
+ ifneq ($(PATH_TOOL_QT4_BIN),)
+ export PATH_TOOL_QT4_BIN
+ endif
+ endif
+ # If not found, we'll enter the 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4_BIN)
+endif
+ifneq ($(PATH_TOOL_QT4_BIN),)
+ TOOL_QT4_MOC ?= $(PATH_TOOL_QT4_BIN)/moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT4_UIC ?= $(PATH_TOOL_QT4_BIN)/uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ ifndef TOOL_QT4_RCC
+ TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE)
+ ifeq ($(wildcard $(TOOL_QT4_RCC)),)
+ TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ endif
+ endif
+ TOOL_QT4_LRC ?= $(PATH_TOOL_QT4_BIN)/lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT4_LUPDATE ?= $(PATH_TOOL_QT4_BIN)/lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+else
+ # Pathless, relies on the environment.
+ TOOL_QT4_MOC ?= moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT4_UIC ?= uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT4_RCC ?= rcc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT4_LRC ?= lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT4_LUPDATE ?= lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+endif
+
+# General Properties used by kBuild and/or units/qt.kmk
+TOOL_QT4_MOCFLAGS ?=
+TOOL_QT4_MOCINCS ?=
+TOOL_QT4_MOCDEFS ?=
+TOOL_QT4_MOCDEFS.darwin ?= __APPLE__ __GNUC__
+TOOL_QT4_MOCDEFS.solaris ?= __sun
+TOOL_QT4_MOCDEFS.win.amd64 ?= WIN64
+TOOL_QT4_MOCDEFS.win.x86 ?= WIN32
+
+
+## MOC a C++ source file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT4_MOC_CPP_DEPEND =
+TOOL_QT4_MOC_CPP_DEPORD =
+TOOL_QT4_MOC_CPP_OUTPUT =
+TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
+define TOOL_QT4_MOC_CPP_CMDS
+ $(QUIET)$(TOOL_QT4_MOC)\
+ $(flags)\
+ $(addprefix -I, $(incs))\
+ $(addprefix -D, $(defs))\
+ -o $(out)\
+ $(source)
+endef
+
+## MOC a C++ header file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT4_MOC_HPP_DEPEND =
+TOOL_QT4_MOC_HPP_DEPORD =
+TOOL_QT4_MOC_HPP_OUTPUT =
+TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
+define TOOL_QT4_MOC_HPP_CMDS
+ $(QUIET)$(TOOL_QT4_MOC)\
+ $(flags)\
+ $(addprefix -I, $(incs))\
+ $(addprefix -D, $(defs))\
+ -o $(out)\
+ $(source)
+endef
+
+## Compile a Qt user interface file (.ui).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT4_UIC_UI_DEPEND =
+TOOL_QT4_UIC_UI_DEPORD =
+TOOL_QT4_UIC_UI_OUTPUT =
+TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
+define TOOL_QT4_UIC_UI_CMDS
+ $(QUIET)$(TOOL_QT4_UIC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+endef
+
+## Compile a Qt resource file (.qrc).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+# @remarks The sed script generating the dependency file is a bit naive.
+TOOL_QT4_RCC_QRC_DEPEND =
+TOOL_QT4_RCC_QRC_DEPORD =
+TOOL_QT4_RCC_QRC_OUTPUT =
+TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
+define TOOL_QT4_RCC_QRC_CMDS
+ $(QUIET)$(TOOL_QT4_RCC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+ $(QUIET2)$(APPEND) $(dep) '\'
+ $(QUIET2)$(APPEND) $(dep) '$(out): \'
+ $(QUIET2)$(APPEND) $(dep) '$(source) \'
+ $(QUIET2)$(SED) \
+ -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
+ -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
+ -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
+ -e 's|$$$$| \\|' \
+ --append $(dep) \
+ $(source)
+ $(QUIET2)$(APPEND) $(dep)
+ $(QUIET2)$(SED) \
+ -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
+ -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
+ -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
+ -e 's|$$$$|:\n|' \
+ --append $(dep) \
+ $(source)
+ $(QUIET2)$(APPEND) $(dep)
+endef
+
+## Compile a Qt translation file (.ts).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT4_LRC_TS_DEPEND =
+TOOL_QT4_LRC_TS_DEPORD =
+TOOL_QT4_LRC_TS_OUTPUT =
+TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
+define TOOL_QT4_LRC_TS_CMDS
+ $(QUIET)$(TOOL_QT4_LRC)\
+ $(flags)\
+ $(source)\
+ -qm $(out)
+endef
+
+
+
+#
+#
+# Back to the Qt4 unit.
+#
+#
+
+
+## wrapper for the lrelease (LRC) command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT4_LRC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt4_target_pre_handle_translation_dx
+
+$(out) + $(more_output) +| $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT4_LRC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
+$(target)-inst-nls_SOURCES += $(out)
+
+endef # def_unit_qt4_target_pre_handle_translation_dx
+
+##
+# Handle a source file listed in QT_TRANSLATIONS.
+#
+# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
+# to be translated into .qm files that are loadble by Qt.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt4_target_pre_handle_translation
+local type := LRC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
+local out := $(outbase).qm
+local dep := $(out).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_LRC_TS_CMDS
+ $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
+local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
+local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt4_target_pre_handle_translation_dx))
+
+endef # def_unit_qt4_target_pre_handle_translation
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT4_RCC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt4_target_pre_handle_rcc_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT4_RCC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt4_target_pre_handle_rcc_dx
+
+##
+# Source handler for .qrc sources (Qt resource files).
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt4_src_handler_qrc
+local type := RCC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
+local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.gen.cpp
+local realout := $(outbase).gen.cpp
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_RCC_QRC_CMDS
+ $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
+local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
+local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
+
+endef # def_unit_qt4_src_handler_qrc
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT4_UIC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt4_target_pre_handle_ui_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT4_UIC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt4_target_pre_handle_ui_dx
+
+##
+# Source handler for .ui sources.
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt4_src_handler_ui
+local type := UIC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.gen.h
+local realout := $(outbase).gen.h
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_UIC_UI_CMDS
+ $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
+local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
+local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt4_target_pre_handle_ui_dx))
+
+endef # def_unit_qt4_src_handler_ui
+
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT4_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT4_MOC_HPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt4_target_pre_handle_moc_hdr_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCHDRS.
+#
+# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
+# generate a .cpp file for each of them and add it to the generated
+# sources so that it's compiled and linked. (There is an alternative
+# way to do this where the .cpp file is included, this isn't currently
+# supported by this unit.)
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt4_target_pre_handle_moc_hdr
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.cpp
+local realout := $(outbase).cpp
+local dep := $(realout).dep
+local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
+local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_HPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
+
+endef # def_unit_qt4_target_pre_handle_moc_hdr
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT4_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT4_MOC_CPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt4_target_pre_handle_moc_src_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT4_MOC_CPP_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCSRCS.
+#
+# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
+# a .moc file that we're expected to generate here.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt4_target_pre_handle_moc_src
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.moc
+local realout := $(outbase).moc
+local dep := $(realout).dep
+local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
+local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_CPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
+
+endef # def_unit_qt4_target_pre_handle_moc_src
+
+
+##
+# Adds sources containing Q_OBJECT to QT_MOCSRCS.
+define def_unit_qt4_target_pre_cpp_source
+ifneq ($(file-size $(source)),-1)
+ ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
+ $(eval $(target)_QT_MOCSRCS += $(source))
+ endif
+endif
+endef # def_unit_qt4_target_pre_cpp_source
+
+##
+# Invoked early in the processing of a target that uses the Qt unit.
+#
+# It will append the qt source handlers to the target (.h, .ui, .ts,
+# .png, .bmp, .gif).
+#
+# It will then check all the C++ sources and check which needs
+# a .moc files and generate rules and dependencies fofor these
+#
+define def_unit_qt4_target_pre
+
+# Make QTTOOL the default for the specific Qt tools instead of TOOL.
+ifneq ($($(target)_QTTOOL),)
+ ifeq ($($(target)_MOCTOOL),)
+ $(target)_MOCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_UICTOOL),)
+ $(target)_UICTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_RCCTOOL),)
+ $(target)_RCCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_LRCTOOL),)
+ $(target)_LRCTOOL := $($(target)_QTTOOL)
+ endif
+endif
+
+# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
+local qt_modules := \
+ $($(target)_QT_MODULES.$(bld_trg)) \
+ $($(target)_QT_MODULES.$(bld_trg_arch)) \
+ $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MODULES.$(bld_trg_cpu)) \
+ $($(target)_QT_MODULES.$(bld_type)) \
+ $($(target)_QT_MODULES)
+local qt_prefix := $(firstword \
+ $($(target)_QT_PREFIX.$(bld_trg)) \
+ $($(target)_QT_PREFIX.$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_PREFIX.$(bld_type)) \
+ $($(target)_QT_PREFIX))
+local qt_infix := $(firstword \
+ $($(target)_QT_INFIX.$(bld_trg)) \
+ $($(target)_QT_INFIX.$(bld_trg_arch)) \
+ $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_INFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_INFIX.$(bld_type)) \
+ $($(target)_QT_INFIX))
+ifeq ($(bld_trg),darwin)
+ # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
+ $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
+ $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
+ $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
+ $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
+else
+ ifeq ($(bld_trg),win)
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
+ ifeq ($(tool_do),LINK_PROGRAM)
+ $(eval $(target)_LIBS += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
+ endif
+ else
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
+ endif
+ $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
+endif
+$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
+
+
+# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
+# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
+ifndef $(target)_QT_MOCSRCS
+ $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
+ $($(target)_SOURCES.$(bld_trg)) \
+ $($(target)_SOURCES.$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_SOURCES.$(bld_type)) \
+ $($(target)_SOURCES) \
+ ), $(evalval def_unit_qt4_target_pre_cpp_source))
+endif
+
+# Install source handlers for .ui files.
+$(target)_SRC_HANDLERS += \
+ .ui:def_unit_qt4_src_handler_ui \
+ .UI:def_unit_qt4_src_handler_ui \
+ .qrc:def_unit_qt4_src_handler_qrc \
+ .qrc:def_unit_qt4_src_handler_qrc
+
+# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
+local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
+$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
+
+# Deal with QT_MOCSRCS.
+$(foreach source, \
+ $($(target)_QT_MOCSRCS.$(bld_trg)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCSRCS.$(bld_type)) \
+ $($(target)_QT_MOCSRCS) \
+ , $(evalvalctx def_unit_qt4_target_pre_handle_moc_src))
+
+# Deal with QT_MOCHDRS.
+$(foreach source, \
+ $($(target)_QT_MOCHDRS.$(bld_trg)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCHDRS.$(bld_type)) \
+ $($(target)_QT_MOCHDRS) \
+ , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr))
+
+# Deal with QT_TRANSLATIONS.
+# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
+local translations := \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_type)) \
+ $($(target)_QT_TRANSLATIONS)
+ifneq ($(strip $(translations)),)
+ local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
+ $(eval $(expr))
+ ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
+ $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
+ else
+ $(target)-inst-nls_MODE := 0644
+ endif
+ ifdef $(target)_QT_TRANSLATIONS_INST
+ $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
+ endif
+ $(target)-inst-nls_SOURCES :=
+ $(foreach source, $(translations)\
+ , $(evalvalctx def_unit_qt4_target_pre_handle_translation))
+endif
+
+endef # def_unit_qt4_target_pre
+
+
+#
+# Rule for debugging.
+#
+unit-qt4-show-vars:
+ @$(ECHO) 'The Qt4 SDK variables:'
+ @$(ECHO) ' PATH_SDK_QT4 = "$(PATH_SDK_QT4)"'
+ @$(ECHO) ' PATH_SDK_QT4_INC = "$(PATH_SDK_QT4_INC)"'
+ @$(ECHO) ' PATH_SDK_QT4_LIB = "$(PATH_SDK_QT4_LIB)"'
+ @$(ECHO) ' PATH_SDK_QT4_LIB.amd64 = "$(PATH_SDK_QT4_LIB.amd64)"'
+ @$(ECHO) ' PATH_SDK_QT4_LIB.x86 = "$(PATH_SDK_QT4_LIB.x86)"'
+ @$(ECHO) 'The Qt4 TOOL variables:'
+ @$(ECHO) ' PATH_TOOL_QT4_BIN = "$(PATH_TOOL_QT4_BIN)"'
+ @$(ECHO) ' TOOL_QT4_BIN_SUFF = "$(TOOL_QT4_BIN_SUFF)"'
+ @$(ECHO) ' TOOL_QT4_MOC = "$(TOOL_QT4_MOC)"'
+ @$(ECHO) ' TOOL_QT4_UIC = "$(TOOL_QT4_UIC)"'
+ @$(ECHO) ' TOOL_QT4_RCC = "$(TOOL_QT4_RCC)"'
+ @$(ECHO) ' TOOL_QT4_LRC = "$(TOOL_QT4_LRC)"'
+ @$(ECHO) ' TOOL_QT4_LUPDATE = "$(TOOL_QT4_LUPDATE)"'
+
diff --git a/kBuild/units/qt5.kmk b/kBuild/units/qt5.kmk
new file mode 100644
index 0000000..76353df
--- /dev/null
+++ b/kBuild/units/qt5.kmk
@@ -0,0 +1,1214 @@
+# $Id: qt5.kmk 3349 2020-05-23 09:54:19Z bird $
+## @file
+# Qt 5 unit.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+ifdef UNIT_qt5
+ $(error kBuild: The qt5 unit was included twice!)
+endif
+UNIT_qt5 = qt5
+
+
+if !defined(UNIT_qt3) && !defined(UNIT_qt4)
+ # Add our target properties (same as qt3 & qt4).
+ PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
+ PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
+endif
+PROPS_SINGLE += RCCTOOL QT_INFIX
+PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
+
+
+## @todo use pkg-config?
+
+#
+# The QT5 SDK.
+#
+# This is implemented here rather than in sdks/QT5.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+## @todo the SDK might actually not be necessary as it turns out... For now it servers
+# a purpose if the host differs from the target, in theory at least.
+SDK_QT5 = Qt5
+
+# SDK Specific Properties
+# PATH_SDK_QT5 - The general Qt5 root directory.
+# PATH_SDK_QT5_INC - The include directory.
+# PATH_SDK_QT5_LIB.amd64 - The lib directory for AMD64.
+# PATH_SDK_QT5_LIB.x86 - The lib directory for X86.
+# PATH_SDK_QT5_LIB - The lib directory for KBUILD_TARGET.
+ifndef PATH_SDK_QT5
+ PATH_SDK_QT5 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v5*)))
+ ifeq ($(PATH_SDK_QT5),)
+ # If target == host, try look for Qt in the various platform specific places.
+ ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
+ ifeq ($(KBUILD_TARGET),darwin)
+ PATH_SDK_QT5 := $(patsubst %/Frameworks/QtCore.framework/Versions/5,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/5)))
+ else ifeq ($(KBUILD_TARGET),win)
+ # No idea here yet...
+ else ifeq ($(KBUILD_TARGET),ose)
+ # No port...
+ else
+ # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT5_LIB* stuff if it doesn't work.
+ # Try find the general root of thing by looking for the qt4to5 program, if not found, then look for rcc.
+ PATH_SDK_QT5 := $(patsubst %/bin/qt4to5-qt5,%,$(firstword $(wildcard \
+ /usr/bin/qt4to5-qt5 \
+ /usr/local/bin/qt4to5-qt5 \
+ /usr/qt/5/bin/qt4to5-qt5 \
+ /usr/share/qt5/bin/qt4to5-qt5 \
+ )))
+ ifeq ($(PATH_SDK_QT5),)
+ PATH_SDK_QT5 := $(patsubst %/bin/qt4to5,%,$(firstword $(wildcard \
+ /usr/bin/qt4to5 \
+ /usr/local/bin/qt4to5 \
+ /usr/qt/5/bin/qt4to5 \
+ /usr/share/qt5/bin/qt4to5 \
+ )))
+ endif
+ ifeq ($(PATH_SDK_QT5),)
+ PATH_SDK_QT5 := $(patsubst %/bin/rcc-qt5,%,$(firstword $(wildcard \
+ /usr/bin/rcc-qt5 \
+ /usr/local/bin/rcc-qt5 \
+ /usr/qt/5/bin/rcc-qt5 \
+ /usr/share/qt5/bin/rcc-qt5 \
+ )))
+ endif
+ ifeq ($(PATH_SDK_QT5),)
+ PATH_SDK_QT5 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
+ /usr/lib/*/qt5/bin/rcc \
+ /usr/bin/rcc \
+ /usr/local/bin/rcc \
+ /usr/qt/5/bin/rcc \
+ /usr/share/qt5/bin/rcc \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT5),)
+ export PATH_SDK_QT5
+
+ # Locate the include files. Check for qglobalstatic.h (since 5.1) first.
+ ifeq ($(PATH_SDK_QT5_INC),)
+ PATH_SDK_QT5_INC := $(patsubst %/QtCore/qglobalstatic.h,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt5/QtCore/qglobalstatic.h) \
+ $(PATH_SDK_QT5)/include/qt5/QtCore/qglobalstatic.h \
+ /usr/include/qt5/QtCore/qtglobalstatic.h \
+ /usr/local/include/qt5/QtCore/qtglobalstatic.h \
+ $(PATH_SDK_QT5)/include/QtCore/qglobalstatic.h \
+ /usr/include/qt/QtCore/qglobalstatic.h \
+ /usr/local/include/qt/QtCore/qglobalstatic.h \
+ )))
+ ifeq ($(PATH_SDK_QT5_INC),)
+ PATH_SDK_QT5_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt5/QtCore/qglobal.h) \
+ $(PATH_SDK_QT5)/include/qt5/QtCore/qglobal.h \
+ /usr/include/qt5/QtCore/qtglobal.h \
+ /usr/local/include/qt5/QtCore/qtglobal.h \
+ $(PATH_SDK_QT5)/include/QtCore/qglobal.h \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT5_INC),)
+ export PATH_SDK_QT5_INC
+ endif
+ endif
+
+ # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
+ ifeq ($(PATH_SDK_QT5_LIB.x86),)
+ PATH_SDK_QT5_LIB.x86 := $(patsubst %/libQt5Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT5)/lib32/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib32/qt5/libQt5Core$(SUFF_DLL) \
+ /usr/lib32/libQt5Core$(SUFF_DLL) \
+ /usr/lib32/qt5/libQt5Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/lib/$(type)/libQt5Core$(SUFF_DLL)) \
+ /usr/local/lib32/libQt5Core$(SUFF_DLL) \
+ /usr/local/lib32/qt5/libQt5Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/local/lib/$(type)/libQt5Core$(SUFF_DLL)) \
+ $(PATH_SDK_QT5)/lib/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib/qt5/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib/i386-linux-gnu/libQt5Core$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT5_LIB.x86),)
+ export PATH_SDK_QT5_LIB.x86
+ endif
+ endif
+ ifeq ($(PATH_SDK_QT5_LIB.amd64),)
+ PATH_SDK_QT5_LIB.amd64 := $(patsubst %/libQt5Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT5)/lib64/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib64/qt5/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib/amd64/libQt5Core$(SUFF_DLL) \
+ /usr/lib64/libQt5Core$(SUFF_DLL) \
+ /usr/lib64/qt5/libQt5Core$(SUFF_DLL) \
+ /usr/lib/amd64/libQt5Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/lib/$(type)/libQt5Core$(SUFF_DLL)) \
+ /usr/local/lib64/libQt5Core$(SUFF_DLL) \
+ /usr/local/lib64/qt5/libQt5Core$(SUFF_DLL) \
+ /usr/local/lib/amd64/libQt5Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/local/lib/$(type)/libQt5Core$(SUFF_DLL)) \
+ $(PATH_SDK_QT5)/lib/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib/qt5/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib/x86_64-linux-gnu/libQt5Core$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT5_LIB.amd64),)
+ export PATH_SDK_QT5_LIB.amd64
+ endif
+ endif
+
+ # And finally, the library path for KBUILD_TARGET.
+ ifeq ($(PATH_SDK_QT5_LIB),)
+ PATH_SDK_QT5_LIB := $(PATH_SDK_QT5_LIB.$(KBUILD_TARGET_ARCH))
+ ifeq ($(PATH_SDK_QT5_LIB),)
+ PATH_SDK_QT5_LIB := $(patsubst %/libQt5Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT5)/lib/libQt5Core$(SUFF_DLL) \
+ $(PATH_SDK_QT5)/lib/qt5/libQt5Core$(SUFF_DLL) \
+ /usr/lib/libQt5Core$(SUFF_DLL) \
+ /usr/lib/qt5/libQt5Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/lib/$(type)/libQt5Core$(SUFF_DLL)) \
+ /usr/local/lib/libQt5Core$(SUFF_DLL) \
+ /usr/local/lib/qt5/libQt5Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/local/lib/$(type)/libQt5Core$(SUFF_DLL)) \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT5_LIB),)
+ export PATH_SDK_QT5_LIB
+ endif
+ endif
+
+ endif
+ endif # Unices
+ endif
+ # Found it?
+ ifeq ($(PATH_SDK_QT5),)
+ $(warning kBuild: Couldn't find the Qt5 headers and libaries...)
+ PATH_SDK_QT5 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_QT5 := $(PATH_SDK_QT5)
+endif
+
+# Libraries can be in either Frameworks or lib depending on how you
+# build it on the mac. The .dmg installs into Frameworks but builds into lib.
+ifeq ($(KBUILD_TARGET),darwin)
+ ifndef PATH_SDK_QT5_LIB
+ ifneq ($(wildcard $(PATH_SDK_QT5)/Frameworks),)
+ PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/Frameworks
+ else
+ PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/lib
+ endif
+ endif
+else
+ PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/lib
+ PATH_SDK_QT5_INC ?= $(PATH_SDK_QT5)/include
+endif
+
+# The bits that kBuild picks up.
+# (nothing here)
+
+
+#
+# The QT5 tool.
+#
+# This is implemented here rather than in tools/QT5.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+TOOL_QT5 = Qt5
+
+# Tool Specific Properties
+# PATH_TOOL_QT5 - Obsolete.
+# PATH_TOOL_QT5_BIN - The
+# TOOL_QT5_BIN_SUFF -
+if !defined(PATH_TOOL_QT5_BIN) && defined(PATH_TOOL_QT5)
+ PATH_TOOL_QT5_BIN := $(PATH_TOOL_QT5)/bin
+endif
+ifndef PATH_TOOL_QT5_BIN
+ PATH_TOOL_QT5_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v5*/bin)))
+ if "$(PATH_TOOL_QT5_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
+ PATH_TOOL_QT5_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v5*/bin)))
+ endif
+ ifeq ($(PATH_TOOL_QT5_BIN),)
+ ifdef TOOL_QT5_BIN_SUFF
+ TOOL_QT5_BIN_SUFF := $(TOOL_QT5_BIN_SUFF)
+ endif
+ # Try looking for moc-qt5 / moc-$(suffix) first.
+ ifneq ($(TOOL_QT5_BIN_SUFF),)
+ PATH_TOOL_QT5_BIN := $(patsubst %/moc$(TOOL_QT5_BIN_SUFF),%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt5/bin/moc$(TOOL_QT5_BIN_SUFF)) \
+ /usr/lib/qt5/bin/moc$(TOOL_QT5_BIN_SUFF) \
+ /usr/qt/5/bin/moc$(TOOL_QT5_BIN_SUFF) \
+ /usr/share/qt5/bin/moc$(TOOL_QT5_BIN_SUFF) \
+ /usr/local/bin/moc$(TOOL_QT5_BIN_SUFF) \
+ /usr/bin/moc$(TOOL_QT5_BIN_SUFF) \
+ )))
+ else
+ # No suffix given, so before we check out -qt5 look at qt5 specific locations to avoid choosers and symlinks.
+ PATH_TOOL_QT5_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt5/bin/moc) \
+ $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt5/bin/moc,) \
+ /usr/lib/qt5/bin/moc \
+ /usr/local/lib/qt5/bin/moc \
+ /usr/qt/5/bin/moc \
+ /usr/local/qt/5/bin/moc \
+ /usr/share/qt5/bin/moc \
+ /usr/local/share/qt5/bin/moc \
+ )))
+ ifeq ($(PATH_TOOL_QT5_BIN),)
+ PATH_TOOL_QT5_BIN := $(patsubst %/moc-qt5,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt5/bin/moc-qt5) \
+ /usr/lib/qt5/bin/moc-qt5 \
+ /usr/qt/5/bin/moc-qt5 \
+ /usr/share/qt5/bin/moc-qt5 \
+ /usr/local/bin/moc-qt5 \
+ /usr/bin/moc-qt5 \
+ )))
+ ifneq ($(PATH_TOOL_QT5_BIN),)
+ TOOL_QT5_BIN_SUFF := -qt5
+ endif
+ endif
+ endif
+ # If still no go, try looking for qt4to5 and rcc.
+ ifeq ($(PATH_TOOL_QT5_BIN),)
+ PATH_TOOL_QT5_BIN := $(patsubst %/qt4to5,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt5/bin/qt4to5) \
+ /usr/lib/qt5/bin/qt4to5 \
+ /usr/qt/5/bin/qt4to5 \
+ /usr/share/qt5/bin/qt4to5 \
+ /usr/local/bin/qt4to5 \
+ /usr/bin/qt4to5 \
+ )))
+ endif
+ ifeq ($(PATH_TOOL_QT5_BIN),)
+ PATH_TOOL_QT5_BIN := $(patsubst %/rcc$(TOOL_QT5_BIN_SUFF),%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF)) \
+ /usr/lib/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+ /usr/qt/5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+ /usr/share/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+ /usr/local/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+ /usr/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+ )))
+ endif
+ if "$(PATH_TOOL_QT5_BIN)" == "" && "$(TOOL_QT5_BIN_SUFF)" != ""
+ PATH_TOOL_QT5_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt5/bin/rcc) \
+ /usr/lib/qt5/bin/rcc \
+ /usr/qt/5/bin/rcc \
+ /usr/share/qt5/bin/rcc \
+ /usr/local/bin/rcc \
+ /usr/bin/rcc \
+ )))
+ endif
+ ifneq ($(PATH_TOOL_QT5_BIN),)
+ export PATH_TOOL_QT5_BIN
+ endif
+ endif
+ # If not found, we'll enter the 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_QT5_BIN := $(PATH_TOOL_QT5_BIN)
+endif
+ifneq ($(PATH_TOOL_QT5_BIN),)
+ TOOL_QT5_MOC ?= $(PATH_TOOL_QT5_BIN)/moc$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT5_UIC ?= $(PATH_TOOL_QT5_BIN)/uic$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ ifndef TOOL_QT5_RCC
+ TOOL_QT5_RCC := $(PATH_TOOL_QT5_BIN)/rcc$(HOSTSUFF_EXE)
+ ifeq ($(wildcard $(TOOL_QT5_RCC)),)
+ TOOL_QT5_RCC := $(PATH_TOOL_QT5_BIN)/rcc$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ endif
+ endif
+ TOOL_QT5_LRC ?= $(PATH_TOOL_QT5_BIN)/lrelease$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT5_LUPDATE ?= $(PATH_TOOL_QT5_BIN)/lupdate$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+else
+ # Pathless, relies on the environment.
+ TOOL_QT5_MOC ?= moc$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT5_UIC ?= uic$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT5_RCC ?= rcc$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT5_LRC ?= lrelease$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT5_LUPDATE ?= lupdate$(TOOL_QT5_BIN_SUFF)$(HOSTSUFF_EXE)
+endif
+ifdef TOOL_QT5_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ TOOL_QT5_MOC_KSUBMIT ?= kmk_builtin_kSubmit --$(SP)
+ endif
+endif
+
+# General Properties used by kBuild and/or units/qt.kmk
+TOOL_QT5_MOCFLAGS ?=
+TOOL_QT5_MOCINCS ?=
+TOOL_QT5_MOCDEFS ?=
+TOOL_QT5_MOCDEFS.darwin ?= __APPLE__ __GNUC__
+TOOL_QT5_MOCDEFS.solaris ?= __sun
+TOOL_QT5_MOCDEFS.win.amd64 ?= WIN64
+TOOL_QT5_MOCDEFS.win.x86 ?= WIN32
+
+
+## MOC a C++ source file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT5_MOC_CPP_DEPEND =
+TOOL_QT5_MOC_CPP_DEPORD =
+TOOL_QT5_MOC_CPP_OUTPUT =
+TOOL_QT5_MOC_CPP_OUTPUT_MAYBE =
+ifdef KMK_WITH_QUOTING
+ define TOOL_QT5_MOC_CPP_CMDS
+ $(QUIET)$(TOOL_QT5_MOC_KSUBMIT)$(TOOL_QT5_MOC)\
+ $(flags)\
+ $(qaddprefix sh,-I, $(incs))\
+ $(qaddprefix sh,-D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+else
+ define TOOL_QT5_MOC_CPP_CMDS
+ $(QUIET)$(TOOL_QT5_MOC_KSUBMIT)$(TOOL_QT5_MOC)\
+ $(flags)\
+ $(addprefix -I, $(incs))\
+ $(addprefix -D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+endif
+
+## MOC a C++ header file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT5_MOC_HPP_DEPEND =
+TOOL_QT5_MOC_HPP_DEPORD =
+TOOL_QT5_MOC_HPP_OUTPUT =
+TOOL_QT5_MOC_HPP_OUTPUT_MAYBE =
+ifdef KMK_WITH_QUOTING
+ define TOOL_QT5_MOC_HPP_CMDS
+ $(QUIET)$(TOOL_QT5_MOC_KSUBMIT)$(TOOL_QT5_MOC)\
+ $(flags)\
+ $(qaddprefix sh,-I, $(incs))\
+ $(qaddprefix sh,-D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+else
+ define TOOL_QT5_MOC_HPP_CMDS
+ $(QUIET)$(TOOL_QT5_MOC_KSUBMIT)$(TOOL_QT5_MOC)\
+ $(flags)\
+ $(addprefix -I, $(incs))\
+ $(addprefix -D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+endif
+
+## Compile a Qt user interface file (.ui).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT5_UIC_UI_DEPEND =
+TOOL_QT5_UIC_UI_DEPORD =
+TOOL_QT5_UIC_UI_OUTPUT =
+TOOL_QT5_UIC_UI_OUTPUT_MAYBE =
+define TOOL_QT5_UIC_UI_CMDS
+ $(QUIET)$(TOOL_QT5_UIC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+endef
+
+## Compile a Qt resource file (.qrc).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+# @remarks The sed script generating the dependency file is a bit naive.
+TOOL_QT5_RCC_QRC_DEPEND =
+TOOL_QT5_RCC_QRC_DEPORD =
+TOOL_QT5_RCC_QRC_OUTPUT =
+TOOL_QT5_RCC_QRC_OUTPUT_MAYBE =
+define TOOL_QT5_RCC_QRC_CMDS
+ $(QUIET)$(TOOL_QT5_RCC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+ $(QUIET2)$(APPEND) -n $(dep) '\' \
+ '$(out): \' \
+ '$(source) \'
+ $(QUIET2)$(SED) \
+ -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
+ -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
+ -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
+ -e 's|$$$$| \\|' \
+ --append $(dep) \
+ $(source)
+ $(QUIET2)$(APPEND) $(dep)
+ $(QUIET2)$(SED) \
+ -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
+ -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
+ -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
+ -e 's|$$$$|:\n|' \
+ --append $(dep) \
+ $(source)
+ $(QUIET2)$(APPEND) $(dep)
+endef
+
+## Compile a Qt translation file (.ts).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT5_LRC_TS_DEPEND =
+TOOL_QT5_LRC_TS_DEPORD =
+TOOL_QT5_LRC_TS_OUTPUT =
+TOOL_QT5_LRC_TS_OUTPUT_MAYBE =
+define TOOL_QT5_LRC_TS_CMDS
+ $(QUIET)$(TOOL_QT5_LRC)\
+ $(flags)\
+ $(source)\
+ -qm $(out)
+endef
+
+
+
+#
+#
+# Back to the Qt5 unit.
+#
+#
+
+
+## wrapper for the lrelease (LRC) command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT5_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT5_LRC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt5_target_pre_handle_translation helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt5_target_pre_handle_translation_dx
+
+$(out) + $(more_output) +| $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT5_LRC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
+$(target)-inst-nls_SOURCES += $(out)
+
+endef # def_unit_qt5_target_pre_handle_translation_dx
+
+##
+# Handle a source file listed in QT_TRANSLATIONS.
+#
+# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
+# to be translated into .qm files that are loadble by Qt.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt5_target_pre_handle_translation
+local type := LRC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
+local out := $(outbase).qm
+local dep := $(out).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_LRC_TS_CMDS
+ $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
+local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
+local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt5_target_pre_handle_translation_dx))
+
+endef # def_unit_qt5_target_pre_handle_translation
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT5_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT5_RCC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt5_target_pre_handle_qrc helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt5_target_pre_handle_rcc_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT5_RCC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt5_target_pre_handle_rcc_dx
+
+##
+# Source handler for .qrc sources (Qt resource files).
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt5_src_handler_qrc
+local type := RCC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
+local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.gen.cpp
+local realout := $(outbase).gen.cpp
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_RCC_QRC_CMDS
+ $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
+local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
+local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt5_target_pre_handle_rcc_dx))
+
+endef # def_unit_qt5_src_handler_qrc
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT5_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT5_UIC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt5_src_handler_ui helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt5_target_pre_handle_ui_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT5_UIC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt5_target_pre_handle_ui_dx
+
+##
+# Source handler for .ui sources.
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt5_src_handler_ui
+local type := UIC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.gen.h
+local realout := $(outbase).gen.h
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_UIC_UI_CMDS
+ $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
+local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
+local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt5_target_pre_handle_ui_dx))
+
+endef # def_unit_qt5_src_handler_ui
+
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT5_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT5_MOC_HPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt5_target_pre_handle_moc_hdr helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt5_target_pre_handle_moc_hdr_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT5_MOC_HPP_CMDS_DEP) \
+ | \
+ $(orderdeps) $(my_target_intermediate_vars)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCHDRS.
+#
+# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
+# generate a .cpp file for each of them and add it to the generated
+# sources so that it's compiled and linked. (There is an alternative
+# way to do this where the .cpp file is included, this isn't currently
+# supported by this unit.)
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt5_target_pre_handle_moc_hdr
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.cpp
+local realout := $(outbase).cpp
+local dep := $(realout).dep
+local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
+local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_HPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt5_target_pre_handle_moc_hdr_dx))
+
+endef # def_unit_qt5_target_pre_handle_moc_hdr
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT5_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT5_MOC_CPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt5_target_pre_handle_moc_src helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt5_target_pre_handle_moc_src_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT5_MOC_CPP_CMDS_DEP) \
+ | \
+ $(orderdeps) $(my_target_intermediate_vars)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCSRCS.
+#
+# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
+# a .moc file that we're expected to generate here.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt5_target_pre_handle_moc_src
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.moc
+local realout := $(outbase).moc
+local dep := $(realout).dep
+local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
+local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_CPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt5_target_pre_handle_moc_src_dx))
+
+endef # def_unit_qt5_target_pre_handle_moc_src
+
+
+##
+# Adds sources containing Q_OBJECT to QT_MOCSRCS.
+define def_unit_qt5_target_pre_cpp_source
+ifneq ($(file-size $(source)),-1)
+ ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
+ $(eval $(target)_QT_MOCSRCS += $(source))
+ endif
+endif
+endef # def_unit_qt5_target_pre_cpp_source
+
+##
+# Invoked early in the processing of a target that uses the Qt unit.
+#
+# It will append the qt source handlers to the target (.h, .ui, .ts,
+# .png, .bmp, .gif).
+#
+# It will then check all the C++ sources and check which needs
+# a .moc files and generate rules and dependencies fofor these
+#
+define def_unit_qt5_target_pre
+
+# Make QTTOOL the default for the specific Qt tools instead of TOOL.
+ifneq ($($(target)_QTTOOL),)
+ ifeq ($($(target)_MOCTOOL),)
+ $(target)_MOCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_UICTOOL),)
+ $(target)_UICTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_RCCTOOL),)
+ $(target)_RCCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_LRCTOOL),)
+ $(target)_LRCTOOL := $($(target)_QTTOOL)
+ endif
+endif
+
+# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
+local qt_modules := \
+ $($(target)_QT_MODULES.$(bld_trg)) \
+ $($(target)_QT_MODULES.$(bld_trg_arch)) \
+ $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MODULES.$(bld_trg_cpu)) \
+ $($(target)_QT_MODULES.$(bld_type)) \
+ $($(target)_QT_MODULES)
+local qt_prefix := $(firstword \
+ $($(target)_QT_PREFIX.$(bld_trg)) \
+ $($(target)_QT_PREFIX.$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_PREFIX.$(bld_type)) \
+ $($(target)_QT_PREFIX))
+local qt_infix := $(firstword \
+ $($(target)_QT_INFIX.$(bld_trg)) \
+ $($(target)_QT_INFIX.$(bld_trg_arch)) \
+ $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_INFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_INFIX.$(bld_type)) \
+ $($(target)_QT_INFIX))
+ifeq ($(bld_trg),darwin)
+ # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
+ $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT5_LIB) )
+ $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT5_LIB) )
+ $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT5_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
+ $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/5/Headers) )
+else
+ ifeq ($(bld_trg),win)
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_LIB)) )
+ ifeq ($(tool_do),LINK_PROGRAM)
+ $(eval $(target)_LIBS += $(PATH_SDK_QT5_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
+ endif
+ else
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) )
+ endif
+ $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) )
+endif
+$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
+
+
+# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
+# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
+ifndef $(target)_QT_MOCSRCS
+ $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
+ $($(target)_SOURCES.$(bld_trg)) \
+ $($(target)_SOURCES.$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_SOURCES.$(bld_type)) \
+ $($(target)_SOURCES) \
+ ), $(evalval def_unit_qt5_target_pre_cpp_source))
+endif
+
+# Install source handlers for .ui files.
+$(target)_SRC_HANDLERS += \
+ .ui:def_unit_qt5_src_handler_ui \
+ .UI:def_unit_qt5_src_handler_ui \
+ .qrc:def_unit_qt5_src_handler_qrc \
+ .qrc:def_unit_qt5_src_handler_qrc
+
+# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
+local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
+$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
+
+# Since we add a lot of stuff to 2_INTERMEDIATES, we must exclude it from the intermediates
+# used by the rules we generate to avoid circular dependencies.
+local my_target_intermediate_vars := $(filter-out %_2_INTERMEDIATES$(CLOSEPAR),$(target_intermediate_vars))
+
+# Deal with QT_MOCSRCS.
+$(foreach source, \
+ $($(target)_QT_MOCSRCS.$(bld_trg)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCSRCS.$(bld_type)) \
+ $($(target)_QT_MOCSRCS) \
+ , $(evalvalctx def_unit_qt5_target_pre_handle_moc_src))
+
+# Deal with QT_MOCHDRS.
+$(foreach source, \
+ $($(target)_QT_MOCHDRS.$(bld_trg)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCHDRS.$(bld_type)) \
+ $($(target)_QT_MOCHDRS) \
+ , $(evalvalctx def_unit_qt5_target_pre_handle_moc_hdr))
+
+# Deal with QT_TRANSLATIONS.
+# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
+local translations := \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_type)) \
+ $($(target)_QT_TRANSLATIONS)
+ifneq ($(strip $(translations)),)
+ local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
+ $(eval $(expr))
+ ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
+ $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
+ else
+ $(target)-inst-nls_MODE := 0644
+ endif
+ ifdef $(target)_QT_TRANSLATIONS_INST
+ $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
+ endif
+ $(target)-inst-nls_SOURCES :=
+ $(foreach source, $(translations)\
+ , $(evalvalctx def_unit_qt5_target_pre_handle_translation))
+endif
+
+endef # def_unit_qt5_target_pre
+
+
+#
+# Rule for debugging.
+#
+unit-qt5-show-vars:
+ @$(ECHO) 'The Qt5 SDK variables:'
+ @$(ECHO) ' PATH_SDK_QT5 = "$(PATH_SDK_QT5)"'
+ @$(ECHO) ' PATH_SDK_QT5_INC = "$(PATH_SDK_QT5_INC)"'
+ @$(ECHO) ' PATH_SDK_QT5_LIB = "$(PATH_SDK_QT5_LIB)"'
+ @$(ECHO) ' PATH_SDK_QT5_LIB.amd64 = "$(PATH_SDK_QT5_LIB.amd64)"'
+ @$(ECHO) ' PATH_SDK_QT5_LIB.x86 = "$(PATH_SDK_QT5_LIB.x86)"'
+ @$(ECHO) 'The Qt5 TOOL variables:'
+ @$(ECHO) ' PATH_TOOL_QT5_BIN = "$(PATH_TOOL_QT5_BIN)"'
+ @$(ECHO) ' TOOL_QT5_BIN_SUFF = "$(TOOL_QT5_BIN_SUFF)"'
+ @$(ECHO) ' TOOL_QT5_MOC = "$(TOOL_QT5_MOC)"'
+ @$(ECHO) ' TOOL_QT5_UIC = "$(TOOL_QT5_UIC)"'
+ @$(ECHO) ' TOOL_QT5_RCC = "$(TOOL_QT5_RCC)"'
+ @$(ECHO) ' TOOL_QT5_LRC = "$(TOOL_QT5_LRC)"'
+ @$(ECHO) ' TOOL_QT5_LUPDATE = "$(TOOL_QT5_LUPDATE)"'
+
diff --git a/kBuild/units/qt6.kmk b/kBuild/units/qt6.kmk
new file mode 100644
index 0000000..fc3d91c
--- /dev/null
+++ b/kBuild/units/qt6.kmk
@@ -0,0 +1,1244 @@
+# $Id: qt6.kmk 3559 2022-03-02 01:47:27Z bird $
+## @file
+# Qt 6 unit.
+#
+
+#
+# Copyright (c) 2008-2022 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+ifdef UNIT_qt6
+ $(error kBuild: The qt6 unit was included twice!)
+endif
+UNIT_qt6 = qt6
+
+
+if !defined(UNIT_qt3) && !defined(UNIT_qt4)
+ # Add our target properties (same as qt3 & qt4).
+ PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
+ PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
+endif
+PROPS_SINGLE += RCCTOOL QT_INFIX
+PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
+
+
+## @todo use pkg-config?
+
+#
+# The QT6 SDK.
+#
+# This is implemented here rather than in sdks/QT6.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+## @todo the SDK might actually not be necessary as it turns out... For now it servers
+# a purpose if the host differs from the target, in theory at least.
+SDK_QT6 = Qt6
+
+# SDK Specific Properties
+# PATH_SDK_QT6 - The general Qt6 root directory.
+# PATH_SDK_QT6_INC - The include directory.
+# PATH_SDK_QT6_LIB.amd64 - The lib directory for AMD64.
+# PATH_SDK_QT6_LIB.x86 - The lib directory for X86.
+# PATH_SDK_QT6_LIB - The lib directory for KBUILD_TARGET.
+ifndef PATH_SDK_QT6
+ PATH_SDK_QT6 := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TRG)/qt/v6*)))
+ ifeq ($(PATH_SDK_QT6),)
+ # If target == host, try look for Qt in the various platform specific places.
+ ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
+ ifeq ($(KBUILD_TARGET),darwin)
+ PATH_SDK_QT6 := $(patsubst %/Frameworks/QtCore.framework/Versions/6,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/6)))
+ else ifeq ($(KBUILD_TARGET),win)
+ # No idea here yet...
+ else ifeq ($(KBUILD_TARGET),ose)
+ # No port...
+ else
+ # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT6_LIB* stuff if it doesn't work.
+ # Try find the general root of thing by looking for the rcc program, as there seems to be no qt6 specific one to look for.
+ PATH_SDK_QT6 := $(patsubst %/bin/rcc-qt6,%,$(firstword $(wildcard \
+ /usr/bin/rcc-qt6 \
+ /usr/local/bin/rcc-qt6 \
+ /usr/qt/6/bin/rcc-qt6 \
+ $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/rcc-qt6) \
+ /usr/lib/qt6/bin/rcc-qt6 \
+ /usr/share/qt6/bin/rcc-qt6 \
+ )))
+ ifeq ($(PATH_SDK_QT6),)
+ PATH_SDK_QT6 := $(patsubst %/libexec/rcc-qt6,%,$(firstword $(wildcard \
+ /usr/libexec/rcc-qt6 \
+ /usr/local/libexec/rcc-qt6 \
+ /usr/qt/6/libexec/rcc-qt6 \
+ $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/libexec/rcc-qt6) \
+ /usr/lib/qt6/libexec/rcc-qt6 \
+ /usr/share/qt6/libexec/rcc-qt6 \
+ )))
+ endif
+ ifeq ($(PATH_SDK_QT6),)
+ PATH_SDK_QT6 := $(patsubst %/libexec/rcc,%,$(firstword $(wildcard \
+ /usr/qt/6/libexec/rcc \
+ $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/libexec/rcc) \
+ /usr/lib/qt6/libexec/rcc \
+ /usr/share/qt6/libexec/rcc \
+ /usr/libexec/rcc \
+ /usr/local/libexec/rcc \
+ )))
+ endif
+ ifeq ($(PATH_SDK_QT6),)
+ PATH_SDK_QT6 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
+ /usr/qt/6/bin/rcc \
+ $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/rcc) \
+ /usr/lib/qt6/bin/rcc \
+ /usr/share/qt6/bin/rcc \
+ /usr/bin/rcc \
+ /usr/local/bin/rcc \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT6),)
+ export PATH_SDK_QT6
+
+ # Locate the include files. Check for QStringConverter (since 6.?) first.
+ ifeq ($(PATH_SDK_QT6_INC),)
+ PATH_SDK_QT6_INC := $(patsubst %/QtCore/QStringConverter,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt6/QtCore/QStringConverter) \
+ $(PATH_SDK_QT6)/include/qt6/QtCore/QStringConverter \
+ /usr/include/qt6/QtCore/QStringConverter \
+ /usr/local/include/qt6/QtCore/QStringConverter \
+ $(PATH_SDK_QT6)/include/QtCore/QStringConverter \
+ /usr/include/qt/QtCore/QStringConverter \
+ /usr/local/include/qt/QtCore/QStringConverter \
+ )))
+ ifeq ($(PATH_SDK_QT6_INC),)
+ PATH_SDK_QT6_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt6/QtCore/qglobal.h) \
+ $(PATH_SDK_QT6)/include/qt6/QtCore/qglobal.h \
+ /usr/include/qt6/QtCore/qglobal.h \
+ /usr/local/include/qt6/QtCore/qglobal.h \
+ $(PATH_SDK_QT6)/include/QtCore/qglobal.h \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT6_INC),)
+ export PATH_SDK_QT6_INC
+ endif
+ endif
+
+ # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
+ ifeq ($(PATH_SDK_QT6_LIB.x86),)
+ PATH_SDK_QT6_LIB.x86 := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT6)/lib32/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib32/qt6/libQt6Core$(SUFF_DLL) \
+ /usr/lib32/libQt6Core$(SUFF_DLL) \
+ /usr/lib32/qt6/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ /usr/local/lib32/libQt6Core$(SUFF_DLL) \
+ /usr/local/lib32/qt6/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/i386-linux-gnu/libQt6Core$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT6_LIB.x86),)
+ export PATH_SDK_QT6_LIB.x86
+ endif
+ endif
+ ifeq ($(PATH_SDK_QT6_LIB.amd64),)
+ PATH_SDK_QT6_LIB.amd64 := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT6)/lib64/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib64/qt6/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/amd64/libQt6Core$(SUFF_DLL) \
+ /usr/lib64/libQt6Core$(SUFF_DLL) \
+ /usr/lib64/qt6/libQt6Core$(SUFF_DLL) \
+ /usr/lib/amd64/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ /usr/local/lib64/libQt6Core$(SUFF_DLL) \
+ /usr/local/lib64/qt6/libQt6Core$(SUFF_DLL) \
+ /usr/local/lib/amd64/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/x86_64-linux-gnu/libQt6Core$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT6_LIB.amd64),)
+ export PATH_SDK_QT6_LIB.amd64
+ endif
+ endif
+ ifeq ($(PATH_SDK_QT6_LIB.arm64),)
+ PATH_SDK_QT6_LIB.arm64 := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT6)/lib64/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib64/qt6/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/arm64/libQt6Core$(SUFF_DLL) \
+ /usr/lib64/libQt6Core$(SUFF_DLL) \
+ /usr/lib64/qt6/libQt6Core$(SUFF_DLL) \
+ /usr/lib/arm64/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).arm64),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ /usr/local/lib64/libQt6Core$(SUFF_DLL) \
+ /usr/local/lib64/qt6/libQt6Core$(SUFF_DLL) \
+ /usr/local/lib/arm64/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).arm64),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/x86_64-linux-gnu/libQt6Core$(SUFF_DLL) \
+ )))
+ ifneq ($(PATH_SDK_QT6_LIB.arm64),)
+ export PATH_SDK_QT6_LIB.arm64
+ endif
+ endif
+
+ # And finally, the library path for KBUILD_TARGET.
+ ifeq ($(PATH_SDK_QT6_LIB),)
+ PATH_SDK_QT6_LIB := $(PATH_SDK_QT6_LIB.$(KBUILD_TARGET_ARCH))
+ ifeq ($(PATH_SDK_QT6_LIB),)
+ PATH_SDK_QT6_LIB := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
+ $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
+ $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
+ /usr/lib/libQt6Core$(SUFF_DLL) \
+ /usr/lib/qt6/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ /usr/local/lib/libQt6Core$(SUFF_DLL) \
+ /usr/local/lib/qt6/libQt6Core$(SUFF_DLL) \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
+ )))
+ endif
+ ifneq ($(PATH_SDK_QT6_LIB),)
+ export PATH_SDK_QT6_LIB
+ endif
+ endif
+
+ endif
+ endif # Unices
+ endif
+ # Found it?
+ ifeq ($(PATH_SDK_QT6),)
+ $(warning kBuild: Couldn't find the Qt6 headers and libaries...)
+ PATH_SDK_QT6 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
+ endif
+ endif
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_SDK_QT6 := $(PATH_SDK_QT6)
+endif
+
+# Libraries can be in either Frameworks or lib depending on how you
+# build it on the mac. The .dmg installs into Frameworks but builds into lib.
+ifeq ($(KBUILD_TARGET),darwin)
+ ifndef PATH_SDK_QT6_LIB
+ ifneq ($(wildcard $(PATH_SDK_QT6)/Frameworks),)
+ PATH_SDK_QT6_LIB ?= $(PATH_SDK_QT6)/Frameworks
+ else
+ PATH_SDK_QT6_LIB ?= $(PATH_SDK_QT6)/lib
+ endif
+ endif
+else
+ PATH_SDK_QT6_LIB ?= $(PATH_SDK_QT6)/lib
+ PATH_SDK_QT6_INC ?= $(PATH_SDK_QT6)/include
+endif
+
+# The bits that kBuild picks up.
+# (nothing here)
+
+
+#
+# The QT6 tool.
+#
+# This is implemented here rather than in tools/QT6.kmk to enforce the global USES.
+# It also makes things easier to develop, with fewer files I mean.
+#
+TOOL_QT6 = Qt6
+
+# Tool Specific Properties
+# PATH_TOOL_QT6 - Obsolete.
+# PATH_TOOL_QT6_BIN - The path to the lrc and lupdate tools.
+# PATH_TOOL_QT6_LIBEXEC - The path to the moc, uic & rcc tools.
+# TOOL_QT6_BIN_SUFF - The binary suffix for PATH_TOOL_QT6_BIN tools.
+# TOOL_QT6_LIBEXEC_SUFF - The binary suffix for PATH_TOOL_QT6_LIBEXEC tools.
+if !defined(PATH_TOOL_QT6_BIN) && defined(PATH_TOOL_QT6)
+ PATH_TOOL_QT6_BIN := $(PATH_TOOL_QT6)/bin
+endif
+ifndef PATH_TOOL_QT6_BIN
+ PATH_TOOL_QT6_BIN := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/qt/v6*/bin)))
+ if "$(PATH_TOOL_QT6_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
+ PATH_TOOL_QT6_BIN := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/qt/v6*/bin)))
+ endif
+ ifeq ($(PATH_TOOL_QT6_BIN),)
+ ifdef TOOL_QT6_BIN_SUFF
+ TOOL_QT6_BIN_SUFF := $(TOOL_QT6_BIN_SUFF)
+ endif
+ # Try looking for lupdate-qt6 / lupdate-$(suffix) first (this is in bin rather than libexec).
+ ifneq ($(TOOL_QT6_BIN_SUFF),)
+ PATH_TOOL_QT6_BIN := $(patsubst %/lupdate$(TOOL_QT6_BIN_SUFF),%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF)) \
+ $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF)) \
+ /usr/lib/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
+ /usr/qt/6/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
+ /usr/share/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
+ /usr/local/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
+ /usr/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
+ )))
+ else
+ # No suffix given, so before we check out -qt6 look at qt6 specific locations to avoid choosers and symlinks.
+ PATH_TOOL_QT6_BIN := $(patsubst %/lupdate,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/lupdate) \
+ $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/lupdate,) \
+ /usr/lib/qt6/bin/lupdate \
+ /usr/local/lib/qt6/bin/lupdate \
+ /usr/qt/6/bin/lupdate \
+ /usr/local/qt/6/bin/lupdate \
+ /usr/share/qt6/bin/lupdate \
+ /usr/local/share/qt6/bin/lupdate \
+ )))
+ ifeq ($(PATH_TOOL_QT6_BIN),)
+ PATH_TOOL_QT6_BIN := $(patsubst %/lupdate-qt6,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/lupdate-qt6) \
+ $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/lupdate-qt6,) \
+ /usr/lib/qt6/bin/lupdate-qt6 \
+ /usr/qt/6/bin/lupdate-qt6 \
+ /usr/share/qt6/bin/lupdate-qt6 \
+ /usr/local/bin/lupdate-qt6 \
+ /usr/bin/lupdate-qt6 \
+ )))
+ ifneq ($(PATH_TOOL_QT6_BIN),)
+ TOOL_QT6_BIN_SUFF := -qt6
+ endif
+ endif
+ endif
+ # If still no go, try looking for qmake.
+ ifeq ($(PATH_TOOL_QT6_BIN),)
+ PATH_TOOL_QT6_BIN := $(patsubst %/qmake,%,$(firstword $(wildcard \
+ $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/qmake) \
+ $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/qmake,) \
+ /usr/lib/qt6/bin/qmake \
+ /usr/qt/6/bin/qmake \
+ /usr/share/qt6/bin/qmake \
+ /usr/local/bin/qmake \
+ /usr/bin/qmake \
+ )))
+ endif
+ ifneq ($(PATH_TOOL_QT6_BIN),)
+ export PATH_TOOL_QT6_BIN
+ endif
+ endif
+ # If not found, we'll enter the 'pathless' mode.
+else
+ # Resolve any fancy stuff once and for all.
+ PATH_TOOL_QT6_BIN := $(PATH_TOOL_QT6_BIN)
+endif
+
+# Unixes have moc, rcc, uic in a libexec dir rather than the bin dir, so try
+# find that directory or alias the LIBEXEC stuff onto BIN.
+ifndef PATH_TOOL_QT6_LIBEXEC
+ ifneq ($(PATH_TOOL_QT6_BIN),)
+ ifneq ($(qwildcard ,$(PATH_TOOL_QT6_BIN)/../libexec/moc*),)
+ PATH_TOOL_QT6_LIBEXEC := $(qabspath ,$(PATH_TOOL_QT6_BIN)/../libexec)
+ else
+ PATH_TOOL_QT6_LIBEXEC := $(PATH_TOOL_QT6_BIN)
+ endif
+ endif
+else
+ PATH_TOOL_QT6_LIBEXEC := $(PATH_TOOL_QT6_LIBEXEC)
+endif
+if !defined(TOOL_QT6_LIBEXEC_SUFF) && defined(PATH_TOOL_QT6_LIBEXEC)
+ ifneq ($(qwildcard ,$(PATH_TOOL_QT6_LIBEXEC)/moc-qt6$(HOSTSUFF_EXE)),)
+ TOOL_QT6_LIBEXEC_SUFF := -qt6
+ endif
+endif
+
+ifneq ($(PATH_TOOL_QT6_BIN),)
+ TOOL_QT6_MOC ?= $(PATH_TOOL_QT6_LIBEXEC)/moc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_UIC ?= $(PATH_TOOL_QT6_LIBEXEC)/uic$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_RCC ?= $(PATH_TOOL_QT6_LIBEXEC)/rcc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_LRC ?= $(PATH_TOOL_QT6_BIN)/lrelease$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_LUPDATE ?= $(PATH_TOOL_QT6_BIN)/lupdate$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
+else
+ # Pathless, relies on the environment.
+ TOOL_QT6_MOC ?= moc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_UIC ?= uic$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_RCC ?= rcc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_LRC ?= lrelease$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
+ TOOL_QT6_LUPDATE ?= lupdate$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
+endif
+ifdef TOOL_QT6_USE_KSUBMIT
+ ifeq ($(KBUILD_HOST),win)
+ TOOL_QT6_MOC_KSUBMIT ?= kmk_builtin_kSubmit --$(SP)
+ endif
+endif
+
+# General Properties used by kBuild and/or units/qt.kmk
+TOOL_QT6_MOCFLAGS ?=
+TOOL_QT6_MOCINCS ?=
+TOOL_QT6_MOCDEFS ?=
+TOOL_QT6_MOCDEFS.darwin ?= __APPLE__ __GNUC__
+TOOL_QT6_MOCDEFS.solaris ?= __sun
+TOOL_QT6_MOCDEFS.win.amd64 ?= WIN64
+TOOL_QT6_MOCDEFS.win.x86 ?= WIN32
+
+
+## MOC a C++ source file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT6_MOC_CPP_DEPEND =
+TOOL_QT6_MOC_CPP_DEPORD =
+TOOL_QT6_MOC_CPP_OUTPUT =
+TOOL_QT6_MOC_CPP_OUTPUT_MAYBE =
+ifdef KMK_WITH_QUOTING
+ define TOOL_QT6_MOC_CPP_CMDS
+ $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
+ $(flags)\
+ $(qaddprefix sh,-I, $(incs))\
+ $(qaddprefix sh,-D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+else
+ define TOOL_QT6_MOC_CPP_CMDS
+ $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
+ $(flags)\
+ $(addprefix -I, $(incs))\
+ $(addprefix -D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+endif
+
+## MOC a C++ header file.
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT6_MOC_HPP_DEPEND =
+TOOL_QT6_MOC_HPP_DEPORD =
+TOOL_QT6_MOC_HPP_OUTPUT =
+TOOL_QT6_MOC_HPP_OUTPUT_MAYBE =
+ifdef KMK_WITH_QUOTING
+ define TOOL_QT6_MOC_HPP_CMDS
+ $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
+ $(flags)\
+ $(qaddprefix sh,-I, $(incs))\
+ $(qaddprefix sh,-D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+else
+ define TOOL_QT6_MOC_HPP_CMDS
+ $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
+ $(flags)\
+ $(addprefix -I, $(incs))\
+ $(addprefix -D, $(defs))\
+ -o $(out)\
+ $(source)
+ endef
+endif
+
+## Compile a Qt user interface file (.ui).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT6_UIC_UI_DEPEND =
+TOOL_QT6_UIC_UI_DEPORD =
+TOOL_QT6_UIC_UI_OUTPUT =
+TOOL_QT6_UIC_UI_OUTPUT_MAYBE =
+define TOOL_QT6_UIC_UI_CMDS
+ $(QUIET)$(TOOL_QT6_UIC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+endef
+
+## Compile a Qt resource file (.qrc).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+# @remarks The sed script generating the dependency file is a bit naive.
+TOOL_QT6_RCC_QRC_DEPEND =
+TOOL_QT6_RCC_QRC_DEPORD =
+TOOL_QT6_RCC_QRC_OUTPUT =
+TOOL_QT6_RCC_QRC_OUTPUT_MAYBE =
+define TOOL_QT6_RCC_QRC_CMDS
+ $(QUIET)$(TOOL_QT6_RCC)\
+ $(flags)\
+ -o $(out)\
+ $(source)
+ $(QUIET2)$(APPEND) -n $(dep) '\' \
+ '$(out): \' \
+ '$(source) \'
+ $(QUIET2)$(SED) \
+ -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
+ -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
+ -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
+ -e 's|$$$$| \\|' \
+ --append $(dep) \
+ $(source)
+ $(QUIET2)$(APPEND) $(dep)
+ $(QUIET2)$(SED) \
+ -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
+ -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
+ -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
+ -e 's|$$$$|:\n|' \
+ --append $(dep) \
+ $(source)
+ $(QUIET2)$(APPEND) $(dep)
+endef
+
+## Compile a Qt translation file (.ts).
+# @param $(target) Normalized main target name.
+# @param $(source) Source filename (relative).
+# @param $(out) Object file name. This shall be (re)created by the compilation.
+# @param $(dep) Dependcy file. This may be (re)created by the compilation.
+# @param $(flags) Flags.
+# @param $(defs) Definitions.
+# @param $(incs) Includes.
+# @param $(outbase) Output basename (full). Use this for list files and such.
+#
+TOOL_QT6_LRC_TS_DEPEND =
+TOOL_QT6_LRC_TS_DEPORD =
+TOOL_QT6_LRC_TS_OUTPUT =
+TOOL_QT6_LRC_TS_OUTPUT_MAYBE =
+define TOOL_QT6_LRC_TS_CMDS
+ $(QUIET)$(TOOL_QT6_LRC)\
+ $(flags)\
+ $(source)\
+ -qm $(out)
+endef
+
+
+
+#
+#
+# Back to the Qt6 unit.
+#
+#
+
+
+## wrapper for the lrelease (LRC) command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT6_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT6_LRC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt6_target_pre_handle_translation helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt6_target_pre_handle_translation_dx
+
+$(out) + $(more_output) +| $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT6_LRC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT6_LRC_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_LRC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
+$(target)-inst-nls_SOURCES += $(out)
+
+endef # def_unit_qt6_target_pre_handle_translation_dx
+
+##
+# Handle a source file listed in QT_TRANSLATIONS.
+#
+# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
+# to be translated into .qm files that are loadble by Qt.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt6_target_pre_handle_translation
+local type := LRC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
+local out := $(outbase).qm
+local dep := $(out).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_LRC_TS_CMDS
+ $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
+local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
+local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt6_target_pre_handle_translation_dx))
+
+endef # def_unit_qt6_target_pre_handle_translation
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT6_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT6_RCC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt6_target_pre_handle_qrc helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt6_target_pre_handle_rcc_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT6_RCC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT6_RCC_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_RCC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt6_target_pre_handle_rcc_dx
+
+##
+# Source handler for .qrc sources (Qt resource files).
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt6_src_handler_qrc
+local type := RCC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
+local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.gen.cpp
+local realout := $(outbase).gen.cpp
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_RCC_QRC_CMDS
+ $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
+local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
+local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt6_target_pre_handle_rcc_dx))
+
+endef # def_unit_qt6_src_handler_qrc
+
+
+
+## wrapper for the UIC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT6_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT6_UIC_CMDS_DEP =
+endif
+
+##
+# def_unit_qt6_src_handler_ui helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt6_target_pre_handle_ui_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT6_UIC_CMDS_DEP) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT6_UIC_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_UIC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef # def_unit_qt6_target_pre_handle_ui_dx
+
+##
+# Source handler for .ui sources.
+#
+# @remarks $(evalvalctx me).
+define def_unit_qt6_src_handler_ui
+local type := UIC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.gen.h
+local realout := $(outbase).gen.h
+local dep := $(realout).dep
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_UIC_UI_CMDS
+ $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
+local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
+local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt6_target_pre_handle_ui_dx))
+
+endef # def_unit_qt6_src_handler_ui
+
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT6_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT6_MOC_HPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt6_target_pre_handle_moc_hdr helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt6_target_pre_handle_moc_hdr_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT6_MOC_HPP_CMDS_DEP) \
+ | \
+ $(orderdeps) $(my_target_intermediate_vars)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT6_MOC_HPP_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_MOC_HPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_GEN_SOURCES_ += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCHDRS.
+#
+# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
+# generate a .cpp file for each of them and add it to the generated
+# sources so that it's compiled and linked. (There is an alternative
+# way to do this where the .cpp file is included, this isn't currently
+# supported by this unit.)
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt6_target_pre_handle_moc_hdr
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.cpp
+local realout := $(outbase).cpp
+local dep := $(realout).dep
+local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
+local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_HPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt6_target_pre_handle_moc_hdr_dx))
+
+endef # def_unit_qt6_target_pre_handle_moc_hdr
+
+
+## wrapper for the MOC command dependencies.
+ifndef NO_COMPILE_CMDS_DEPS
+ _UNIT_QT6_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _UNIT_QT6_MOC_CPP_CMDS_DEP =
+endif
+
+##
+# def_unit_qt6_target_pre_handle_moc_src helper that is expanded before evaluation.
+#
+# This is necessary to resolve reference to local variables before doing
+# assignments and setting up commands. They would otherwise be resolved
+# later in a different context and the result would be completely wrong.
+#
+define def_unit_qt6_target_pre_handle_moc_src_dx
+
+$(out) +| $(realout) $(more_output) $(maybe_output): \
+ $(deps) \
+ $(value _UNIT_QT6_MOC_CPP_CMDS_DEP) \
+ | \
+ $(orderdeps) $(my_target_intermediate_vars)
+ %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
+ $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
+
+$(cmds)
+
+ $(QUIET)$(CP) --changed -f $(out) $(realout)
+ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+ %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+ 'define $(target)_$(subst :,_,$(source))_QT6_MOC_CPP_CMDS_PREV_' \
+ '--insert-command=$(out)' \
+ 'endef'
+else
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_MOC_CPP_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+endif
+
+$(target)_2_INTERMEDIATES += $(realout)
+$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
+
+endef
+
+##
+# Handle a source file listed in QT_MOCSRCS.
+#
+# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
+# a .moc file that we're expected to generate here.
+#
+# @remarks Invoked via $(evalvalctx ).
+define def_unit_qt6_target_pre_handle_moc_src
+local type := MOC
+
+# fetch the properties.
+local tool := $(kb-src-tool dummy_var)
+local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
+local out := $(outbase).tmp.moc
+local realout := $(outbase).moc
+local dep := $(realout).dep
+local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
+local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
+local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
+local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
+local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
+
+# default path + source dep.
+ifneq ($(defpath),)
+ ifdef KMK_WITH_QUOTING
+local source := $(qabspathex ,$(source),$(defpath))
+local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
+local incs := $(qabspathex ,$(incs),$(defpath))
+ else
+local source := $(abspathex $(source),$(defpath))
+local deps := $(abspathex $(deps),$(defpath)) $(source)
+local incs := $(abspathex $(incs),$(defpath))
+ endif
+else
+local deps += $(source)
+endif
+
+# call the tool
+ifndef TOOL_$(tool)_MOC_CPP_CMDS
+ $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
+endif
+local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
+local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
+local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
+local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
+
+# generate the link rule and update some source and target variables.
+ifndef NO_COMPILE_CMDS_DEPS
+ $(eval includedep $(dep))
+endif
+$(eval $(def_unit_qt6_target_pre_handle_moc_src_dx))
+
+endef # def_unit_qt6_target_pre_handle_moc_src
+
+
+##
+# Adds sources containing Q_OBJECT to QT_MOCSRCS.
+define def_unit_qt6_target_pre_cpp_source
+ifneq ($(file-size $(source)),-1)
+ ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
+ $(eval $(target)_QT_MOCSRCS += $(source))
+ endif
+endif
+endef # def_unit_qt6_target_pre_cpp_source
+
+##
+# Invoked early in the processing of a target that uses the Qt unit.
+#
+# It will append the qt source handlers to the target (.h, .ui, .ts,
+# .png, .bmp, .gif).
+#
+# It will then check all the C++ sources and check which needs
+# a .moc files and generate rules and dependencies fofor these
+#
+define def_unit_qt6_target_pre
+
+# Make QTTOOL the default for the specific Qt tools instead of TOOL.
+ifneq ($($(target)_QTTOOL),)
+ ifeq ($($(target)_MOCTOOL),)
+ $(target)_MOCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_UICTOOL),)
+ $(target)_UICTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_RCCTOOL),)
+ $(target)_RCCTOOL := $($(target)_QTTOOL)
+ endif
+ ifeq ($($(target)_LRCTOOL),)
+ $(target)_LRCTOOL := $($(target)_QTTOOL)
+ endif
+endif
+
+# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
+local qt_modules := \
+ $($(target)_QT_MODULES.$(bld_trg)) \
+ $($(target)_QT_MODULES.$(bld_trg_arch)) \
+ $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MODULES.$(bld_trg_cpu)) \
+ $($(target)_QT_MODULES.$(bld_type)) \
+ $($(target)_QT_MODULES)
+local qt_prefix := $(firstword \
+ $($(target)_QT_PREFIX.$(bld_trg)) \
+ $($(target)_QT_PREFIX.$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_PREFIX.$(bld_type)) \
+ $($(target)_QT_PREFIX))
+local qt_infix := $(firstword \
+ $($(target)_QT_INFIX.$(bld_trg)) \
+ $($(target)_QT_INFIX.$(bld_trg_arch)) \
+ $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_INFIX.$(bld_trg_cpu)) \
+ $($(target)_QT_INFIX.$(bld_type)) \
+ $($(target)_QT_INFIX))
+ifeq ($(bld_trg),darwin)
+ # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
+ $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT6_LIB) )
+ $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT6_LIB) )
+ $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT6_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
+ $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT6_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/A/Headers) )
+else
+ ifeq ($(bld_trg),win)
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT6_LIB)/$(qt_prefix)Qt6$(module)$(qt_infix)$(SUFF_LIB)) )
+ ifeq ($(tool_do),LINK_PROGRAM)
+ $(eval $(target)_LIBS += $(PATH_SDK_QT6_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
+ endif
+ else
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT6_LIB)/lib$(qt_prefix)Qt6$(module)$(qt_infix)$(SUFF_DLL)) )
+ endif
+ $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT6_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT6_INC) )
+endif
+$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
+
+
+# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
+# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
+ifndef $(target)_QT_MOCSRCS
+ $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
+ $($(target)_SOURCES.$(bld_trg)) \
+ $($(target)_SOURCES.$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_SOURCES.$(bld_trg_cpu)) \
+ $($(target)_SOURCES.$(bld_type)) \
+ $($(target)_SOURCES) \
+ ), $(evalval def_unit_qt6_target_pre_cpp_source))
+endif
+
+# Install source handlers for .ui files.
+$(target)_SRC_HANDLERS += \
+ .ui:def_unit_qt6_src_handler_ui \
+ .UI:def_unit_qt6_src_handler_ui \
+ .qrc:def_unit_qt6_src_handler_qrc \
+ .qrc:def_unit_qt6_src_handler_qrc
+
+# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
+local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
+local qtuicdir := $($(target)_0_OUTDIR)/qtuic
+local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
+local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
+$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
+$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
+
+# Since we add a lot of stuff to 2_INTERMEDIATES, we must exclude it from the intermediates
+# used by the rules we generate to avoid circular dependencies.
+local my_target_intermediate_vars := $(filter-out %_2_INTERMEDIATES$(CLOSEPAR),$(target_intermediate_vars))
+
+# Deal with QT_MOCSRCS.
+$(foreach source, \
+ $($(target)_QT_MOCSRCS.$(bld_trg)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCSRCS.$(bld_type)) \
+ $($(target)_QT_MOCSRCS) \
+ , $(evalvalctx def_unit_qt6_target_pre_handle_moc_src))
+
+# Deal with QT_MOCHDRS.
+$(foreach source, \
+ $($(target)_QT_MOCHDRS.$(bld_trg)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
+ $($(target)_QT_MOCHDRS.$(bld_type)) \
+ $($(target)_QT_MOCHDRS) \
+ , $(evalvalctx def_unit_qt6_target_pre_handle_moc_hdr))
+
+# Deal with QT_TRANSLATIONS.
+# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
+local translations := \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
+ $($(target)_QT_TRANSLATIONS.$(bld_type)) \
+ $($(target)_QT_TRANSLATIONS)
+ifneq ($(strip $(translations)),)
+ local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
+ $(eval $(expr))
+ ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
+ $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
+ else
+ $(target)-inst-nls_MODE := 0644
+ endif
+ ifdef $(target)_QT_TRANSLATIONS_INST
+ $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
+ endif
+ $(target)-inst-nls_SOURCES :=
+ $(foreach source, $(translations)\
+ , $(evalvalctx def_unit_qt6_target_pre_handle_translation))
+endif
+
+endef # def_unit_qt6_target_pre
+
+
+#
+# Rule for debugging.
+#
+unit-qt6-show-vars:
+ @$(ECHO) 'The Qt6 SDK variables:'
+ @$(ECHO) ' PATH_SDK_QT6 = "$(PATH_SDK_QT6)"'
+ @$(ECHO) ' PATH_SDK_QT6_INC = "$(PATH_SDK_QT6_INC)"'
+ @$(ECHO) ' PATH_SDK_QT6_LIB = "$(PATH_SDK_QT6_LIB)"'
+ @$(ECHO) ' PATH_SDK_QT6_LIB.amd64 = "$(PATH_SDK_QT6_LIB.amd64)"'
+ @$(ECHO) ' PATH_SDK_QT6_LIB.x86 = "$(PATH_SDK_QT6_LIB.x86)"'
+ @$(ECHO) 'The Qt6 TOOL variables:'
+ @$(ECHO) ' PATH_TOOL_QT6_BIN = "$(PATH_TOOL_QT6_BIN)"'
+ @$(ECHO) ' PATH_TOOL_QT6_LIBEXEC = "$(PATH_TOOL_QT6_LIBEXEC)"'
+ @$(ECHO) ' TOOL_QT6_BIN_SUFF = "$(TOOL_QT6_BIN_SUFF)"'
+ @$(ECHO) ' TOOL_QT6_LIBEXEC_SUFF = "$(TOOL_QT6_LIBEXEC_SUFF)"'
+ @$(ECHO) ' TOOL_QT6_MOC = "$(TOOL_QT6_MOC)"'
+ @$(ECHO) ' TOOL_QT6_UIC = "$(TOOL_QT6_UIC)"'
+ @$(ECHO) ' TOOL_QT6_RCC = "$(TOOL_QT6_RCC)"'
+ @$(ECHO) ' TOOL_QT6_LRC = "$(TOOL_QT6_LRC)"'
+ @$(ECHO) ' TOOL_QT6_LUPDATE = "$(TOOL_QT6_LUPDATE)"'
+
diff --git a/kBuild/units/vccprecomp.kmk b/kBuild/units/vccprecomp.kmk
new file mode 100644
index 0000000..5f21d10
--- /dev/null
+++ b/kBuild/units/vccprecomp.kmk
@@ -0,0 +1,66 @@
+# $Id: vccprecomp.kmk 3415 2020-08-20 23:43:33Z bird $
+## @file
+# kBuild Unit - Target Level Precompiled Headers for Visual C++.
+#
+
+#
+# Copyright (c) 2016-2019 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+
+UNIT_vccprecomp = Target level precompiled Headers for Visual C++
+
+#
+# Early target processing pass #1.
+#
+# This set the internal _VCC_PCH_FILE and VCC_COMMON_OBJ_PDB properties,
+# which will be picked up by the VCCxxx tool.
+#
+define def_unit_vccprecomp_target_pre
+ $(target)_1_VCC_PCH_FILE := $(outbase)-pch.pch
+ $(target)_1_VCC_COMMON_OBJ_PDB := $(outbase)-common-obj.pdb
+endef
+
+#
+# Early target processing pass #2.
+#
+# This sets up a rule for creating the .pch file after qt5 and similar units
+# are done modifying INCS, DEFS and company. The '-PCH' variant of the VCC
+# tool, is defined together with $(pchtool) and allow us to bypass the options
+# and dependencies triggered by _1_VCC_PCH_FILE, _1_VCC_COMMON_OBJ_PDB and
+# _PCH_HDR, and also make sure we don't get circular dependencies by way of
+# kDepObj and the debug info.
+#
+define def_unit_vccprecomp_target_pre_2
+ local pchtool := $(call _TARGET_TOOL,$(target),PCH)
+ local source := $($(target)_PCH_HDR)
+ $(source)_TOOL := $(pchtool)-PCH
+ local suff := $(suffix $(source))
+ local type := CXX
+ $(kb-src-one 4)
+endef
+
diff --git a/kBuild/units/yacc.kmk b/kBuild/units/yacc.kmk
new file mode 100644
index 0000000..e4bb8cc
--- /dev/null
+++ b/kBuild/units/yacc.kmk
@@ -0,0 +1,198 @@
+# $Id: yacc.kmk 3284 2019-01-05 01:40:31Z bird $
+## @file
+# yacc/bison unit.
+#
+
+#
+# Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifdef UNIT_yacc
+ $(error kBuild: The yacc unit was included twice!)
+endif
+UNIT_yacc = yacc
+
+# Add our target properties.
+PROPS_TOOLS += YACCTOOL
+PROPS_SINGLE += YACCTOOL
+PROPS_ACCUMULATE_R += YACCFLAGS
+
+# Add ourselves to the default source handlers.
+KBUILD_SRC_HANDLERS += \
+ .y:def_src_handler_yacc_y \
+ .ypp:def_src_handler_yacc_ypp \
+ .y++:def_src_handler_yacc_ypp
+
+
+## wrapper the compile command dependency check.
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEP_YACC_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_YACC_CMDS_PREV_),$$(commands $(out)),FORCE)
+else
+ _DEP_YACC_CMDS =
+endif
+
+
+##
+# Generates the rules for running flex on a specific source file.
+#
+# @param $(obj) The object file.
+# @param lots more
+define def_yacc_rule
+$(out) + $(output_extra) +| $(output_maybe) : \
+ $(deps) \
+ $(value _DEP_YACC_CMDS) \
+ | \
+ $(orderdeps)
+ %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
+ $$(QUIET)$$(RM) -f -- $(dep) $(out) $(output_extra) $(output_maybe)
+
+$(cmds)
+
+ifndef NO_COMPILE_CMDS_DEPS
+ %$$(QUIET2)$$(APPEND) '$(dep)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_YACC_CMDS_PREV_'
+ %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
+ %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
+
+# update globals and target properties.
+_OUT_FILES += $(out) $(output_extra) $(output_maybe)
+$(target)_GEN_SOURCES_ += $(out)
+$(target)_2_INTERMEDIATES += $(intermediates)
+
+endef # def_yacc_rule
+
+
+##
+# Handler for .y files listed in the SOURCES properties.
+#
+# .y files are transformed into .c (and maybe .h) files that then gets
+# compiled by the C compiler.
+#
+# @param target The target file.
+# @param source The source file.
+# @param lots more
+# @returns quite a bit.
+#
+define def_src_handler_yacc_y
+# Figure out all the props.
+local type := YACC
+local tmp := $(kb-src-tool tool)
+ifeq ($(tool),)
+$(error kBuild: $(target) / $(sources) does not a (yacc) tool defined!)
+endif
+ifndef TOOL_$(tool)_YACC_CMDS
+$(error kBuild: TOOL_$(tool)_YACC_CMDS isn't defined! target=$(target) source=$(source) )
+endif
+local out := $(kb-obj-base outbase).c
+local tmp := $(kb-src-prop YACCFLAGS,flags,left-to-right,)
+local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath))
+local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath))
+local dirdep := $(call DIRDEP,$(dir $(out)))
+
+# Adjust paths if we got a default path.
+ifneq ($(defpath),)
+ local source := $(abspathex $(source),$(defpath))
+endif
+
+# dependency file.
+local dep := $(out)$(SUFF_DEP)
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ $(eval includedep $(dep))
+endif
+
+# Call the tool.
+local cmds := $(TOOL_$(tool)_YACC_CMDS)
+local output_extra := $(TOOL_$(tool)_YACC_OUTPUT)
+local output_maybe := $(TOOL_$(tool)_YACC_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_YACC_DEPEND) $(source)
+local orderdeps += $(TOOL_$(tool)_YACC_DEPORD) $(dirdep)
+
+# Whether it generates a header file depends on flags.
+local intermediates := $(filter %.h %.hpp %.h++ %.H,$(output_extra))
+
+# Generate the rule.
+$(eval $(def_yacc_rule))
+
+endef # def_src_handler_yacc_y
+
+
+##
+# Handler for .ypp/.y++ files listed in the SOURCES properties.
+#
+# .ypp/++ files are transformed into .cpp/++ (and maybe .hpp/++) files that then gets
+# compiled by the C++ compiler.
+#
+# @param target The target file.
+# @param source The source file.
+# @param lots more
+# @returns quite a bit.
+#
+define def_src_handler_yacc_ypp
+# Figure out all the props.
+local type := YACC
+local tmp := $(kb-src-tool tool)
+ifeq ($(tool),)
+$(error kBuild: $(target) / $(sources) does not a (yacc) tool defined!)
+endif
+ifndef TOOL_$(tool)_YACC_CMDS
+$(error kBuild: TOOL_$(tool)_YACC_CMDS isn't defined! target=$(target) source=$(source) )
+endif
+local out := $(kb-obj-base outbase).c$(substr $(suffix $(source),3))
+local tmp := $(kb-src-prop YACCFLAGS,flags,left-to-right,)
+local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath))
+local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath))
+local dirdep := $(call DIRDEP,$(dir $(out)))
+
+# Adjust paths if we got a default path.
+ifneq ($(defpath),)
+ local source := $(abspathex $(source),$(defpath))
+endif
+
+# dependency file.
+local dep := $(out)$(SUFF_DEP)
+ifndef NO_COMPILE_CMDS_DEPS
+ _DEPFILES_INCLUDED += $(dep)
+ $(eval includedep $(dep))
+endif
+
+# Call the tool.
+local cmds := $(TOOL_$(tool)_YACC_CMDS)
+local output_extra := $(TOOL_$(tool)_YACC_OUTPUT)
+local output_maybe := $(TOOL_$(tool)_YACC_OUTPUT_MAYBE)
+local deps += $(TOOL_$(tool)_YACC_DEPEND) $(source)
+local orderdeps += $(TOOL_$(tool)_YACC_DEPORD) $(dirdep)
+
+# Whether it generates a header file depends on flags.
+local intermediates := $(filter %.h %.hpp %.h++ %.H,$(output_extra))
+
+# Generate the rule.
+$(eval $(def_yacc_rule))
+
+endef # def_src_handler_yacc_ypp
+
diff --git a/kBuild/up.kmk b/kBuild/up.kmk
new file mode 100644
index 0000000..4892434
--- /dev/null
+++ b/kBuild/up.kmk
@@ -0,0 +1,68 @@
+# $Id: up.kmk 3422 2020-08-21 11:48:40Z bird $
+## @file
+# kBuild - File included at top of a up forwarder makefile.
+# This method is DEPRECATED. Use Makefile.kup files instead.
+#
+
+#
+# Copyright (c) 2005-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version source of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite typetype0, Boston, MA 0sourcetargettargettarget-targettype07 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+
+# include the header to get the right MAKE and to include config.kmk
+# files since these may contain global goals.
+include $(KBUILD_PATH)/header.kmk
+
+UP_TO ?= ..
+
+# typical kbuild goals.
+all_recursive \
+binaries \
+clean \
+dlls \
+libraries \
+needed \
+nothing \
+objects \
+others \
+packing \
+pass_binaries \
+pass_clean \
+pass_dlls \
+pass_needed \
+pass_nothing \
+pass_others \
+pass_packing \
+programs \
+rebuild \
+sysmods \
+target \
+ :
+ $(MAKE) -C $(UP_TO) $@
+
+# the syntax checkers.
+%.o %.obj:
+ $(MAKE) -C $(UP_TO) $@
+
diff --git a/kBuild/win-common.kmk b/kBuild/win-common.kmk
new file mode 100644
index 0000000..bdba760
--- /dev/null
+++ b/kBuild/win-common.kmk
@@ -0,0 +1,61 @@
+# $Id: win-common.kmk 3323 2020-04-16 23:10:45Z bird $
+## @file
+# kBuild Common Windows Definitions - Used by tools and SDKs.
+#
+
+#
+# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+INCLUDED_WIN_COMMON_KMK := 1
+
+## @def WINCMN_PROGRAM_FILES
+## The 'Program Files' directory, with forward slashes and GNU make quoted.
+WINCMN_PROGRAM_FILES := $(quote $(subst \,/,${ProgramFiles}))
+
+## @def WINCMN_PROGRAM_FILES_ALT
+## The 'Program Files (x86)' directory, with forward slashes and GNU make quoted.
+WINCMN_PROGRAM_FILES_ALT := $(quote $(subst \,/,${ProgramFiles(x86)}))
+
+## @def WINCMN_PROGRAM_FILES_LIST_EXTRA
+## Additional 'Program Files'-like locations to search for stuff. Handy for EWDK.
+## GNU make quoting.
+WINCMN_PROGRAM_FILES_LIST_EXTRA ?=
+
+## @def WINCMN_PROGRAM_FILES_LIST
+## The 'Program Files'-like locations to search for stuff. GNU make quoting.
+WINCMN_PROGRAM_FILES_LIST := $(WINCMN_PROGRAM_FILES_LIST_EXTRA) $(WINCMN_PROGRAM_FILES) $(WINCMN_PROGRAM_FILES_ALT)
+
+## @def WINCMN_MAP_ARCH.*
+## Maps kBuild architecture names to one used by newer windows tools and kits.
+## @{
+WINCMN_MAP_ARCH.amd64 := x64
+WINCMN_MAP_ARCH.arm32 := arm
+WINCMN_MAP_ARCH.arm64 := arm64
+WINCMN_MAP_ARCH.ia64 := ia64
+WINCMN_MAP_ARCH.x86 := x86
+## @}