Index: trunk/kBuild/footer.kmk
===================================================================
--- trunk/kBuild/footer.kmk	(revision 82)
+++ trunk/kBuild/footer.kmk	(revision 83)
@@ -34,5 +34,5 @@
 
 # all targets.
-ALL_TARGETS := $(LIBRARIES) $(PROGRAMS) $(DLLS) $(DRIVERS) $(OTHERS)
+ALL_TARGETS := $(LIBRARIES) $(PROGRAMS) $(DLLS) $(SYSMODS) $(OTHERS)
 
 # dependency files.
@@ -49,4 +49,5 @@
 _DLLS   :=
 _EXES   :=
+_SYSMODS:=
 _DIRS   :=
 
@@ -694,6 +695,87 @@
 
 #
-# DRIVERS
-#
+# SYSMODS
+#
+
+## System moduler (one).
+# @param    $(target)   Normalized target (program) name.
+define def_sysmod
+# source -> object
+$(eval $(def_target_sources))
+
+# library
+$(eval tool        := $(call _TARGET_TOOL,$(target),LD))
+$(eval flags       :=\
+	$(TOOL_$(tool)_LDFLAGS)\
+	$(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
+	$(LDFLAGS)\
+	$(LDFLAGS.$(BUILD_TYPE))\
+	$($(target)_LDFLAGS)\
+	$($(target)_LDFLAGS.$(BUILD_TYPE))\
+)
+$(eval syssuff     := $(firstword $($(target)_SYSSUFF) $($(target)_SYSSUFF) $(TOOL_$(tool)_LDSYSSUFF) $(SUFF_SYS)))
+$(eval outbase     := $(call _TARGET_BASE,$(target),$(target)))
+$(eval sys         := $(outbase)$(syssuff))
+$(eval objs         = $(_OBJS_$(target)))
+$(eval libs        :=\
+	$($(target)_LIBS.$(BUILD_TYPE))\
+	$($(target)_LIBS)\
+	$(LIBS.$(BUILD_TYPE))\
+	$(LIBS)\
+	$(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
+	$(TOOL_$(tool)_LIBS)\
+)
+$(eval libpath    :=\
+	$($(target)_LIBPATH.$(BUILD_TYPE))\
+	$($(target)_LIBPATH)\
+	$(LIBPATH.$(BUILD_TYPE))\
+	$(LIBPATH)\
+	$(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
+	$(TOOL_$(tool)_LIBPATH)\
+)
+$(eval dirdep      := $(dir $(sys)).dir_created)
+## @todo fix dependencies
+$(eval deps        := )
+#
+$(eval deffile    := $(strip $(firstword
+	$($(target)_DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\
+	$($(target)_DEFFILE.$(BUILD_TARGET))\
+	$($(target)_DEFFILE.$(BUILD_TYPE))\
+	$($(target)_DEFFILE)\
+	$(DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\
+	$(DEFFILE.$(BUILD_TARGET))\
+	$(DEFFILE.$(BUILD_TYPE))\
+	$(DEFFILE)\
+)))
+$(eval custom_pre    := $(strip $(firstword
+	$($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
+	$($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
+	$($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
+	$($(target)_CUSTOM_PRE)\
+	$(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
+	$(CUSTOM_PRE.$(BUILD_TARGET))\
+	$(CUSTOM_PRE.$(BUILD_TYPE))\
+	$(CUSTOM_PRE)\
+)))
+$(eval custom_post    := $(strip $(firstword
+	$($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
+	$($(target)_CUSTOM_POST.$(BUILD_TARGET))\
+	$($(target)_CUSTOM_POST.$(BUILD_TYPE))\
+	$($(target)_CUSTOM_POST)\
+	$(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
+	$(CUSTOM_POST.$(BUILD_TARGET))\
+	$(CUSTOM_POST.$(BUILD_TYPE))\
+	$(CUSTOM_POST)\
+)))
+
+$(eval $(TOOL_$(tool)_LINK_SYSMOD))
+
+_OBJS += $(_OBJS_$(target))
+_SYSMODS += $(sys)
+_OUT_FILES += $(sys)
+endef
+
+# Process libraries
+$(foreach target, $(SYSMODS), $(eval $(def_sysmod)))
 
 
@@ -713,5 +795,5 @@
 # Directories.
 #
-_OUTPUT_FILES := $(_OBJS) $(_LIBS) $(_EXES) $(_DLLS)
+_OUTPUT_FILES := $(_OBJS) $(_LIBS) $(_EXES) $(_DLLS) $(_SYSMODS)
 _DIRFILES := $(sort $(addsuffix /.dir_created,$(_DIRS)) $(addsuffix .dir_created,$(dir $(_OUTPUT_FILES))))
 
@@ -805,6 +887,6 @@
 
 ## PASS: binaries
-# This pass builds binary targets, i.e. programs, dlls, drivers and stuff.
-pass_binaries_doit: $(_DLLS) $(_EXES) $(_KMODS) $(_OTHER_BINARIES)
+# This pass builds binary targets, i.e. programs, dlls, system modules and stuff.
+pass_binaries_doit: $(_DLLS) $(_EXES) $(_SYSMODS) $(_OTHER_BINARIES)
 pass := binaries
 PASS := BINARIES
@@ -812,5 +894,5 @@
 
 ## PASS: others
-# This pass builds binary targets, i.e. programs, dlls, drivers and stuff.
+# This pass builds other targets.
 pass_others_doit: $(_OTHERS)
 pass := others
@@ -872,5 +954,5 @@
 programs:  $(_EXES)
 dlls:      $(_DLLS)	
-kernelmodules: $(_KMODS)
+sysmods:   $(_SYSMODS)
 
 
Index: trunk/kBuild/header.kmk
===================================================================
--- trunk/kBuild/header.kmk	(revision 82)
+++ trunk/kBuild/header.kmk	(revision 83)
@@ -84,5 +84,5 @@
 BUILD_PLATFORM      := win32
 endif
-ifeq ($(BUILD_PLATFORM),WIN32)
+ifeq ($(BUILD_PLATFORM),win32)
 _BUILD_PLATFORM_OK  := 1
 endif
@@ -180,5 +180,5 @@
 ifeq ($(BUILD_PLATFORM),os2)
 PATH_TOOLS          := $(PATH_TOOLS_OS2)
-EXEC_X86_WIN32      := $(PATH_TOOLS)/bin/innopec.exe
+EXEC_X86_WIN32      := innopec.exe
 HOSTSUFF_EXE        := .exe
 endif
Index: trunk/kBuild/tools/VCC70.kmk
===================================================================
--- trunk/kBuild/tools/VCC70.kmk	(revision 82)
+++ trunk/kBuild/tools/VCC70.kmk	(revision 83)
@@ -50,5 +50,5 @@
 TOOL_VCC70_ASOBJSUFF          := .obj
 
-TOOL_VCC70_AR                 := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/ar$(HOSTSUFF_EXE)
+TOOL_VCC70_AR                 := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/lib.exe
 TOOL_VCC70_ARFLAGS            := -nologo
 TOOL_VCC70_ARLIBSUFF          := .lib
@@ -78,5 +78,5 @@
 	$(TOOL_VCC70_CC) -c\
 		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-		-Fo:$$@\
+		-Fo$$@\
 		$(PATH_CURRENT)/$(source)		
 		
@@ -102,5 +102,5 @@
 	$(TOOL_VCC70_CXX) -c\
 		$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-		-Fo:$$@\
+		-Fo$$@\
 		$(PATH_CURRENT)/$(source)		
 		
@@ -156,2 +156,33 @@
 endef
 
+
+## Link system module (windows aka driver, linux aka kernel module)
+# @param    $(target)   Normalized main target name.
+# @param    $(sys)		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	$(deffile)  Definition file. (optional, PC only)
+# @param	$(custom_pre)   Custom step invoked before linking.
+# @param	$(custom_post)  Custom step invoked after linking.
+#
+# @param    $(outbase)  Output basename (full). Use this for list files and such.
+define TOOL_VCC70_LINK_SYSMOD
+$(warning dbg: TOOL_VCC70_LINK_SYSMOD: target=$(target) sys=$(sys) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
+$(sys): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
+	$(call MSG_L1,Creating Program $$@)
+ifneq ($(custom_pre),)
+	$(eval $(custom_pre))
+endif	
+	$(TOOL_VCC70_LD) $(flags) \
+		/OUT:$$@ $(objs) \
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+ifneq ($(custom_post),)
+	$(eval $(custom_post))
+endif	
+	
+endef
+
