summaryrefslogtreecommitdiffstats
path: root/kBuild/tools
diff options
context:
space:
mode:
Diffstat (limited to 'kBuild/tools')
-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
70 files changed, 20103 insertions, 0 deletions
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