Index: /trunk/src/VBox/Runtime/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Runtime/Makefile.kmk	(revision 95126)
+++ /trunk/src/VBox/Runtime/Makefile.kmk	(revision 95127)
@@ -2361,4 +2361,6 @@
 	r3/win/dllmain-win.cpp \
 	 $(VBoxRT_0_OUTDIR)/VBoxRT.def
+VBoxRT_CLEAN.win              += \
+	$(VBoxRT_0_OUTDIR)/VBoxRT.def
 VBoxRT_INCS                   := $(RuntimeR3_INCS)
 VBoxRT_INCS.$(KBUILD_TARGET)  := $(RuntimeR3_INCS.$(KBUILD_TARGET))
@@ -2415,24 +2417,4 @@
 	/delayload:oleaut32.dll \
 	/delayload:advapi32.dll
-
-if1of ($(DLLS), VBoxRT)
-VBoxRT_CLEAN += $(VBoxRT_0_OUTDIR)/VBoxRT.def
-$$(VBoxRT_0_OUTDIR)/VBoxRT.def: \
-		$(PATH_SUB_CURRENT)/r3/win/VBoxRT-$$(if-expr $$(KBUILD_TARGET_ARCH) == amd64,win64,win32).def \
-		$(if-expr defined(VBOX_WITH_OPENSSL3)\
-		,$(PATH_SUB_CURRENT)/r3/win/VBoxRT-openssl-3.0.def \
-		,$(PATH_SUB_CURRENT)/r3/win/VBoxRT-openssl-1.1plus.def )\
-		$(if-expr "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" && defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES)\
-		,$(PATH_SUB_CURRENT)/r3/win/VBoxRT-msvcr100-win32.def ,) \
-		| $$(dir $$@) #$(PATH_SUB_CURRENT)/r3/win/VBoxRT-msvcp100-win32.def
-	$(RM) -f -- $@
-	$(SED)  --output "$@" \
-		$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86"  ,-e "/not-x86/d",  -e "/only-x86/d") \
-		$(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64",-e "/not-amd64/d",-e "/only-amd64/d") \
-		$(if-expr "$(KBUILD_TARGET_ARCH)" == "arm64",-e "/not-arm64/d",-e "/only-arm64/d") \
-		$(if-expr "$(substr $(if-expr $(KBUILD_TARGET) != 'win',$(VBOX_GCC_std), $(VBOX_VCC_std)),-2)" >= "17" \
-		                                            ,-e "/before-noexcept/d", -e "/after-noexcept/d") \
-		$^
-endif
 
 if1of (VBoxRT,$(DLLS))
@@ -2503,4 +2485,27 @@
 endif # linux
 
