Index: trunk/kBuild/tools/GCC4MACH.kmk
===================================================================
--- trunk/kBuild/tools/GCC4MACH.kmk	(revision 559)
+++ 	(revision )
@@ -1,242 +1,0 @@
-# $Id: GCC4MACH.kmk 474 2006-07-16 03:43:04Z bird $
-## @file
-#
-# kBuild Tool Config - Darwin / Mac OS X / Mach GCC (v4).
-#
-# Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@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_GCC4MACH                    := Mach GCC v4
-
-TOOL_GCC4MACH_CC                 := gcc$(HOSTSUFF_EXE)
-TOOL_GCC4MACH_COBJSUFF           := .o
-TOOL_GCC4MACH_CFLAGS             := -g
-TOOL_GCC4MACH_CFLAGS.debug       := -O0
-TOOL_GCC4MACH_CFLAGS.release     := -O2
-TOOL_GCC4MACH_CFLAGS.profile     := -O2 #-pg
-TOOL_GCC4MACH_CINCS              :=
-TOOL_GCC4MACH_CDEFS              :=
-
-TOOL_GCC4MACH_CXX                := g++$(HOSTSUFF_EXE)
-TOOL_GCC4MACH_CXXOBJSUFF         := .o
-TOOL_GCC4MACH_CXXOBJSUFF         := .o
-TOOL_GCC4MACH_CXXFLAGS           := -g
-TOOL_GCC4MACH_CXXFLAGS.debug     := -O0
-TOOL_GCC4MACH_CXXFLAGS.release   := -O2
-TOOL_GCC4MACH_CXXFLAGS.profile   := -O2 #-pg
-TOOL_GCC4MACH_CXXINCS            :=
-TOOL_GCC4MACH_CXXDEFS            :=
-
-TOOL_GCC4MACH_AS                 := gcc$(HOSTSUFF_EXE)
-TOOL_GCC4MACH_ASFLAGS            := -g -x assembler-with-cpp
-TOOL_GCC4MACH_ASOBJSUFF          := .o
-
-TOOL_GCC4MACH_AR                 := ar$(HOSTSUFF_EXE)
-TOOL_GCC4MACH_ARFLAGS            := -c -rs
-TOOL_GCC4MACH_ARLIBSUFF          := .a
-
-TOOL_GCC4MACH_AR_IMP             := $(ECHO) not supported!
-
-TOOL_GCC4MACH_LD                 := g++$(HOSTSUFF_EXE)
-TOOL_GCC4MACH_LD_SYSMOD          := ld$(HOSTSUFF_EXE)
-TOOL_GCC4MACH_LDFLAGS            :=
-TOOL_GCC4MACH_LDFLAGS.debug      := -g
-TOOL_GCC4MACH_LDFLAGS.release    := -s
-ifndef TOOL_GCC4MACH_LDFLAGS.$(BUILD_TARGET)
-TOOL_GCC4MACH_LDFLAGS.dll        := -dynamiclib
-else
-TOOL_GCC4MACH_LDFLAGS.dll        := $(TOOL_GCC4MACH_LDFLAGS.$(BUILD_TARGET))
-endif
-TOOL_GCC4MACH_LDFLAGS.sysmod     := -r
-#TOOL_GCC4MACH_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)))
-TOOL_GCC4MACH_LD_MAP              =
-TOOL_GCC4MACH_LD_SYSMOD_MAP       =
-
-ifdef SLKRUNS
-TOOL_GCC4MACH_CC  += -fmessage-length=0
-TOOL_GCC4MACH_CXX += -fmessage-length=0
-endif
-
-
-## 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_GCC4MACH_COMPILE_C_OUTPUT =
-TOOL_GCC4MACH_COMPILE_C_DEPEND =
-TOOL_GCC4MACH_COMPILE_C_DEPORD =
-define TOOL_GCC4MACH_COMPILE_C_CMDS
-	$(TOOL_GCC4MACH_CC) -c\
-		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-		-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-		-o $(obj)\
-		$(call 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_GCC4MACH_COMPILE_CXX_OUTPUT =
-TOOL_GCC4MACH_COMPILE_CXX_DEPEND =
-TOOL_GCC4MACH_COMPILE_CXX_DEPORD =
-define TOOL_GCC4MACH_COMPILE_CXX_CMDS
-	$(TOOL_GCC4MACH_CXX) -c\
-		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-		-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-		-o $(obj)\
-		$(call 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_GCC4MACH_COMPILE_AS_OUTPUT =
-TOOL_GCC4MACH_COMPILE_AS_DEPEND =
-TOOL_GCC4MACH_COMPILE_AS_DEPORD =
-define TOOL_GCC4MACH_COMPILE_AS_CMDS
-	$(TOOL_GCC4MACH_AS) -c\
-		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-		-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-		-o $(obj)\
-		$(call 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_GCC4MACH_LINK_LIBRARY_OUTPUT = 
-TOOL_GCC4MACH_LINK_LIBRARY_DEPEND = $(filter %.a %.lib %.def %.imp,$(othersrc))
-TOOL_GCC4MACH_LINK_LIBRARY_DEPORD =
-define TOOL_GCC4MACH_LINK_LIBRARY_CMDS
-	$(TOOL_GCC4MACH_AR) $(flags) $(out) $(objs) $(filter %.a %.lib, $(othersrc))
-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_GCC4MACH_LINK_PROGRAM_OUTPUT = $(outbase).map
-TOOL_GCC4MACH_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
-TOOL_GCC4MACH_LINK_PROGRAM_DEPORD =
-define TOOL_GCC4MACH_LINK_PROGRAM_CMDS
-	$(TOOL_GCC4MACH_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_GCC4MACH_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_GCC4MACH_LINK_DLL_OUTPUT = $(outbase).map
-TOOL_GCC4MACH_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
-TOOL_GCC4MACH_LINK_DLL_DEPORD =
-define TOOL_GCC4MACH_LINK_DLL_CMDS
-	$(TOOL_GCC4MACH_LD) $(TOOL_GCC4MACH_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC4MACH_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_GCC4MACH_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_GCC4MACH_LINK_SYSMOD_OUTPUT = $(outbase).map
-TOOL_GCC4MACH_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
-TOOL_GCC4MACH_LINK_SYSMOD_DEPORD =
-define TOOL_GCC4MACH_LINK_SYSMOD_CMDS
-	$(TOOL_GCC4MACH_LD_SYSMOD) $(TOOL_GCC4MACH_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_GCC4MACH_LD_SYSMOD_MAP,$(outbase).map)
-endef
-
Index: trunk/kBuild/tools/GCC4MACHO.kmk
===================================================================
--- trunk/kBuild/tools/GCC4MACHO.kmk	(revision 560)
+++ trunk/kBuild/tools/GCC4MACHO.kmk	(revision 560)
@@ -0,0 +1,242 @@
+# $Id: GCC4MACH.kmk 474 2006-07-16 03:43:04Z bird $
+## @file
+#
+# kBuild Tool Config - Darwin / Mac OS X / Mach-O GCC (v4).
+#
+# Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@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_GCC4MACHO                    := Mach-O GCC v4
+
+TOOL_GCC4MACHO_CC                 := gcc$(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_COBJSUFF           := .o
+TOOL_GCC4MACHO_CFLAGS             := -g
+TOOL_GCC4MACHO_CFLAGS.debug       := -O0
+TOOL_GCC4MACHO_CFLAGS.release     := -O2
+TOOL_GCC4MACHO_CFLAGS.profile     := -O2 #-pg
+TOOL_GCC4MACHO_CINCS              :=
+TOOL_GCC4MACHO_CDEFS              :=
+
+TOOL_GCC4MACHO_CXX                := g++$(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_CXXOBJSUFF         := .o
+TOOL_GCC4MACHO_CXXOBJSUFF         := .o
+TOOL_GCC4MACHO_CXXFLAGS           := -g
+TOOL_GCC4MACHO_CXXFLAGS.debug     := -O0
+TOOL_GCC4MACHO_CXXFLAGS.release   := -O2
+TOOL_GCC4MACHO_CXXFLAGS.profile   := -O2 #-pg
+TOOL_GCC4MACHO_CXXINCS            :=
+TOOL_GCC4MACHO_CXXDEFS            :=
+
+TOOL_GCC4MACHO_AS                 := gcc$(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_ASFLAGS            := -g -x assembler-with-cpp
+TOOL_GCC4MACHO_ASOBJSUFF          := .o
+
+TOOL_GCC4MACHO_AR                 := ar$(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_ARFLAGS            := -c -rs
+TOOL_GCC4MACHO_ARLIBSUFF          := .a
+
+TOOL_GCC4MACHO_AR_IMP             := $(ECHO) not supported!
+
+TOOL_GCC4MACHO_LD                 := g++$(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_LD_SYSMOD          := ld$(HOSTSUFF_EXE)
+TOOL_GCC4MACHO_LDFLAGS            :=
+TOOL_GCC4MACHO_LDFLAGS.debug      := -g
+TOOL_GCC4MACHO_LDFLAGS.release    := -s
+ifndef TOOL_GCC4MACHO_LDFLAGS.$(BUILD_TARGET)
+TOOL_GCC4MACHO_LDFLAGS.dll        := -dynamiclib
+else
+TOOL_GCC4MACHO_LDFLAGS.dll        := $(TOOL_GCC4MACHO_LDFLAGS.$(BUILD_TARGET))
+endif
+TOOL_GCC4MACHO_LDFLAGS.sysmod     := -r
+#TOOL_GCC4MACHO_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)))
+TOOL_GCC4MACHO_LD_MAP              =
+TOOL_GCC4MACHO_LD_SYSMOD_MAP       =
+
+ifdef SLKRUNS
+TOOL_GCC4MACHO_CC  += -fmessage-length=0
+TOOL_GCC4MACHO_CXX += -fmessage-length=0
+endif
+
+
+## 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_OUTPUT =
+TOOL_GCC4MACHO_COMPILE_C_DEPEND =
+TOOL_GCC4MACHO_COMPILE_C_DEPORD =
+define TOOL_GCC4MACHO_COMPILE_C_CMDS
+	$(TOOL_GCC4MACHO_CC) -c\
+		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+		-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+		-o $(obj)\
+		$(call 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_GCC4MACHO_COMPILE_CXX_OUTPUT =
+TOOL_GCC4MACHO_COMPILE_CXX_DEPEND =
+TOOL_GCC4MACHO_COMPILE_CXX_DEPORD =
+define TOOL_GCC4MACHO_COMPILE_CXX_CMDS
+	$(TOOL_GCC4MACHO_CXX) -c\
+		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+		-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+		-o $(obj)\
+		$(call 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_GCC4MACHO_COMPILE_AS_OUTPUT =
+TOOL_GCC4MACHO_COMPILE_AS_DEPEND =
+TOOL_GCC4MACHO_COMPILE_AS_DEPORD =
+define TOOL_GCC4MACHO_COMPILE_AS_CMDS
+	$(TOOL_GCC4MACHO_AS) -c\
+		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
+		-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
+		-o $(obj)\
+		$(call 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_GCC4MACHO_LINK_LIBRARY_OUTPUT = 
+TOOL_GCC4MACHO_LINK_LIBRARY_DEPEND = $(filter %.a %.lib %.def %.imp,$(othersrc))
+TOOL_GCC4MACHO_LINK_LIBRARY_DEPORD =
+define TOOL_GCC4MACHO_LINK_LIBRARY_CMDS
+	$(TOOL_GCC4MACHO_AR) $(flags) $(out) $(objs) $(filter %.a %.lib, $(othersrc))
+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).map
+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
+	$(TOOL_GCC4MACHO_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_GCC4MACHO_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_GCC4MACHO_LINK_DLL_OUTPUT = $(outbase).map
+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
+	$(TOOL_GCC4MACHO_LD) $(TOOL_GCC4MACHO_LDFLAGS.dll) $(flags) -o $(out)\
+		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC4MACHO_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_GCC4MACHO_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_GCC4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).map
+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
+	$(TOOL_GCC4MACHO_LD_SYSMOD) $(TOOL_GCC4MACHO_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_GCC4MACHO_LD_SYSMOD_MAP,$(outbase).map)
+endef
+
