VirtualBox

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

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

USE_NEW_OS_INTERFACE_FOR_GIP for NT (disabled).

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