VirtualBox

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

Last change on this file since 106655 was 106655, checked in by vboxsync, 3 months ago

Add/VBoxGuest: Makefile adjustments for win.arm64. jiraref:VBP-1253

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