VirtualBox

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

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

inverted 2.4 check.

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