VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile.kmk@ 19890

Last change on this file since 19890 was 18181, checked in by vboxsync, 16 years ago

Added/updated version resources for Windows host drivers.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.7 KB
Line 
1# $Id: Makefile.kmk 18181 2009-03-24 13:57:17Z vboxsync $
2## @file
3# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
4#
5
6#
7# Copyright (C) 2006-2007 Sun Microsystems, Inc.
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# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27# Clara, CA 95054 USA or visit http://www.sun.com if you need
28# additional information or have any questions.
29#
30
31SUB_DEPTH = ../../../..
32include $(KBUILD_PATH)/subheader.kmk
33
34#
35# Targets
36#
37LIBRARIES += SUPR3 SUPR3HardenedStatic
38ifndef VBOX_ONLY_DOCS
39 ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT)),)
40 LIBRARIES += SUPR0
41 endif
42 ifdef VBOX_WITH_SUPSVC
43 PROGRAMS += VBoxSupSvc
44 endif
45 ifdef VBOX_WITH_VBOXDRV
46 LIBRARIES += SUPR0IdcClient
47 SYSMODS.freebsd += vboxdrv
48 SYSMODS.linux += vboxdrv
49 SYSMODS.win += VBoxDrv
50 SYSMODS.os2 += VBoxDrv
51 SYSMODS.solaris += vboxdrv
52 endif
53 INSTALLS.linux += vboxdrv-mod vboxdrv-sh
54
55 #
56 # Include sub-makefile(s).
57 #
58 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
59
60 #
61 # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
62 #
63 include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
64endif # !VBOX_ONLY_DOCS
65
66
67#
68# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
69#
70ifneq ($(filter l4%,$(KBUILD_TARGET) $(BUILD_TARGET_SUB)),)
71 # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
72 SUPR3_TEMPLATE = VBOXR3NP
73else
74 SUPR3_TEMPLATE = VBOXR3
75endif
76SUPR3_DEFS = \
77 IN_SUP_R3 IN_RT_R3 \
78 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC) \
79 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,)
80SUPR3_INCS := $(PATH_SUB_CURRENT)
81SUPR3_INCS.l4 = $(L4_INCDIR)
82SUPR3_SOURCES = \
83 SUPLib.cpp \
84 SUPR3HardenedIPRT.cpp \
85 SUPR3HardenedVerify.cpp \
86 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
87
88
89#
90# The static part of the hardened support library (ring-3).
91#
92SUPR3HardenedStatic_TEMPLATE = VBOXR3HARDENEDLIB
93SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
94SUPR3HardenedStatic_DEFS += \
95 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC,) \
96 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,)
97SUPR3HardenedStatic_INCS = .
98SUPR3HardenedStatic_SOURCES = \
99 SUPR3HardenedMain.cpp \
100 SUPR3HardenedVerify.cpp \
101 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
102
103ifndef VBOX_ONLY_DOCS
104
105#
106# VBoxSupSvc - The system wide service/daemon.
107#
108VBoxSupSvc_TEMPLATE = VBOXR3EXE
109VBoxSupSvc_SOURCES = \
110 SUPSvc.cpp \
111 SUPSvcGlobal.cpp \
112 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
113if1of ($(KBUILD_TARGET), win)
114 VBoxSupSvc_SOURCES += \
115 SUPSvcGrant.cpp
116endif
117ifn1of ($(KBUILD_TARGET), win)
118 VBoxSupSvc_SOURCES += \
119 SUPSvcMain-posix.cpp
120endif
121VBoxSupSvc_LIBS = \
122 $(LIB_RUNTIME)
123
124
125#
126# SUPR0 - The Ring-0 Import / Thunk library.
127#
128SUPR0_TEMPLATE = VBOXR0
129ifeq ($(VBOX_LDR_FMT),pe)
130 SUPR0_SOURCES += SUPR0.def
131endif
132ifeq ($(VBOX_LDR_FMT),lx)
133SUPR0_SOURCES += $$(PATH_SUPR0)/SUPR0.def
134$$(PATH_SUPR0)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $$(dir $$@)
135 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > [email protected]
136 $(MV) -f [email protected] $@
137endif
138
139
140#
141# SUPR0IdcClient - The Ring-0 IDC client driver library.
142#
143SUPR0IdcClient_TEMPLATE = VBOXR0DRV
144SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
145SUPR0IdcClient_SDKS.win = W2K3DDK WINPSDKINCS
146SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
147 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
148SUPR0IdcClient_SOURCES = \
149 SUPR0IdcClient.c \
150 SUPR0IdcClientComponent.c \
151 SUPR0IdcClientStubs.c
152
153
154#
155# VBoxDrv.sys - The Windows driver.
156#
157## @todo consoliate all the targets into a single mess.
158ifeq ($(KBUILD_TARGET),win)
159VBoxDrv_TEMPLATE = VBOXR0DRV
160ifdef VBOX_SIGNING_MODE
161 VBoxDrv_NOINST = true
162endif
163VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER
164VBoxDrv_DEFS.amd64 = RT_WITH_W64_UNWIND_HACK
165VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
166VBoxDrv_INCS := $(PATH_SUB_CURRENT)
167VBoxDrv_SOURCES = \
168 win/SUPDrv-win.cpp \
169 win/SUPDrvA-win.asm \
170 SUPDrv.c \
171 win/VBoxDrv.rc
172VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
173VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
174VBoxDrv_LIBS = \
175 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
176 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
177 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
178
179
180INSTALLS += VBoxDrv-inf
181VBoxDrv-inf_INST = $(INST_BIN)
182VBoxDrv-inf_MODE = a+r,u+w
183VBoxDrv-inf_SOURCES = \
184 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
185VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
186VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
187
188$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
189 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
190 $(call VBOX_EDIT_INF_FN,$<,$@)
191
192 ifdef VBOX_SIGNING_MODE
193VBoxDrv-inf_SOURCES += \
194 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
195 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
196
197$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
198 $(INSTALL) -m 644 $< $(@D)
199
200$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
201 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
202 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys
203 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
204 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
205 endif # signing
206endif # win
207
208
209#
210# vboxdrv.ko - The Linux Kernel Module (syntax check only).
211#
212ifeq ($(KBUILD_TARGET),linux)
213vboxdrv_TEMPLATE = VBOXR0DRV
214vboxdrv_NOINST = true
215vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
216ifdef VBOX_LINUX_VERSION_2_4
217vboxdrv_DEFS += EXPORT_SYMTAB
218endif
219vboxdrv_INCS := \
220 $(PATH_SUB_CURRENT) \
221 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
222vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
223vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
224vboxdrv_SOURCES = \
225 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
226 SUPDrv.c
227ifndef VBOX_LINUX_VERSION_2_4
228vboxdrv_SOURCES += \
229 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).mod.c
230endif
231
232
233#
234# Targets for installing the linux sources.
235#
236vboxdrv-mod_INST = bin/src/vboxdrv/
237vboxdrv-mod_MODE = a+r,u+w
238vboxdrv-mod_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
239vboxdrv-mod_SOURCES += \
240 $(if $(VBOX_OSE),,\
241 $(PATH_vboxdrv-mod)/dkms.conf) \
242 $(PATH_vboxdrv-mod)/Makefile
243vboxdrv-mod_CLEAN = \
244 $(PATH_vboxdrv-mod)/dkms.conf \
245 $(PATH_vboxdrv-mod)/Makefile
246
247vboxdrv-sh_INST = bin/src/vboxdrv
248vboxdrv-sh_MODE = a+rx,u+w
249vboxdrv-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
250vboxdrv-sh_SOURCES += \
251 $(PATH_vboxdrv-sh)/build_in_tmp \
252 $(if $(VBOX_OSE),,\
253 $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers)
254vboxdrv-sh_CLEAN = \
255 $(PATH_TARGET)/vboxdrv-sh-1.dep \
256 $(PATH_vboxdrv-sh)/build_in_tmp
257
258
259# Scripts needed for building the kernel modules
260
261$$(PATH_vboxdrv-sh)/build_in_tmp: \
262 $(PATH_ROOT)/src/VBox/HostDrivers/linux/build_in_tmp \
263 $(VBOX_VERSION_STAMP) \
264 | $$(dir $$@)
265 $(call MSG_TOOL,Creating,,$@)
266 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxdrv;g" --output $@ $<
267 $(QUIET)chmod 0755 $@
268
269$$(PATH_vboxdrv-mod)/dkms.conf: \
270 $(PATH_SUB_CURRENT)/linux/dkms.conf \
271 $(VBOX_VERSION_STAMP) \
272 | $$(dir $$@)
273 $(call MSG_TOOL,Creating,,$@)
274 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" --output $@ $<
275
276includedep $(PATH_TARGET)/vboxdrv-sh-1.dep
277$$(PATH_vboxdrv-mod)/Makefile: \
278 $(PATH_SUB_CURRENT)/linux/Makefile \
279 $$(if $$(eq $$(Support/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
280 | $$(dir $$@)
281 $(call MSG_TOOL,Creating,,$@)
282 ifndef VBOX_WITH_HARDENING
283 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
284 else
285 $(QUIET)$(CP) -f $< $@
286 endif
287 %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/vboxdrv-sh-1.dep
288 %$(QUIET2)$(APPEND) '$(PATH_TARGET)/vboxdrv-sh-1.dep' 'Support/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
289
290endif # real linux
291
292
293
294
295#
296# VBoxDrv.kext - The Darwin Kernel Extension.
297#
298ifeq ($(KBUILD_TARGET),darwin)
299# The Tiger variant.
300SYSMODS.x86 += VBoxDrvTiger
301VBoxDrvTiger_TEMPLATE = VBOXR0DRV
302VBoxDrvTiger_INST = $(INST_VBOXDRV_TIGER)Contents/MacOS/
303VBoxDrvTiger_DEFS := IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
304VBoxDrvTiger_DEFS.debug += DEBUG_DARWIN_GIP
305VBoxDrvTiger_INCS = .
306VBoxDrvTiger_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
307VBoxDrvTiger_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
308VBoxDrvTiger_SOURCES = \
309 SUPDrv.c \
310 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).cpp
311
312INSTALLS += VBoxDrvTiger.kext
313VBoxDrvTiger.kext_INST = $(INST_VBOXDRV_TIGER)Contents/
314VBoxDrvTiger.kext_SOURCES = $(PATH_VBoxDrvTiger.kext)/Info.plist
315VBoxDrvTiger.kext_CLEAN = $(PATH_VBoxDrvTiger.kext)/Info.plist
316
317$$(PATH_VBoxDrvTiger.kext)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info-Tiger.plist $(VBOX_VERSION_MK) | $$(dir $$@)
318 $(call MSG_GENERATE,VBoxDrvTiger,$@,$<)
319 $(QUIET)$(RM) -f $@
320 $(QUIET)$(SED) \
321 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
322 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
323 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
324 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
325 --output $@ \
326 $<
327
328# The Leopard variant.
329SYSMODS += VBoxDrv
330VBoxDrv_EXTENDS = VBoxDrvTiger
331VBoxDrv_EXTENDS_BY = appending
332VBoxDrv_TEMPLATE = VBOXR0DRV$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86",OSX105,)
333VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
334VBoxDrv_DEFS = VBOX_WITH_HOST_VMX
335
336INSTALLS += VBoxDrv.kext
337VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
338VBoxDrv.kext_SOURCES = $(PATH_VBoxDrv.kext)/Info.plist
339VBoxDrv.kext_CLEAN = $(PATH_VBoxDrv.kext)/Info.plist
340
341$$(PATH_VBoxDrv.kext)/Info.plist: \
342 $(PATH_SUB_CURRENT)/darwin/Info.plist \
343 $(VBOX_VERSION_MK) | $$(dir $$@)
344 $(call MSG_GENERATE,VBoxDrv,$@,$<)
345 $(QUIET)$(RM) -f $@
346 $(QUIET)$(SED) \
347 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
348 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
349 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
350 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
351 --output $@ \
352 $<
353
354# Common manual loader script.
355INSTALLS += Scripts
356Scripts_INST = $(INST_DIST)
357Scripts_SOURCES = \
358 darwin/load.sh
359
360endif # darwin
361
362
363#
364# VBoxDrv.sys - The OS/2 driver.
365#
366ifeq ($(KBUILD_TARGET),os2)
367VBoxDrv_TEMPLATE = VBOXR0DRV
368VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
369VBoxDrv_INCS := $(PATH_SUB_CURRENT)
370#VBoxDrv_LDFLAGS = -s -t -v
371VBoxDrv_SOURCES = \
372 os2/SUPDrvA-os2.asm \
373 os2/SUPDrv-os2.def
374VBoxDrv_LIBS = \
375 $(TARGET_VBoxDrvLib) \
376 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
377 $(VBOX_GCC_LIBGCC) \
378 end
379
380# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
381LIBRARIES += VBoxDrvLib
382VBoxDrvLib_TEMPLATE = VBOXR0DRV
383VBoxDrvLib_NOINST = 1
384VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
385VBoxDrvLib_INCS := \
386 . \
387 $(PATH_ROOT)/src/VBox/Runtime/include
388VBoxDrvLib_SOURCES = \
389 os2/SUPDrv-os2.cpp \
390 SUPDrv.c
391endif
392
393
394#
395# vboxdrv.ko - The FreeBSD Kernel Module.
396#
397ifeq ($(KBUILD_TARGET),freebsd)
398vboxdrv_TEMPLATE = VBOXR0DRV
399vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
400vboxdrv_INCS := $(PATH_SUB_CURRENT)
401vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
402vboxdrv_SOURCES := \
403 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
404 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).def \
405 SUPDrv.c
406## @todo the SUPDrv-freebsd.def is most probably gonna break it and require build system hacking...
407endif # freebsd
408
409
410#
411# vboxdrv.o - The Solaris Kernel Module.
412#
413ifeq ($(KBUILD_TARGET),solaris)
414vboxdrv_TEMPLATE = VBOXR0DRV
415vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER
416ifdef VBOX_WITH_NETFLT
417 vboxdrv_DEFS += VBOX_WITH_NETFLT
418endif
419vboxdrv_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV)
420vboxdrv_DEPS += $(VBOX_SVN_REV_KMK)
421vboxdrv_INCS := $(PATH_SUB_CURRENT)
422vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
423vboxdrv_SOURCES = \
424 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
425 SUPDrv.c
426endif # solaris
427
428
429#
430# SUPDrv.c needs the VBOX_SVN_REV.
431#
432SUPDrv.c_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV)
433
434
435endif # !VBOX_ONLY_DOCS
436include $(KBUILD_PATH)/subfooter.kmk
437
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