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