+if1of ($(DLLS), VBoxRT)
+ # .def file for windows.
+ $(call KB_FN_DO_PASS0_ON_TARGET,VBoxRT)
+ $(VBoxRT_0_OUTDIR)/VBoxRT.def: \
+		$(PATH_SUB_CURRENT)/r3/win/VBoxRT-$$(if-expr $$(KBUILD_TARGET_ARCH) == amd64,win64,win32).def \
+		$(if-expr defined(VBOX_WITH_OPENSSL3)\
+		,$(PATH_SUB_CURRENT)/r3/win/VBoxRT-openssl-3.0.def \
+		,$(PATH_SUB_CURRENT)/r3/win/VBoxRT-openssl-1.1plus.def )\
+		$(if-expr "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" && defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES)\
+		,$(PATH_SUB_CURRENT)/r3/win/VBoxRT-msvcr100-win32.def ,) \
+		| $$(dir $$@) #$(PATH_SUB_CURRENT)/r3/win/VBoxRT-msvcp100-win32.def
+	$(RM) -f -- $@
+	$(SED)  --output "$@" \
+		$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86"  ,-e "/not-x86/d",  -e "/only-x86/d") \
+		$(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64",-e "/not-amd64/d",-e "/only-amd64/d") \
+		$(if-expr "$(KBUILD_TARGET_ARCH)" == "arm64",-e "/not-arm64/d",-e "/only-arm64/d") \
+		$(if-expr "$(substr $(if-expr $(KBUILD_TARGET) != 'win',$(VBOX_GCC_std), $(VBOX_VCC_std)),-2)" >= "17" \
+		                                            ,-e "/before-noexcept/d", -e "/after-noexcept/d") \
+		$^
+	$(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
+ $(call KB_FN_AUTO_CMD_DEPS,$(VBoxRT_0_OUTDIR)/VBoxRT.def)
+endif
+
 
 #
@@ -2557,6 +2562,13 @@
 	$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def
 VBoxRT-x86_CLEAN += $(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def
+
+if1of (VBoxRT-x86,$(DLLS))
+ $(call VBOX_SET_VER_INFO_DLL,VBoxRT-x86,VirtualBox 32-bit Runtime)
+endif
+
 if1of ($(DLLS), VBoxRT-x86)
-$$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def: \
+ # .def file for windows.
+ $(call KB_FN_DO_PASS0_ON_TARGET,VBoxRT-x86)
+ $(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def: \
 		$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win32.def \
 		| $$(dir $$@) # Hopefully no need to export openssl here.
@@ -2568,9 +2580,7 @@
 		$(if-expr "$(substr $(if-expr $(KBUILD_TARGET) != 'win',$(VBOX_GCC_std), $(VBOX_VCC_std)),-2)" >= "17" \
 		                                            ,-e "/before-noexcept/d", -e "/after-noexcept/d") \
-		$^
-endif
-
-if1of (VBoxRT-x86,$(DLLS))
- $(call VBOX_SET_VER_INFO_DLL,VBoxRT-x86,VirtualBox 32-bit Runtime)
+		$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win32.def
+	$(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
+ $(call KB_FN_AUTO_CMD_DEPS,$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def)
 endif
 
@@ -2602,22 +2612,24 @@
  VBoxRTStableCheck_CLEAN = \
  	$(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm
+ $(call KB_FN_DO_PASS0_ON_TARGET,VBoxRTStableCheck)
+
  ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
-$$(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm: \
-       $(PATH_SUB_CURRENT)/VBox/DefToAsmExterns.sed \
-	$(PATH_SUB_CURRENT)/VBox/VBoxRTImp.def \
-	$(PATH_SUB_CURRENT)/VBox/VBoxRTImp-vcc64.def \
-	$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win64.def \
-	| $$(dir $$@)
+ $(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm: \
+ 		$(PATH_SUB_CURRENT)/VBox/DefToAsmExterns.sed \
+ 		$(PATH_SUB_CURRENT)/VBox/VBoxRTImp.def \
+ 		$(PATH_SUB_CURRENT)/VBox/VBoxRTImp-vcc64.def \
+ 		$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win64.def \
+ 		| $$(dir $$@)
  else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
-$$(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm: \
-       $(PATH_SUB_CURRENT)/VBox/DefToAsmExternsVcc32.sed \
-	$(PATH_SUB_CURRENT)/VBox/VBoxRTImp.def \
-	$(PATH_SUB_CURRENT)/VBox/VBoxRTImp-vcc32.def \
-	$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win32.def | $$(dir $$@)
+ $(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm: \
+ 		$(PATH_SUB_CURRENT)/VBox/DefToAsmExternsVcc32.sed \
+ 		$(PATH_SUB_CURRENT)/VBox/VBoxRTImp.def \
+ 		$(PATH_SUB_CURRENT)/VBox/VBoxRTImp-vcc32.def \
+ 		$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win32.def | $$(dir $$@)
  else
-$$(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm: \
-       $(PATH_SUB_CURRENT)/VBox/DefToAsmExterns.sed \
-	$(PATH_SUB_CURRENT)/VBox/VBoxRTImp.def \
-	$(PATH_SUB_CURRENT)/VBox/VBoxRTImp-gcc.def | $$(dir $$@)
+ $(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm: \
+ 		$(PATH_SUB_CURRENT)/VBox/DefToAsmExterns.sed \
+ 		$(PATH_SUB_CURRENT)/VBox/VBoxRTImp.def \
+ 		$(PATH_SUB_CURRENT)/VBox/VBoxRTImp-gcc.def | $$(dir $$@)
  endif
 	$(APPEND) -tn "$@" '%include "iprt/asmdefs.mac"' ''
@@ -2634,4 +2646,7 @@
 		                                            ,-e "/before-noexcept/d", -e "/after-noexcept/d") \
 		-f "$<" $(filter %.def, $^)
+	$(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
+ $(call KB_FN_AUTO_CMD_DEPS,$(VBoxRTStableCheck_0_OUTDIR)/VBoxRTStableCheckA.asm)
+
 endif
 endif ## @todo bugref:9898
