VirtualBox

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

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

Use VBOX_VERSION_STRING when possible.

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