1 | # $Id: Makefile.kmk 9210 2008-05-29 08:31:14Z 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 $(KBUILD_PATH)/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 $(VBOX_VERSION_MK)
|
---|
78 | $(call MSG_TOOL,Creating,,$@)
|
---|
79 | $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxdrv;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%,$(KBUILD_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 | $(KBUILD_TARGET)/SUPLib-$(KBUILD_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 ($(KBUILD_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 ($(KBUILD_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 | $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
|
---|
192 | SUPDRVShared.c
|
---|
193 | ifndef VBOX_LINUX_VERSION_2_4
|
---|
194 | vboxdrv_SOURCES += \
|
---|
195 | $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).mod.c
|
---|
196 | endif
|
---|
197 | endif # real linux
|
---|
198 |
|
---|
199 |
|
---|
200 | #
|
---|
201 | # VBoxDrv.kext - The Darwin Kernel Extension.
|
---|
202 | #
|
---|
203 | ifeq ($(KBUILD_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 | $(KBUILD_TARGET)/SUPDrv-$(KBUILD_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 | VBoxDrv.kext_CLEAN = \
|
---|
223 | $(PATH_TARGET)/VBoxDrv/Info.plist
|
---|
224 |
|
---|
225 | $(PATH_TARGET)/VBoxDrv/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET)/VBoxDrv)
|
---|
226 | $(call MSG_GENERATE,VBoxDrv,$@,$<)
|
---|
227 | $(xQUIET)$(RM) -f $@
|
---|
228 | $(xQUIET)$(SED) \
|
---|
229 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
230 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
231 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
232 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
233 | $< > $@
|
---|
234 |
|
---|
235 | INSTALLS += Scripts
|
---|
236 | Scripts_INST = $(INST_DIST)
|
---|
237 | Scripts_SOURCES = \
|
---|
238 | darwin/load.sh
|
---|
239 |
|
---|
240 | endif # darwin
|
---|
241 |
|
---|
242 |
|
---|
243 | #
|
---|
244 | # VBoxDrv.sys - The OS/2 driver.
|
---|
245 | #
|
---|
246 | ifeq ($(KBUILD_TARGET),os2)
|
---|
247 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
248 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
249 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
250 | #VBoxDrv_LDFLAGS = -s -t -v
|
---|
251 | VBoxDrv_SOURCES = \
|
---|
252 | os2/SUPDrvA-os2.asm \
|
---|
253 | os2/SUPDrv-os2.def
|
---|
254 | VBoxDrv_LIBS = \
|
---|
255 | $(TARGET_VBoxDrvLib) \
|
---|
256 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
257 | $(VBOX_GCC_LIBGCC) \
|
---|
258 | end
|
---|
259 |
|
---|
260 | # temp hack to ensure that SUPDrvA-os2.asm is first in the link.
|
---|
261 | LIBRARIES += VBoxDrvLib
|
---|
262 | VBoxDrvLib_TEMPLATE = VBOXR0DRV
|
---|
263 | VBoxDrvLib_NOINST = 1
|
---|
264 | VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
265 | VBoxDrvLib_INCS := \
|
---|
266 | $(PATH_SUB_CURRENT) \
|
---|
267 | $(PATH_TARGET) \
|
---|
268 | $(PATH_ROOT)/src/VBox/Runtime/include
|
---|
269 | VBoxDrvLib_SOURCES = \
|
---|
270 | os2/SUPDrv-os2.cpp \
|
---|
271 | SUPDRVShared.c
|
---|
272 | endif
|
---|
273 |
|
---|
274 |
|
---|
275 | #
|
---|
276 | # vboxdrv.ko - The FreeBSD Kernel Module.
|
---|
277 | #
|
---|
278 | ifeq ($(KBUILD_TARGET),freebsd)
|
---|
279 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
280 | vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
281 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
282 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
283 | endif
|
---|
284 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
285 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
286 | vboxdrv_SOURCES = \
|
---|
287 | $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
|
---|
288 | SUPDRVShared.c
|
---|
289 | endif # freebsd
|
---|
290 |
|
---|
291 |
|
---|
292 | #
|
---|
293 | # vboxdrv.o - The Solaris Kernel Module.
|
---|
294 | #
|
---|
295 | ifeq ($(KBUILD_TARGET),solaris)
|
---|
296 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
297 | vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
298 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
299 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
300 | endif
|
---|
301 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
302 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
303 | vboxdrv_SOURCES = \
|
---|
304 | $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
|
---|
305 | SUPDRVShared.c
|
---|
306 | endif # solaris
|
---|
307 |
|
---|
308 |
|
---|
309 | include $(KBUILD_PATH)/subfooter.kmk
|
---|
310 |
|
---|