1 | # $Id: Makefile.kmk 2478 2007-05-04 00:46:16Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the support library and the drivers/modules/kexts it uses.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License as published by the Free Software Foundation,
|
---|
13 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 | # If you received this file as part of a commercial VirtualBox
|
---|
18 | # distribution, then only the terms of your commercial VirtualBox
|
---|
19 | # license agreement apply instead of the previous paragraph.
|
---|
20 | #
|
---|
21 |
|
---|
22 | DEPTH ?= ../../../..
|
---|
23 | SUB_DEPTH = ..
|
---|
24 | include $(PATH_KBUILD)/subheader.kmk
|
---|
25 |
|
---|
26 | #
|
---|
27 | # Targets
|
---|
28 | #
|
---|
29 | LIBRARIES += SUPR3
|
---|
30 | ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
|
---|
31 | LIBRARIES += SUPR0
|
---|
32 | endif
|
---|
33 | ifdef VBOX_WITH_VBOXDRV
|
---|
34 | SYSMODS.darwin += VBoxDrv
|
---|
35 | SYSMODS.linux += vboxdrv
|
---|
36 | SYSMODS.win += VBoxDrv
|
---|
37 | SYSMODS.os2 += VBoxDrv
|
---|
38 | endif
|
---|
39 |
|
---|
40 |
|
---|
41 | #
|
---|
42 | # Include sub-makefile(s).
|
---|
43 | #
|
---|
44 | include $(VBOX_PATH_SUPPORT)/testcase/Makefile.kmk
|
---|
45 |
|
---|
46 |
|
---|
47 | ifeq ($(BUILD_TARGET),linux)
|
---|
48 | ## @todo change this to use a INSTALLS target.
|
---|
49 | EXPORT_FILE_PAIRS = \
|
---|
50 | include/iprt/alloc.h=$(PATH_ROOT)/include/iprt/alloc.h \
|
---|
51 | include/iprt/asm.h=$(PATH_ROOT)/include/iprt/asm.h \
|
---|
52 | include/iprt/assert.h=$(PATH_ROOT)/include/iprt/assert.h \
|
---|
53 | include/iprt/cdefs.h=$(PATH_ROOT)/include/iprt/cdefs.h \
|
---|
54 | include/iprt/err.h=$(PATH_ROOT)/include/iprt/err.h \
|
---|
55 | include/iprt/heap.h=$(PATH_ROOT)/include/iprt/heap.h \
|
---|
56 | include/iprt/initterm.h=$(PATH_ROOT)/include/iprt/initterm.h \
|
---|
57 | include/iprt/log.h=$(PATH_ROOT)/include/iprt/log.h \
|
---|
58 | include/iprt/mem.h=$(PATH_ROOT)/include/iprt/mem.h \
|
---|
59 | include/iprt/param.h=$(PATH_ROOT)/include/iprt/param.h \
|
---|
60 | include/iprt/process.h=$(PATH_ROOT)/include/iprt/process.h \
|
---|
61 | include/iprt/semaphore.h=$(PATH_ROOT)/include/iprt/semaphore.h \
|
---|
62 | include/iprt/spinlock.h=$(PATH_ROOT)/include/iprt/spinlock.h \
|
---|
63 | include/iprt/stdarg.h=$(PATH_ROOT)/include/iprt/stdarg.h \
|
---|
64 | include/iprt/stdint.h=$(PATH_ROOT)/include/iprt/stdint.h \
|
---|
65 | include/iprt/string.h=$(PATH_ROOT)/include/iprt/string.h \
|
---|
66 | include/iprt/thread.h=$(PATH_ROOT)/include/iprt/thread.h \
|
---|
67 | include/iprt/types.h=$(PATH_ROOT)/include/iprt/types.h \
|
---|
68 | include/iprt/avl.h=$(PATH_ROOT)/include/iprt/avl.h \
|
---|
69 | include/VBox/cdefs.h=$(PATH_ROOT)/include/VBox/cdefs.h \
|
---|
70 | include/VBox/log.h=$(PATH_ROOT)/include/VBox/log.h \
|
---|
71 | include/VBox/sup.h=$(PATH_ROOT)/include/VBox/sup.h \
|
---|
72 | include/VBox/types.h=$(PATH_ROOT)/include/VBox/types.h \
|
---|
73 | include/internal/initterm.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/initterm.h \
|
---|
74 | include/internal/thread.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/thread.h \
|
---|
75 | include/internal/magics.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/magics.h \
|
---|
76 | linux/SUPDrv-linux.c=$(VBOX_PATH_SUPPORT)/linux/SUPDrv-linux.c \
|
---|
77 | Makefile=$(VBOX_PATH_SUPPORT)/linux/Makefile \
|
---|
78 | build_in_tmp=$(VBOX_PATH_SUPPORT)/linux/build_in_tmp \
|
---|
79 | alloc/heapsimple.c=$(PATH_ROOT)/src/VBox/Runtime/alloc/heapsimple.cpp \
|
---|
80 | r0drv/alloc-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.cpp \
|
---|
81 | r0drv/alloc-r0drv.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.h \
|
---|
82 | r0drv/initterm-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/initterm-r0drv.cpp \
|
---|
83 | r0drv/linux/alloc-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c \
|
---|
84 | r0drv/linux/initterm-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c \
|
---|
85 | r0drv/linux/process-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c \
|
---|
86 | r0drv/linux/semaphore-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/semaphore-r0drv-linux.c \
|
---|
87 | r0drv/linux/spinlock-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c \
|
---|
88 | r0drv/linux/string.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/string.h \
|
---|
89 | r0drv/linux/thread-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c \
|
---|
90 | r0drv/linux/the-linux-kernel.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h \
|
---|
91 | version-generated.h=$(PATH_OUT)/version-generated.h \
|
---|
92 | SUPDRV.h=$(VBOX_PATH_SUPPORT)/SUPDRV.h \
|
---|
93 | SUPDRVIOC.h=$(VBOX_PATH_SUPPORT)/SUPDRVIOC.h \
|
---|
94 | SUPDRVShared.c=$(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
95 | OTHERS := $(foreach pair,$(EXPORT_FILE_PAIRS),$(PATH_BIN)/src/$(firstword $(subst =, ,$(pair))))
|
---|
96 | OTHER_CLEAN = $(OTHERS)
|
---|
97 | endif # real linux
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 | #
|
---|
102 | # The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
|
---|
103 | #
|
---|
104 | ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
|
---|
105 | # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
|
---|
106 | SUPR3_TEMPLATE = VBOXR3NP
|
---|
107 | else
|
---|
108 | SUPR3_TEMPLATE = VBOXR3
|
---|
109 | endif
|
---|
110 | SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
|
---|
111 | SUPR3_INCS = $(VBOX_PATH_SUPPORT)
|
---|
112 | SUPR3_INCS.l4 = $(L4_INCDIR)
|
---|
113 | ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
|
---|
114 | SUPR3_SOURCES = \
|
---|
115 | $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
|
---|
116 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
|
---|
117 | else
|
---|
118 | SUPR3_SOURCES = \
|
---|
119 | $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
|
---|
120 | $(VBOX_PATH_SUPPORT)/win32/SUPLib-win32.cpp
|
---|
121 | endif
|
---|
122 |
|
---|
123 | #
|
---|
124 | # SUPR0 - The Ring-0 Import / Thunk library.
|
---|
125 | #
|
---|
126 | SUPR0_TEMPLATE = VBOXR0
|
---|
127 | ifeq ($(VBOX_LDR_FMT),pe)
|
---|
128 | SUPR0_SOURCES += $(VBOX_PATH_SUPPORT)/SUPR0.def
|
---|
129 | endif
|
---|
130 | ifeq ($(VBOX_LDR_FMT),lx)
|
---|
131 | SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
|
---|
132 | $(PATH_TARGET)/SUPR0.def: $(VBOX_PATH_SUPPORT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
|
---|
133 | $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > [email protected]
|
---|
134 | $(MV) -f [email protected] $@
|
---|
135 | endif
|
---|
136 |
|
---|
137 |
|
---|
138 | #
|
---|
139 | # VBoxDrv.sys - The Windows driver.
|
---|
140 | #
|
---|
141 | ifeq ($(BUILD_TARGET),win)
|
---|
142 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
143 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
|
---|
144 | VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
|
---|
145 | VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
146 | VBoxDrv_SOURCES = \
|
---|
147 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
148 | VBoxDrv_SOURCES.x86 = \
|
---|
149 | $(VBOX_PATH_SUPPORT)/win32/SUPDrv-win32.cpp \
|
---|
150 | $(VBOX_PATH_SUPPORT)/win32/SUPDrvA-win32.asm
|
---|
151 | VBoxDrv_SOURCES.amd64 = \
|
---|
152 | $(VBOX_PATH_SUPPORT)/win64/SUPDrv-win64.cpp \
|
---|
153 | $(VBOX_PATH_SUPPORT)/win64/SUPDrvA-win64.asm
|
---|
154 | VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
155 | VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
156 | VBoxDrv_LIBS = \
|
---|
157 | $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
|
---|
158 | $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
|
---|
159 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
160 | endif
|
---|
161 |
|
---|
162 |
|
---|
163 | #
|
---|
164 | # vboxdrv.ko - The Linux Kernel Module.
|
---|
165 | #
|
---|
166 | ifeq ($(BUILD_TARGET),linux)
|
---|
167 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
168 | vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
|
---|
169 | vboxdrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
170 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
171 | vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
|
---|
172 | vboxdrv_SOURCES = \
|
---|
173 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
174 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
175 | ifndef VBOX_LINUX_VERSION_2_4
|
---|
176 | vboxdrv_SOURCES += \
|
---|
177 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
|
---|
178 | endif
|
---|
179 | endif # real linux
|
---|
180 |
|
---|
181 |
|
---|
182 | #
|
---|
183 | # VBoxDrv.kext - The Darwin Kernel Extension.
|
---|
184 | #
|
---|
185 | ifeq ($(BUILD_TARGET),darwin)
|
---|
186 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
187 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
188 | VBoxDrv_DEFS += DEBUG_DARWIN_GIP
|
---|
189 | VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
190 | VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
191 | VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
192 | VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
|
---|
193 | VBoxDrv_SOURCES = \
|
---|
194 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
|
---|
195 | $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
|
---|
196 |
|
---|
197 | INSTALLS += VBoxDrv.kext
|
---|
198 | VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
|
---|
199 | VBoxDrv.kext_SOURCES = \
|
---|
200 | $(PATH_TARGET)/Info.plist
|
---|
201 |
|
---|
202 | $(PATH_TARGET)/Info.plist: $(VBOX_PATH_SUPPORT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
|
---|
203 | $(call MSG_GENERATE,VBoxDrv,$@,$<)
|
---|
204 | $(xQUIET)$(RM) -f $@
|
---|
205 | $(xQUIET)$(SED) \
|
---|
206 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
207 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
208 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
209 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
210 | $< > $@
|
---|
211 |
|
---|
212 | INSTALLS += Scripts
|
---|
213 | Scripts_INST = $(INST_DIST)
|
---|
214 | Scripts_SOURCES = \
|
---|
215 | $(VBOX_PATH_SUPPORT)/darwin/load.sh
|
---|
216 |
|
---|
217 | endif
|
---|
218 |
|
---|
219 |
|
---|
220 | #
|
---|
221 | # VBoxDrv.sys - The OS/2 driver.
|
---|
222 | #
|
---|
223 | ifeq ($(BUILD_TARGET),os2)
|
---|
224 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
225 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
226 | VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
|
---|
227 | #VBoxDrv_LDFLAGS = -s -t -v
|
---|
228 | VBoxDrv_SOURCES = \
|
---|
229 | $(VBOX_PATH_SUPPORT)/os2/SUPDrvA-os2.asm \
|
---|
230 | $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.def
|
---|
231 | VBoxDrv_LIBS = \
|
---|
232 | $(TARGET_VBoxDrvLib) \
|
---|
233 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
234 | $(VBOX_GCC_LIBGCC) \
|
---|
235 | end
|
---|
236 |
|
---|
237 | # temp hack to ensure that SUPDrvA-os2.asm is first in the link.
|
---|
238 | LIBRARIES += VBoxDrvLib
|
---|
239 | VBoxDrvLib_TEMPLATE = VBOXR0DRV
|
---|
240 | VBoxDrvLib_NOINST = 1
|
---|
241 | VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
242 | VBoxDrvLib_INCS = $(VBOX_PATH_SUPPORT) $(PATH_TARGET) $(PATH_ROOT)/src/VBox/Runtime/include
|
---|
243 | VBoxDrvLib_SOURCES = \
|
---|
244 | $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.cpp \
|
---|
245 | $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
|
---|
246 | endif
|
---|
247 |
|
---|
248 |
|
---|
249 | #
|
---|
250 | # Generate rules for exporting the linux sources.
|
---|
251 | #
|
---|
252 | define def_export_rule
|
---|
253 | $(eval dst := $(word 1,$(subst =, ,$(pair))))
|
---|
254 | $(eval src := $(word 2,$(subst =, ,$(pair))))
|
---|
255 | $(PATH_BIN)/src/$(dst): $(src)
|
---|
256 | $$(call MSG_INST_TRG,VBOXDRV,$$<,$$@)
|
---|
257 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
258 | $$(QUIET)$$(CP) $$< $$@
|
---|
259 |
|
---|
260 | symlinked/$(dst):
|
---|
261 | $$(call MSG_INST_SYM,$$<,$$@)
|
---|
262 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
263 | $$(QUIET)ln -sfn $(abspath $(src)) $$@
|
---|
264 |
|
---|
265 | endef
|
---|
266 | # generate rules
|
---|
267 | $(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
|
---|
268 |
|
---|
269 |
|
---|
270 | #
|
---|
271 | # Rule for creating a symlinked setup.
|
---|
272 | #
|
---|
273 | symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
|
---|
274 | $(ECHO) done
|
---|
275 |
|
---|
276 |
|
---|
277 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
278 |
|
---|