VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk@ 95798

Last change on this file since 95798 was 93431, checked in by vboxsync, 3 years ago

Add/VBoxGuest/Makefile.kmk: Respect VBOX_WITH_ADDITION_DRIVERS. bugref:9898

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.5 KB
Line 
1# $Id: Makefile.kmk 93431 2022-01-24 22:18:35Z vboxsync $
2## @file
3# Makefile for the Cross Platform Guest Additions Driver.
4#
5
6#
7# Copyright (C) 2007-2022 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# The contents of this file may alternatively be used under the terms
18# of the Common Development and Distribution License Version 1.0
19# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20# VirtualBox OSE distribution, in which case the provisions of the
21# CDDL are applicable instead of those of the GPL.
22#
23# You may elect to license modified versions of this file under the
24# terms and conditions of either the GPL or the CDDL or both.
25#
26
27SUB_DEPTH = ../../../../..
28include $(KBUILD_PATH)/subheader.kmk
29
30# Include sub-makefile.
31include $(PATH_SUB_CURRENT)/lib/Makefile.kmk
32
33
34if defined(VBOX_WITH_ADDITION_DRIVERS) && "$(intersects $(KBUILD_TARGET), darwin freebsd haiku netbsd os2 solaris win)" != ""
35 #
36 # VBoxGuest - The Guest Additions Driver.
37 #
38 SYSMODS += VBoxGuest
39 VBoxGuest_TEMPLATE = VBOXGUESTR0
40 VBoxGuest_NAME.freebsd = vboxguest
41 VBoxGuest_NAME.haiku = vboxguest
42 VBoxGuest_NAME.netbsd = vboxguest
43 VBoxGuest_NAME.solaris = vboxguest
44 VBoxGuest_INST.darwin = $(INST_ADDITIONS)VBoxGuest.kext/Contents/MacOS/
45 ifdef VBOX_SIGN_ADDITIONS # See Additions/WINNT/Makefile.kmk?
46 VBoxGuest_INSTTYPE.win = none
47 VBoxGuest_DEBUG_INSTTYPE.win = both
48 endif
49 VBoxGuest_DEFS.haiku = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1
50 VBoxGuest_DEFS.solaris = VBOX_SVN_REV=$(VBOX_SVN_REV)
51 VBoxGuest_DEFS.win = VBOX_GUESTDRV_WITH_RELEASE_LOGGER
52 VBoxGuest_DEFS.win.x86 = TARGET_NT4 TARGET_NT3 RT_WITHOUT_NOCRT_WRAPPERS
53 VBoxGuest_DEFS.darwin = VBOX_GUESTDRV_WITH_RELEASE_LOGGER
54 ifeq ($(KBUILD_TYPE),release)
55 # Allow stopping/removing the driver without a reboot
56 # in debug mode; this is very useful for testing the shutdown stuff!
57 VBoxGuest_DEFS.win += VBOX_REBOOT_ON_UNINSTALL
58 endif
59 ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION
60 VBoxGuest_DEFS.win += VBOX_WITH_GUEST_BUGCHECK_DETECTION
61 endif
62 #VBoxGuest_DEFS.win += LOG_ENABLED LOG_TO_BACKDOOR
63 VBoxGuest_DEFS.win += \
64 $(if $(VBOX_WITH_DPC_LATENCY_CHECKER),VBOX_WITH_DPC_LATENCY_CHECKER,)
65 VBoxGuest_DEPS.solaris += $(VBOX_SVN_REV_KMK)
66 VBoxGuest_DEPS.haiku += $(VBOX_SVN_REV_HEADER)
67 VBoxGuest_DEPS.freebsd += $(VBOX_SVN_REV_HEADER)
68 VBoxGuest_DEPS.netbsd += $(VBOX_SVN_REV_HEADER)
69 VBoxGuest_DEPS.darwin += $(VBOX_SVN_REV_HEADER)
70 VBoxGuest_DEFS = VBGL_VBOXGUEST VBOX_WITH_HGCM
71 VBoxGuest_INCS = .
72 VBoxGuest_INCS.freebsd = $(VBoxGuest_0_OUTDIR) $(PATH_STAGE)/gen-sys-hdrs
73 VBoxGuest_INCS.netbsd = $(VBoxGuest_0_OUTDIR) netbsd
74 ifeq ($(KBUILD_HOST),solaris)
75 VBoxGuest_LDFLAGS.solaris += -N misc/ctf
76 else
77 VBoxGuest_SOURCES.solaris = solaris/deps.asm
78 VBoxGuest_solaris/deps.asm_ASFLAGS = -f bin -g null
79 endif
80 ifneq ($(KBUILD_TARGET),os2)
81 ifeq ($(KBUILD_TARGET),win)
82 VBoxGuest_LDFLAGS.x86 = -Entry:DriverEntry@8
83 VBoxGuest_LDFLAGS.amd64 = -Entry:DriverEntry
84 ifeq ($(KBUILD_TARGET_ARCH),x86)
85 VBoxGuest_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_GST_NT4)
86 VBoxGuest_LIBS = \
87 $(VBOX_LIB_VBGL_R0BASE) \
88 $(VBOX_LIB_IPRT_GUEST_R0) \
89 $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/exsup.lib \
90 $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/int64.lib \
91 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
92 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
93 ifneq ($(VBOX_VCC_CC_GUARD_CF),)
94 VBoxGuest_LIBS += \
95 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/BufferOverflowK.lib
96 endif
97 else
98 VBoxGuest_LIBS = \
99 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
100 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
101 endif
102 VBoxGuest_USES.win += vboximportchecker
103 VBoxGuest_VBOX_IMPORT_CHECKER.win.x86 = nt31/r0
104 VBoxGuest_VBOX_IMPORT_CHECKER.win.amd64 = xp64/r0
105 endif # win
106 ifn1of ($(KBUILD_TARGET), linux freebsd netbsd solaris haiku)
107 VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).cpp
108 else
109 VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).c
110 VBoxGuest_$(KBUILD_TARGET).c_DEPS = $(VBOX_SVN_REV_HEADER)
111 ifeq ($(KBUILD_TARGET),freebsd)
112 VBoxGuest-$(KBUILD_TARGET).c_CFLAGS = -Wno-sign-compare # /usr/src/sys/sys/vmmeter.h: In function 'vm_paging_needed'
113 endif
114 endif
115 VBoxGuest_SOURCES += \
116 VBoxGuest.cpp
117 VBoxGuest_SOURCES.win += \
118 win/VBoxGuest.rc
119 VBoxGuest_SOURCES.win.x86 += \
120 ../../../Runtime/common/string/strcmp.asm \
121 ../../../Runtime/common/string/strchr.asm \
122 ../../../Runtime/r0drv/nt/nt3fakes-r0drv-nt.cpp \
123 ../../../Runtime/r0drv/nt/nt3fakesA-r0drv-nt.asm
124 VBoxGuest_LIBS += \
125 $(VBOX_LIB_VBGL_R0BASE) \
126 $(VBOX_LIB_IPRT_GUEST_R0)
127 VBoxGuest_ORDERDEPS.freebsd = \
128 $(PATH_STAGE)/gen-sys-hdrs/pci_if.h \
129 $(PATH_STAGE)/gen-sys-hdrs/bus_if.h \
130 $(PATH_STAGE)/gen-sys-hdrs/device_if.h
131 ifeq ($(KBUILD_TARGET),haiku)
132 # Haiku drivers cannot export symbols for other drivers, but modules can.
133 # Therefore vboxguest is a module containing the ring-0 guest lib, and vboxdev/vboxsf
134 # use this module to access the guest lib
135 SYSMODS += VBoxDev
136 VBoxDev_TEMPLATE = VBOXGUESTR0
137 VBoxDev_NAME = vboxdev
138 VBoxDev_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1 VBGL_VBOXGUEST VBOX_WITH_HGCM IN_RING0
139 VBoxDev_SOURCES = VBoxDev-haiku.c VBoxGuest-haiku-stubs.c
140 endif
141 else # OS/2:
142 # The library order is crucial, so a bit of trickery is necessary.
143 # A library is used to make sure that VBoxGuestA-os2.asm is first in the link. (temporary hack?)
144VBoxGuest_SOURCES = \
145 VBoxGuestA-os2.asm
146 ifdef VBOX_USE_WATCOM_FOR_OS2
147VBoxGuest_LIBS = \
148 $(VBoxGuestLibOs2Hack_1_TARGET) \
149 $(VBOX_LIB_VBGL_R0BASE) \
150 $(VBOX_LIB_IPRT_GUEST_R0) \
151 $(PATH_IGCC)/lib/libend.lib
152 else
153VBoxGuest_SOURCES += \
154 VBoxGuest-os2.def
155#VBoxGuest_LDFLAGS = -s -t -v
156VBoxGuest_LIBS = \
157 $(VBoxGuestLibOs2Hack_1_TARGET) \
158 $(VBOX_LIB_VBGL_R0BASE) \
159 $(VBOX_LIB_IPRT_GUEST_R0) \
160 $(VBOX_GCC_LIBGCC) \
161 end
162 endif
163## When debugging init with kDrvTest:
164#VBoxGuest_NAME = VBoxGst
165
166# See above.
167LIBRARIES += VBoxGuestLibOs2Hack
168VBoxGuestLibOs2Hack_TEMPLATE = VBOXGUESTR0LIB
169VBoxGuestLibOs2Hack_INSTTYPE = none
170VBoxGuestLibOs2Hack_DEFS = $(VBoxGuest_DEFS)
171VBoxGuestLibOs2Hack_INCS = \
172 . \
173 $(PATH_ROOT)/src/VBox/Runtime/include # for the os2ddk
174VBoxGuestLibOs2Hack_SOURCES = \
175 VBoxGuest-os2.cpp \
176 VBoxGuest.cpp
177 endif # OS/2
178
179 VBoxGuest.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
180endif # enabled
181
182
183if defined(VBOX_WITH_ADDITION_DRIVERS) && "$(KBUILD_TARGET)" == "darwin"
184 # Files necessary to make a darwin kernel extension bundle.
185 INSTALLS += VBoxGuest.kext
186 VBoxGuest.kext_INST = $(INST_ADDITIONS)/VBoxGuest.kext/Contents/
187 VBoxGuest.kext_SOURCES = $(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist
188 VBoxGuest.kext_CLEAN = $(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist
189 VBoxGuest.kext_BLDDIRS = $(VBoxGuest.kext_0_OUTDIR)/Contents/
190
191$$(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist: \
192 $(PATH_SUB_CURRENT)/darwin/Info.plist \
193 $(VBOX_VERSION_MK) | $$(dir $$@)
194 $(call MSG_GENERATE,VBoxGuest,$@,$<)
195 $(QUIET)$(RM) -f $@
196 $(QUIET)$(SED) \
197 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
198 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
199 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
200 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
201 -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
202 -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
203 -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
204 --output $@ \
205 $<
206
207$(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxGuest)
208endif # darwin
209
210
211ifeq ($(KBUILD_TARGET),linux)
212 #
213 # Install the source files and script(s).
214 #
215 include $(PATH_SUB_CURRENT)/linux/files_vboxguest
216 # sources and stuff.
217 INSTALLS += vboxguest-src
218 vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
219 vboxguest-src_MODE = a+r,u+w
220 vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
221
222 INSTALLS += vboxguest-scripts
223 vboxguest-scripts_INST = $(INST_ADDITIONS)src/
224 vboxguest-scripts_MODE = a+rx,u+w
225 vboxguest-scripts_SOURCES = ../../../HostDrivers/linux/build_in_tmp
226
227 # scripts.
228 INSTALLS += vboxguest-sh
229 vboxguest-sh_INST = $(INST_ADDITIONS)src/vboxguest/
230 vboxguest-sh_MODE = a+rx,u+w
231 vboxguest-sh_SOURCES = $(subst ",,$(FILES_VBOXGUEST_BIN))
232
233 #
234 # Build test for the Guest Additions kernel module (kmk check).
235 #
236$(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,vboxguest-src,,save_symvers)
237endif # Linux
238
239ifeq ($(KBUILD_TARGET),freebsd)
240 #
241 # Install the source files and script(s).
242 #
243 include $(PATH_SUB_CURRENT)/freebsd/files_vboxguest
244 # sources and stuff.
245 INSTALLS += vboxguest-src
246 vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
247 vboxguest-src_MODE = a+r,u+w
248 vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
249
250endif # FreeBSD
251
252ifeq ($(KBUILD_TARGET),win)
253 #
254 # VBoxGuestInst - The installer.
255 #
256 PROGRAMS.win.x86 += VBoxGuestInstNT
257 VBoxGuestInstNT_TEMPLATE = VBoxGuestR3Exe
258 VBoxGuestInstNT_SOURCES = win/VBoxGuestInst.cpp
259 VBoxGuestInstNT_USES = vboximportchecker
260 VBoxGuestInstNT_VBOX_IMPORT_CHECKER.win.x86 = nt31
261endif
262
263
264#
265# Helper script.
266#
267INSTALLS.solaris += VBoxGuestLoad
268VBoxGuestLoad_TEMPLATE = VBOXGUESTR0
269VBoxGuestLoad_EXEC_SOURCES = solaris/load.sh
270
271
272include $(FILE_KBUILD_SUB_FOOTER)
273
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette