VirtualBox

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

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

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.2 KB
Line 
1# $Id: Makefile.kmk 5999 2007-12-07 15:05:06Z 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 := $(PATH_SUB_CURRENT)
166vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
167vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
168vboxdrv_SOURCES = \
169 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
170 SUPDRVShared.c
171ifndef VBOX_LINUX_VERSION_2_4
172vboxdrv_SOURCES += \
173 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
174endif
175endif # real linux
176
177
178#
179# VBoxDrv.kext - The Darwin Kernel Extension.
180#
181ifeq ($(BUILD_TARGET),darwin)
182VBoxDrv_TEMPLATE = VBOXR0DRV
183VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
184ifdef VBOX_WITH_IDT_PATCHING
185VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
186endif
187VBoxDrv_DEFS += DEBUG_DARWIN_GIP
188VBoxDrv_INCS := $(PATH_SUB_CURRENT)
189VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
190VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
191VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
192VBoxDrv_SOURCES = \
193 SUPDRVShared.c \
194 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
195
196INSTALLS += VBoxDrv.kext
197VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
198VBoxDrv.kext_SOURCES = \
199 $(PATH_TARGET)/VBoxDrv/Info.plist
200
201$(PATH_TARGET)/VBoxDrv/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET)/VBoxDrv)
202 $(call MSG_GENERATE,VBoxDrv,$@,$<)
203 $(xQUIET)$(RM) -f $@
204 $(xQUIET)$(SED) \
205 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
206 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
207 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
208 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
209 $< > $@
210
211INSTALLS += Scripts
212Scripts_INST = $(INST_DIST)
213Scripts_SOURCES = \
214 darwin/load.sh
215
216endif # darwin
217
218
219#
220# VBoxDrv.sys - The OS/2 driver.
221#
222ifeq ($(BUILD_TARGET),os2)
223VBoxDrv_TEMPLATE = VBOXR0DRV
224VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
225VBoxDrv_INCS := $(PATH_SUB_CURRENT)
226#VBoxDrv_LDFLAGS = -s -t -v
227VBoxDrv_SOURCES = \
228 os2/SUPDrvA-os2.asm \
229 os2/SUPDrv-os2.def
230VBoxDrv_LIBS = \
231 $(TARGET_VBoxDrvLib) \
232 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
233 $(VBOX_GCC_LIBGCC) \
234 end
235
236# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
237LIBRARIES += VBoxDrvLib
238VBoxDrvLib_TEMPLATE = VBOXR0DRV
239VBoxDrvLib_NOINST = 1
240VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
241VBoxDrvLib_INCS := \
242 $(PATH_SUB_CURRENT) \
243 $(PATH_TARGET) \
244 $(PATH_ROOT)/src/VBox/Runtime/include
245VBoxDrvLib_SOURCES = \
246 os2/SUPDrv-os2.cpp \
247 SUPDRVShared.c
248endif
249
250
251#
252# vboxdrv.ko - The FreeBSD Kernel Module.
253#
254ifeq ($(BUILD_TARGET),freebsd)
255vboxdrv_TEMPLATE = VBOXR0DRV
256vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
257ifdef VBOX_WITH_IDT_PATCHING
258vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
259endif
260vboxdrv_INCS := $(PATH_SUB_CURRENT)
261vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
262vboxdrv_SOURCES = \
263 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
264 SUPDRVShared.c
265endif # freebsd
266
267
268#
269# vboxdrv.o - The Solaris Kernel Module.
270#
271ifeq ($(BUILD_TARGET),solaris)
272vboxdrv_TEMPLATE = VBOXR0DRV
273vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
274ifdef VBOX_WITH_IDT_PATCHING
275vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
276endif
277vboxdrv_INCS := $(PATH_SUB_CURRENT)
278vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
279vboxdrv_SOURCES = \
280 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
281 SUPDRVShared.c
282endif # solaris
283
284
285include $(PATH_KBUILD)/subfooter.kmk
286
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