Index: trunk/src/VBox/Devices/Makefile.kmk
===================================================================
--- trunk/src/VBox/Devices/Makefile.kmk	(revision 53272)
+++ trunk/src/VBox/Devices/Makefile.kmk	(revision 53273)
@@ -256,4 +256,5 @@
    VBoxDD_LDFLAGS.darwin += -framework OpenGL
   endif
+  Graphics/DevVGA-SVGA3d-ogl.cpp_CXXFLAGS.darwin = -F$(VBOX_PATH_MACOSX_SDK_10_7)/System/Library/Frameworks/
  endif
 
@@ -1352,81 +1353,88 @@
 
 
-TEMPLATE_VBoxSVGA3D         = VBoxSVGA3D
-TEMPLATE_VBoxSVGA3D_EXTENDS = VBOXR3
-TEMPLATE_VBoxSVGA3D_CFLAGS  = \
-	$(filter-out -pedantic -fno-common -Wstrict-prototypes,$(TEMPLATE_VBOXR3_CFLAGS))
-TEMPLATE_VBoxSVGA3D_CXXFLAG = \
-        $(filter-out -pedantic -fno-common,$(TEMPLATE_VBOXR3_CXXFLAGS))
-TEMPLATE_VBoxSVGA3D_CFLAGS.darwin  = \
-        $(filter-out -fno-common,$(TEMPLATE_VBOXR3_CFLAGS.darwin))
-TEMPLATE_VBoxSVGA3D_LDFLAGS.darwin += \
-	-framework AppKit -framework OpenGL
-
 if defined(VBOX_WITH_VMSVGA3D) && !defined(VBOX_ONLY_EXTPACKS)
