VirtualBox

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

Last change on this file since 106908 was 106873, checked in by vboxsync, 2 months ago

Add/VBoxGuest/Makefile.kmk: Fixed regression from r165131 where VBoxGuest.sys wouldn't be installed when signing is disabled (win32-dep* builds). VBoxGuest.inf (esp. not unedited) doesn't belong in the SOURCES list AFAIK. We don't use += for the first assignment of a target property, that's confusing. bugref:10762

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.2 KB
Line 
1# $Id: Makefile.kmk 106873 2024-11-07 16:03:07Z 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
37SUB_DEPTH = ../../../../..
38include $(KBUILD_PATH)/subheader.kmk
39
40# Include sub-makefile.
41include $(PATH_SUB_CURRENT)/lib/Makefile.kmk
42
43
44if 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 VBoxGuest_LDFLAGS.arm64 = -Entry:DriverEntry
95 ifeq ($(KBUILD_TARGET_ARCH),x86)
96 VBoxGuest_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_GST_NT4)
97 VBoxGuest_LIBS = \
98 $(VBOX_LIB_VBGL_R0BASE) \
99 $(VBOX_LIB_IPRT_GUEST_R0) \
100 $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/exsup.lib \
101 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
102 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
103 ifneq ($(VBOX_VCC_CC_GUARD_CF),)
104 VBoxGuest_LIBS.x86 += \
105 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/BufferOverflowK.lib
106 endif
107 else
108 VBoxGuest_LIBS = \
109 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
110 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
111 VBoxGuest_LIBS.arm64 += \
112 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/BufferOverflowFastFailK.lib
113 endif
114 VBoxGuest_USES.win += vboximportchecker
115 VBoxGuest_VBOX_IMPORT_CHECKER.win.x86 = nt31/r0
116 VBoxGuest_VBOX_IMPORT_CHECKER.win.amd64 = xp64/r0
117 endif # win
118 ifn1of ($(KBUILD_TARGET), linux freebsd netbsd solaris haiku)
119 VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).cpp
120 else
121 VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).c
122 VBoxGuest_$(KBUILD_TARGET).c_DEPS = $(VBOX_SVN_REV_HEADER)
123 ifeq ($(KBUILD_TARGET),freebsd)
124 VBoxGuest-$(KBUILD_TARGET).c_CFLAGS = -Wno-sign-compare # /usr/src/sys/sys/vmmeter.h: In function 'vm_paging_needed'
125 endif
126 endif
127 VBoxGuest_SOURCES += \
128 VBoxGuest.cpp
129 VBoxGuest_SOURCES.win += \
130 win/VBoxGuest.rc
131 VBoxGuest_SOURCES.win.x86 += \
132 ../../../Runtime/common/string/strcmp.asm \
133 ../../../Runtime/common/string/strchr.asm \
134 ../../../Runtime/r0drv/nt/nt3fakes-r0drv-nt.cpp \
135 ../../../Runtime/r0drv/nt/nt3fakesA-r0drv-nt.asm
136 VBoxGuest_LIBS += \
137 $(VBOX_LIB_VBGL_R0BASE) \
138 $(VBOX_LIB_IPRT_GUEST_R0)
139 VBoxGuest_ORDERDEPS.freebsd = \
140 $(PATH_STAGE)/gen-sys-hdrs/pci_if.h \
141 $(PATH_STAGE)/gen-sys-hdrs/bus_if.h \
142 $(PATH_STAGE)/gen-sys-hdrs/device_if.h
143 ifeq ($(KBUILD_TARGET),haiku)
144 # Haiku drivers cannot export symbols for other drivers, but modules can.
145 # Therefore vboxguest is a module containing the ring-0 guest lib, and vboxdev/vboxsf
146 # use this module to access the guest lib
147 SYSMODS += VBoxDev
148 VBoxDev_TEMPLATE = VBoxGuestR0Drv
149 VBoxDev_NAME = vboxdev
150 VBoxDev_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1 VBGL_VBOXGUEST VBOX_WITH_HGCM IN_RING0
151 VBoxDev_SOURCES = VBoxDev-haiku.c VBoxGuest-haiku-stubs.c
152 endif
153 else # OS/2:
154 # The library order is crucial, so a bit of trickery is necessary.
155 # A library is used to make sure that VBoxGuestA-os2.asm is first in the link. (temporary hack?)
156 VBoxGuest_SOURCES = \
157 VBoxGuestA-os2.asm
158 ifdef VBOX_USE_WATCOM_FOR_OS2
159 VBoxGuest_LIBS = \
160 $(VBoxGuestLibOs2Hack_1_TARGET) \
161 $(VBOX_LIB_VBGL_R0BASE) \
162 $(VBOX_LIB_IPRT_GUEST_R0) \
163 $(PATH_IGCC)/lib/libend.lib
164 else
165 VBoxGuest_SOURCES += \
166 VBoxGuest-os2.def
167 #VBoxGuest_LDFLAGS = -s -t -v
168 VBoxGuest_LIBS = \
169 $(VBoxGuestLibOs2Hack_1_TARGET) \
170 $(VBOX_LIB_VBGL_R0BASE) \
171 $(VBOX_LIB_IPRT_GUEST_R0) \
172 $(VBOX_GCC_LIBGCC) \
173 end
174 endif
175 ## When debugging init with kDrvTest:
176 #VBoxGuest_NAME = VBoxGst
177
178 # See above.
179 LIBRARIES += VBoxGuestLibOs2Hack
180 VBoxGuestLibOs2Hack_TEMPLATE = VBoxGuestR0DrvLib
181 VBoxGuestLibOs2Hack_INSTTYPE = none
182 VBoxGuestLibOs2Hack_DEFS = $(VBoxGuest_DEFS)
183 VBoxGuestLibOs2Hack_INCS = \
184 . \
185 $(PATH_ROOT)/src/VBox/Runtime/include # for the os2ddk
186 VBoxGuestLibOs2Hack_SOURCES = \
187 VBoxGuest-os2.cpp \
188 VBoxGuest.cpp
189 endif # OS/2
190
191 VBoxGuest.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
192endif # enabled
193
194
195if defined(VBOX_WITH_ADDITION_DRIVERS) && "$(KBUILD_TARGET)" == "darwin"
196 # Files necessary to make a darwin kernel extension bundle.
197 INSTALLS += VBoxGuest.kext
198 VBoxGuest.kext_INST = $(INST_ADDITIONS)/VBoxGuest.kext/Contents/
199 VBoxGuest.kext_SOURCES = $(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist
200 VBoxGuest.kext_CLEAN = $(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist
201 VBoxGuest.kext_BLDDIRS = $(VBoxGuest.kext_0_OUTDIR)/Contents/
202
203 $$(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist: \
204 $(PATH_SUB_CURRENT)/darwin/Info.plist \
205 $(VBOX_VERSION_MK) | $$(dir $$@)
206 $(call MSG_GENERATE,VBoxGuest,$@,$<)
207 $(QUIET)$(RM) -f $@
208 $(QUIET)$(SED) \
209 -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
210 -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
211 -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
212 -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
213 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
214 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
215 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
216 --output $@ \
217 $<
218
219 $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxGuest)
220endif # darwin
221
222
223ifeq ($(KBUILD_TARGET),linux)
224 #
225 # Install the source files and script(s).
226 #
227 include $(PATH_SUB_CURRENT)/linux/files_vboxguest
228 # sources and stuff.
229 INSTALLS += vboxguest-src
230 vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
231 vboxguest-src_MODE = a+r,u+w
232 vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
233
234 INSTALLS += vboxguest-scripts
235 vboxguest-scripts_INST = $(INST_ADDITIONS)src/
236 vboxguest-scripts_MODE = a+rx,u+w
237 vboxguest-scripts_SOURCES = ../../../HostDrivers/linux/build_in_tmp
238
239 # scripts.
240 INSTALLS += vboxguest-sh
241 vboxguest-sh_INST = $(INST_ADDITIONS)src/vboxguest/
242 vboxguest-sh_MODE = a+rx,u+w
243 vboxguest-sh_SOURCES = $(subst ",,$(FILES_VBOXGUEST_BIN))
244
245 #
246 # Build test for the Guest Additions kernel module (kmk check).
247 #
248 $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,vboxguest-src,,save_symvers)
249endif # Linux
250
251ifeq ($(KBUILD_TARGET),freebsd)
252 #
253 # Install the source files and script(s).
254 #
255 include $(PATH_SUB_CURRENT)/freebsd/files_vboxguest
256 # sources and stuff.
257 INSTALLS += vboxguest-src
258 vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
259 vboxguest-src_MODE = a+r,u+w
260 vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
261
262endif # FreeBSD
263
264ifeq ($(KBUILD_TARGET),win)
265 #
266 # VBoxGuestInst - The installer.
267 #
268 PROGRAMS.win.x86 += VBoxGuestInstNT
269 VBoxGuestInstNT_TEMPLATE = VBoxGuestR3Exe
270 ifndef VBOX_WITH_NOCRT_STATIC
271 VBoxGuestInstNT_LDFLAGS := -Include:_vcc100_kernel32_fakes_asm # Temporary kludge to deal with some link order issue.
272 endif
273 VBoxGuestInstNT_INCS = ../../WINNT/include
274 VBoxGuestInstNT_SOURCES = win/VBoxGuestInst.cpp
275 VBoxGuestInstNT_USES = vboximportchecker
276 VBoxGuestInstNT_VBOX_IMPORT_CHECKER.win.x86 = nt31
277endif
278
279
280#
281# Helper script.
282#
283INSTALLS.solaris += VBoxGuestLoad
284VBoxGuestLoad_TEMPLATE = VBoxGuestR0Drv
285VBoxGuestLoad_EXEC_SOURCES = solaris/load.sh
286
287
288include $(FILE_KBUILD_SUB_FOOTER)
289
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