VirtualBox

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

Last change on this file since 6845 was 6845, checked in by vboxsync, 17 years ago

Fix a soon to appear post-2.6.24 linux kernel issue dropping a macro definition. Used the opportunity to make the linux support driver use the-linux-kernel.h, too, and move common hacks there. Left the host driver specific things where they were.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.3 KB
Line 
1# $Id: Makefile.kmk 6845 2008-02-07 12:50:50Z 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 innotek GmbH
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
27DEPTH ?= ../../../..
28SUB_DEPTH = ..
29include $(PATH_KBUILD)/subheader.kmk
30
31#
32# Targets
33#
34LIBRARIES += SUPR3
35ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT)),)
36LIBRARIES += SUPR0
37endif
38ifdef VBOX_WITH_VBOXDRV
39SYSMODS.darwin += VBoxDrv
40SYSMODS.freebsd += vboxdrv
41SYSMODS.linux += vboxdrv
42SYSMODS.win += VBoxDrv
43SYSMODS.os2 += VBoxDrv
44SYSMODS.solaris += vboxdrv
45endif
46
47INSTALLS.linux = vboxmod-bin vboxmod-sh
48
49#
50# Include sub-makefile(s).
51#
52include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
53
54#
55# Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
56#
57include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
58
59vboxmod-bin_INST = bin/src/
60vboxmod-bin_MODE = a+r,u+w
61vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
62
63vboxmod-sh_INST = bin/src/
64vboxmod-sh_MODE = a+rx,u+w
65vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
66
67#
68# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
69#
70ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
71# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
72SUPR3_TEMPLATE = VBOXR3NP
73else
74SUPR3_TEMPLATE = VBOXR3
75endif
76SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
77ifdef VBOX_WITH_IDT_PATCHING
78SUPR3_DEFS += VBOX_WITH_IDT_PATCHING
79endif
80SUPR3_INCS := $(PATH_SUB_CURRENT)
81SUPR3_INCS.l4 = $(L4_INCDIR)
82SUPR3_SOURCES = \
83 SUPLib.cpp \
84 $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
85
86#
87# SUPR0 - The Ring-0 Import / Thunk library.
88#
89SUPR0_TEMPLATE = VBOXR0
90ifeq ($(VBOX_LDR_FMT),pe)
91SUPR0_SOURCES += SUPR0.def
92endif
93ifeq ($(VBOX_LDR_FMT),lx)
94SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
95$(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
96 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
97 $(MV) -f $@.tmp $@
98endif
99
100
101#
102# VBoxDrv.sys - The Windows driver.
103#
104ifeq ($(BUILD_TARGET),win)
105VBoxDrv_TEMPLATE = VBOXR0DRV
106ifdef VBOX_SIGNING_MODE
107 VBoxDrv_NOINST = true
108endif
109VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE_FOR_MM
110ifdef VBOX_WITH_IDT_PATCHING
111VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
112endif
113VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
114VBoxDrv_INCS := $(PATH_SUB_CURRENT)
115VBoxDrv_SOURCES = \
116 win/SUPDrv-win.cpp \
117 win/SUPDrvA-win.asm \
118 SUPDRVShared.c
119VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
120VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
121VBoxDrv_LIBS = \
122 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
123 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
124 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
125
126
127INSTALLS += VBoxDrv-inf
128VBoxDrv-inf_INST = $(INST_BIN)
129VBoxDrv-inf_MODE = a+r,u+w
130VBoxDrv-inf_SOURCES = \
131 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
132VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
133VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
134
135$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
136 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
137 $(call VBOX_EDIT_INF_FN,$<,$@)
138
139 ifdef VBOX_SIGNING_MODE
140VBoxDrv-inf_SOURCES += \
141 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
142 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
143
144$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
145 $(INSTALL) -m 644 $< $(@D)
146
147$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
148 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
149 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
150 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
151 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
152 endif # signing
153endif # win
154
155
156#
157# vboxdrv.ko - The Linux Kernel Module (syntax only).
158#
159ifeq ($(BUILD_TARGET),linux)
160vboxdrv_TEMPLATE = VBOXR0DRV
161vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC USE_NEW_OS_INTERFACE_FOR_MM
162ifdef VBOX_WITH_IDT_PATCHING
163vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
164endif
165vboxdrv_INCS := \
166 $(PATH_SUB_CURRENT) \
167 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
168vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
169vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
170vboxdrv_SOURCES = \
171 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
172 SUPDRVShared.c
173ifndef VBOX_LINUX_VERSION_2_4
174vboxdrv_SOURCES += \
175 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
176endif
177endif # real linux
178
179
180#
181# VBoxDrv.kext - The Darwin Kernel Extension.
182#
183ifeq ($(BUILD_TARGET),darwin)
184VBoxDrv_TEMPLATE = VBOXR0DRV
185VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
186ifdef VBOX_WITH_IDT_PATCHING
187VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
188endif
189VBoxDrv_DEFS += DEBUG_DARWIN_GIP
190VBoxDrv_INCS := $(PATH_SUB_CURRENT)
191VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
192VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
193VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
194VBoxDrv_SOURCES = \
195 SUPDRVShared.c \
196 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
197
198INSTALLS += VBoxDrv.kext
199VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
200VBoxDrv.kext_SOURCES = \
201 $(PATH_TARGET)/VBoxDrv/Info.plist
202
203$(PATH_TARGET)/VBoxDrv/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET)/VBoxDrv)
204 $(call MSG_GENERATE,VBoxDrv,$@,$<)
205 $(xQUIET)$(RM) -f $@
206 $(xQUIET)$(SED) \
207 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
208 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
209 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
210 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
211 $< > $@
212
213INSTALLS += Scripts
214Scripts_INST = $(INST_DIST)
215Scripts_SOURCES = \
216 darwin/load.sh
217
218endif # darwin
219
220
221#
222# VBoxDrv.sys - The OS/2 driver.
223#
224ifeq ($(BUILD_TARGET),os2)
225VBoxDrv_TEMPLATE = VBOXR0DRV
226VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
227VBoxDrv_INCS := $(PATH_SUB_CURRENT)
228#VBoxDrv_LDFLAGS = -s -t -v
229VBoxDrv_SOURCES = \
230 os2/SUPDrvA-os2.asm \
231 os2/SUPDrv-os2.def
232VBoxDrv_LIBS = \
233 $(TARGET_VBoxDrvLib) \
234 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
235 $(VBOX_GCC_LIBGCC) \
236 end
237
238# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
239LIBRARIES += VBoxDrvLib
240VBoxDrvLib_TEMPLATE = VBOXR0DRV
241VBoxDrvLib_NOINST = 1
242VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
243VBoxDrvLib_INCS := \
244 $(PATH_SUB_CURRENT) \
245 $(PATH_TARGET) \
246 $(PATH_ROOT)/src/VBox/Runtime/include
247VBoxDrvLib_SOURCES = \
248 os2/SUPDrv-os2.cpp \
249 SUPDRVShared.c
250endif
251
252
253#
254# vboxdrv.ko - The FreeBSD Kernel Module.
255#
256ifeq ($(BUILD_TARGET),freebsd)
257vboxdrv_TEMPLATE = VBOXR0DRV
258vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
259ifdef VBOX_WITH_IDT_PATCHING
260vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
261endif
262vboxdrv_INCS := $(PATH_SUB_CURRENT)
263vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
264vboxdrv_SOURCES = \
265 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
266 SUPDRVShared.c
267endif # freebsd
268
269
270#
271# vboxdrv.o - The Solaris Kernel Module.
272#
273ifeq ($(BUILD_TARGET),solaris)
274vboxdrv_TEMPLATE = VBOXR0DRV
275vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
276ifdef VBOX_WITH_IDT_PATCHING
277vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
278endif
279vboxdrv_INCS := $(PATH_SUB_CURRENT)
280vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
281vboxdrv_SOURCES = \
282 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
283 SUPDRVShared.c
284endif # solaris
285
286
287include $(PATH_KBUILD)/subfooter.kmk
288
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