VirtualBox

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

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

Ported the support driver to OS/2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.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
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_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
203 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
204 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
205 $< > $@
206
207INSTALLS += Scripts
208Scripts_INST = $(INST_DIST)
209Scripts_SOURCES = \
210 $(VBOX_PATH_SUPPORT)/darwin/load.sh
211
212endif
213
214
215#
216# VBoxDrv.sys - The OS/2 driver.
217#
218ifeq ($(BUILD_TARGET),os2)
219VBoxDrv_TEMPLATE = VBOXR0DRV
220VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
221VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
222#VBoxDrv_LDFLAGS = -s -t -v
223VBoxDrv_SOURCES = \
224 $(VBOX_PATH_SUPPORT)/os2/SUPDrvA-os2.asm \
225 $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.def
226VBoxDrv_LIBS = \
227 $(TARGET_VBoxDrvLib) \
228 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
229 $(VBOX_GCC_LIBGCC) \
230 end
231
232# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
233LIBRARIES += VBoxDrvLib
234VBoxDrvLib_TEMPLATE = VBOXR0DRV
235VBoxDrvLib_NOINST = 1
236VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
237VBoxDrvLib_INCS = $(VBOX_PATH_SUPPORT) $(PATH_TARGET) $(PATH_ROOT)/src/VBox/Runtime/include
238VBoxDrvLib_SOURCES = \
239 $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.cpp \
240 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
241endif
242
243
244#
245# Generate rules for exporting the linux sources.
246#
247define def_export_rule
248$(eval dst := $(word 1,$(subst =, ,$(pair))))
249$(eval src := $(word 2,$(subst =, ,$(pair))))
250$(PATH_BIN)/src/$(dst): $(src)
251 $$(call MSG_L1,Installing $$@)
252 $$(QUIET)$$(MKDIR) -p $$(@D)
253 $$(QUIET)$$(CP) $$< $$@
254
255symlinked/$(dst):
256 $$(call MSG_L1,Symlink $$@)
257 $$(QUIET)$$(MKDIR) -p $$(@D)
258 $$(QUIET)ln -sfn $(abspath $(src)) $$@
259
260endef
261# generate rules
262$(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
263
264
265#
266# Rule for creating a symlinked setup.
267#
268symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
269 $(ECHO) done
270
271
272include $(PATH_KBUILD)/subfooter.kmk
273
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