-DLLS += VBoxSVGA3D
-endif
-
-VBoxSVGA3D_TEMPLATE = VBoxSVGA3D
-VBoxSVGA3D_SDKS         = ReorderCompilerIncs
-VBoxSVGA3D_DEFS         = \
-	__WINESRC__ \
-	WINE_UNICODE_API="" \
-	_REENTRANT \
-	WINE_NOWINSOCK \
-	IN_RING3 \
-	VBOX_WITH_VMSVGA \
-	VBOX_WITH_VMSVGA3D \
-	DLLDIR=\"\" \
-	BINDIR=\"\" \
-	LIB_TO_BINDIR=\"\" \
-	LIB_TO_DLLDIR=\"\" \
-	BIN_TO_DLLDIR=\"\" \
-	LIB_TO_DATADIR=\"\" \
-	BIN_TO_DATADIR=\"\" \
-	_USE_MATH_DEFINES \
-	VBOX_USING_WINDDK_W7_OR_LATER \
-	VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT \
-	IN_vmsvgashader_STATIC \
-	VBOX_WINE_WITH_IPRT
-if "$(KBUILD_TYPE)" != "debug" || defined(VBOX_WINE_NO_DEBUG_MSGS)
- VBoxSVGA3D_DEFS       += WINE_NO_DEBUG_MSGS
-endif
-VBoxSVGA3D_DEFS.x86    += __i386__
-VBoxSVGA3D_DEFS.amd64  += __x86_64__
-VBoxSVGA3D_DEFS.win    += \
-	USE_WIN32_OPENGL \
-	VBOX_WINE_WITHOUT_LIBWINE
-# WINE relies on a gcc 4.4 feature but we have 4.2 on Darwin
-VBoxSVGA3D_DEFS.darwin += \
-	__builtin_ms_va_list=va_list \
-	__stdcall=
-VBoxSVGA3D_CFLAGS = \
-	$(filter-out -pedantic -Wattributes,$(VBoxR3DllWarnNoPic_CFLAGS))
-VBoxSVGA3D_INCS.win    := \
-	Graphics/shaderlib/libWineStub/include
-VBoxSVGA3D_INCS.linux  := \
-	Graphics/shaderlib/wine/include
-VBoxSVGA3D_INCS.darwin := \
-	Graphics/shaderlib/wine/include
-VBoxSVGA3D_SOURCES     := \
-	Graphics/shaderlib/glsl_shader.c \
-	Graphics/shaderlib/shader.c \
-	Graphics/shaderlib/shader_sm1.c \
-	Graphics/shaderlib/shader_sm4.c \
-	Graphics/shaderlib/shaderapi.c \
-	Graphics/shaderlib/utils.c \
-	Graphics/shaderlib/stateblock.c \
-	Graphics/shaderlib/directx.c \
-	Graphics/shaderlib/libWineStub/debug.c
-VBoxSVGA3D_SOURCES.darwin  += \
-	Graphics/DevVGA-SVGA3d-cocoa.m
-VBoxSVGA3D_LIBS        = \
-	$(LIB_RUNTIME)
-VBoxSVGA3D_LIBS.win       += $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Opengl32.lib
-if1of ($(KBUILD_TARGET), solaris linux freebsd)
- VBoxSVGA3D_LIBS += GL
-endif
-VBoxSVGA3D_LDFLAGS.darwin += \
-	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxSVGA3D.dylib
+ #
+ # Template used for VBoxSVGA3D.  (Stips away compiler options.)
+ #
+ TEMPLATE_VBoxSVGA3D         = VBoxSVGA3D
+ TEMPLATE_VBoxSVGA3D_EXTENDS = VBOXR3
+ TEMPLATE_VBoxSVGA3D_CFLAGS  = \
+ 	$(filter-out -pedantic -fno-common -Wstrict-prototypes,$(TEMPLATE_VBOXR3_CFLAGS))
+ TEMPLATE_VBoxSVGA3D_CXXFLAG = \
+ 	$(filter-out -pedantic -fno-common,$(TEMPLATE_VBOXR3_CXXFLAGS))
+ TEMPLATE_VBoxSVGA3D_CFLAGS.darwin  = \
+ 	$(filter-out -fno-common,$(TEMPLATE_VBOXR3_CFLAGS.darwin))
+ TEMPLATE_VBoxSVGA3D_LDFLAGS.darwin = \
+ 	-framework AppKit -framework OpenGL
+
+ #
+ # The shader library used by the SVGA3D implementation.
+ #
+ DLLS += VBoxSVGA3D
+ VBoxSVGA3D_TEMPLATE = VBoxSVGA3D
+ VBoxSVGA3D_SDKS         = ReorderCompilerIncs
+ VBoxSVGA3D_DEFS         = \
+ 	__WINESRC__ \
+ 	WINE_UNICODE_API="" \
+ 	_REENTRANT \
+ 	WINE_NOWINSOCK \
+ 	VBOX_WITH_VMSVGA \
+ 	VBOX_WITH_VMSVGA3D \
+ 	DLLDIR=\"\" \
+ 	BINDIR=\"\" \
+ 	LIB_TO_BINDIR=\"\" \
+ 	LIB_TO_DLLDIR=\"\" \
+ 	BIN_TO_DLLDIR=\"\" \
+ 	LIB_TO_DATADIR=\"\" \
+ 	BIN_TO_DATADIR=\"\" \
+ 	_USE_MATH_DEFINES \
+ 	VBOX_USING_WINDDK_W7_OR_LATER \
+ 	VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT \
+ 	IN_vmsvgashader_STATIC \
+ 	VBOX_WINE_WITH_IPRT
+ if "$(KBUILD_TYPE)" != "debug" || defined(VBOX_WINE_NO_DEBUG_MSGS)
+  VBoxSVGA3D_DEFS       += WINE_NO_DEBUG_MSGS
+ endif
+ VBoxSVGA3D_DEFS.x86    += __i386__
+ VBoxSVGA3D_DEFS.amd64  += __x86_64__
+ VBoxSVGA3D_DEFS.win    += \
+ 	USE_WIN32_OPENGL \
+ 	VBOX_WINE_WITHOUT_LIBWINE
+ # WINE relies on a gcc 4.4 feature but we have 4.2 on Darwin
+ VBoxSVGA3D_DEFS.darwin += \
+ 	__builtin_ms_va_list=va_list \
+ 	__stdcall= \
+ 	ms_abi=
+ # WTF IS THIS? -fno-pic?? doubt it.
+ VBoxSVGA3D_CFLAGS = \
+ 	$(filter-out -pedantic -Wattributes,$(VBoxR3DllWarnNoPic_CFLAGS))
+ VBoxSVGA3D_INCS.win    := \
+ 	Graphics/shaderlib/libWineStub/include
+ VBoxSVGA3D_INCS.linux  := \
+ 	Graphics/shaderlib/wine/include
+ VBoxSVGA3D_INCS.darwin := \
+ 	Graphics/shaderlib/wine/include
+ VBoxSVGA3D_SOURCES     := \
+ 	Graphics/shaderlib/glsl_shader.c \
+ 	Graphics/shaderlib/shader.c \
+ 	Graphics/shaderlib/shader_sm1.c \
+ 	Graphics/shaderlib/shader_sm4.c \
+ 	Graphics/shaderlib/shaderapi.c \
+ 	Graphics/shaderlib/utils.c \
+ 	Graphics/shaderlib/stateblock.c \
+ 	Graphics/shaderlib/directx.c \
+ 	Graphics/shaderlib/libWineStub/debug.c
+ VBoxSVGA3D_SOURCES.darwin  += \
+ 	Graphics/DevVGA-SVGA3d-cocoa.m
+ VBoxSVGA3D_LIBS        = \
+ 	$(LIB_RUNTIME)
+ VBoxSVGA3D_LIBS.win       += $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Opengl32.lib
+ if1of ($(KBUILD_TARGET), solaris linux freebsd)
+  VBoxSVGA3D_LIBS += GL
+ endif
+ VBoxSVGA3D_LDFLAGS.darwin += \
+ 	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxSVGA3D.dylib
+
+endif # defined(VBOX_WITH_VMSVGA3D) && !defined(VBOX_ONLY_EXTPACKS)
 
 include $(FILE_KBUILD_SUB_FOOTER)
