VirtualBox

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

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

BUILD_TARGET* -> KBUILD_TARGET*.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1# $Id: Makefile.kmk 8758 2008-05-11 18:27:49Z 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; 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#
90ifneq ($(filter l4%,$(KBUILD_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 $(KBUILD_TARGET)/SUPLib-$(KBUILD_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 ($(KBUILD_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 ($(KBUILD_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 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
192 SUPDRVShared.c
193ifndef VBOX_LINUX_VERSION_2_4
194vboxdrv_SOURCES += \
195 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).mod.c
196endif
197endif # real linux
198
199
200#
201# VBoxDrv.kext - The Darwin Kernel Extension.
202#
203ifeq ($(KBUILD_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 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).cpp
217
218INSTALLS += VBoxDrv.kext
219VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
220VBoxDrv.kext_SOURCES = \
221 $(PATH_TARGET)/VBoxDrv/Info.plist
222VBoxDrv.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
235INSTALLS += Scripts
236Scripts_INST = $(INST_DIST)
237Scripts_SOURCES = \
238 darwin/load.sh
239
240endif # darwin
241
242
243#
244# VBoxDrv.sys - The OS/2 driver.
245#
246ifeq ($(KBUILD_TARGET),os2)
247VBoxDrv_TEMPLATE = VBOXR0DRV
248VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
249VBoxDrv_INCS := $(PATH_SUB_CURRENT)
250#VBoxDrv_LDFLAGS = -s -t -v
251VBoxDrv_SOURCES = \
252 os2/SUPDrvA-os2.asm \
253 os2/SUPDrv-os2.def
254VBoxDrv_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.
261LIBRARIES += VBoxDrvLib
262VBoxDrvLib_TEMPLATE = VBOXR0DRV
263VBoxDrvLib_NOINST = 1
264VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
265VBoxDrvLib_INCS := \
266 $(PATH_SUB_CURRENT) \
267 $(PATH_TARGET) \
268 $(PATH_ROOT)/src/VBox/Runtime/include
269VBoxDrvLib_SOURCES = \
270 os2/SUPDrv-os2.cpp \
271 SUPDRVShared.c
272endif
273
274
275#
276# vboxdrv.ko - The FreeBSD Kernel Module.
277#
278ifeq ($(KBUILD_TARGET),freebsd)
279vboxdrv_TEMPLATE = VBOXR0DRV
280vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
281ifdef VBOX_WITH_IDT_PATCHING
282vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
283endif
284vboxdrv_INCS := $(PATH_SUB_CURRENT)
285vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
286vboxdrv_SOURCES = \
287 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
288 SUPDRVShared.c
289endif # freebsd
290
291
292#
293# vboxdrv.o - The Solaris Kernel Module.
294#
295ifeq ($(KBUILD_TARGET),solaris)
296vboxdrv_TEMPLATE = VBOXR0DRV
297vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
298ifdef VBOX_WITH_IDT_PATCHING
299vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
300endif
301vboxdrv_INCS := $(PATH_SUB_CURRENT)
302vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
303vboxdrv_SOURCES = \
304 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
305 SUPDRVShared.c
306endif # solaris
307
308
309include $(PATH_KBUILD)/subfooter.kmk
310
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