1 | # $Id: Makefile.kmk 70194 2017-12-18 13:39:39Z 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
|
---|
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 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/exsup.lib \
|
---|
88 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/ntoskrnl.lib \
|
---|
89 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/hal.lib
|
---|
90 | else
|
---|
91 | VBoxGuest_LIBS = \
|
---|
92 | $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
|
---|
93 | $(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
|
---|
94 | endif
|
---|
95 | endif # win
|
---|
96 | ifn1of ($(KBUILD_TARGET), linux freebsd netbsd solaris haiku)
|
---|
97 | VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).cpp
|
---|
98 | else
|
---|
99 | VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).c
|
---|
100 | VBoxGuest_$(KBUILD_TARGET).c_DEPS = $(VBOX_SVN_REV_HEADER)
|
---|
101 | ifeq ($(KBUILD_TARGET),freebsd)
|
---|
102 | VBoxGuest-$(KBUILD_TARGET).c_CFLAGS = -Wno-sign-compare # /usr/src/sys/sys/vmmeter.h: In function 'vm_paging_needed'
|
---|
103 | endif
|
---|
104 | endif
|
---|
105 | VBoxGuest_SOURCES += \
|
---|
106 | VBoxGuest.cpp
|
---|
107 | ifeq ($(KBUILD_TARGET), win)
|
---|
108 | VBoxGuest_SOURCES += \
|
---|
109 | win/VBoxGuest.rc
|
---|
110 | endif
|
---|
111 | VBoxGuest_LIBS += \
|
---|
112 | $(VBOX_LIB_VBGL_R0BASE) \
|
---|
113 | $(VBOX_LIB_IPRT_GUEST_R0)
|
---|
114 | VBoxGuest_ORDERDEPS.freebsd = \
|
---|
115 | $(PATH_STAGE)/gen-sys-hdrs/pci_if.h \
|
---|
116 | $(PATH_STAGE)/gen-sys-hdrs/bus_if.h \
|
---|
117 | $(PATH_STAGE)/gen-sys-hdrs/device_if.h
|
---|
118 | ifeq ($(KBUILD_TARGET),haiku)
|
---|
119 | # Haiku drivers cannot export symbols for other drivers, but modules can.
|
---|
120 | # Therefore vboxguest is a module containing the ring-0 guest lib, and vboxdev/vboxsf
|
---|
121 | # use this module to access the guest lib
|
---|
122 | SYSMODS += VBoxDev
|
---|
123 | VBoxDev_TEMPLATE = VBOXGUESTR0
|
---|
124 | VBoxDev_NAME = vboxdev
|
---|
125 | VBoxDev_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1 VBGL_VBOXGUEST VBOX_WITH_HGCM IN_RING0
|
---|
126 | VBoxDev_SOURCES = VBoxDev-haiku.c VBoxGuest-haiku-stubs.c
|
---|
127 | endif
|
---|
128 | else # OS/2:
|
---|
129 | # The library order is crucial, so a bit of trickery is necessary.
|
---|
130 | # A library is used to make sure that VBoxGuestA-os2.asm is first in the link. (temporary hack?)
|
---|
131 | VBoxGuest_SOURCES = \
|
---|
132 | VBoxGuestA-os2.asm \
|
---|
133 | VBoxGuest-os2.def
|
---|
134 | #VBoxGuest_LDFLAGS = -s -t -v
|
---|
135 | VBoxGuest_LIBS = \
|
---|
136 | $(TARGET_VBoxGuestLibOs2Hack) \
|
---|
137 | $(VBOX_LIB_VBGL_R0BASE) \
|
---|
138 | $(VBOX_LIB_IPRT_GUEST_R0) \
|
---|
139 | $(VBOX_GCC_LIBGCC) \
|
---|
140 | end
|
---|
141 | ## When debugging init with kDrvTest:
|
---|
142 | #VBoxGuest_NAME = VBoxGst
|
---|
143 |
|
---|
144 | # see
|
---|
145 | LIBRARIES += VBoxGuestLibOs2Hack
|
---|
146 | VBoxGuestLibOs2Hack_TEMPLATE = VBOXGUESTR0LIB
|
---|
147 | VBoxGuestLibOs2Hack_INSTTYPE = none
|
---|
148 | VBoxGuestLibOs2Hack_DEFS = $(VBoxGuest_DEFS)
|
---|
149 | VBoxGuestLibOs2Hack_INCS = \
|
---|
150 | . \
|
---|
151 | $(PATH_ROOT)/src/VBox/Runtime/include # for the os2ddk
|
---|
152 | VBoxGuestLibOs2Hack_SOURCES = \
|
---|
153 | VBoxGuest-os2.cpp \
|
---|
154 | VBoxGuest.cpp
|
---|
155 | endif # OS/2
|
---|
156 |
|
---|
157 | VBoxGuest.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
|
---|
158 |
|
---|
159 | if "$(KBUILD_TARGET)" == "win" && 1
|
---|
160 | #
|
---|
161 | # Windows NT 3.x driver.
|
---|
162 | #
|
---|
163 | SYSMODS.x86 += VBoxGuestNT3
|
---|
164 | VBoxGuestNT3_EXTENDS = VBoxGuest
|
---|
165 | VBoxGuestNT3_INSTTYPE.win = both
|
---|
166 | VBoxGuestNT3_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_GST_NT4)
|
---|
167 | VBoxGuestNT3_DEFS = $(VBoxGuest_DEFS) TARGET_NT4 TARGET_NT3 RT_WITHOUT_NOCRT_WRAPPERS
|
---|
168 | VBoxGuestNT3_SOURCES = \
|
---|
169 | VBoxGuest.cpp \
|
---|
170 | VBoxGuest-$(KBUILD_TARGET).cpp \
|
---|
171 | ../../../Runtime/common/string/strcmp.asm \
|
---|
172 | ../../../Runtime/common/string/strchr.asm \
|
---|
173 | ../../../Runtime/r0drv/nt/nt3fakes-r0drv-nt.cpp \
|
---|
174 | ../../../Runtime/r0drv/nt/nt3fakesA-r0drv-nt.asm \
|
---|
175 | win/VBoxGuest.rc
|
---|
176 | VBoxGuestNT3_LIBS = \
|
---|
177 | $(VBOX_LIB_IPRT_GUEST_R0_NT4) \
|
---|
178 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/exsup.lib \
|
---|
179 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/int64.lib \
|
---|
180 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/ntoskrnl.lib \
|
---|
181 | $(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/hal.lib \
|
---|
182 | $(VBOX_LIB_VBGL_R0BASE)
|
---|
183 | endif # win
|
---|
184 | endif # enabled
|
---|
185 |
|
---|
186 |
|
---|
187 | ifeq ($(KBUILD_TARGET), darwin)
|
---|
188 | # Files necessary to make a darwin kernel extension bundle.
|
---|
189 | INSTALLS += VBoxGuest.kext
|
---|
190 | VBoxGuest.kext_INST = $(INST_ADDITIONS)/VBoxGuest.kext/Contents/
|
---|
191 | VBoxGuest.kext_SOURCES = $(VBoxGuest.kext_0_OUTDIR)/Info.plist
|
---|
192 | VBoxGuest.kext_CLEAN = $(VBoxGuest.kext_0_OUTDIR)/Info.plist
|
---|
193 |
|
---|
194 | $$(VBoxGuest.kext_0_OUTDIR)/Info.plist: \
|
---|
195 | $(PATH_SUB_CURRENT)/darwin/Info.plist \
|
---|
196 | $(VBOX_VERSION_MK) | $$(dir $$@)
|
---|
197 | $(call MSG_GENERATE,VBoxGuest,$@,$<)
|
---|
198 | $(QUIET)$(RM) -f $@
|
---|
199 | $(QUIET)$(SED) \
|
---|
200 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
201 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
202 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
203 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
204 | -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
|
---|
205 | -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
|
---|
206 | -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
|
---|
207 | --output $@ \
|
---|
208 | $<
|
---|
209 | endif # darwin
|
---|
210 |
|
---|
211 |
|
---|
212 | ifeq ($(KBUILD_TARGET),linux)
|
---|
213 | #
|
---|
214 | # Install the source files and script(s).
|
---|
215 | #
|
---|
216 | include $(PATH_SUB_CURRENT)/linux/files_vboxguest
|
---|
217 | # sources and stuff.
|
---|
218 | INSTALLS += vboxguest-src
|
---|
219 | vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
|
---|
220 | vboxguest-src_MODE = a+r,u+w
|
---|
221 | vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
|
---|
222 |
|
---|
223 | INSTALLS += vboxguest-scripts
|
---|
224 | vboxguest-scripts_INST = $(INST_ADDITIONS)src/
|
---|
225 | vboxguest-scripts_MODE = a+rx,u+w
|
---|
226 | vboxguest-scripts_SOURCES = ../../../HostDrivers/linux/build_in_tmp
|
---|
227 |
|
---|
228 | # scripts.
|
---|
229 | INSTALLS += vboxguest-sh
|
---|
230 | vboxguest-sh_INST = $(INST_ADDITIONS)src/vboxguest/
|
---|
231 | vboxguest-sh_MODE = a+rx,u+w
|
---|
232 | vboxguest-sh_SOURCES = $(subst ",,$(FILES_VBOXGUEST_BIN))
|
---|
233 |
|
---|
234 | #
|
---|
235 | # Build test for the Guest Additions kernel module (kmk check).
|
---|
236 | #
|
---|
237 | if defined(VBOX_WITH_TESTCASES) \
|
---|
238 | && !defined(VBOX_ONLY_SDK) \
|
---|
239 | && !defined(VBOX_ONLY_DOCS) \
|
---|
240 | && !defined(VBOX_ONLY_VALIDATIONKIT) \
|
---|
241 | && !defined(VBOX_WITHOUT_LINUX_TEST_BUILDS) \
|
---|
242 | && "$(KBUILD_TARGET)" == "linux" \
|
---|
243 | && "$(KBUILD_HOST_ARCH)" == "$(KBUILD_TARGET_ARCH)"
|
---|
244 | ifneq ($(KERN_DIR),)
|
---|
245 | save_symvers = vboxguest-src
|
---|
246 | $(foreach module, vboxguest-src, $(evalcall2 VBOX_LINUX_GENERATE_KMOD_TEST))
|
---|
247 | endif
|
---|
248 | endif
|
---|
249 | endif # Linux
|
---|
250 |
|
---|
251 | ifeq ($(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 |
|
---|
262 | endif # FreeBSD
|
---|
263 |
|
---|
264 | ifeq ($(KBUILD_TARGET),win)
|
---|
265 | #
|
---|
266 | # VBoxGuestInst - The installer.
|
---|
267 | #
|
---|
268 | PROGRAMS.win.x86 += VBoxGuestInstNT
|
---|
269 | VBoxGuestInstNT_TEMPLATE = VBoxGuestR3Exe
|
---|
270 | VBoxGuestInstNT_SOURCES = win/VBoxGuestInst.cpp
|
---|
271 | endif
|
---|
272 |
|
---|
273 |
|
---|
274 | #
|
---|
275 | # Helper script.
|
---|
276 | #
|
---|
277 | INSTALLS.solaris += VBoxGuestLoad
|
---|
278 | VBoxGuestLoad_TEMPLATE = VBOXGUESTR0
|
---|
279 | VBoxGuestLoad_EXEC_SOURCES = solaris/load.sh
|
---|
280 |
|
---|
281 |
|
---|
282 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
283 |
|
---|