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