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 |
|
---|
21 | DEPTH ?= ../../../..
|
---|
22 | SUB_PATH = ..
|
---|
23 | include $(PATH_KBUILD)/subheader.kmk
|
---|
24 |
|
---|
25 | #
|
---|
26 | # Targets
|
---|
27 | #
|
---|
28 | LIBRARIES += SUPR3
|
---|
29 | ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
|
---|
30 | LIBRARIES += SUPR0
|
---|
31 | endif
|
---|
32 | ifdef VBOX_WITH_VBOXDRV
|
---|
33 | SYSMODS.darwin += VBoxDrv
|
---|
34 | SYSMODS.linux += vboxdrv
|
---|
35 | SYSMODS.win += VBoxDrv
|
---|
36 | SYSMODS.os2 += VBoxDrv
|
---|
37 | endif
|
---|
38 |
|
---|
39 |
|
---|
40 | #
|
---|
41 | # Include sub-makefile(s).
|
---|
42 | #
|
---|
43 | include $(VBOX_PATH_SUPPORT)/testcase/Makefile
|
---|
44 |
|
---|
45 |
|
---|
46 | ifeq ($(BUILD_TARGET),linux)
|
---|
47 | ## @todo change this to use a INSTALLS target.
|
---|
48 | EXPORT_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
|
---|
92 | OTHERS := $(foreach pair,$(EXPORT_FILE_PAIRS),$(PATH_BIN)/src/$(firstword $(subst =, ,$(pair))))
|
---|
93 | OTHER_CLEAN = $(OTHERS)
|
---|
94 | endif # real linux
|
---|
95 |
|
---|
96 |
|
---|
97 |
|
---|
98 | #
|
---|
99 | # The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
|
---|
100 | #
|
---|
101 | ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
|
---|
102 | # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
|
---|
103 | SUPR3_TEMPLATE = VBOXR3NP
|
---|
104 | else
|
---|
105 | SUPR3_TEMPLATE = VBOXR3
|
---|
106 | endif
|
---|
107 | SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
|
---|
108 | SUPR3_INCS = $(VBOX_PATH_SUPPORT)
|
---|
109 | SUPR3_INCS.l4 = $(L4_INCDIR)
|
---|
110 | ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
|
---|
111 | SUPR3_SOURCES = \
|
---|
112 | $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
|
---|
113 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
|
---|
114 | else
|
---|
115 | SUPR3_SOURCES = \
|
---|
116 | $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
|
---|
117 | $(VBOX_PATH_SUPPORT)/win32/SUPLib-win32.cpp
|
---|
118 | endif
|
---|
119 |
|
---|
120 | #
|
---|
121 | # SUPR0 - The Ring-0 Import / Thunk library.
|
---|
122 | #
|
---|
123 | SUPR0_TEMPLATE = VBOXR0
|
---|
124 | ifeq ($(VBOX_LDR_FMT),pe)
|
---|
125 | SUPR0_SOURCES += $(VBOX_PATH_SUPPORT)/SUPR0.def
|
---|
126 | endif
|
---|
127 | ifeq ($(VBOX_LDR_FMT),lx)
|
---|
128 | SUPR0_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 $@
|
---|
132 | endif
|
---|
133 |
|
---|
134 |
|
---|
135 | #
|
---|
136 | # VBoxDrv.sys - The Windows driver.
|
---|
137 | #
|
---|
138 | ifeq ($(BUILD_TARGET),win)
|
---|
139 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
140 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
|
---|
141 | VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
|
---|
142 | VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
143 | VBoxDrv_SOURCES = \
|
---|
144 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
145 | VBoxDrv_SOURCES.x86 = \
|
---|
146 | $(VBOX_PATH_SUPPORT)/win32/SUPDrv-win32.cpp \
|
---|
147 | $(VBOX_PATH_SUPPORT)/win32/SUPDrvA-win32.asm
|
---|
148 | VBoxDrv_SOURCES.amd64 = \
|
---|
149 | $(VBOX_PATH_SUPPORT)/win64/SUPDrv-win64.cpp \
|
---|
150 | $(VBOX_PATH_SUPPORT)/win64/SUPDrvA-win64.asm
|
---|
151 | VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
152 | VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
153 | VBoxDrv_LIBS = \
|
---|
154 | $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
|
---|
155 | $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
|
---|
156 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
157 | endif
|
---|
158 |
|
---|
159 |
|
---|
160 | #
|
---|
161 | # vboxdrv.ko - The Linux Kernel Module.
|
---|
162 | #
|
---|
163 | ifeq ($(BUILD_TARGET),linux)
|
---|
164 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
165 | vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
|
---|
166 | vboxdrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
167 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
168 | vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
|
---|
169 | vboxdrv_SOURCES = \
|
---|
170 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
171 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
172 | ifndef VBOX_LINUX_VERSION_2_4
|
---|
173 | vboxdrv_SOURCES += \
|
---|
174 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
|
---|
175 | endif
|
---|
176 | endif # real linux
|
---|
177 |
|
---|
178 |
|
---|
179 | #
|
---|
180 | # VBoxDrv.kext - The Darwin Kernel Extension.
|
---|
181 | #
|
---|
182 | ifeq ($(BUILD_TARGET),darwin)
|
---|
183 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
184 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
185 | VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
186 | VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
187 | VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
188 | VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
|
---|
189 | VBoxDrv_SOURCES = \
|
---|
190 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
|
---|
191 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
|
---|
192 |
|
---|
193 | INSTALLS += VBoxDrv.kext
|
---|
194 | VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
|
---|
195 | VBoxDrv.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 |
|
---|
208 | INSTALLS += Scripts
|
---|
209 | Scripts_INST = $(INST_DIST)
|
---|
210 | Scripts_SOURCES = \
|
---|
211 | $(VBOX_PATH_SUPPORT)/darwin/load.sh
|
---|
212 |
|
---|
213 | endif
|
---|
214 |
|
---|
215 |
|
---|
216 | #
|
---|
217 | # VBoxDrv.sys - The OS/2 driver.
|
---|
218 | #
|
---|
219 | ifeq ($(BUILD_TARGET),os2)
|
---|
220 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
221 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
222 | VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
223 | #VBoxDrv_LDFLAGS = -s -t -v
|
---|
224 | VBoxDrv_SOURCES = \
|
---|
225 | $(VBOX_PATH_SUPPORT)/os2/SUPDrvA-os2.asm \
|
---|
226 | $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.def
|
---|
227 | VBoxDrv_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.
|
---|
234 | LIBRARIES += VBoxDrvLib
|
---|
235 | VBoxDrvLib_TEMPLATE = VBOXR0DRV
|
---|
236 | VBoxDrvLib_NOINST = 1
|
---|
237 | VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
238 | VBoxDrvLib_INCS = $(VBOX_PATH_SUPPORT) $(PATH_TARGET) $(PATH_ROOT)/src/VBox/Runtime/include
|
---|
239 | VBoxDrvLib_SOURCES = \
|
---|
240 | $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.cpp \
|
---|
241 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
242 | endif
|
---|
243 |
|
---|
244 |
|
---|
245 | #
|
---|
246 | # Generate rules for exporting the linux sources.
|
---|
247 | #
|
---|
248 | define 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 |
|
---|
256 | symlinked/$(dst):
|
---|
257 | $$(call MSG_L1,Symlink $$@)
|
---|
258 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
259 | $$(QUIET)ln -sfn $(abspath $(src)) $$@
|
---|
260 |
|
---|
261 | endef
|
---|
262 | # generate rules
|
---|
263 | $(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
|
---|
264 |
|
---|
265 |
|
---|
266 | #
|
---|
267 | # Rule for creating a symlinked setup.
|
---|
268 | #
|
---|
269 | symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
|
---|
270 | $(ECHO) done
|
---|
271 |
|
---|
272 |
|
---|
273 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
274 |
|
---|