# $Id: Makefile.kmk 38093 2011-07-21 12:45:30Z vboxsync $ ## @file # Makefile for the Cross Platform Guest Additions Driver. # # # Copyright (C) 2007-2010 Oracle Corporation # # 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 (GPL) 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. # SUB_DEPTH = ../../../../.. include $(KBUILD_PATH)/subheader.kmk if1of ($(KBUILD_TARGET), freebsd $(if $(defined VBOX_WITH_ADDITION_DRIVERS),linux,) os2 solaris win) # # VBoxGuest - The Guest Additions Driver. # SYSMODS += VBoxGuest VBoxGuest_TEMPLATE = VBOXGUESTR0 VBoxGuest_NAME.freebsd = vboxguest VBoxGuest_NAME.linux = vboxguest VBoxGuest_NAME.solaris = vboxguest VBoxGuest_NOINST.linux = true ifdef VBOX_SIGN_ADDITIONS # See Additions/WINNT/Makefile.kmk? VBoxGuest_NOINST.win = true endif VBoxGuest_DEFS.linux = KBUILD_MODNAME=KBUILD_STR\(vboxguest\) KBUILD_BASENAME=KBUILD_STR\(vboxguest\) DEBUG_HASH=2 DEBUG_HASH2=3 EXPORT_SYMTAB VBoxGuest_DEFS.solaris = VBOX_SVN_REV=$(VBOX_SVN_REV) VBoxGuest_DEFS.win = # VBOX_WITH_VRDP_SESSION_HANDLING ifeq ($(KBUILD_TYPE),release) # Allow stopping/removing the driver without a reboot # in debug mode; this is very useful for testing the shutdown stuff! VBoxGuest_DEFS.win += VBOX_REBOOT_ON_UNINSTALL endif ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION VBoxGuest_DEFS.win += VBOX_WITH_GUEST_BUGCHECK_DETECTION endif #VBoxGuest_DEFS.win += LOG_ENABLED LOG_TO_BACKDOOR VBoxGuest_DEPS.solaris += $(VBOX_SVN_REV_KMK) VBoxGuest_DEPS.linux += $(VBOX_SVN_REV_HEADER) VBoxGuest_DEPS.freebsd += $(VBOX_SVN_REV_HEADER) VBoxGuest_DEFS = VBGL_VBOXGUEST VBOX_WITH_HGCM VBoxGuest_INCS = . VBoxGuest_INCS.freebsd = $(PATH_VBoxGuest) $(PATH_INS)/gen-sys-hdrs VBoxGuest_INCS.linux = ../../../Runtime/r0drv/linux VBoxGuest_LDFLAGS.solaris += -N misc/ctf ifneq ($(KBUILD_TARGET),os2) ifeq ($(KBUILD_TARGET),win) VBoxGuest_LDFLAGS.x86 = -Entry:DriverEntry@8 VBoxGuest_LDFLAGS.amd64 = -Entry:DriverEntry VBoxGuest_LIBS = \ $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \ $(PATH_SDK_W2K3DDK_LIB)/hal.lib ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION VBoxGuest_LIBS += \ $(PATH_SDK_WINDDKWLH_LIB)/aux_klib.lib \ $(PATH_SDK_WINDDKWLH_LIB)/ksecdd.lib \ $(PATH_SDK_WINDDKWLH_LIB)/BufferOverflowK.lib VBoxGuest.cpp_SDKS = WINDDKWLH endif endif # win ifn1of ($(KBUILD_TARGET), linux freebsd solaris) VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).cpp else VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).c endif VBoxGuest_SOURCES += \ VBoxGuest.cpp \ VBoxGuest2.cpp ifeq ($(KBUILD_TARGET), win) VBoxGuest_SOURCES += \ VBoxGuest-$(KBUILD_TARGET)-pnp.cpp \ win/VBoxGuest.rc endif VBoxGuest_LIBS += \ $(VBOX_LIB_VBGL_R0BASE) \ $(VBOX_LIB_IPRT_GUEST_R0) VBoxGuest_ORDERDEPS.freebsd = \ $(PATH_INS)/gen-sys-hdrs/pci_if.h \ $(PATH_INS)/gen-sys-hdrs/bus_if.h \ $(PATH_INS)/gen-sys-hdrs/device_if.h else # OS/2: # The library order is crucial, so a bit of trickery is necessary. # A library is used to make sure that VBoxGuestA-os2.asm is first in the link. (temporary hack?) VBoxGuest_SOURCES = \ VBoxGuestA-os2.asm \ VBoxGuest-os2.def #VBoxGuest_LDFLAGS = -s -t -v VBoxGuest_LIBS = \ $(TARGET_VBoxGuestLibOs2Hack) \ $(VBOX_LIB_VBGL_R0BASE) \ $(VBOX_LIB_IPRT_GUEST_R0) \ $(VBOX_GCC_LIBGCC) \ end ## When debugging init with kDrvTest: #VBoxGuest_NAME = VBoxGst # see LIBRARIES += VBoxGuestLibOs2Hack VBoxGuestLibOs2Hack_TEMPLATE = VBOXGUESTR0LIB VBoxGuestLibOs2Hack_NOINST = true VBoxGuestLibOs2Hack_DEFS = $(VBoxGuest_DEFS) VBoxGuestLibOs2Hack_INCS = \ . \ $(PATH_ROOT)/src/VBox/Runtime/include # for the os2ddk VBoxGuestLibOs2Hack_SOURCES = \ VBoxGuest-os2.cpp \ VBoxGuest.cpp \ VBoxGuest2.cpp endif # OS/2 VBoxGuest2.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) VBoxGuest.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) ifeq ($(KBUILD_TARGET),win) # # Windows NT4 driver. # SYSMODS.x86 += VBoxGuestNT VBoxGuestNT_EXTENDS = VBoxGuest VBoxGuestNT_NOINST.win = $(NO_SUCH_VARIABLE) VBoxGuestNT_DEFS = $(VBoxGuest_DEFS) TARGET_NT4 VBoxGuestNT_SOURCES = \ VBoxGuest.cpp \ VBoxGuest2.cpp \ VBoxGuest-$(KBUILD_TARGET).cpp \ VBoxGuest-$(KBUILD_TARGET)-legacy.cpp \ win/VBoxGuest.rc VBoxGuestNT_LIBS = \ $(PATH_SDK_W2K3DDK_LIB)/exsup.lib \ $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \ $(PATH_SDK_W2K3DDK_LIB)/hal.lib \ $(VBOX_LIB_VBGL_R0BASE) \ $(VBOX_LIB_IPRT_GUEST_R0_NT4) endif # win endif # enabled ifeq ($(KBUILD_TARGET),linux) # # Install the source files and script(s). # include $(PATH_SUB_CURRENT)/linux/files_vboxguest # sources and stuff. INSTALLS += vboxguest-src vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/ vboxguest-src_MODE = a+r,u+w vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN)) INSTALLS += vboxguest-dkms-conf vboxguest-dkms-conf_INST = $(INST_ADDITIONS)src/ vboxguest-dkms-conf_MODE = a+r,u+w vboxguest-dkms-conf_SOURCES = $(vboxguest-sh_0_OUTDIR)/dkms.conf vboxguest-dkms-conf_CLEAN = $(vboxguest-sh_0_OUTDIR)/dkms.conf INSTALLS += vboxguest-dkms-sh vboxguest-dkms-sh_INST = $(INST_ADDITIONS)src/ vboxguest-dkms-sh_MODE = a+rx,u+w vboxguest-dkms-sh_SOURCES = $(vboxguest-sh_0_OUTDIR)/do_dkms vboxguest-dkms-sh_CLEAN = $(vboxguest-sh_0_OUTDIR)/do_dkms $$(vboxguest-sh_0_OUTDIR)/dkms.conf: \ $(PATH_SUB_CURRENT)/linux/dkms.conf \ $(VBOX_VERSION_STAMP) \ | $$(dir $$@) $(call MSG_TOOL,Creating,,$@) $(QUIET)$(SED) \ -e "s;_VERSION_;${VBOX_VERSION_STRING};g" \ -e "s;_BUILDTYPE_;$(KBUILD_TYPE);g" \ --output $@ $< $$(vboxguest-sh_0_OUTDIR)/do_dkms: \ $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_dkms \ $(VBOX_VERSION_STAMP) \ | $$(dir $$@) $(call MSG_TOOL,Creating,,$@) $(QUIET)$(SED) \ -e "s;_VERSION_;${VBOX_VERSION_STRING};g" \ -e "s;_MODULE_;vboxguest;g" \ -e "s;_OLDMODULES_;vboxguest vboxadd vboxsf vboxvfs vboxvideo;g" \ --output $@ $< $(QUIET)$(CHMOD) a+rx,u+w $@ # scripts. INSTALLS += vboxguest-sh vboxguest-sh_INST = $(INST_ADDITIONS)src/vboxguest/ vboxguest-sh_MODE = a+rx,u+w vboxguest-sh_SOURCES = $(subst ",,$(FILES_VBOXGUEST_BIN)) vboxguest-sh_SOURCES += $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers vboxguest-sh_SOURCES += $(vboxguest-sh_0_OUTDIR)/build_in_tmp vboxguest-sh_CLEAN = $(vboxguest-sh_0_OUTDIR)/build_in_tmp $$(vboxguest-sh_0_OUTDIR)/build_in_tmp: \ $(PATH_ROOT)/src/VBox/HostDrivers/linux/build_in_tmp \ $(VBOX_VERSION_STAMP) \ | $$(dir $$@) $(call MSG_TOOL,Creating,,$@) $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxguest;g; s;_BUILDTYPE_;${KBUILD_TYPE};g" --output $@ $< $(QUIET)$(CHMOD) 0755 $@ endif # Linux ifeq ($(KBUILD_TARGET),freebsd) # # Install the source files and script(s). # include $(PATH_SUB_CURRENT)/freebsd/files_vboxguest # sources and stuff. INSTALLS += vboxguest-src vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/ vboxguest-src_MODE = a+r,u+w vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN)) endif # FreeBSD ifeq ($(KBUILD_TARGET),win) # # VBoxGuestInst - The installer. # #PROGRAMS += VBoxGuestInst VBoxGuestInst_TEMPLATE= VBOXGUESTR3EXE VBoxGuestInst_SOURCES = win/VBoxGuestInst.cpp endif include $(KBUILD_PATH)/subfooter.kmk