VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile@ 387

Last change on this file since 387 was 387, checked in by vboxsync, 18 years ago

Use RTR0ProcHandleSelf / RTProcSelf. Implemented clientDied() cleanup on darwin.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1#
2# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
3#
4
5#
6# Copyright (C) 2006 InnoTek Systemberatung GmbH
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16# If you received this file as part of a commercial VirtualBox
17# distribution, then only the terms of your commercial VirtualBox
18# license agreement apply instead of the previous paragraph.
19#
20
21DEPTH ?= ../../../..
22SUB_PATH = ..
23include $(PATH_KBUILD)/subheader.kmk
24
25#
26# Targets
27#
28LIBRARIES += SUPR3
29ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
30LIBRARIES += SUPR0
31endif
32ifdef VBOX_WITH_VBOXDRV
33SYSMODS.darwin += VBoxDrv
34SYSMODS.linux += vboxdrv
35SYSMODS.win += VBoxDrv
36endif
37
38
39#
40# Include sub-makefile(s).
41#
42include $(VBOX_PATH_SUPPORT)/testcase/Makefile
43
44
45ifeq ($(BUILD_TARGET),linux)
46## @todo change this to use a INSTALLS target.
47EXPORT_FILE_PAIRS = \
48 include/iprt/alloc.h=$(PATH_ROOT)/include/iprt/alloc.h \
49 include/iprt/asm.h=$(PATH_ROOT)/include/iprt/asm.h \
50 include/iprt/assert.h=$(PATH_ROOT)/include/iprt/assert.h \
51 include/iprt/cdefs.h=$(PATH_ROOT)/include/iprt/cdefs.h \
52 include/iprt/err.h=$(PATH_ROOT)/include/iprt/err.h \
53 include/iprt/heap.h=$(PATH_ROOT)/include/iprt/heap.h \
54 include/iprt/initterm.h=$(PATH_ROOT)/include/iprt/initterm.h \
55 include/iprt/log.h=$(PATH_ROOT)/include/iprt/log.h \
56 include/iprt/mem.h=$(PATH_ROOT)/include/iprt/mem.h \
57 include/iprt/param.h=$(PATH_ROOT)/include/iprt/param.h \
58 include/iprt/process.h=$(PATH_ROOT)/include/iprt/process.h \
59 include/iprt/semaphore.h=$(PATH_ROOT)/include/iprt/semaphore.h \
60 include/iprt/spinlock.h=$(PATH_ROOT)/include/iprt/spinlock.h \
61 include/iprt/stdarg.h=$(PATH_ROOT)/include/iprt/stdarg.h \
62 include/iprt/stdint.h=$(PATH_ROOT)/include/iprt/stdint.h \
63 include/iprt/string.h=$(PATH_ROOT)/include/iprt/string.h \
64 include/iprt/thread.h=$(PATH_ROOT)/include/iprt/thread.h \
65 include/iprt/types.h=$(PATH_ROOT)/include/iprt/types.h \
66 include/VBox/cdefs.h=$(PATH_ROOT)/include/VBox/cdefs.h \
67 include/VBox/log.h=$(PATH_ROOT)/include/VBox/log.h \
68 include/VBox/sup.h=$(PATH_ROOT)/include/VBox/sup.h \
69 include/VBox/types.h=$(PATH_ROOT)/include/VBox/types.h \
70 include/internal/initterm.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/initterm.h \
71 linux/SUPDrv-linux.c=$(VBOX_PATH_SUPPORT)/linux/SUPDrv-linux.c \
72 Makefile=$(VBOX_PATH_SUPPORT)/linux/Makefile \
73 alloc/heapsimple.c=$(PATH_ROOT)/src/VBox/Runtime/alloc/heapsimple.cpp \
74 r0drv/alloc-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.cpp \
75 r0drv/alloc-r0drv.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.h \
76 r0drv/initterm-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/initterm-r0drv.cpp \
77 r0drv/linux/alloc-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c \
78 r0drv/linux/initterm-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c \
79 r0drv/linux/semaphore-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/semaphore-r0drv-linux.c \
80 r0drv/linux/spinlock-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c \
81 r0drv/linux/string.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/string.h \
82 r0drv/linux/thread-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c \
83 r0drv/linux/the-linux-kernel.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h \
84 SUPDRV.h=$(VBOX_PATH_SUPPORT)/SUPDRV.h \
85 SUPDRVIOC.h=$(VBOX_PATH_SUPPORT)/SUPDRVIOC.h \
86 SUPDRVShared.c=$(VBOX_PATH_SUPPORT)/SUPDRVShared.c
87OTHERS := $(foreach pair,$(EXPORT_FILE_PAIRS),$(PATH_BIN)/src/$(firstword $(subst =, ,$(pair))))
88OTHER_CLEAN = $(OTHERS)
89endif # real linux
90
91
92
93#
94# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
95#
96ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
97# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
98SUPR3_TEMPLATE = VBOXR3NP
99else
100SUPR3_TEMPLATE = VBOXR3
101endif
102SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
103SUPR3_DEFS.l4 = IN_RING0 # makes sure that we incorporate _all_ prototypes from VBox/sup.h
104SUPR3_INCS = $(VBOX_PATH_SUPPORT)
105SUPR3_INCS.l4 = $(L4_INCDIR)
106ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
107SUPR3_SOURCES = \
108 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
109 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
110else
111SUPR3_SOURCES = \
112 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
113 $(VBOX_PATH_SUPPORT)/win32/SUPLib-win32.cpp
114endif
115
116#
117# SUPR0 - The Ring-0 Import / Thunk library.
118#
119SUPR0_TEMPLATE = VBOXR0
120ifeq ($(VBOX_LDR_FMT),elf)
121SUPR0_SOURCES.amd64 += $(VBOX_PATH_SUPPORT)/SUPR0Elf.asm
122endif
123ifeq ($(VBOX_LDR_FMT),pe)
124SUPR0_SOURCES += $(VBOX_PATH_SUPPORT)/SUPR0.def
125endif
126ifeq ($(VBOX_LDR_FMT),lx)
127SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
128$(PATH_TARGET)/SUPR0.def: $(VBOX_PATH_SUPPORT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
129 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
130 $(MV) -f $@.tmp $@
131endif
132
133
134#
135# VBoxDrv.sys - The Windows driver.
136#
137ifeq ($(BUILD_TARGET),win)
138VBoxDrv_TEMPLATE = VBOXR0DRV
139VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
140VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
141VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
142VBoxDrv_SOURCES = \
143 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
144VBoxDrv_SOURCES.x86 = \
145 $(VBOX_PATH_SUPPORT)/win32/SUPDrv-win32.cpp \
146 $(VBOX_PATH_SUPPORT)/win32/SUPDrvA-win32.asm
147VBoxDrv_SOURCES.amd64 = \
148 $(VBOX_PATH_SUPPORT)/win64/SUPDrv-win64.cpp \
149 $(VBOX_PATH_SUPPORT)/win64/SUPDrvA-win64.asm
150VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
151VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
152VBoxDrv_LIBS = \
153 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
154 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
155 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
156endif
157
158
159#
160# vboxdrv.ko - The Linux Kernel Module.
161#
162ifeq ($(BUILD_TARGET),linux)
163vboxdrv_TEMPLATE = VBOXR0DRV
164vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
165vboxdrv_INCS = $(VBOX_PATH_SUPPORT)
166vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
167vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
168vboxdrv_SOURCES = \
169 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
170 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
171ifndef VBOX_LINUX_VERSION_2_4
172vboxdrv_SOURCES += \
173 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
174endif
175endif # real linux
176
177
178#
179# VBoxDrv.kext - The Darwin Kernel Extension.
180#
181ifeq ($(BUILD_TARGET),darwin)
182VBoxDrv_TEMPLATE = VBOXR0DRV
183VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
184VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
185VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
186VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
187VBoxDrv_INST = bin/VBoxDrv.kext/Contents/MacOS/
188VBoxDrv_SOURCES = \
189 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
190 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
191
192INSTALLS += VBoxDrv.kext
193VBoxDrv.kext_INST = bin/VBoxDrv.kext/Contents/
194VBoxDrv.kext_SOURCES = \
195 $(PATH_TARGET)/Info.plist
196
197$(PATH_TARGET)/Info.plist: $(VBOX_PATH_SUPPORT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
198 $(call MSG_L1,Generating $@)
199 $(xQUIET)$(RM) -f $@
200 $(xQUIET)$(SED) \
201 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
202 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
203 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
204 $< > $@
205
206INSTALLS += Scripts
207Scripts_INST = bin/
208Scripts_SOURCES = \
209 $(VBOX_PATH_SUPPORT)/darwin/load.sh
210
211endif
212
213
214#
215# Generate rules for exporting the linux sources.
216#
217define def_export_rule
218$(eval dst := $(word 1,$(subst =, ,$(pair))))
219$(eval src := $(word 2,$(subst =, ,$(pair))))
220$(PATH_BIN)/src/$(dst): $(src)
221 $$(call MSG_L1,Installing $$@)
222 $$(QUIET)$$(MKDIR) -p $$(@D)
223 $$(QUIET)$$(CP) $$< $$@
224
225symlinked/$(dst):
226 $$(call MSG_L1,Symlink $$@)
227 $$(QUIET)$$(MKDIR) -p $$(@D)
228 $$(QUIET)ln -sfn $(abspath $(src)) $$@
229
230endef
231# generate rules
232$(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
233
234
235#
236# Rule for creating a symlinked setup.
237#
238symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
239 $(ECHO) done
240
241
242include $(PATH_KBUILD)/subfooter.kmk
243
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