VirtualBox

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

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

No IDT patching on OS/2 - stack isn't flat, remember.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.8 KB
Line 
1# $Id: Makefile.kmk 5019 2007-09-25 00:51:55Z 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 as published by the Free Software Foundation,
13# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14# distribution. VirtualBox OSE is distributed in the hope that it will
15# be useful, but WITHOUT ANY WARRANTY of any kind.
16
17DEPTH ?= ../../../..
18SUB_DEPTH = ..
19include $(PATH_KBUILD)/subheader.kmk
20
21#
22# Targets
23#
24LIBRARIES += SUPR3
25ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT)),)
26LIBRARIES += SUPR0
27endif
28ifdef VBOX_WITH_VBOXDRV
29SYSMODS.darwin += VBoxDrv
30SYSMODS.freebsd += vboxdrv
31SYSMODS.linux += vboxdrv
32SYSMODS.win += VBoxDrv
33SYSMODS.os2 += VBoxDrv
34SYSMODS.solaris += vboxdrv
35endif
36
37INSTALLS.linux = vboxmod-bin vboxmod-sh
38
39#
40# Include sub-makefile(s).
41#
42include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
43
44#
45# Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
46#
47include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
48
49vboxmod-bin_INST = bin/src/
50vboxmod-bin_MODE = a+r,u+w
51vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
52
53vboxmod-sh_INST = bin/src/
54vboxmod-sh_MODE = a+rx,u+w
55vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
56
57#
58# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
59#
60ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
61# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
62SUPR3_TEMPLATE = VBOXR3NP
63else
64SUPR3_TEMPLATE = VBOXR3
65endif
66SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
67ifdef VBOX_WITH_IDT_PATCHING
68SUPR3_DEFS += VBOX_WITH_IDT_PATCHING
69endif
70SUPR3_INCS := $(PATH_SUB_CURRENT)
71SUPR3_INCS.l4 = $(L4_INCDIR)
72SUPR3_SOURCES = \
73 SUPLib.cpp \
74 $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
75
76#
77# SUPR0 - The Ring-0 Import / Thunk library.
78#
79SUPR0_TEMPLATE = VBOXR0
80ifeq ($(VBOX_LDR_FMT),pe)
81SUPR0_SOURCES += SUPR0.def
82endif
83ifeq ($(VBOX_LDR_FMT),lx)
84SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
85$(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
86 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
87 $(MV) -f $@.tmp $@
88endif
89
90
91#
92# VBoxDrv.sys - The Windows driver.
93#
94ifeq ($(BUILD_TARGET),win)
95VBoxDrv_TEMPLATE = VBOXR0DRV
96ifdef VBOX_SIGNING_MODE
97 VBoxDrv_NOINST = true
98endif
99VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE_FOR_MM
100ifdef VBOX_WITH_IDT_PATCHING
101VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
102endif
103VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
104VBoxDrv_INCS := $(PATH_SUB_CURRENT)
105VBoxDrv_SOURCES = \
106 win/SUPDrv-win.cpp \
107 win/SUPDrvA-win.asm \
108 SUPDRVShared.c
109VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
110VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
111VBoxDrv_LIBS = \
112 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
113 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
114 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
115
116
117INSTALLS += VBoxDrv-inf
118VBoxDrv-inf_INST = $(INST_BIN)
119VBoxDrv-inf_MODE = a+r,u+w
120VBoxDrv-inf_SOURCES = \
121 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
122VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
123VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
124
125$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
126 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
127 $(call VBOX_EDIT_INF_FN,$<,$@)
128
129 ifdef VBOX_SIGNING_MODE
130VBoxDrv-inf_SOURCES += \
131 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
132 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
133
134$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
135 $(INSTALL) -m 644 $< $(@D)
136
137$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
138 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
139 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
140 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
141 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
142 endif # signing
143endif # win
144
145
146#
147# vboxdrv.ko - The Linux Kernel Module (syntax only).
148#
149ifeq ($(BUILD_TARGET),linux)
150vboxdrv_TEMPLATE = VBOXR0DRV
151vboxdrv_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
152ifdef VBOX_WITH_IDT_PATCHING
153vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
154endif
155vboxdrv_INCS := $(PATH_SUB_CURRENT)
156vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
157vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
158vboxdrv_SOURCES = \
159 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
160 SUPDRVShared.c
161ifndef VBOX_LINUX_VERSION_2_4
162vboxdrv_SOURCES += \
163 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
164endif
165endif # real linux
166
167
168#
169# VBoxDrv.kext - The Darwin Kernel Extension.
170#
171ifeq ($(BUILD_TARGET),darwin)
172VBoxDrv_TEMPLATE = VBOXR0DRV
173VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
174ifdef VBOX_WITH_IDT_PATCHING
175VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
176endif
177VBoxDrv_DEFS += DEBUG_DARWIN_GIP
178VBoxDrv_INCS := $(PATH_SUB_CURRENT)
179VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
180VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
181VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
182VBoxDrv_SOURCES = \
183 SUPDRVShared.c \
184 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
185
186INSTALLS += VBoxDrv.kext
187VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
188VBoxDrv.kext_SOURCES = \
189 $(PATH_TARGET)/VBoxDrv/Info.plist
190
191$(PATH_TARGET)/VBoxDrv/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET)/VBoxDrv)
192 $(call MSG_GENERATE,VBoxDrv,$@,$<)
193 $(xQUIET)$(RM) -f $@
194 $(xQUIET)$(SED) \
195 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
196 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
197 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
198 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
199 $< > $@
200
201INSTALLS += Scripts
202Scripts_INST = $(INST_DIST)
203Scripts_SOURCES = \
204 darwin/load.sh
205
206endif # darwin
207
208
209#
210# VBoxDrv.sys - The OS/2 driver.
211#
212ifeq ($(BUILD_TARGET),os2)
213VBoxDrv_TEMPLATE = VBOXR0DRV
214VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
215VBoxDrv_INCS := $(PATH_SUB_CURRENT)
216#VBoxDrv_LDFLAGS = -s -t -v
217VBoxDrv_SOURCES = \
218 os2/SUPDrvA-os2.asm \
219 os2/SUPDrv-os2.def
220VBoxDrv_LIBS = \
221 $(TARGET_VBoxDrvLib) \
222 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
223 $(VBOX_GCC_LIBGCC) \
224 end
225
226# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
227LIBRARIES += VBoxDrvLib
228VBoxDrvLib_TEMPLATE = VBOXR0DRV
229VBoxDrvLib_NOINST = 1
230VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
231VBoxDrvLib_INCS := \
232 $(PATH_SUB_CURRENT) \
233 $(PATH_TARGET) \
234 $(PATH_ROOT)/src/VBox/Runtime/include
235VBoxDrvLib_SOURCES = \
236 os2/SUPDrv-os2.cpp \
237 SUPDRVShared.c
238endif
239
240
241#
242# vboxdrv.ko - The FreeBSD Kernel Module.
243#
244ifeq ($(BUILD_TARGET),freebsd)
245vboxdrv_TEMPLATE = VBOXR0DRV
246vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
247ifdef VBOX_WITH_IDT_PATCHING
248vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
249endif
250vboxdrv_INCS := $(PATH_SUB_CURRENT)
251vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
252vboxdrv_SOURCES = \
253 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
254 SUPDRVShared.c
255endif # freebsd
256
257
258#
259# vboxdrv.o - The Solaris Kernel Module.
260#
261ifeq ($(BUILD_TARGET),solaris)
262vboxdrv_TEMPLATE = VBOXR0DRV
263vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
264ifdef VBOX_WITH_IDT_PATCHING
265vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
266endif
267vboxdrv_INCS := $(PATH_SUB_CURRENT)
268vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
269vboxdrv_SOURCES = \
270 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
271 SUPDRVShared.c
272endif # solaris
273
274
275include $(PATH_KBUILD)/subfooter.kmk
276
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