VirtualBox

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

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

I use it.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 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/log.h=$(PATH_ROOT)/include/iprt/log.h \
54 include/iprt/mem.h=$(PATH_ROOT)/include/iprt/mem.h \
55 include/iprt/param.h=$(PATH_ROOT)/include/iprt/param.h \
56 include/iprt/semaphore.h=$(PATH_ROOT)/include/iprt/semaphore.h \
57 include/iprt/spinlock.h=$(PATH_ROOT)/include/iprt/spinlock.h \
58 include/iprt/stdarg.h=$(PATH_ROOT)/include/iprt/stdarg.h \
59 include/iprt/stdint.h=$(PATH_ROOT)/include/iprt/stdint.h \
60 include/iprt/string.h=$(PATH_ROOT)/include/iprt/string.h \
61 include/iprt/thread.h=$(PATH_ROOT)/include/iprt/thread.h \
62 include/iprt/types.h=$(PATH_ROOT)/include/iprt/types.h \
63 include/VBox/cdefs.h=$(PATH_ROOT)/include/VBox/cdefs.h \
64 include/VBox/log.h=$(PATH_ROOT)/include/VBox/log.h \
65 include/VBox/sup.h=$(PATH_ROOT)/include/VBox/sup.h \
66 include/VBox/types.h=$(PATH_ROOT)/include/VBox/types.h \
67 linux/SUPDrv-linux.c=$(VBOX_PATH_SUPPORT)/linux/SUPDrv-linux.c \
68 Makefile=$(VBOX_PATH_SUPPORT)/linux/Makefile \
69 r0drv/alloc-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.cpp \
70 r0drv/alloc-r0drv.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.h \
71 r0drv/linux/alloc-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c \
72 r0drv/linux/semaphore-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/semaphore-r0drv-linux.c \
73 r0drv/linux/spinlock-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c \
74 r0drv/linux/string.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/string.h \
75 r0drv/linux/thread-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c \
76 r0drv/linux/the-linux-kernel.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h \
77 SUPDRV.h=$(VBOX_PATH_SUPPORT)/SUPDRV.h \
78 SUPDRVIOC.h=$(VBOX_PATH_SUPPORT)/SUPDRVIOC.h \
79 SUPDRVShared.c=$(VBOX_PATH_SUPPORT)/SUPDRVShared.c
80OTHERS := $(foreach pair,$(EXPORT_FILE_PAIRS),$(PATH_BIN)/src/$(firstword $(subst =, ,$(pair))))
81OTHER_CLEAN = $(OTHERS)
82endif # real linux
83
84
85
86#
87# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
88#
89ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
90# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
91SUPR3_TEMPLATE = VBOXR3NP
92else
93SUPR3_TEMPLATE = VBOXR3
94endif
95SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
96SUPR3_DEFS.l4 = IN_RING0 # makes sure that we incorporate _all_ prototypes from VBox/sup.h
97SUPR3_INCS = $(VBOX_PATH_SUPPORT)
98SUPR3_INCS.l4 = $(L4_INCDIR)
99ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
100SUPR3_SOURCES = \
101 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
102 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
103else
104SUPR3_SOURCES = \
105 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
106 $(VBOX_PATH_SUPPORT)/win32/SUPLib-win32.cpp
107endif
108
109#
110# SUPR0 - The Ring-0 Import / Thunk library.
111#
112SUPR0_TEMPLATE = VBOXR0
113ifeq ($(VBOX_LDR_FMT),elf)
114SUPR0_SOURCES.amd64 += $(VBOX_PATH_SUPPORT)/SUPR0Elf.asm
115endif
116ifeq ($(VBOX_LDR_FMT),pe)
117SUPR0_SOURCES += $(VBOX_PATH_SUPPORT)/SUPR0.def
118endif
119ifeq ($(VBOX_LDR_FMT),lx)
120SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
121$(PATH_TARGET)/SUPR0.def: $(VBOX_PATH_SUPPORT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
122 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
123 $(MV) -f $@.tmp $@
124endif
125
126
127#
128# VBoxDrv.sys - The Windows driver.
129#
130ifeq ($(BUILD_TARGET),win)
131VBoxDrv_TEMPLATE = VBOXR0DRV
132VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
133VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
134VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
135VBoxDrv_SOURCES = \
136 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
137VBoxDrv_SOURCES.x86 = \
138 $(VBOX_PATH_SUPPORT)/win32/SUPDrv-win32.cpp \
139 $(VBOX_PATH_SUPPORT)/win32/SUPDrvA-win32.asm
140VBoxDrv_SOURCES.amd64 = \
141 $(VBOX_PATH_SUPPORT)/win64/SUPDrv-win64.cpp \
142 $(VBOX_PATH_SUPPORT)/win64/SUPDrvA-win64.asm
143VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
144VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
145VBoxDrv_LIBS = \
146 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
147 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
148 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
149endif
150
151
152#
153# vboxdrv.ko - The Linux Kernel Module.
154#
155ifeq ($(BUILD_TARGET),linux)
156vboxdrv_TEMPLATE = VBOXR0DRV
157vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
158vboxdrv_INCS = $(VBOX_PATH_SUPPORT)
159vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
160vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
161vboxdrv_SOURCES = \
162 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
163 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
164ifndef VBOX_LINUX_VERSION_2_4
165vboxdrv_SOURCES += \
166 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
167endif
168endif # real linux
169
170
171#
172# VBoxDrv.kext - The Darwin Kernel Extension.
173#
174ifeq ($(BUILD_TARGET),darwin)
175VBoxDrv_TEMPLATE = VBOXR0DRV
176VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
177VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
178VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) $(VBOX_GCC_LIBGCC)
179VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
180VBoxDrv_INST = bin/VBoxDrv.kext/Contents/MacOS/
181VBoxDrv_SOURCES = \
182 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
183 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c
184
185INSTALLS += VBoxDrv.kext
186VBoxDrv.kext_INST = bin/VBoxDrv.kext/Contents/
187VBoxDrv.kext_SOURCES = \
188 $(PATH_TARGET)/Info.plist
189
190$(PATH_TARGET)/Info.plist: $(VBOX_PATH_SUPPORT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
191 $(call MSG_L1,Generating $@)
192 $(xQUIET)$(RM) -f $@
193 $(xQUIET)$(SED) \
194 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
195 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
196 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
197 $< > $@
198
199INSTALLS += Scripts
200Scripts_INST = bin/
201Scripts_SOURCES = \
202 $(VBOX_PATH_SUPPORT)/darwin/load.sh
203
204endif
205
206
207#
208# Generate rules for exporting the linux sources.
209#
210define def_export_rule
211$(eval dst := $(word 1,$(subst =, ,$(pair))))
212$(eval src := $(word 2,$(subst =, ,$(pair))))
213$(PATH_BIN)/src/$(dst): $(src)
214 $$(call MSG_L1,Installing $$@)
215 $$(QUIET)$$(MKDIR) -p $$(@D)
216 $$(QUIET)$$(CP) $$< $$@
217
218symlinked/$(dst):
219 $$(call MSG_L1,Symlink $$@)
220 $$(QUIET)$$(MKDIR) -p $$(@D)
221 $$(QUIET)ln -sfn $(abspath $(src)) $$@
222
223endef
224# generate rules
225$(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
226
227
228#
229# Rule for creating a symlinked setup.
230#
231symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
232 $(ECHO) done
233
234
235include $(PATH_KBUILD)/subfooter.kmk
236
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