VirtualBox

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

Last change on this file since 98416 was 98416, checked in by vboxsync, 16 months ago

Additions/*.kmk: Automatic scm cleanups. bugref:10348

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

© 2023 Oracle
ContactPrivacy policyTerms of Use