Index: trunk/kBuild/tools/GCC3.kmk
===================================================================
--- trunk/kBuild/tools/GCC3.kmk	(revision 205)
+++ trunk/kBuild/tools/GCC3.kmk	(revision 206)
@@ -131,12 +131,36 @@
 # @param	$(dirdep)   Directory creation dependency.
 # @param	$(deps)		Other dependencies.
-#
-# @param    $(outbase)  Output basename (full). Use this for list files and such.
+# @param	$(othersrc) Unhandled sources.
+#
+# @param    $(outbase)  Output basename (full). Use this for list files and such.
+
+define TOOL_GCC3_LINK_LIBRARY_ADDMODE
+
+	echo "ADDMOD $(o)" >> $$@.ar-script
+endef
+
+define TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB
+
+	$(MKDIR) -p $(dir $(outbase))ar.extract/$(notdir $(srclib))
+	cd $(dir $(outbase))ar.extract/$(notdir $(srclib)) && $(TOOL_GCC3_AR) x $(srclib)
+	for o in `$(TOOL_GCC3_AR) t $(srclib)`; do echo "ADDMOD $(dir $(outbase))ar.extract/$(notdir $(srclib))/$$$${o}" >> $$@.ar-script; done
+endef
+
 define TOOL_GCC3_LINK_LIBRARY
-#$ (warning dbg: TOOL_GCC3_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))
-$(lib): $(dirdep) $(objs) $(deps)
+#$ (warning dbg: TOOL_GCC3_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
+$(lib): $(dirdep) $(objs) $(deps) $(filter %.a %.lib,$(othersrc))
 	$(call MSG_L1,Creating Library $$@)
 	$(RM) -f $$@
+ifneq ($(strip $(filter %.a %.lib,$(othersrc))),,)
+	echo "CREATE $$@" > $$@.ar-script
+	$(foreach o, $(objs), $(TOOL_GCC3_LINK_LIBRARY_ADDMOD))
+	$(foreach srclib, $(filter %.a %.lib,$(othersrc)),$(TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB))
+	echo "SAVE" >> $$@.ar-script
+	echo "END" >> $$@.ar-script
+	$(TOOL_GCC3_AR) -M < $$@.ar-script
+	$(RM) -Rf "$(dir $(outbase))ar.extract/"
+else
 	$(TOOL_GCC3_AR) $(flags) $$@ $(objs)
+endif
 
 endef
Index: trunk/kBuild/tools/GCC3OMF.kmk
===================================================================
--- trunk/kBuild/tools/GCC3OMF.kmk	(revision 205)
+++ trunk/kBuild/tools/GCC3OMF.kmk	(revision 206)
@@ -130,12 +130,13 @@
 # @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.
 define TOOL_GCC3OMF_LINK_LIBRARY
-#$ (warning dbg: TOOL_GCC3OMF_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))
-$(lib): $(dirdep) $(objs) $(deps)
+#$ (warning dbg: TOOL_GCC3OMF_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
+$(lib): $(dirdep) $(objs) $(deps) $(filter %.a %.lib,$(othersrc))
 	$(call MSG_L1,Creating Library $$@)
 	$(RM) -f $$@
-	$(TOOL_GCC3OMF_AR) $(flags) $$@ $(objs)
+	$(TOOL_GCC3OMF_AR) $(flags) $$@ $(objs) $(filter %.a %.lib,$(othersrc))
 
 endef
@@ -158,5 +159,5 @@
 define TOOL_GCC3OMF_LINK_PROGRAM
 #$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) exe=$(exe) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
-$(exe): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
+$(exe): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def, $(othersrc))
 	$(call MSG_L1,Creating Program $$@)
 ifneq ($(custom_pre),)
@@ -164,6 +165,7 @@
 endif
 	$(TOOL_GCC3OMF_LD) $(flags) -o $$@ $(objs) \
-	$(foreach p,$(libpath), -L$(p)) \
-	$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
+		$(filter %.def, $(othersrc)) \
+		$(foreach p,$(libpath), -L$(p)) \
+		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
 ifneq ($(custom_post),)
 	$(eval $(custom_post))
@@ -220,5 +222,5 @@
 define TOOL_GCC3OMF_LINK_SYSMOD
 #$ (warning dbg: TOOL_GCC3OMF_LINK_SYSMOD: target=$(target) sys=$(sys) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
-$(sys): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
+$(sys): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def, $(othersrc))
 	$(call MSG_L1,Creating Program $$@)
 ifneq ($(custom_pre),)
@@ -226,4 +228,5 @@
 endif
 	$(TOOL_GCC3OMF_LD_SYSMOD) $(TOOL_GCC3OMF_LDFLAGS.sysmod) $(flags) -o $$@ $(objs) \
+		$(filter %.def, $(othersrc)) \
 		$(foreach p,$(libpath), -L$(p)) \
 		$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
Index: trunk/kBuild/tools/VCC70.kmk
===================================================================
--- trunk/kBuild/tools/VCC70.kmk	(revision 205)
+++ trunk/kBuild/tools/VCC70.kmk	(revision 206)
@@ -141,6 +141,6 @@
 	$(call MSG_L1,Creating Library $$@)
 	$(RM) -f $$@
-	$(TOOL_VCC70_AR) $(flags) /OUT:$(lib) $(subst /,\\,$(objs)) \
-		$(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
+	$(TOOL_VCC70_AR) $(flags) /OUT:$(lib) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
+        $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
 
 endef
@@ -163,5 +163,5 @@
 define TOOL_VCC70_LINK_PROGRAM
 #$ (warning dbg: TOOL_VCC70_LINK_PROGRAM: target=$(target) exe=$(exe) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
-$(exe): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
+$(exe): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def,$(othersrc))
 	$(call MSG_L1,Creating Program $$@)
 ifneq ($(custom_pre),)
@@ -201,5 +201,5 @@
 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) othersrc=$(othersrc) outbase=$(outbase))
-$(sys): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
+$(sys): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def %.exp %.res,$(othersrc))
 	$(call MSG_L1,Creating Program $$@)
 ifneq ($(custom_pre),)
@@ -239,5 +239,5 @@
 define TOOL_VCC70_LINK_DLL
 #$ (warning dbg: TOOL_VCC70_LINK_DLL: target=$(target) dll=$(dll) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
-$(dll): $(dirdep) $(call DIRDEP,$(PATH_LIB)) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
+$(dll): $(dirdep) $(call DIRDEP,$(PATH_LIB)) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def %.exp %.res,$(othersrc))
 	$(call MSG_L1,Creating Program $$@)
 ifneq ($(custom_pre),)
