VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
1# $Id: Makefile.kmk 4071 2007-08-07 17:07:59Z 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
25ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
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
67SUPR3_INCS := $(PATH_SUB_CURRENT)
68SUPR3_INCS.l4 = $(L4_INCDIR)
69SUPR3_SOURCES = \
70 SUPLib.cpp \
71 $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
72
73#
74# SUPR0 - The Ring-0 Import / Thunk library.
75#
76SUPR0_TEMPLATE = VBOXR0
77ifeq ($(VBOX_LDR_FMT),pe)
78SUPR0_SOURCES += SUPR0.def
79endif
80ifeq ($(VBOX_LDR_FMT),lx)
81SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
82$(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
83 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > [email protected]
84 $(MV) -f [email protected] $@
85endif
86
87
88#
89# VBoxDrv.sys - The Windows driver.
90#
91ifeq ($(BUILD_TARGET),win)
92VBoxDrv_TEMPLATE = VBOXR0DRV
93ifdef VBOX_SIGNING_MODE
94 VBoxDrv_NOINST = true
95endif
96VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
97VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
98VBoxDrv_INCS := $(PATH_SUB_CURRENT)
99VBoxDrv_SOURCES = \
100 win/SUPDrv-win.cpp \
101 win/SUPDrvA-win.asm \
102 SUPDRVShared.c
103VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
104VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
105VBoxDrv_LIBS = \
106 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
107 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
108 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
109
110
111INSTALLS += VBoxDrv-inf
112VBoxDrv-inf_INST = $(INST_BIN)
113VBoxDrv-inf_MODE = a+r,u+w
114VBoxDrv-inf_SOURCES = \
115 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
116VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
117VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
118
119$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
120 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
121 $(call VBOX_EDIT_INF_FN,$<,$@)
122
123 ifdef VBOX_SIGNING_MODE
124VBoxDrv-inf_SOURCES += \
125 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
126 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
127
128$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
129 $(INSTALL) -m 644 $< $(@D)
130
131$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
132 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
133 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
134 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
135 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
136 endif # signing
137endif # win
138
139
140#
141# vboxdrv.ko - The Linux Kernel Module (syntax only).
142#
143ifeq ($(BUILD_TARGET),linux)
144vboxdrv_TEMPLATE = VBOXR0DRV
145vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
146vboxdrv_INCS := $(PATH_SUB_CURRENT)
147vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
148vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
149vboxdrv_SOURCES = \
150 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
151 SUPDRVShared.c
152ifndef VBOX_LINUX_VERSION_2_4
153vboxdrv_SOURCES += \
154 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
155endif
156endif # real linux
157
158
159#
160# VBoxDrv.kext - The Darwin Kernel Extension.
161#
162ifeq ($(BUILD_TARGET),darwin)
163VBoxDrv_TEMPLATE = VBOXR0DRV
164VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
165VBoxDrv_DEFS += DEBUG_DARWIN_GIP
166VBoxDrv_INCS := $(PATH_SUB_CURRENT)
167VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
168VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
169VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
170VBoxDrv_SOURCES = \
171 SUPDRVShared.c \
172 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
173
174INSTALLS += VBoxDrv.kext
175VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
176VBoxDrv.kext_SOURCES = \
177 $(PATH_TARGET)/Info.plist
178
179$(PATH_TARGET)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
180 $(call MSG_GENERATE,VBoxDrv,$@,$<)
181 $(xQUIET)$(RM) -f $@
182 $(xQUIET)$(SED) \
183 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
184 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
185 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
186 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
187 $< > $@
188
189INSTALLS += Scripts
190Scripts_INST = $(INST_DIST)
191Scripts_SOURCES = \
192 darwin/load.sh
193
194endif # darwin
195
196
197#
198# VBoxDrv.sys - The OS/2 driver.
199#
200ifeq ($(BUILD_TARGET),os2)
201VBoxDrv_TEMPLATE = VBOXR0DRV
202VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
203VBoxDrv_INCS := $(PATH_SUB_CURRENT)
204#VBoxDrv_LDFLAGS = -s -t -v
205VBoxDrv_SOURCES = \
206 os2/SUPDrvA-os2.asm \
207 os2/SUPDrv-os2.def
208VBoxDrv_LIBS = \
209 $(TARGET_VBoxDrvLib) \
210 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
211 $(VBOX_GCC_LIBGCC) \
212 end
213
214# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
215LIBRARIES += VBoxDrvLib
216VBoxDrvLib_TEMPLATE = VBOXR0DRV
217VBoxDrvLib_NOINST = 1
218VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
219VBoxDrvLib_INCS := \
220 $(PATH_SUB_CURRENT) \
221 $(PATH_TARGET) \
222 $(PATH_ROOT)/src/VBox/Runtime/include
223VBoxDrvLib_SOURCES = \
224 os2/SUPDrv-os2.cpp \
225 SUPDRVShared.c
226endif
227
228
229#
230# vboxdrv.ko - The FreeBSD Kernel Module.
231#
232ifeq ($(BUILD_TARGET),freebsd)
233vboxdrv_TEMPLATE = VBOXR0DRV
234vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
235vboxdrv_INCS := $(PATH_SUB_CURRENT)
236vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
237vboxdrv_SOURCES = \
238 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
239 SUPDRVShared.c
240endif # freebsd
241
242
243#
244# vboxdrv.o - The Solaris Kernel Module.
245#
246ifeq ($(BUILD_TARGET),solaris)
247vboxdrv_TEMPLATE = VBOXR0DRV
248vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
249vboxdrv_INCS := $(PATH_SUB_CURRENT)
250vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
251vboxdrv_SOURCES = \
252 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c
253# SUPDRVShared.c
254endif # solaris
255
256
257include $(PATH_KBUILD)/subfooter.kmk
258
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