Index: /trunk/kBuild/tools/GXX.kmk
===================================================================
--- /trunk/kBuild/tools/GXX.kmk	(revision 971)
+++ /trunk/kBuild/tools/GXX.kmk	(revision 971)
@@ -0,0 +1,221 @@
+# $Id$
+## @file
+#
+# kBuild Tool Config - Generic GCC using the system GCC, for building C++ code.
+#
+# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@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
+#
+#
+
+TOOL_GXX := Generic GCC using the system GCC, for building C++ code.
+
+# Tool Specific Properties
+TOOL_GXX_CC  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX_CXX ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX_AS  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX_AR  ?= ar$(HOSTSUFF_EXE)
+TOOL_GXX_RANLIB ?= ranlib$(HOSTSUFF_EXE)
+TOOL_GXX_LD  ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX_LDFLAGS.dll.os2 ?= -Zdll
+TOOL_GXX_LDFLAGS.dll.darwin ?= -dynamiclib
+ifndef TOOL_GXX_LDFLAGS.$(BUILD_TARGET)
+TOOL_GXX_LDFLAGS.dll ?= -shared
+else
+TOOL_GXX_LDFLAGS.dll ?= $(TOOL_GXX_LDFLAGS.$(BUILD_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_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) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+		-Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+		-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_GXX_COMPILE_CXX_OUTPUT =
+TOOL_GXX_COMPILE_CXX_DEPEND =
+TOOL_GXX_COMPILE_CXX_DEPORD =
+define TOOL_GXX_COMPILE_CXX_CMDS
+	$(QUIET)$(TOOL_GXX_CXX) -c\
+		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+		-Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+		-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_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) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+		-Wp,-MD,$(dep) -Wp,-MT,$(obj) \
+		-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_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) $(objs)
+	$(call xargs,$(QUIET)$(TOOL_GXX_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_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) $(objs) \
+		$(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)		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) $(objs) \
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+endef
+
Index: /trunk/kBuild/tools/GXX3.kmk
===================================================================
--- /trunk/kBuild/tools/GXX3.kmk	(revision 971)
+++ /trunk/kBuild/tools/GXX3.kmk	(revision 971)
@@ -0,0 +1,286 @@
+# $Id$
+## @file
+#
+# kBuild Tool Config - Generic GCC v3.2.x using the system GCC and Binutils, for building C++ code.
+#
+# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@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
+#
+#
+
+TOOL_GXX3 := Generic GCC v3.2.x or later using the system GCC and Binutils, for building C++ code.
+
+# Tool Specific Properties
+TOOL_GXX3_CC  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX3_CXX ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX3_AS  ?= gcc$(HOSTSUFF_EXE)
+ifeq ($(BUILD_TARGET),solaris)
+ TOOL_GXX3_AR ?= gar$(HOSTSUFF_EXE)
+else
+ TOOL_GXX3_AR ?= ar$(HOSTSUFF_EXE)
+endif
+ifeq ($(BUILD_TARGET),os2)
+ TOOL_GXX3_AR_IMP ?= emximp$(HOSTSTUFF_EXE)
+else
+ TOOL_GXX3_AR_IMP ?= $(ECHO) not supported!
+endif
+TOOL_GXX3_LD ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX3_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
+ifndef TOOL_GXX3_LDFLAGS.$(BUILD_TARGET)
+ TOOL_GXX3_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX3_LDFLAGS.dll ?= $(TOOL_GXX3_LDFLAGS.$(BUILD_TARGET))
+endif
+TOOL_GXX3_LDFLAGS.sysmod ?= -r
+TOOL_GXX3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(BUILD_TARGET),os2)
+ TOOL_GXX3_LD_MAP ?= -Zmap=$(1)
+ TOOL_GXX3_LD_SYSMOD_MAP ?= -Zmap=$(1)
+endif
+ifdef SLKRUNS
+ TOOL_GXX3_CC  += -fmessage-length=0
+ TOOL_GXX3_CXX += -fmessage-length=0
+endif
+
+# General Properties used by kBuild
+TOOL_GXX3_COBJSUFF         ?= .o
+TOOL_GXX3_CFLAGS           ?=
+TOOL_GXX3_CFLAGS.debug     ?= -g
+TOOL_GXX3_CFLAGS.profile   ?= -g -O2 #-pg
+TOOL_GXX3_CFLAGS.release   ?= -O2
+TOOL_GXX3_CINCS            ?=
+TOOL_GXX3_CDEFS            ?=
+
+TOOL_GXX3_CXXOBJSUFF       ?= .o
+TOOL_GXX3_CXXOBJSUFF       ?= .o
+TOOL_GXX3_CXXFLAGS         ?=
+TOOL_GXX3_CXXFLAGS.debug   ?= -g
+TOOL_GXX3_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX3_CXXFLAGS.release ?= -O2
+TOOL_GXX3_CXXINCS          ?=
+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_OUTPUT =
+TOOL_GXX3_COMPILE_C_DEPEND =
+TOOL_GXX3_COMPILE_C_DEPORD =
+define TOOL_GXX3_COMPILE_C_CMDS
+	$(QUIET)$(TOOL_GXX3_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_GXX3_COMPILE_CXX_OUTPUT =
+TOOL_GXX3_COMPILE_CXX_DEPEND =
+TOOL_GXX3_COMPILE_CXX_DEPORD =
+define TOOL_GXX3_COMPILE_CXX_CMDS
+	$(QUIET)$(TOOL_GXX3_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_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) $(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    $(othersrc) Unhandled sources.
+# @param    $(outbase)  Output basename (full). Use this for list files and such.
+TOOL_GXX3_LINK_LIBRARY_OUTPUT = $(out).ar-script $(outbase).imp.a
+TOOL_GXX3_LINK_LIBRARY_DEPEND = $(othersrc)
+TOOL_GXX3_LINK_LIBRARY_DEPORD =
+ifeq ($(filter append-dash-n,$(KMK_FEATURES)),append-dash-n)
+define TOOL_GXX3_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,$(othersrc)), 'ADDLIB $(o)')
+	$(if $(filter %.def %.imp,$(othersrc))\
+		,$(TOOL_GXX3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp,$(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)$(TOOL_GXX3_AR) -M < $(out).ar-script
+endef
+else
+define TOOL_GXX3_LINK_LIBRARY_CMDS
+	$(QUIET)$(APPEND) $(out).ar-script "CREATE $(out)"
+	$(foreach o, $(objs)\
+		,$(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script "ADDMOD $(o)")
+	$(foreach srclib, $(filter-out %.def %.imp,$(othersrc))\
+		,$(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script "ADDLIB $(srclib)")
+	$(if $(filter %.def %.imp,$(othersrc))\
+		,$(TOOL_GXX3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp,$(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)$(TOOL_GXX3_AR) -M < $(out).ar-script
+endef
+endif
+
+
+## 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 = $(outbase).map
+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) $(objs)\
+		$(filter %.def, $(othersrc))\
+		$(foreach p,$(libpath), -L$(p))\
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+		$(call TOOL_GXX3_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_GXX3_LINK_DLL_OUTPUT = $(outbase).map
+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 win32 os2, $(BUILD_TARGET)),$(call TOOL_GXX3_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%,%,$(basename $(lib))), $(lib)))\
+		$(call TOOL_GXX3_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_GXX3_LINK_SYSMOD_OUTPUT = $(outbase).map
+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) $(objs)\
+		$(filter %.def, $(othersrc))\
+		$(foreach p,$(libpath), -L$(p))\
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+		$(call TOOL_GXX3_LD_SYSMOD_MAP,$(outbase).map)
+endef
+
Index: /trunk/kBuild/tools/GXX32.kmk
===================================================================
--- /trunk/kBuild/tools/GXX32.kmk	(revision 971)
+++ /trunk/kBuild/tools/GXX32.kmk	(revision 971)
@@ -0,0 +1,272 @@
+# $Id$
+## @file
+#
+# kBuild Tool Config - Generic 32-bit GCC v3.2.x or later using the system GCC, for building C++ code.
+#
+# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@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
+#
+#
+
+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
+TOOL_GXX32_CC  ?= gcc$(HOSTSUFF_EXE) -m32
+TOOL_GXX32_CXX ?= g++$(HOSTSUFF_EXE) -m32
+TOOL_GXX32_AS  ?= gcc$(HOSTSUFF_EXE) -m32
+TOOL_GXX32_AR  ?= ar$(HOSTSUFF_EXE)
+TOOL_GXX32_LD  ?= g++$(HOSTSUFF_EXE) -m32
+TOOL_GXX32_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
+ifndef TOOL_GXX32_LDFLAGS.$(BUILD_TARGET)
+TOOL_GXX32_LDFLAGS.dll ?= -shared
+else
+TOOL_GXX32_LDFLAGS.dll ?= $(TOOL_GXX32_LDFLAGS.$(BUILD_TARGET))
+endif
+TOOL_GXX32_LDFLAGS.sysmod ?= -r -m elf_i386
+TOOL_GXX32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(BUILD_TARGET),os2)
+TOOL_GXX32_LD_MAP ?= -Zmap=$(1)
+else
+TOOL_GXX32_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
+endif
+ifeq ($(BUILD_TARGET),os2)
+TOOL_GXX32_LD_SYSMOD_MAP ?= -Zmap=$(1)
+else
+TOOL_GXX32_LD_SYSMOD_MAP ?= -Map $(1) --cref
+endif
+ifdef SLKRUNS
+TOOL_GXX32_CC  += -fmessage-length=0
+TOOL_GXX32_CXX += -fmessage-length=0
+endif
+
+# General Properties used by kBuild
+TOOL_GXX32_COBJSUFF         ?= .o
+TOOL_GXX32_CFLAGS           ?=
+TOOL_GXX32_CFLAGS.debug     ?= -g
+TOOL_GXX32_CFLAGS.profile   ?= -g -O2 #-pg
+TOOL_GXX32_CFLAGS.release   ?= -O2
+TOOL_GXX32_CINCS            ?=
+TOOL_GXX32_CDEFS            ?=
+
+TOOL_GXX32_CXXOBJSUFF       ?= .o
+TOOL_GXX32_CXXOBJSUFF       ?= .o
+TOOL_GXX32_CXXFLAGS         ?=
+TOOL_GXX32_CXXFLAGS.debug   ?= -g
+TOOL_GXX32_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX32_CXXFLAGS.release ?= -O2
+TOOL_GXX32_CXXINCS          ?=
+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_OUTPUT =
+TOOL_GXX32_COMPILE_C_DEPEND =
+TOOL_GXX32_COMPILE_C_DEPORD =
+define TOOL_GXX32_COMPILE_C_CMDS
+	$(QUIET)$(TOOL_GXX32_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_GXX32_COMPILE_CXX_OUTPUT =
+TOOL_GXX32_COMPILE_CXX_DEPEND =
+TOOL_GXX32_COMPILE_CXX_DEPORD =
+define TOOL_GXX32_COMPILE_CXX_CMDS
+	$(QUIET)$(TOOL_GXX32_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_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) $(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    $(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 =
+ifeq ($(filter append-dash-n,$(KMK_FEATURES)),append-dash-n)
+define TOOL_GXX32_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_GXX32_AR) -M < $(out).ar-script
+endef
+else
+define TOOL_GXX32_LINK_LIBRARY_CMDS
+	$(QUIET)$(APPEND) $(out).ar-script "CREATE $(out)"
+	$(foreach o, $(objs)\
+		,$(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script "ADDMOD $(o)")
+	$(foreach srclib,$(othersrc)\
+		,$(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script "ADDLIB $(srclib)")
+	$(QUIET)$(APPEND) $(out).ar-script "SAVE"
+	$(QUIET)$(APPEND) $(out).ar-script "END"
+	$(QUIET)$(TOOL_GXX32_AR) -M < $(out).ar-script
+endef
+endif
+
+
+## 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 = $(outbase).map
+TOOL_GXX32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX32_LINK_PROGRAM_DEPORD =
+define TOOL_GXX32_LINK_PROGRAM_CMDS
+	$(QUIET)$(TOOL_GXX32_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_GXX32_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_GXX32_LINK_DLL_OUTPUT = $(outbase).map
+TOOL_GXX32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+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 win32 os2, $(BUILD_TARGET)),$(call TOOL_GXX32_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_GXX32_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_GXX32_LINK_SYSMOD_OUTPUT = $(outbase).map
+TOOL_GXX32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX32_LINK_SYSMOD_DEPORD =
+define TOOL_GXX32_LINK_SYSMOD_CMDS
+	$(QUIET)$(TOOL_GXX32_LD_SYSMOD) $(TOOL_GXX32_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_GXX32_LD_SYSMOD_MAP,$(outbase).map)
+endef
+
Index: /trunk/kBuild/tools/GXX3OMF.kmk
===================================================================
--- /trunk/kBuild/tools/GXX3OMF.kmk	(revision 971)
+++ /trunk/kBuild/tools/GXX3OMF.kmk	(revision 971)
@@ -0,0 +1,270 @@
+# $Id$
+## @file
+#
+# kBuild Tool Config - GCC v3 targeting OS/2 OMF, for building C++ code.
+#
+# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@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
+#
+#
+
+TOOL_GXX3OMF := GCC v3 targeting OS/2 OMF, for building C++ code.
+
+# Tool Specific Properties
+TOOL_GXX3OMF_CC  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX3OMF_CXX ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX3OMF_AS  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX3OMF_AR  ?= emxomfar$(HOSTSUFF_EXE)
+TOOL_GXX3OMF_AR_IMP ?= emximp$(HOSTSUFF_EXE)
+TOOL_GXX3OMF_LD ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX3OMF_LD_SYSMOD ?= g++$(HOSTSUFF_EXE)
+ifndef TOOL_GXX3OMF_LDFLAGS.$(BUILD_TARGET)
+TOOL_GXX3OMF_LDFLAGS.dll ?= -shared -Zdll
+else
+TOOL_GXX3OMF_LDFLAGS.dll ?= $(TOOL_GXX3OMF_LDFLAGS.$(BUILD_TARGET))
+endif
+TOOL_GXX3OMF_LDFLAGS.sysmod ?= -nostdlib
+TOOL_GXX3OMF_LD_MAP ?= -Zmap=$(1)
+TOOL_GXX3OMF_LD_SYSMOD_MAP ?= -Zmap=$(1)
+
+ifdef SLKRUNS
+TOOL_GXX3OMF_CC  += -fmessage-length=0
+TOOL_GXX3OMF_CXX += -fmessage-length=0
+endif
+
+# General Properties used by kBuild
+TOOL_GXX3OMF_COBJSUFF         ?= .o
+TOOL_GXX3OMF_CFLAGS           ?= -Zomf
+TOOL_GXX3OMF_CFLAGS.debug     ?= -g
+TOOL_GXX3OMF_CFLAGS.profile   ?= -g -O2 #-pg
+TOOL_GXX3OMF_CFLAGS.release   ?= -O2
+TOOL_GXX3OMF_CINCS            ?=
+TOOL_GXX3OMF_CDEFS            ?=
+
+TOOL_GXX3OMF_CXXOBJSUFF       ?= .o
+TOOL_GXX3OMF_CXXOBJSUFF       ?= .o
+TOOL_GXX3OMF_CXXFLAGS         ?= -Zomf
+TOOL_GXX3OMF_CXXFLAGS.debug   ?= -g
+TOOL_GXX3OMF_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX3OMF_CXXFLAGS.release ?= -O2
+TOOL_GXX3OMF_CXXINCS          ?=
+TOOL_GXX3OMF_CXXDEFS          ?=
+
+TOOL_GXX3OMF_ASFLAGS          ?= -x assembler-with-cpp
+TOOL_GXX3OMF_ASFLAGS.debug    ?= -g
+TOOL_GXX3OMF_ASFLAGS.profile  ?= -g
+TOOL_GXX3OMF_ASOBJSUFF        ?= .obj
+
+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_OUTPUT =
+TOOL_GXX3OMF_COMPILE_C_DEPEND =
+TOOL_GXX3OMF_COMPILE_C_DEPORD =
+define TOOL_GXX3OMF_COMPILE_C_CMDS
+	$(QUIET)$(TOOL_GXX3OMF_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_GXX3OMF_COMPILE_CXX_OUTPUT =
+TOOL_GXX3OMF_COMPILE_CXX_DEPEND =
+TOOL_GXX3OMF_COMPILE_CXX_DEPORD =
+define TOOL_GXX3OMF_COMPILE_CXX_CMDS
+	$(QUIET)$(TOOL_GXX3OMF_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_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) $(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    $(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,$(othersrc))\
+		,$(QUIET)$(APPEND) -n $(outbase).rsp $(filter %.def %.imp,$(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) $(objs) $(filter-out %.def %.imp,$(othersrc))
+	$(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)\
+		$(objs)\
+		$(foreach p,$(libpath), -L$(p))\
+		$(othersrc)\
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(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)\
+		$(objs)\
+		$(foreach p,$(libpath), -L$(p))\
+		$(othersrc)\
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+		-Zmap=$(outbase).map
+	$(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)\
+		$(objs)\
+		$(foreach p,$(libpath), -L$(p))\
+		$(othersrc)\
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
+		-Zmap=$(outbase).map
+	$(QUIET)$(TOOL_GXX3OMF_LD_SYSMOD) @$(outbase).rsp
+endef
+
Index: /trunk/kBuild/tools/GXX3PLAIN.kmk
===================================================================
--- /trunk/kBuild/tools/GXX3PLAIN.kmk	(revision 971)
+++ /trunk/kBuild/tools/GXX3PLAIN.kmk	(revision 971)
@@ -0,0 +1,238 @@
+# $Id$
+## @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-2007 knut st. osmundsen <bird-kBuild-spam@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
+#
+#
+
+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
+TOOL_GXX3PLAIN_CC  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_CXX ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_AS  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_AR  ?= ar$(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_RANLIB ?= ranlib$(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_LD  ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
+TOOL_GXX3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
+ifndef TOOL_GXX3PLAIN_LDFLAGS.$(BUILD_TARGET)
+ TOOL_GXX3PLAIN_LDFLAGS.dll ?= -shared
+else
+ TOOL_GXX3PLAIN_LDFLAGS.dll ?= $(TOOL_GXX3PLAIN_LDFLAGS.$(BUILD_TARGET))
+endif
+TOOL_GXX3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
+TOOL_GXX3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
+TOOL_GXX3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
+ifndef TOOL_GXX3PLAIN_LD_SONAME.$(BUILD_TARGET)
+ TOOL_GXX3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+else
+ TOOL_GXX3PLAIN_LD_SONAME ?= $(TOOL_GXX3PLAIN_LD_SONAME.$(BUILD_TARGET))
+endif
+ifdef SLKRUNS
+ TOOL_GXX3PLAIN_CC  += -fmessage-length=0
+ TOOL_GXX3PLAIN_CXX += -fmessage-length=0
+endif
+
+# General Properties used by kBuild
+TOOL_GXX3PLAIN_COBJSUFF         ?= .o
+TOOL_GXX3PLAIN_CFLAGS           ?=
+TOOL_GXX3PLAIN_CFLAGS.debug     ?= -g
+TOOL_GXX3PLAIN_CFLAGS.profile   ?= -g -O2 #-pg
+TOOL_GXX3PLAIN_CFLAGS.release   ?= -O2
+TOOL_GXX3PLAIN_CINCS            ?=
+TOOL_GXX3PLAIN_CDEFS            ?=
+
+TOOL_GXX3PLAIN_CXXOBJSUFF       ?= .o
+TOOL_GXX3PLAIN_CXXOBJSUFF       ?= .o
+TOOL_GXX3PLAIN_CXXFLAGS         ?=
+TOOL_GXX3PLAIN_CXXFLAGS.debug   ?= -g
+TOOL_GXX3PLAIN_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX3PLAIN_CXXFLAGS.release ?= -O2
+TOOL_GXX3PLAIN_CXXINCS          ?=
+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          ?=
+TOOL_GXX3PLAIN_LDFLAGS.debug    ?= -g
+TOOL_GXX3PLAIN_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_GXX3PLAIN_COMPILE_C_OUTPUT =
+TOOL_GXX3PLAIN_COMPILE_C_DEPEND =
+TOOL_GXX3PLAIN_COMPILE_C_DEPORD =
+define TOOL_GXX3PLAIN_COMPILE_C_CMDS
+	$(QUIET)$(TOOL_GXX3PLAIN_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_GXX3PLAIN_COMPILE_CXX_OUTPUT =
+TOOL_GXX3PLAIN_COMPILE_CXX_DEPEND =
+TOOL_GXX3PLAIN_COMPILE_CXX_DEPORD =
+define TOOL_GXX3PLAIN_COMPILE_CXX_CMDS
+	$(QUIET)$(TOOL_GXX3PLAIN_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_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) $(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    $(othersrc) Unhandled sources.
+# @param    $(outbase)  Output basename (full). Use this for list files and such.
+TOOL_GXX3PLAIN_LINK_LIBRARY_OUTPUT = $(out).ar-script
+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),$(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 = $(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) $(objs)\
+		$(filter %.def, $(othersrc))\
+		$(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)		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 = $(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, $(BUILD_TARGET)),$(call TOOL_GXX3PLAIN_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%,%,$(basename $(lib))), $(lib)))
+endef
+
Index: /trunk/kBuild/tools/GXX4MACHO.kmk
===================================================================
--- /trunk/kBuild/tools/GXX4MACHO.kmk	(revision 971)
+++ /trunk/kBuild/tools/GXX4MACHO.kmk	(revision 971)
@@ -0,0 +1,255 @@
+# $Id$
+## @file
+#
+# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-o, for building C++ code.
+#
+# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@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
+#
+#
+
+TOOL_GXX4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-o, for building C++ code.
+
+# Tool Specific Properties
+TOOL_GXX4MACHO_CC  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX4MACHO_CXX ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX4MACHO_AS  ?= gcc$(HOSTSUFF_EXE)
+TOOL_GXX4MACHO_LD  ?= g++$(HOSTSUFF_EXE)
+TOOL_GXX4MACHO_LD_SYSMOD ?= g++$(HOSTSUFF_EXE)
+ifndef TOOL_GXX4MACHO_LDFLAGS.$(BUILD_TARGET)
+TOOL_GXX4MACHO_LDFLAGS.dll ?= -dynamiclib
+else
+TOOL_GXX4MACHO_LDFLAGS.dll ?= $(TOOL_GXX4MACHO_LDFLAGS.$(BUILD_TARGET))
+endif
+TOOL_GXX4MACHO_LDFLAGS.sysmod ?= -r
+#TOOL_GXX4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+
+ifdef SLKRUNS
+TOOL_GXX4MACHO_CC  += -fmessage-length=0
+TOOL_GXX4MACHO_CXX += -fmessage-length=0
+endif
+
+# General Properties used by kBuild
+TOOL_GXX4MACHO_COBJSUFF         ?= .o
+TOOL_GXX4MACHO_CFLAGS           ?=
+TOOL_GXX4MACHO_CFLAGS.debug     ?= -g
+TOOL_GXX4MACHO_CFLAGS.profile   ?= -g -O2 #-pg
+TOOL_GXX4MACHO_CFLAGS.release   ?= -O2
+TOOL_GXX4MACHO_CINCS            ?=
+TOOL_GXX4MACHO_CDEFS            ?=
+
+TOOL_GXX4MACHO_CXXOBJSUFF       ?= .o
+TOOL_GXX4MACHO_CXXOBJSUFF       ?= .o
+TOOL_GXX4MACHO_CXXFLAGS         ?=
+TOOL_GXX4MACHO_CXXFLAGS.debug   ?= -g
+TOOL_GXX4MACHO_CXXFLAGS.profile ?= -g -O2 #-pg
+TOOL_GXX4MACHO_CXXFLAGS.release ?= -O2
+TOOL_GXX4MACHO_CXXINCS          ?=
+TOOL_GXX4MACHO_CXXDEFS          ?=
+
+TOOL_GXX4MACHO_ASFLAGS          ?= -x assembler-with-cpp
+TOOL_GXX4MACHO_ASFLAGS.debug    ?= -g
+TOOL_GXX4MACHO_ASFLAGS.profile  ?= -g
+TOOL_GXX4MACHO_ASOBJSUFF        ?= .o
+
+TOOL_GXX4MACHO_AR               ?= ar$(HOSTSUFF_EXE)
+TOOL_GXX4MACHO_ARFLAGS          ?= -c -rs
+TOOL_GXX4MACHO_ARLIBSUFF        ?= .a
+
+TOOL_GXX4MACHO_LDFLAGS          ?=
+TOOL_GXX4MACHO_LDFLAGS.debug    ?= -g
+TOOL_GXX4MACHO_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_GXX4MACHO_COMPILE_C_OUTPUT =
+TOOL_GXX4MACHO_COMPILE_C_DEPEND =
+TOOL_GXX4MACHO_COMPILE_C_DEPORD =
+define TOOL_GXX4MACHO_COMPILE_C_CMDS
+	$(QUIET)$(TOOL_GXX4MACHO_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_GXX4MACHO_COMPILE_CXX_OUTPUT =
+TOOL_GXX4MACHO_COMPILE_CXX_DEPEND =
+TOOL_GXX4MACHO_COMPILE_CXX_DEPORD =
+define TOOL_GXX4MACHO_COMPILE_CXX_CMDS
+	$(QUIET)$(TOOL_GXX4MACHO_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_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) $(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    $(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
+	$(call xargs,$(QUIET)$(TOOL_GXX4MACHO_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_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).map $(outbase).rsp
+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 $(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%,%,$(basename $(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_GXX4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
+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 $(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%,%,$(basename $(lib))), $(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_GXX4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
+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 $(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%,%,$(basename $(lib))), $(lib)))
+endef
+
