# $Id: Makefile.kmk 2676 2007-05-16 17:20:50Z vboxsync $ ## @file # Sub-Makefile for the support library and the drivers/modules/kexts it uses. # # # Copyright (C) 2006 InnoTek Systemberatung GmbH # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; # you can redistribute it and/or modify it under the terms of the GNU # General Public License as published by the Free Software Foundation, # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE # distribution. VirtualBox OSE is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY of any kind. # # If you received this file as part of a commercial VirtualBox # distribution, then only the terms of your commercial VirtualBox # license agreement apply instead of the previous paragraph. # DEPTH ?= ../../../.. SUB_DEPTH = .. include $(PATH_KBUILD)/subheader.kmk # # Targets # LIBRARIES += SUPR3 ifneq ($(filter-out darwin,$(BUILD_TARGET)),) LIBRARIES += SUPR0 endif ifdef VBOX_WITH_VBOXDRV SYSMODS.darwin += VBoxDrv SYSMODS.linux += vboxdrv SYSMODS.win += VBoxDrv SYSMODS.os2 += VBoxDrv endif INSTALLS.linux = vboxmod-bin vboxmod-sh # # Include sub-makefile(s). # include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk # # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN # include $(PATH_SUB_CURRENT)/linux/files_vboxdrv vboxmod-bin_INST = bin/src/ vboxmod-bin_MODE = a+r,u+w vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #" vboxmod-sh_INST = bin/src/ vboxmod-sh_MODE = a+rx,u+w vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #" # # The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT). # ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),) # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled. SUPR3_TEMPLATE = VBOXR3NP else SUPR3_TEMPLATE = VBOXR3 endif SUPR3_DEFS = IN_SUP_R3 IN_RT_R3 SUPR3_INCS := $(PATH_SUB_CURRENT) SUPR3_INCS.l4 = $(L4_INCDIR) ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win! SUPR3_SOURCES = \ SUPLib.cpp \ $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp else SUPR3_SOURCES = \ SUPLib.cpp \ win32/SUPLib-win32.cpp endif # # SUPR0 - The Ring-0 Import / Thunk library. # SUPR0_TEMPLATE = VBOXR0 ifeq ($(VBOX_LDR_FMT),pe) SUPR0_SOURCES += SUPR0.def endif ifeq ($(VBOX_LDR_FMT),lx) SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def $(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET)) $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp $(MV) -f $@.tmp $@ endif # # VBoxDrv.sys - The Windows driver. # ifeq ($(BUILD_TARGET),win) VBoxDrv_TEMPLATE = VBOXR0DRV VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 VBoxDrv_SDKS = W2K3DDK WINPSDKINCS VBoxDrv_INCS := $(PATH_SUB_CURRENT) VBoxDrv_SOURCES = \ SUPDRVShared.c VBoxDrv_SOURCES.x86 = \ win32/SUPDrv-win32.cpp \ win32/SUPDrvA-win32.asm VBoxDrv_SOURCES.amd64 = \ win64/SUPDrv-win64.cpp \ win64/SUPDrvA-win64.asm VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8 VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry VBoxDrv_LIBS = \ $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \ $(PATH_SDK_W2K3DDK_LIB)/hal.lib \ $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) INSTALLS += VBoxDrvInf VBoxDrvInf_INST = $(INST_BIN) ifndef VBOX_LATER_TODAY #ndef VBOX_SIGNING_MODE VBoxDrvInf_SOURCES = win32/VBoxDrv.inf else VBoxDrvInf_SOURCES = \ $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \ $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat VBoxDrvInf_CLEAN += \ $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat \ $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \ $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: win32/VBoxDrv.inf Makefile.kmk $(RM) -f $@ $(MKDIR) -p $(@D) ifeq ($(BUILD_TARGET_ARCH),amd64) $(SED) \ -e 's/^\;CatalogFile=/CatalogFile.NTamd64=/' \ -e 's/^\%INNOTEK%=INNOTEK *$$/%INNOTEK%=INNOTEK, NTamd64/' \ -e 's/^\[VBoxDrv_Service\] *$$/\[VBoxDrv_Service.NTamd64\]/' \ -e 's/^\;amd64 *//' \ $< > $@ else $(SED) -e 's/^\;CatalogFile=/CatalogFile=/' $< > $@ endif $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: $$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf $$(TARGET_VBoxDrv) $(RM) -f $(@D)/VBoxDrv.cat $(INSTALL) -m 644 $(TARGET_VBoxDrv) $(@D) ifeq ($(BUILD_TARGET_ARCH),amd64) C:Inf2Cat.exe /driver:$(@D) /verbose /os:XP_X64,Server2003_X64,Vista_X64 else C:Inf2Cat.exe /driver:$(@D) /verbose /os:2000,XP_X86,Server2003_X86,Vista_X86 endif $(MV) $(@D)/vboxdrv.cat $@ endif endif # # vboxdrv.ko - The Linux Kernel Module. # ifeq ($(BUILD_TARGET),linux) vboxdrv_TEMPLATE = VBOXR0DRV vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC vboxdrv_INCS := $(PATH_SUB_CURRENT) vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC) vboxdrv_SOURCES = \ $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \ SUPDRVShared.c ifndef VBOX_LINUX_VERSION_2_4 vboxdrv_SOURCES += \ $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c endif endif # real linux # # VBoxDrv.kext - The Darwin Kernel Extension. # ifeq ($(BUILD_TARGET),darwin) VBoxDrv_TEMPLATE = VBOXR0DRV VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE VBoxDrv_DEFS += DEBUG_DARWIN_GIP VBoxDrv_INCS := $(PATH_SUB_CURRENT) VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/ VBoxDrv_SOURCES = \ SUPDRVShared.c \ $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp INSTALLS += VBoxDrv.kext VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/ VBoxDrv.kext_SOURCES = \ $(PATH_TARGET)/Info.plist $(PATH_TARGET)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET)) $(call MSG_GENERATE,VBoxDrv,$@,$<) $(xQUIET)$(RM) -f $@ $(xQUIET)$(SED) \ -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \ -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \ -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \ -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \ $< > $@ INSTALLS += Scripts Scripts_INST = $(INST_DIST) Scripts_SOURCES = \ darwin/load.sh endif # # VBoxDrv.sys - The OS/2 driver. # ifeq ($(BUILD_TARGET),os2) VBoxDrv_TEMPLATE = VBOXR0DRV VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE VBoxDrv_INCS := $(PATH_SUB_CURRENT) #VBoxDrv_LDFLAGS = -s -t -v VBoxDrv_SOURCES = \ os2/SUPDrvA-os2.asm \ os2/SUPDrv-os2.def VBoxDrv_LIBS = \ $(TARGET_VBoxDrvLib) \ $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \ $(VBOX_GCC_LIBGCC) \ end # temp hack to ensure that SUPDrvA-os2.asm is first in the link. LIBRARIES += VBoxDrvLib VBoxDrvLib_TEMPLATE = VBOXR0DRV VBoxDrvLib_NOINST = 1 VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE VBoxDrvLib_INCS := \ $(PATH_SUB_CURRENT) \ $(PATH_TARGET) \ $(PATH_ROOT)/src/VBox/Runtime/include VBoxDrvLib_SOURCES = \ os2/SUPDrv-os2.cpp \ SUPDRVShared.c endif include $(PATH_KBUILD)/subfooter.kmk