VirtualBox

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

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

supdrv: Prototyped the fix for the PspGetSetContextInternal / RtlVirtualUnwind crashes on Vista64. (disabled)

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