VirtualBox

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

Last change on this file was 98511, checked in by vboxsync, 15 months ago

IPRT,/Config.kmk,Add/*.kmk: Drop int64.lib, use our own implementation from IPRT. bugref:10261

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.1 KB
RevLine 
[3657]1# $Id: Makefile.kmk 98511 2023-02-08 21:31:43Z vboxsync $
2## @file
[6024]3# Makefile for the Cross Platform Guest Additions Driver.
[3657]4#
5
6#
[98103]7# Copyright (C) 2007-2023 Oracle and/or its affiliates.
[5999]8#
[96407]9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
[5999]11#
[96407]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#
[69308]25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
[96407]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
[69308]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#
[96407]34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
[3657]36
[12446]37SUB_DEPTH = ../../../../..
[41477]38include $(KBUILD_PATH)/subheader.kmk
[3657]39
[68642]40# Include sub-makefile.
41include $(PATH_SUB_CURRENT)/lib/Makefile.kmk
[3657]42
[68642]43
[93431]44if defined(VBOX_WITH_ADDITION_DRIVERS) && "$(intersects $(KBUILD_TARGET), darwin freebsd haiku netbsd os2 solaris win)" != ""
[6657]45 #
[31517]46 # VBoxGuest - The Guest Additions Driver.
[6657]47 #
[14319]48 SYSMODS += VBoxGuest
[98126]49 VBoxGuest_TEMPLATE = VBoxGuestR0Drv
[14319]50 VBoxGuest_NAME.freebsd = vboxguest
[43363]51 VBoxGuest_NAME.haiku = vboxguest
[63339]52 VBoxGuest_NAME.netbsd = vboxguest
[14319]53 VBoxGuest_NAME.solaris = vboxguest
[45459]54 VBoxGuest_INST.darwin = $(INST_ADDITIONS)VBoxGuest.kext/Contents/MacOS/
[96691]55 if defined(VBOX_SIGNING_MODE) && defined(VBOX_SIGN_ADDITIONS) # See Additions/WINNT/Makefile.kmk?
[39252]56 VBoxGuest_INSTTYPE.win = none
57 VBoxGuest_DEBUG_INSTTYPE.win = both
[32273]58 endif
[43363]59 VBoxGuest_DEFS.haiku = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1
[32273]60 VBoxGuest_DEFS.solaris = VBOX_SVN_REV=$(VBOX_SVN_REV)
[51224]61 VBoxGuest_DEFS.win = VBOX_GUESTDRV_WITH_RELEASE_LOGGER
[70350]62 VBoxGuest_DEFS.win.x86 = TARGET_NT4 TARGET_NT3 RT_WITHOUT_NOCRT_WRAPPERS
[48034]63 VBoxGuest_DEFS.darwin = VBOX_GUESTDRV_WITH_RELEASE_LOGGER
[32317]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
[32273]69 ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION
70 VBoxGuest_DEFS.win += VBOX_WITH_GUEST_BUGCHECK_DETECTION
71 endif
[36060]72 #VBoxGuest_DEFS.win += LOG_ENABLED LOG_TO_BACKDOOR
[41972]73 VBoxGuest_DEFS.win += \
[98416]74 $(if $(VBOX_WITH_DPC_LATENCY_CHECKER),VBOX_WITH_DPC_LATENCY_CHECKER,)
[14319]75 VBoxGuest_DEPS.solaris += $(VBOX_SVN_REV_KMK)
[45459]76 VBoxGuest_DEPS.haiku += $(VBOX_SVN_REV_HEADER)
[29044]77 VBoxGuest_DEPS.freebsd += $(VBOX_SVN_REV_HEADER)
[63339]78 VBoxGuest_DEPS.netbsd += $(VBOX_SVN_REV_HEADER)
[45459]79 VBoxGuest_DEPS.darwin += $(VBOX_SVN_REV_HEADER)
[11820]80 VBoxGuest_DEFS = VBGL_VBOXGUEST VBOX_WITH_HGCM
[12446]81 VBoxGuest_INCS = .
[38316]82 VBoxGuest_INCS.freebsd = $(VBoxGuest_0_OUTDIR) $(PATH_STAGE)/gen-sys-hdrs
[70133]83 VBoxGuest_INCS.netbsd = $(VBoxGuest_0_OUTDIR) netbsd
[41683]84 ifeq ($(KBUILD_HOST),solaris)
[41725]85 VBoxGuest_LDFLAGS.solaris += -N misc/ctf
[41683]86 else
[41725]87 VBoxGuest_SOURCES.solaris = solaris/deps.asm
88 VBoxGuest_solaris/deps.asm_ASFLAGS = -f bin -g null
[41683]89 endif
[8758]90 ifneq ($(KBUILD_TARGET),os2)
[32266]91 ifeq ($(KBUILD_TARGET),win)
[32273]92 VBoxGuest_LDFLAGS.x86 = -Entry:DriverEntry@8
[32266]93 VBoxGuest_LDFLAGS.amd64 = -Entry:DriverEntry
[70162]94 ifeq ($(KBUILD_TARGET_ARCH),x86)
95 VBoxGuest_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_GST_NT4)
96 VBoxGuest_LIBS = \
[70350]97 $(VBOX_LIB_VBGL_R0BASE) \
98 $(VBOX_LIB_IPRT_GUEST_R0) \
[70162]99 $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/exsup.lib \
[93265]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
[70162]106 else
[93265]107 VBoxGuest_LIBS = \
[70162]108 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
109 $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
[32266]110 endif
[70330]111 VBoxGuest_USES.win += vboximportchecker
[70350]112 VBoxGuest_VBOX_IMPORT_CHECKER.win.x86 = nt31/r0
[70330]113 VBoxGuest_VBOX_IMPORT_CHECKER.win.amd64 = xp64/r0
[32266]114 endif # win
[63339]115 ifn1of ($(KBUILD_TARGET), linux freebsd netbsd solaris haiku)
[32273]116 VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).cpp
117 else
118 VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).c
[60592]119 VBoxGuest_$(KBUILD_TARGET).c_DEPS = $(VBOX_SVN_REV_HEADER)
[68581]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
[32273]123 endif
124 VBoxGuest_SOURCES += \
[54609]125 VBoxGuest.cpp
[70350]126 VBoxGuest_SOURCES.win += \
[32273]127 win/VBoxGuest.rc
[70350]128 VBoxGuest_SOURCES.win.x86 += \
[98416]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
[32273]133 VBoxGuest_LIBS += \
[6657]134 $(VBOX_LIB_VBGL_R0BASE) \
135 $(VBOX_LIB_IPRT_GUEST_R0)
[22573]136 VBoxGuest_ORDERDEPS.freebsd = \
[38154]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
[43363]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
[98126]145 VBoxDev_TEMPLATE = VBoxGuestR0Drv
[43363]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
[6657]150 else # OS/2:
[11895]151 # The library order is crucial, so a bit of trickery is necessary.
[6657]152 # A library is used to make sure that VBoxGuestA-os2.asm is first in the link. (temporary hack?)
[98416]153 VBoxGuest_SOURCES = \
[75552]154 VBoxGuestA-os2.asm
155 ifdef VBOX_USE_WATCOM_FOR_OS2
[98416]156 VBoxGuest_LIBS = \
157 $(VBoxGuestLibOs2Hack_1_TARGET) \
158 $(VBOX_LIB_VBGL_R0BASE) \
159 $(VBOX_LIB_IPRT_GUEST_R0) \
160 $(PATH_IGCC)/lib/libend.lib
[75552]161 else
[98416]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
[75552]171 endif
[98416]172 ## When debugging init with kDrvTest:
173 #VBoxGuest_NAME = VBoxGst
[7535]174
[98416]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
[6657]186 endif # OS/2
[33676]187
[33395]188 VBoxGuest.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
[21412]189endif # enabled
[21118]190
[45459]191
[93431]192if defined(VBOX_WITH_ADDITION_DRIVERS) && "$(KBUILD_TARGET)" == "darwin"
[45459]193 # Files necessary to make a darwin kernel extension bundle.
194 INSTALLS += VBoxGuest.kext
195 VBoxGuest.kext_INST = $(INST_ADDITIONS)/VBoxGuest.kext/Contents/
[75705]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/
[45459]199
[98416]200 $$(VBoxGuest.kext_0_OUTDIR)/Contents/Info.plist: \
201 $(PATH_SUB_CURRENT)/darwin/Info.plist \
202 $(VBOX_VERSION_MK) | $$(dir $$@)
[45459]203 $(call MSG_GENERATE,VBoxGuest,$@,$<)
204 $(QUIET)$(RM) -f $@
205 $(QUIET)$(SED) \
[96399]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' \
[45459]213 --output $@ \
214 $<
[75705]215
[98416]216 $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxGuest)
[45459]217endif # darwin
218
219
[21412]220ifeq ($(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.
[69531]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))
[21118]230
[39321]231 INSTALLS += vboxguest-scripts
232 vboxguest-scripts_INST = $(INST_ADDITIONS)src/
233 vboxguest-scripts_MODE = a+rx,u+w
[57969]234 vboxguest-scripts_SOURCES = ../../../HostDrivers/linux/build_in_tmp
[32183]235
[21412]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))
[21118]241
[70084]242 #
243 # Build test for the Guest Additions kernel module (kmk check).
244 #
[98416]245 $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,vboxguest-src,,save_symvers)
[21412]246endif # Linux
[21118]247
[25590]248ifeq ($(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.
[69531]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))
[25590]258
259endif # FreeBSD
260
[32266]261ifeq ($(KBUILD_TARGET),win)
[70146]262 #
263 # VBoxGuestInst - The installer.
264 #
265 PROGRAMS.win.x86 += VBoxGuestInstNT
266 VBoxGuestInstNT_TEMPLATE = VBoxGuestR3Exe
[96453]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
[96459]270 VBoxGuestInstNT_INCS = ../../WINNT/include
[70146]271 VBoxGuestInstNT_SOURCES = win/VBoxGuestInst.cpp
[70342]272 VBoxGuestInstNT_USES = vboximportchecker
273 VBoxGuestInstNT_VBOX_IMPORT_CHECKER.win.x86 = nt31
[32266]274endif
275
[68793]276
277#
278# Helper script.
279#
280INSTALLS.solaris += VBoxGuestLoad
[98126]281VBoxGuestLoad_TEMPLATE = VBoxGuestR0Drv
[68793]282VBoxGuestLoad_EXEC_SOURCES = solaris/load.sh
283
284
[41477]285include $(FILE_KBUILD_SUB_FOOTER)
[6020]286
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use