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 |
|
---|
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]*/ /' $< > [email protected]
|
---|
97 | $(MV) -f [email protected] $@
|
---|
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 := $(PATH_SUB_CURRENT)
|
---|
166 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
167 | vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
|
---|
168 | vboxdrv_SOURCES = \
|
---|
169 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
170 | SUPDRVShared.c
|
---|
171 | ifndef VBOX_LINUX_VERSION_2_4
|
---|
172 | vboxdrv_SOURCES += \
|
---|
173 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
|
---|
174 | endif
|
---|
175 | endif # real linux
|
---|
176 |
|
---|
177 |
|
---|
178 | #
|
---|
179 | # VBoxDrv.kext - The Darwin Kernel Extension.
|
---|
180 | #
|
---|
181 | ifeq ($(BUILD_TARGET),darwin)
|
---|
182 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
183 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
184 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
185 | VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
186 | endif
|
---|
187 | VBoxDrv_DEFS += DEBUG_DARWIN_GIP
|
---|
188 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
189 | VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
190 | VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
191 | VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
|
---|
192 | VBoxDrv_SOURCES = \
|
---|
193 | SUPDRVShared.c \
|
---|
194 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
|
---|
195 |
|
---|
196 | INSTALLS += VBoxDrv.kext
|
---|
197 | VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
|
---|
198 | VBoxDrv.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 |
|
---|
211 | INSTALLS += Scripts
|
---|
212 | Scripts_INST = $(INST_DIST)
|
---|
213 | Scripts_SOURCES = \
|
---|
214 | darwin/load.sh
|
---|
215 |
|
---|
216 | endif # darwin
|
---|
217 |
|
---|
218 |
|
---|
219 | #
|
---|
220 | # VBoxDrv.sys - The OS/2 driver.
|
---|
221 | #
|
---|
222 | ifeq ($(BUILD_TARGET),os2)
|
---|
223 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
224 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
225 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
226 | #VBoxDrv_LDFLAGS = -s -t -v
|
---|
227 | VBoxDrv_SOURCES = \
|
---|
228 | os2/SUPDrvA-os2.asm \
|
---|
229 | os2/SUPDrv-os2.def
|
---|
230 | VBoxDrv_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.
|
---|
237 | LIBRARIES += VBoxDrvLib
|
---|
238 | VBoxDrvLib_TEMPLATE = VBOXR0DRV
|
---|
239 | VBoxDrvLib_NOINST = 1
|
---|
240 | VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
241 | VBoxDrvLib_INCS := \
|
---|
242 | $(PATH_SUB_CURRENT) \
|
---|
243 | $(PATH_TARGET) \
|
---|
244 | $(PATH_ROOT)/src/VBox/Runtime/include
|
---|
245 | VBoxDrvLib_SOURCES = \
|
---|
246 | os2/SUPDrv-os2.cpp \
|
---|
247 | SUPDRVShared.c
|
---|
248 | endif
|
---|
249 |
|
---|
250 |
|
---|
251 | #
|
---|
252 | # vboxdrv.ko - The FreeBSD Kernel Module.
|
---|
253 | #
|
---|
254 | ifeq ($(BUILD_TARGET),freebsd)
|
---|
255 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
256 | vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
257 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
258 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
259 | endif
|
---|
260 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
261 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
262 | vboxdrv_SOURCES = \
|
---|
263 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
264 | SUPDRVShared.c
|
---|
265 | endif # freebsd
|
---|
266 |
|
---|
267 |
|
---|
268 | #
|
---|
269 | # vboxdrv.o - The Solaris Kernel Module.
|
---|
270 | #
|
---|
271 | ifeq ($(BUILD_TARGET),solaris)
|
---|
272 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
273 | vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
274 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
275 | vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
276 | endif
|
---|
277 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
278 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
279 | vboxdrv_SOURCES = \
|
---|
280 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
281 | SUPDRVShared.c
|
---|
282 | endif # solaris
|
---|
283 |
|
---|
284 |
|
---|
285 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
286 |
|
---|