VirtualBox

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

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

added missing dependency to $(VBOX_VERSION_STAMP)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1# $Id: Makefile.kmk 9218 2008-05-29 11:39:15Z 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 $(KBUILD_PATH)/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 $(VBOX_VERSION_STAMP)
79 $(call MSG_TOOL,Creating,,$@)
80 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxdrv;g" < $< > $@
81 $(QUIET)chmod 0755 $@
82
83$(PATH_BIN)/src/dkms.conf: \
84 $(PATH_SUB_CURRENT)/linux/dkms.conf \
85 $(VBOX_VERSION_STAMP)
86 $(call MSG_TOOL,Creating,,$@)
87 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" < $< > $@
88
89#
90# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
91#
92ifneq ($(filter l4%,$(KBUILD_TARGET) $(BUILD_TARGET_SUB)),)
93# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
94SUPR3_TEMPLATE = VBOXR3NP
95else
96SUPR3_TEMPLATE = VBOXR3
97endif
98SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
99ifdef VBOX_WITH_IDT_PATCHING
100SUPR3_DEFS += VBOX_WITH_IDT_PATCHING
101endif
102SUPR3_INCS := $(PATH_SUB_CURRENT)
103SUPR3_INCS.l4 = $(L4_INCDIR)
104SUPR3_SOURCES = \
105 SUPLib.cpp \
106 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
107
108#
109# SUPR0 - The Ring-0 Import / Thunk library.
110#
111SUPR0_TEMPLATE = VBOXR0
112ifeq ($(VBOX_LDR_FMT),pe)
113SUPR0_SOURCES += SUPR0.def
114endif
115ifeq ($(VBOX_LDR_FMT),lx)
116SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
117$(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
118 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > [email protected]
119 $(MV) -f [email protected] $@
120endif
121
122
123#
124# VBoxDrv.sys - The Windows driver.
125#
126ifeq ($(KBUILD_TARGET),win)
127VBoxDrv_TEMPLATE = VBOXR0DRV
128ifdef VBOX_SIGNING_MODE
129 VBoxDrv_NOINST = true
130endif
131VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE_FOR_MM
132ifdef VBOX_WITH_IDT_PATCHING
133VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
134endif
135VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
136VBoxDrv_INCS := $(PATH_SUB_CURRENT)
137VBoxDrv_SOURCES = \
138 win/SUPDrv-win.cpp \
139 win/SUPDrvA-win.asm \
140 SUPDRVShared.c
141VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
142VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
143VBoxDrv_LIBS = \
144 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
145 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
146 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
147
148
149INSTALLS += VBoxDrv-inf
150VBoxDrv-inf_INST = $(INST_BIN)
151VBoxDrv-inf_MODE = a+r,u+w
152VBoxDrv-inf_SOURCES = \
153 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
154VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
155VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
156
157$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
158 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
159 $(call VBOX_EDIT_INF_FN,$<,$@)
160
161 ifdef VBOX_SIGNING_MODE
162VBoxDrv-inf_SOURCES += \
163 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
164 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
165
166$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
167 $(INSTALL) -m 644 $< $(@D)
168
169$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
170 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
171 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
172 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
173 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
174 endif # signing
175endif # win
176
177
178#
179# vboxdrv.ko - The Linux Kernel Module (syntax only).
180#
181ifeq ($(KBUILD_TARGET),linux)
182vboxdrv_TEMPLATE = VBOXR0DRV
183vboxdrv_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
184ifdef VBOX_WITH_IDT_PATCHING
185vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
186endif
187vboxdrv_INCS := \
188 $(PATH_SUB_CURRENT) \
189 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
190vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
191vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
192vboxdrv_SOURCES = \
193 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
194 SUPDRVShared.c
195ifndef VBOX_LINUX_VERSION_2_4
196vboxdrv_SOURCES += \
197 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).mod.c
198endif
199endif # real linux
200
201
202#
203# VBoxDrv.kext - The Darwin Kernel Extension.
204#
205ifeq ($(KBUILD_TARGET),darwin)
206VBoxDrv_TEMPLATE = VBOXR0DRV
207VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
208ifdef VBOX_WITH_IDT_PATCHING
209VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
210endif
211VBoxDrv_DEFS += DEBUG_DARWIN_GIP
212VBoxDrv_INCS := $(PATH_SUB_CURRENT)
213VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
214VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
215VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
216VBoxDrv_SOURCES = \
217 SUPDRVShared.c \
218 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).cpp
219
220INSTALLS += VBoxDrv.kext
221VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
222VBoxDrv.kext_SOURCES = \
223 $(PATH_TARGET)/VBoxDrv/Info.plist
224VBoxDrv.kext_CLEAN = \
225 $(PATH_TARGET)/VBoxDrv/Info.plist
226
227$(PATH_TARGET)/VBoxDrv/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET)/VBoxDrv)
228 $(call MSG_GENERATE,VBoxDrv,$@,$<)
229 $(xQUIET)$(RM) -f $@
230 $(xQUIET)$(SED) \
231 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
232 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
233 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
234 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
235 $< > $@
236
237INSTALLS += Scripts
238Scripts_INST = $(INST_DIST)
239Scripts_SOURCES = \
240 darwin/load.sh
241
242endif # darwin
243
244
245#
246# VBoxDrv.sys - The OS/2 driver.
247#
248ifeq ($(KBUILD_TARGET),os2)
249VBoxDrv_TEMPLATE = VBOXR0DRV
250VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
251VBoxDrv_INCS := $(PATH_SUB_CURRENT)
252#VBoxDrv_LDFLAGS = -s -t -v
253VBoxDrv_SOURCES = \
254 os2/SUPDrvA-os2.asm \
255 os2/SUPDrv-os2.def
256VBoxDrv_LIBS = \
257 $(TARGET_VBoxDrvLib) \
258 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
259 $(VBOX_GCC_LIBGCC) \
260 end
261
262# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
263LIBRARIES += VBoxDrvLib
264VBoxDrvLib_TEMPLATE = VBOXR0DRV
265VBoxDrvLib_NOINST = 1
266VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
267VBoxDrvLib_INCS := \
268 $(PATH_SUB_CURRENT) \
269 $(PATH_TARGET) \
270 $(PATH_ROOT)/src/VBox/Runtime/include
271VBoxDrvLib_SOURCES = \
272 os2/SUPDrv-os2.cpp \
273 SUPDRVShared.c
274endif
275
276
277#
278# vboxdrv.ko - The FreeBSD Kernel Module.
279#
280ifeq ($(KBUILD_TARGET),freebsd)
281vboxdrv_TEMPLATE = VBOXR0DRV
282vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
283ifdef VBOX_WITH_IDT_PATCHING
284vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
285endif
286vboxdrv_INCS := $(PATH_SUB_CURRENT)
287vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
288vboxdrv_SOURCES = \
289 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
290 SUPDRVShared.c
291endif # freebsd
292
293
294#
295# vboxdrv.o - The Solaris Kernel Module.
296#
297ifeq ($(KBUILD_TARGET),solaris)
298vboxdrv_TEMPLATE = VBOXR0DRV
299vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
300ifdef VBOX_WITH_IDT_PATCHING
301vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
302endif
303vboxdrv_INCS := $(PATH_SUB_CURRENT)
304vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
305vboxdrv_SOURCES = \
306 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
307 SUPDRVShared.c
308endif # solaris
309
310
311include $(KBUILD_PATH)/subfooter.kmk
312
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