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