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