VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile.kmk@ 13073

Last change on this file since 13073 was 13052, checked in by vboxsync, 16 years ago

fixed VBOX_WITH_VBOXDRV

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.8 KB
Line 
1# $Id: Makefile.kmk 13052 2008-10-07 14:10:29Z 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 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# The contents of this file may alternatively be used under the terms
18# of the Common Development and Distribution License Version 1.0
19# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20# VirtualBox OSE distribution, in which case the provisions of the
21# CDDL are applicable instead of those of the GPL.
22#
23# You may elect to license modified versions of this file under the
24# terms and conditions of either the GPL or the CDDL or both.
25#
26# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27# Clara, CA 95054 USA or visit http://www.sun.com if you need
28# additional information or have any questions.
29#
30
31SUB_DEPTH = ../../../..
32include $(KBUILD_PATH)/subheader.kmk
33
34#
35# Targets
36#
37LIBRARIES += SUPR3 SUPR3HardenedStatic
38ifndef VBOX_ONLY_DOCS
39 ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT)),)
40 LIBRARIES += SUPR0
41 endif
42 ifdef VBOX_WITH_SUPSVC
43 PROGRAMS += VBoxSupSvc
44 endif
45 ifdef VBOX_WITH_VBOXDRV
46 LIBRARIES += SUPR0IdcClient
47 SYSMODS.darwin += VBoxDrv
48 SYSMODS.freebsd += vboxdrv
49 SYSMODS.linux += vboxdrv
50 SYSMODS.win += VBoxDrv
51 SYSMODS.os2 += VBoxDrv
52 SYSMODS.solaris += vboxdrv
53 endif
54 OTHERS.linux += \
55 $(PATH_BIN)/src/build_in_tmp \
56 $(PATH_BIN)/src/Makefile \
57 $(if $(VBOX_OSE),,$(PATH_BIN)/src/dkms.conf)
58 INSTALLS.linux += vboxmod-bin vboxmod-sh
59
60 #
61 # Include sub-makefile(s).
62 #
63 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
64
65 #
66 # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
67 #
68 include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
69endif # !VBOX_ONLY_DOCS
70
71
72#
73# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
74#
75ifneq ($(filter l4%,$(KBUILD_TARGET) $(BUILD_TARGET_SUB)),)
76 # L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
77 SUPR3_TEMPLATE = VBOXR3NP
78else
79 SUPR3_TEMPLATE = VBOXR3
80endif
81SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
82ifdef VBOX_WITH_IDT_PATCHING
83 SUPR3_DEFS += VBOX_WITH_IDT_PATCHING
84endif
85ifdef VBOX_WITH_SUPSVC
86 SUPR3_DEFS += VBOX_WITH_SUPSVC
87endif
88SUPR3_INCS := $(PATH_SUB_CURRENT)
89SUPR3_INCS.l4 = $(L4_INCDIR)
90SUPR3_SOURCES = \
91 SUPLib.cpp \
92 SUPR3HardenedIPRT.cpp \
93 SUPR3HardenedVerify.cpp \
94 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
95
96
97#
98# The static part of the hardened support library (ring-3).
99#
100SUPR3HardenedStatic_TEMPLATE = VBOXR3HARDENEDLIB
101SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
102ifdef VBOX_WITH_SUPSVC
103 SUPR3HardenedStatic_DEFS += VBOX_WITH_SUPSVC
104endif
105SUPR3HardenedStatic_INCS = .
106SUPR3HardenedStatic_SOURCES = \
107 SUPR3HardenedMain.cpp \
108 SUPR3HardenedVerify.cpp \
109 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
110
111ifndef VBOX_ONLY_DOCS
112
113#
114# VBoxSupSvc - The system wide service/daemon.
115#
116VBoxSupSvc_TEMPLATE = VBOXR3EXE
117VBoxSupSvc_SOURCES = \
118 SUPSvc.cpp \
119 SUPSvcGlobal.cpp \
120 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
121if1of ($(KBUILD_TARGET), win)
122 VBoxSupSvc_SOURCES += \
123 SUPSvcGrant.cpp
124endif
125ifn1of ($(KBUILD_TARGET), win)
126 VBoxSupSvc_SOURCES += \
127 SUPSvcMain-posix.cpp
128endif
129VBoxSupSvc_LIBS = \
130 $(LIB_RUNTIME)
131
132
133#
134# SUPR0 - The Ring-0 Import / Thunk library.
135#
136SUPR0_TEMPLATE = VBOXR0
137ifeq ($(VBOX_LDR_FMT),pe)
138 SUPR0_SOURCES += SUPR0.def
139endif
140ifeq ($(VBOX_LDR_FMT),lx)
141SUPR0_SOURCES += $$(PATH_SUPR0)/SUPR0.def
142$$(PATH_SUPR0)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $$(dir $$@)
143 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > [email protected]
144 $(MV) -f [email protected] $@
145endif
146
147
148#
149# SUPR0IdcClient - The Ring-0 IDC client driver library.
150#
151SUPR0IdcClient_TEMPLATE = VBOXR0DRV
152SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
153SUPR0IdcClient_SDKS.win = W2K3DDK WINPSDKINCS
154SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
155 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
156SUPR0IdcClient_SOURCES = \
157 SUPR0IdcClient.c \
158 SUPR0IdcClientComponent.c \
159 SUPR0IdcClientStubs.c
160
161
162#
163# VBoxDrv.sys - The Windows driver.
164#
165## @todo consoliate all the targets into a single mess.
166ifeq ($(KBUILD_TARGET),win)
167VBoxDrv_TEMPLATE = VBOXR0DRV
168ifdef VBOX_SIGNING_MODE
169 VBoxDrv_NOINST = true
170endif
171VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER
172ifdef VBOX_WITH_IDT_PATCHING
173 VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
174endif
175VBoxDrv_DEFS.amd64 = SUPDRV_WITH_UNWIND_HACK
176VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
177VBoxDrv_INCS := $(PATH_SUB_CURRENT)
178VBoxDrv_SOURCES = \
179 win/SUPDrv-win.cpp \
180 win/SUPDrvA-win.asm \
181 SUPDrv.c
182VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
183VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
184VBoxDrv_LIBS = \
185 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
186 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
187 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
188
189
190INSTALLS += VBoxDrv-inf
191VBoxDrv-inf_INST = $(INST_BIN)
192VBoxDrv-inf_MODE = a+r,u+w
193VBoxDrv-inf_SOURCES = \
194 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
195VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
196VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
197
198$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
199 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
200 $(call VBOX_EDIT_INF_FN,$<,$@)
201
202 ifdef VBOX_SIGNING_MODE
203VBoxDrv-inf_SOURCES += \
204 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
205 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
206
207$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(TARGET_VBoxDrv) | $$(call DIRDEP,$$(@D))
208 $(INSTALL) -m 644 $< $(@D)
209
210$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
211 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
212 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys
213 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
214 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
215 endif # signing
216endif # win
217
218
219#
220# vboxdrv.ko - The Linux Kernel Module (syntax only).
221#
222ifeq ($(KBUILD_TARGET),linux)
223vboxdrv_TEMPLATE = VBOXR0DRV
224vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
225ifdef VBOX_WITH_IDT_PATCHING
226vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
227endif
228ifdef VBOX_LINUX_VERSION_2_4
229vboxdrv_DEFS += EXPORT_SYMTAB
230endif
231vboxdrv_INCS := \
232 $(PATH_SUB_CURRENT) \
233 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
234vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
235vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
236vboxdrv_SOURCES = \
237 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
238 SUPDrv.c
239ifndef VBOX_LINUX_VERSION_2_4
240vboxdrv_SOURCES += \
241 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).mod.c
242endif
243
244
245#
246# Targets for installing the linux sources.
247#
248vboxmod-bin_INST = bin/src/
249vboxmod-bin_MODE = a+r,u+w
250vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
251
252vboxmod-sh_INST = bin/src/
253vboxmod-sh_MODE = a+rx,u+w
254vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
255vboxmod-sh_CLEAN = $(PATH_TARGET)/vboxmod-sh-1.dep
256
257# Scripts needed for building the kernel modules
258## @todo generate these else where and move them from OTHERS to vboxmod-bin (which btw installs NOBIN files contrary to its name).
259
260$(PATH_BIN)/src/build_in_tmp: \
261 $(PATH_SUB_CURRENT)/linux/build_in_tmp \
262 $(VBOX_VERSION_STAMP)
263 $(call MSG_TOOL,Creating,,$@)
264 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxdrv;g" --output $@ $<
265 $(QUIET)chmod 0755 $@
266
267$(PATH_BIN)/src/dkms.conf: \
268 $(PATH_SUB_CURRENT)/linux/dkms.conf \
269 $(VBOX_VERSION_STAMP)
270 $(call MSG_TOOL,Creating,,$@)
271 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" --output $@ $<
272
273includedep $(PATH_TARGET)/vboxmod-sh-1.dep
274$(PATH_BIN)/src/Makefile: \
275 $(PATH_SUB_CURRENT)/linux/Makefile \
276 $$(if $$(eq $$(Support/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
277 | $(PATH_TARGET)/
278 $(call MSG_TOOL,Creating,,$@)
279 ifndef VBOX_WITH_HARDENING
280 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
281 else
282 $(QUIET)$(CP) -f $< $@
283 endif
284 %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/vboxmod-sh-1.dep
285 %$(QUIET2)$(APPEND) '$(PATH_TARGET)/vboxmod-sh-1.dep' 'Support/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
286
287endif # real linux
288
289
290
291
292#
293# VBoxDrv.kext - The Darwin Kernel Extension.
294#
295ifeq ($(KBUILD_TARGET),darwin)
296VBoxDrv_TEMPLATE = VBOXR0DRV
297VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
298ifdef VBOX_WITH_IDT_PATCHING
299VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING
300endif
301VBoxDrv_DEFS += DEBUG_DARWIN_GIP
302VBoxDrv_INCS := $(PATH_SUB_CURRENT)
303VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
304VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
305VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
306VBoxDrv_SOURCES = \
307 SUPDrv.c \
308 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).cpp
309
310INSTALLS += VBoxDrv.kext
311VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
312VBoxDrv.kext_SOURCES = \
313 $(PATH_VBoxDrv.kext)/Info.plist
314VBoxDrv.kext_CLEAN = \
315 $(PATH_VBoxDrv.kext)/Info.plist
316
317$$(PATH_VBoxDrv.kext)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
318 $(call MSG_GENERATE,VBoxDrv,$@,$<)
319 $(xQUIET)$(RM) -f $@
320 $(xQUIET)$(SED) \
321 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
322 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
323 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
324 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
325 $< > $@
326
327INSTALLS += Scripts
328Scripts_INST = $(INST_DIST)
329Scripts_SOURCES = \
330 darwin/load.sh
331
332endif # darwin
333
334
335#
336# VBoxDrv.sys - The OS/2 driver.
337#
338ifeq ($(KBUILD_TARGET),os2)
339VBoxDrv_TEMPLATE = VBOXR0DRV
340VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
341VBoxDrv_INCS := $(PATH_SUB_CURRENT)
342#VBoxDrv_LDFLAGS = -s -t -v
343VBoxDrv_SOURCES = \
344 os2/SUPDrvA-os2.asm \
345 os2/SUPDrv-os2.def
346VBoxDrv_LIBS = \
347 $(TARGET_VBoxDrvLib) \
348 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
349 $(VBOX_GCC_LIBGCC) \
350 end
351
352# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
353LIBRARIES += VBoxDrvLib
354VBoxDrvLib_TEMPLATE = VBOXR0DRV
355VBoxDrvLib_NOINST = 1
356VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
357VBoxDrvLib_INCS := \
358 . \
359 $(PATH_ROOT)/src/VBox/Runtime/include
360VBoxDrvLib_SOURCES = \
361 os2/SUPDrv-os2.cpp \
362 SUPDrv.c
363endif
364
365
366#
367# vboxdrv.ko - The FreeBSD Kernel Module.
368#
369ifeq ($(KBUILD_TARGET),freebsd)
370vboxdrv_TEMPLATE = VBOXR0DRV
371vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
372ifdef VBOX_WITH_IDT_PATCHING
373vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
374endif
375vboxdrv_INCS := $(PATH_SUB_CURRENT)
376vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
377vboxdrv_SOURCES := \
378 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
379 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).def \
380 SUPDrv.c
381## @todo the SUPDrv-freebsd.def is most probably gonna break it and require build system hacking...
382endif # freebsd
383
384
385#
386# vboxdrv.o - The Solaris Kernel Module.
387#
388ifeq ($(KBUILD_TARGET),solaris)
389vboxdrv_TEMPLATE = VBOXR0DRV
390vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0
391ifdef VBOX_WITH_IDT_PATCHING
392vboxdrv_DEFS += VBOX_WITH_IDT_PATCHING
393endif
394# Disabled temporarily
395#ifdef VBOX_WITH_NETFLT
396#vboxdrv_DEFS += VBOX_WITH_NETFLT
397#endif
398vboxdrv_INCS := $(PATH_SUB_CURRENT)
399vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
400vboxdrv_SOURCES = \
401 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
402 SUPDrv.c
403endif # solaris
404
405
406#
407# SUPDrv.c needs the VBOX_SVN_REV.
408#
409SUPDrv.c_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV)
410
411
412endif # !VBOX_ONLY_DOCS
413include $(KBUILD_PATH)/subfooter.kmk
414
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette