VirtualBox

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

Last change on this file since 8237 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.0 KB
Line 
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
31DEPTH ?= ../../../..
32SUB_DEPTH = ..
33include $(PATH_KBUILD)/subheader.kmk
34
35#
36# Targets
37#
38LIBRARIES += SUPR3
39ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT)),)
40LIBRARIES += SUPR0
41endif
42ifdef VBOX_WITH_VBOXDRV
43SYSMODS.darwin += VBoxDrv
44SYSMODS.freebsd += vboxdrv
45SYSMODS.linux += vboxdrv
46SYSMODS.win += VBoxDrv
47SYSMODS.os2 += VBoxDrv
48SYSMODS.solaris += vboxdrv
49OTHERS.linux += \
50 $(PATH_BIN)/src/build_in_tmp \
51 $(if $(VBOX_OSE),,$(PATH_BIN)/src/dkms.conf)
52endif
53
54INSTALLS.linux = vboxmod-bin vboxmod-sh
55
56#
57# Include sub-makefile(s).
58#
59include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
60
61#
62# Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
63#
64include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
65
66vboxmod-bin_INST = bin/src/
67vboxmod-bin_MODE = a+r,u+w
68vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
69
70vboxmod-sh_INST = bin/src/
71vboxmod-sh_MODE = a+rx,u+w
72vboxmod-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#
90ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
91# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
92SUPR3_TEMPLATE = VBOXR3NP
93else
94SUPR3_TEMPLATE = VBOXR3
95endif
96SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
97ifdef VBOX_WITH_IDT_PATCHING
98SUPR3_DEFS += VBOX_WITH_IDT_PATCHING
99endif
100SUPR3_INCS := $(PATH_SUB_CURRENT)
101SUPR3_INCS.l4 = $(L4_INCDIR)
102SUPR3_SOURCES = \
103 SUPLib.cpp \
104 $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
105
106#
107# SUPR0 - The Ring-0 Import / Thunk library.
108#
109SUPR0_TEMPLATE = VBOXR0
110ifeq ($(VBOX_LDR_FMT),pe)
111SUPR0_SOURCES += SUPR0.def
112endif
113ifeq ($(VBOX_LDR_FMT),lx)
114SUPR0_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] $@
118endif
119
120
121#
122# VBoxDrv.sys - The Windows driver.
123#
124ifeq ($(BUILD_TARGET),win)
125VBoxDrv_TEMPLATE = VBOXR0DRV
126ifdef VBOX_SIGNING_MODE
127 VBoxDrv_NOINST = true
128endif
129VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE_FOR_MM
130ifdef VBOX_WITH_IDT_PATCHING
131VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
132endif
133VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
134VBoxDrv_INCS := $(PATH_SUB_CURRENT)
135VBoxDrv_SOURCES = \
136 win/SUPDrv-win.cpp \
137 win/SUPDrvA-win.asm \
138 SUPDRVShared.c
139VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
140VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
141VBoxDrv_LIBS = \
142 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
143 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
144 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
145
146
147INSTALLS += VBoxDrv-inf
148VBoxDrv-inf_INST = $(INST_BIN)
149VBoxDrv-inf_MODE = a+r,u+w
150VBoxDrv-inf_SOURCES = \
151 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
152VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
153VBoxDrv-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
160VBoxDrv-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
173endif # win
174
175
176#
177# vboxdrv.ko - The Linux Kernel Module (syntax only).
178#
179ifeq ($(BUILD_TARGET),linux)
180vboxdrv_TEMPLATE = VBOXR0DRV
181vboxdrv_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
182ifdef VBOX_WITH_IDT_PATCHING
183vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
184endif
185vboxdrv_INCS := \
186 $(PATH_SUB_CURRENT) \
187 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
188vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
189vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
190vboxdrv_SOURCES = \
191 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
192 SUPDRVShared.c
193ifndef VBOX_LINUX_VERSION_2_4
194vboxdrv_SOURCES += \
195 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
196endif
197endif # real linux
198
199
200#
201# VBoxDrv.kext - The Darwin Kernel Extension.
202#
203ifeq ($(BUILD_TARGET),darwin)
204VBoxDrv_TEMPLATE = VBOXR0DRV
205VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
206ifdef VBOX_WITH_IDT_PATCHING
207VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
208endif
209VBoxDrv_DEFS += DEBUG_DARWIN_GIP
210VBoxDrv_INCS := $(PATH_SUB_CURRENT)
211VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
212VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
213VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
214VBoxDrv_SOURCES = \
215 SUPDRVShared.c \
216 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
217
218INSTALLS += VBoxDrv.kext
219VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
220VBoxDrv.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
233INSTALLS += Scripts
234Scripts_INST = $(INST_DIST)
235Scripts_SOURCES = \
236 darwin/load.sh
237
238endif # darwin
239
240
241#
242# VBoxDrv.sys - The OS/2 driver.
243#
244ifeq ($(BUILD_TARGET),os2)
245VBoxDrv_TEMPLATE = VBOXR0DRV
246VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
247VBoxDrv_INCS := $(PATH_SUB_CURRENT)
248#VBoxDrv_LDFLAGS = -s -t -v
249VBoxDrv_SOURCES = \
250 os2/SUPDrvA-os2.asm \
251 os2/SUPDrv-os2.def
252VBoxDrv_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.
259LIBRARIES += VBoxDrvLib
260VBoxDrvLib_TEMPLATE = VBOXR0DRV
261VBoxDrvLib_NOINST = 1
262VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
263VBoxDrvLib_INCS := \
264 $(PATH_SUB_CURRENT) \
265 $(PATH_TARGET) \
266 $(PATH_ROOT)/src/VBox/Runtime/include
267VBoxDrvLib_SOURCES = \
268 os2/SUPDrv-os2.cpp \
269 SUPDRVShared.c
270endif
271
272
273#
274# vboxdrv.ko - The FreeBSD Kernel Module.
275#
276ifeq ($(BUILD_TARGET),freebsd)
277vboxdrv_TEMPLATE = VBOXR0DRV
278vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
279ifdef VBOX_WITH_IDT_PATCHING
280vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
281endif
282vboxdrv_INCS := $(PATH_SUB_CURRENT)
283vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
284vboxdrv_SOURCES = \
285 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
286 SUPDRVShared.c
287endif # freebsd
288
289
290#
291# vboxdrv.o - The Solaris Kernel Module.
292#
293ifeq ($(BUILD_TARGET),solaris)
294vboxdrv_TEMPLATE = VBOXR0DRV
295vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
296ifdef VBOX_WITH_IDT_PATCHING
297vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
298endif
299vboxdrv_INCS := $(PATH_SUB_CURRENT)
300vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
301vboxdrv_SOURCES = \
302 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
303 SUPDRVShared.c
304endif # solaris
305
306
307include $(PATH_KBUILD)/subfooter.kmk
308
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