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 |
|
---|
27 | DEPTH ?= ../../../..
|
---|
28 | SUB_DEPTH = ..
|
---|
29 | include $(PATH_KBUILD)/subheader.kmk
|
---|
30 |
|
---|
31 | #
|
---|
32 | # Targets
|
---|
33 | #
|
---|
34 | LIBRARIES += SUPR3
|
---|
35 | ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT)),)
|
---|
36 | LIBRARIES += SUPR0
|
---|
37 | endif
|
---|
38 | ifdef VBOX_WITH_VBOXDRV
|
---|
39 | SYSMODS.darwin += VBoxDrv
|
---|
40 | SYSMODS.freebsd += vboxdrv
|
---|
41 | SYSMODS.linux += vboxdrv
|
---|
42 | SYSMODS.win += VBoxDrv
|
---|
43 | SYSMODS.os2 += VBoxDrv
|
---|
44 | SYSMODS.solaris += vboxdrv
|
---|
45 | endif
|
---|
46 |
|
---|
47 | INSTALLS.linux = vboxmod-bin vboxmod-sh
|
---|
48 |
|
---|
49 | #
|
---|
50 | # Include sub-makefile(s).
|
---|
51 | #
|
---|
52 | include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
|
---|
53 |
|
---|
54 | #
|
---|
55 | # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
|
---|
56 | #
|
---|
57 | include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
|
---|
58 |
|
---|
59 | vboxmod-bin_INST = bin/src/
|
---|
60 | vboxmod-bin_MODE = a+r,u+w
|
---|
61 | vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
|
---|
62 |
|
---|
63 | vboxmod-sh_INST = bin/src/
|
---|
64 | vboxmod-sh_MODE = a+rx,u+w
|
---|
65 | vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
|
---|
66 |
|
---|
67 | #
|
---|
68 | # The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
|
---|
69 | #
|
---|
70 | ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
|
---|
71 | # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
|
---|
72 | SUPR3_TEMPLATE = VBOXR3NP
|
---|
73 | else
|
---|
74 | SUPR3_TEMPLATE = VBOXR3
|
---|
75 | endif
|
---|
76 | SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
|
---|
77 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
78 | SUPR3_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
79 | endif
|
---|
80 | SUPR3_INCS := $(PATH_SUB_CURRENT)
|
---|
81 | SUPR3_INCS.l4 = $(L4_INCDIR)
|
---|
82 | SUPR3_SOURCES = \
|
---|
83 | SUPLib.cpp \
|
---|
84 | $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
|
---|
85 |
|
---|
86 | #
|
---|
87 | # SUPR0 - The Ring-0 Import / Thunk library.
|
---|
88 | #
|
---|
89 | SUPR0_TEMPLATE = VBOXR0
|
---|
90 | ifeq ($(VBOX_LDR_FMT),pe)
|
---|
91 | SUPR0_SOURCES += SUPR0.def
|
---|
92 | endif
|
---|
93 | ifeq ($(VBOX_LDR_FMT),lx)
|
---|
94 | SUPR0_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 $@
|
---|
98 | endif
|
---|
99 |
|
---|
100 |
|
---|
101 | #
|
---|
102 | # VBoxDrv.sys - The Windows driver.
|
---|
103 | #
|
---|
104 | ifeq ($(BUILD_TARGET),win)
|
---|
105 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
106 | ifdef VBOX_SIGNING_MODE
|
---|
107 | VBoxDrv_NOINST = true
|
---|
108 | endif
|
---|
109 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE_FOR_MM
|
---|
110 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
111 | VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
112 | endif
|
---|
113 | VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
|
---|
114 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
115 | VBoxDrv_SOURCES = \
|
---|
116 | win/SUPDrv-win.cpp \
|
---|
117 | win/SUPDrvA-win.asm \
|
---|
118 | SUPDRVShared.c
|
---|
119 | VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
120 | VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
121 | VBoxDrv_LIBS = \
|
---|
122 | $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
|
---|
123 | $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
|
---|
124 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
125 |
|
---|
126 |
|
---|
127 | INSTALLS += VBoxDrv-inf
|
---|
128 | VBoxDrv-inf_INST = $(INST_BIN)
|
---|
129 | VBoxDrv-inf_MODE = a+r,u+w
|
---|
130 | VBoxDrv-inf_SOURCES = \
|
---|
131 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
|
---|
132 | VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
|
---|
133 | VBoxDrv-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
|
---|
140 | VBoxDrv-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
|
---|
153 | endif # win
|
---|
154 |
|
---|
155 |
|
---|
156 | #
|
---|
157 | # vboxdrv.ko - The Linux Kernel Module (syntax only).
|
---|
158 | #
|
---|
159 | ifeq ($(BUILD_TARGET),linux)
|
---|
160 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
161 | 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
|
---|
162 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
163 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
164 | endif
|
---|
165 | vboxdrv_INCS := \
|
---|
166 | $(PATH_SUB_CURRENT) \
|
---|
167 | $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
|
---|
168 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
169 | vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
|
---|
170 | vboxdrv_SOURCES = \
|
---|
171 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
172 | SUPDRVShared.c
|
---|
173 | ifndef VBOX_LINUX_VERSION_2_4
|
---|
174 | vboxdrv_SOURCES += \
|
---|
175 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
|
---|
176 | endif
|
---|
177 | endif # real linux
|
---|
178 |
|
---|
179 |
|
---|
180 | #
|
---|
181 | # VBoxDrv.kext - The Darwin Kernel Extension.
|
---|
182 | #
|
---|
183 | ifeq ($(BUILD_TARGET),darwin)
|
---|
184 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
185 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
186 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
187 | VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
188 | endif
|
---|
189 | VBoxDrv_DEFS += DEBUG_DARWIN_GIP
|
---|
190 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
191 | VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
192 | VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
193 | VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
|
---|
194 | VBoxDrv_SOURCES = \
|
---|
195 | SUPDRVShared.c \
|
---|
196 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
|
---|
197 |
|
---|
198 | INSTALLS += VBoxDrv.kext
|
---|
199 | VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
|
---|
200 | VBoxDrv.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 |
|
---|
213 | INSTALLS += Scripts
|
---|
214 | Scripts_INST = $(INST_DIST)
|
---|
215 | Scripts_SOURCES = \
|
---|
216 | darwin/load.sh
|
---|
217 |
|
---|
218 | endif # darwin
|
---|
219 |
|
---|
220 |
|
---|
221 | #
|
---|
222 | # VBoxDrv.sys - The OS/2 driver.
|
---|
223 | #
|
---|
224 | ifeq ($(BUILD_TARGET),os2)
|
---|
225 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
226 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
227 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
228 | #VBoxDrv_LDFLAGS = -s -t -v
|
---|
229 | VBoxDrv_SOURCES = \
|
---|
230 | os2/SUPDrvA-os2.asm \
|
---|
231 | os2/SUPDrv-os2.def
|
---|
232 | VBoxDrv_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.
|
---|
239 | LIBRARIES += VBoxDrvLib
|
---|
240 | VBoxDrvLib_TEMPLATE = VBOXR0DRV
|
---|
241 | VBoxDrvLib_NOINST = 1
|
---|
242 | VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
243 | VBoxDrvLib_INCS := \
|
---|
244 | $(PATH_SUB_CURRENT) \
|
---|
245 | $(PATH_TARGET) \
|
---|
246 | $(PATH_ROOT)/src/VBox/Runtime/include
|
---|
247 | VBoxDrvLib_SOURCES = \
|
---|
248 | os2/SUPDrv-os2.cpp \
|
---|
249 | SUPDRVShared.c
|
---|
250 | endif
|
---|
251 |
|
---|
252 |
|
---|
253 | #
|
---|
254 | # vboxdrv.ko - The FreeBSD Kernel Module.
|
---|
255 | #
|
---|
256 | ifeq ($(BUILD_TARGET),freebsd)
|
---|
257 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
258 | vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
259 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
260 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
261 | endif
|
---|
262 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
263 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
264 | vboxdrv_SOURCES = \
|
---|
265 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
266 | SUPDRVShared.c
|
---|
267 | endif # freebsd
|
---|
268 |
|
---|
269 |
|
---|
270 | #
|
---|
271 | # vboxdrv.o - The Solaris Kernel Module.
|
---|
272 | #
|
---|
273 | ifeq ($(BUILD_TARGET),solaris)
|
---|
274 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
275 | vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
276 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
277 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
278 | endif
|
---|
279 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
280 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
281 | vboxdrv_SOURCES = \
|
---|
282 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
283 | SUPDRVShared.c
|
---|
284 | endif # solaris
|
---|
285 |
|
---|
286 |
|
---|
287 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
288 |
|
---|