1 | # $Id: Makefile.kmk 2981 2007-06-01 16:01:28Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the support library and the drivers/modules/kexts it uses.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2007 innotek 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 | INSTALLS.linux = vboxmod-bin vboxmod-sh
|
---|
41 |
|
---|
42 | #
|
---|
43 | # Include sub-makefile(s).
|
---|
44 | #
|
---|
45 | include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
|
---|
46 |
|
---|
47 | #
|
---|
48 | # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
|
---|
49 | #
|
---|
50 | include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
|
---|
51 |
|
---|
52 | vboxmod-bin_INST = bin/src/
|
---|
53 | vboxmod-bin_MODE = a+r,u+w
|
---|
54 | vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
|
---|
55 |
|
---|
56 | vboxmod-sh_INST = bin/src/
|
---|
57 | vboxmod-sh_MODE = a+rx,u+w
|
---|
58 | vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
|
---|
59 |
|
---|
60 | #
|
---|
61 | # The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
|
---|
62 | #
|
---|
63 | ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
|
---|
64 | # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
|
---|
65 | SUPR3_TEMPLATE = VBOXR3NP
|
---|
66 | else
|
---|
67 | SUPR3_TEMPLATE = VBOXR3
|
---|
68 | endif
|
---|
69 | SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
|
---|
70 | SUPR3_INCS := $(PATH_SUB_CURRENT)
|
---|
71 | SUPR3_INCS.l4 = $(L4_INCDIR)
|
---|
72 | ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
|
---|
73 | SUPR3_SOURCES = \
|
---|
74 | SUPLib.cpp \
|
---|
75 | $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
|
---|
76 | else
|
---|
77 | SUPR3_SOURCES = \
|
---|
78 | SUPLib.cpp \
|
---|
79 | win32/SUPLib-win32.cpp
|
---|
80 | endif
|
---|
81 |
|
---|
82 | #
|
---|
83 | # SUPR0 - The Ring-0 Import / Thunk library.
|
---|
84 | #
|
---|
85 | SUPR0_TEMPLATE = VBOXR0
|
---|
86 | ifeq ($(VBOX_LDR_FMT),pe)
|
---|
87 | SUPR0_SOURCES += SUPR0.def
|
---|
88 | endif
|
---|
89 | ifeq ($(VBOX_LDR_FMT),lx)
|
---|
90 | SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
|
---|
91 | $(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
|
---|
92 | $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > [email protected]
|
---|
93 | $(MV) -f [email protected] $@
|
---|
94 | endif
|
---|
95 |
|
---|
96 |
|
---|
97 | #
|
---|
98 | # VBoxDrv.sys - The Windows driver.
|
---|
99 | #
|
---|
100 | ifeq ($(BUILD_TARGET),win)
|
---|
101 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
102 | ifdef VBOX_SIGNING_MODE
|
---|
103 | VBoxDrv_NOINST = true
|
---|
104 | endif
|
---|
105 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
|
---|
106 | VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
|
---|
107 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
108 | VBoxDrv_SOURCES = \
|
---|
109 | SUPDRVShared.c
|
---|
110 | VBoxDrv_SOURCES.x86 = \
|
---|
111 | win32/SUPDrv-win32.cpp \
|
---|
112 | win32/SUPDrvA-win32.asm
|
---|
113 | VBoxDrv_SOURCES.amd64 = \
|
---|
114 | win64/SUPDrv-win64.cpp \
|
---|
115 | win64/SUPDrvA-win64.asm
|
---|
116 | VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
117 | VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
118 | VBoxDrv_LIBS = \
|
---|
119 | $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
|
---|
120 | $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
|
---|
121 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
122 |
|
---|
123 |
|
---|
124 | INSTALLS += VBoxDrv-inf
|
---|
125 | VBoxDrv-inf_INST = $(INST_BIN)
|
---|
126 | VBoxDrv-inf_MODE = a+r,u+w
|
---|
127 | VBoxDrv-inf_SOURCES = \
|
---|
128 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
|
---|
129 | VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
|
---|
130 | VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
|
---|
131 |
|
---|
132 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win32/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
|
---|
133 | $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
|
---|
134 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
135 |
|
---|
136 | ifdef VBOX_SIGNING_MODE
|
---|
137 | VBoxDrv-inf_SOURCES += \
|
---|
138 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
|
---|
139 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
|
---|
140 |
|
---|
141 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
|
---|
142 | $(INSTALL) -m 644 $< $(@D)
|
---|
143 |
|
---|
144 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
|
---|
145 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
|
---|
146 | $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
|
---|
147 | $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
|
---|
148 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
149 | endif # signing
|
---|
150 | endif # win
|
---|
151 |
|
---|
152 |
|
---|
153 | #
|
---|
154 | # vboxdrv.ko - The Linux Kernel Module.
|
---|
155 | #
|
---|
156 | ifeq ($(BUILD_TARGET),linux)
|
---|
157 | vboxdrv_TEMPLATE = VBOXR0DRV
|
---|
158 | vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
|
---|
159 | vboxdrv_INCS := $(PATH_SUB_CURRENT)
|
---|
160 | vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
161 | vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
|
---|
162 | vboxdrv_SOURCES = \
|
---|
163 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
|
---|
164 | SUPDRVShared.c
|
---|
165 | ifndef VBOX_LINUX_VERSION_2_4
|
---|
166 | vboxdrv_SOURCES += \
|
---|
167 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
|
---|
168 | endif
|
---|
169 | endif # real linux
|
---|
170 |
|
---|
171 |
|
---|
172 | #
|
---|
173 | # VBoxDrv.kext - The Darwin Kernel Extension.
|
---|
174 | #
|
---|
175 | ifeq ($(BUILD_TARGET),darwin)
|
---|
176 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
177 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
178 | VBoxDrv_DEFS += DEBUG_DARWIN_GIP
|
---|
179 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
180 | VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
181 | VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
182 | VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
|
---|
183 | VBoxDrv_SOURCES = \
|
---|
184 | SUPDRVShared.c \
|
---|
185 | $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
|
---|
186 |
|
---|
187 | INSTALLS += VBoxDrv.kext
|
---|
188 | VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
|
---|
189 | VBoxDrv.kext_SOURCES = \
|
---|
190 | $(PATH_TARGET)/Info.plist
|
---|
191 |
|
---|
192 | $(PATH_TARGET)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
|
---|
193 | $(call MSG_GENERATE,VBoxDrv,$@,$<)
|
---|
194 | $(xQUIET)$(RM) -f $@
|
---|
195 | $(xQUIET)$(SED) \
|
---|
196 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
197 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
198 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
199 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
200 | $< > $@
|
---|
201 |
|
---|
202 | INSTALLS += Scripts
|
---|
203 | Scripts_INST = $(INST_DIST)
|
---|
204 | Scripts_SOURCES = \
|
---|
205 | darwin/load.sh
|
---|
206 |
|
---|
207 | endif
|
---|
208 |
|
---|
209 |
|
---|
210 | #
|
---|
211 | # VBoxDrv.sys - The OS/2 driver.
|
---|
212 | #
|
---|
213 | ifeq ($(BUILD_TARGET),os2)
|
---|
214 | VBoxDrv_TEMPLATE = VBOXR0DRV
|
---|
215 | VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
216 | VBoxDrv_INCS := $(PATH_SUB_CURRENT)
|
---|
217 | #VBoxDrv_LDFLAGS = -s -t -v
|
---|
218 | VBoxDrv_SOURCES = \
|
---|
219 | os2/SUPDrvA-os2.asm \
|
---|
220 | os2/SUPDrv-os2.def
|
---|
221 | VBoxDrv_LIBS = \
|
---|
222 | $(TARGET_VBoxDrvLib) \
|
---|
223 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
224 | $(VBOX_GCC_LIBGCC) \
|
---|
225 | end
|
---|
226 |
|
---|
227 | # temp hack to ensure that SUPDrvA-os2.asm is first in the link.
|
---|
228 | LIBRARIES += VBoxDrvLib
|
---|
229 | VBoxDrvLib_TEMPLATE = VBOXR0DRV
|
---|
230 | VBoxDrvLib_NOINST = 1
|
---|
231 | VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
|
---|
232 | VBoxDrvLib_INCS := \
|
---|
233 | $(PATH_SUB_CURRENT) \
|
---|
234 | $(PATH_TARGET) \
|
---|
235 | $(PATH_ROOT)/src/VBox/Runtime/include
|
---|
236 | VBoxDrvLib_SOURCES = \
|
---|
237 | os2/SUPDrv-os2.cpp \
|
---|
238 | SUPDRVShared.c
|
---|
239 | endif
|
---|
240 |
|
---|
241 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
242 |
|
---|