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