Index: trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk	(revision 12516)
+++ trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk	(revision 12519)
@@ -27,4 +27,5 @@
 #
 VBOX_VIRTUALBOX4_SRC := $(PATH_SUB_CURRENT)
+VBOX_VIRTUALBOX4_OUT_DIR := $(PATH_TARGET)/VirtualBox4/misc
 
 VBOX_WITH_REGISTRATION := 1
@@ -56,4 +57,5 @@
 endif
 INSTALLS += VirtualBox4.nls
+
 
 #
@@ -389,18 +391,17 @@
  FORMS := $(filter-out ui/VBoxRegistrationDlg.ui,$(FORMS))
 endif
-VirtualBox4_SOURCES := \
-       $(VirtualBox4_SOURCES) \
-       $(FORMS) \
-       ui/VBoxAboutDlg.ui
-
-# Resource files with some OSE differences.
+$(eval VirtualBox4_SOURCES += \
+	$(FORMS) \
+	ui/VBoxAboutDlg.ui )
+
+# Resource files with some OSE differences (VirtualBoxBrand.qrc is created further down).
 VirtualBox4_SOURCES += VirtualBox.qrc
-VirtualBox4_SOURCES += $(PATH_TARGET)/VirtualBoxBrand.qrc
+VirtualBox4_SOURCES += $(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc
 ifdef VBOX_OSE
- $(PATH_TARGET)/VirtualBoxBrand.qrc_RCCFLAGS = -name OSE
+ $(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc_RCCFLAGS = -name OSE
 else
  VirtualBox4_SOURCES += src/VBoxAboutNonOSEDlg.cpp
  VirtualBox4_QT_MOCHDRS += include/VBoxAboutNonOSEDlg.h
- $(PATH_TARGET)/VirtualBoxBrand.qrc_RCCFLAGS = -name NonOSE
+ $(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc_RCCFLAGS = -name NonOSE
 endif
 
@@ -437,8 +438,6 @@
 #
 VirtualBox4_BLDDIRS       += $(PATH_VirtualBox4)/include
-VirtualBox4_INTERMEDIATES += $(PATH_VirtualBox4)/include/COMWrappers.h \
-			     $(PATH_TARGET)/VirtualBoxBrand.qrc
-VirtualBox4_CLEAN         += $(PATH_VirtualBox4)/include/COMWrappers.h \
-			     $(PATH_TARGET)/VirtualBoxBrand.qrc
+VirtualBox4_INTERMEDIATES += $(PATH_VirtualBox4)/include/COMWrappers.h
+VirtualBox4_CLEAN         += $(PATH_VirtualBox4)/include/COMWrappers.h
 
 $$(PATH_VirtualBox4)/include/COMWrappers.h: \
@@ -452,22 +451,25 @@
 # Generate qrc file with branded icons.
 #
+VirtualBox4_BLDDIRS       += $(VBOX_VIRTUALBOX4_OUT_DIR)
+VirtualBox4_CLEAN         += $(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc
 if "$(KBUILD_HOST)" == "win" ## @todo remove when kBuild ticket #52 has been fixed and deployed.
-VBOX_DRIVE_HACK := $(firstword $(subst :, ,$(PATH_ROOT))):
+ VBOX_DRIVE_HACK := $(firstword $(subst :, ,$(PATH_ROOT))):
 else
-VBOX_DRIVE_HACK :=
-endif
-$(PATH_TARGET)/VirtualBoxBrand.qrc: \
-		$(VBOX_VIRTUALBOX4_SRC)/VirtualBoxBrand.qrc
+ VBOX_DRIVE_HACK :=
+endif
+$(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc: \
+		$(VBOX_VIRTUALBOX4_SRC)/VirtualBoxBrand.qrc \
+		| $$(dir $$@)
 	$(call MSG_GENERATE,VirtualBox4,$<,$@)
 	$(QUIET)$(SED) \
-		-e 's;@VBOX_ABOUT_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_ABOUT_PNG));g' \
-		-e 's;@VBOX_ABOUT_16PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_ABOUT_16PX_PNG));g' \
-		-e 's;@VBOX_VBOX_16PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_VBOX_16PX_PNG));g' \
-		-e 's;@VBOX_VBOX_20PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_VBOX_20PX_PNG));g' \
-		-e 's;@VBOX_VBOX_32PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_VBOX_32PX_PNG));g' \
-		-e 's;@VBOX_VBOX_40PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_VBOX_40PX_PNG));g' \
-		-e 's;@VBOX_VBOX_48PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_VBOX_48PX_PNG));g' \
-		-e 's;@VBOX_VBOX_64PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_VBOX_64PX_PNG));g' \
-		-e 's;@VBOX_CUBE_42PX_PNG@;$(subst $(VBOX_DRIVE_HACK)/,/,$(VBOX_BRAND_GUI_CUBE_42PX_PNG));g' \
+		-e 's;@VBOX_ABOUT_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_ABOUT_PNG));g' \
+		-e 's;@VBOX_ABOUT_16PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_ABOUT_16PX_PNG));g' \
+		-e 's;@VBOX_VBOX_16PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_VBOX_16PX_PNG));g' \
+		-e 's;@VBOX_VBOX_20PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_VBOX_20PX_PNG));g' \
+		-e 's;@VBOX_VBOX_32PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_VBOX_32PX_PNG));g' \
+		-e 's;@VBOX_VBOX_40PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_VBOX_40PX_PNG));g' \
+		-e 's;@VBOX_VBOX_48PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_VBOX_48PX_PNG));g' \
+		-e 's;@VBOX_VBOX_64PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_VBOX_64PX_PNG));g' \
+		-e 's;@VBOX_CUBE_42PX_PNG@;$(subst $(VBOX_DRIVE_HACK),,$(VBOX_BRAND_GUI_CUBE_42PX_PNG));g' \
 		--output $@ \
 		$<
