VirtualBox

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

Last change on this file since 47363 was 46045, checked in by vboxsync, 12 years ago

Remove L4 support from main tree, missing file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.4 KB
Line 
1# $Id: Makefile.kmk 46045 2013-05-13 20:59:46Z vboxsync $
2## @file
3# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
4#
5
6#
7# Copyright (C) 2006-2012 Oracle Corporation
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
27SUB_DEPTH = ../../../..
28include $(KBUILD_PATH)/subheader.kmk
29
30#
31# Targets
32#
33LIBRARIES += SUPR3 SUPR3Static SUPR3HardenedStatic
34ifndef VBOX_ONLY_DOCS
35 if1of ($(VBOX_LDR_FMT), pe lx)
36 LIBRARIES += SUPR0
37 endif
38endif
39if !defined(VBOX_ONLY_DOCS) \
40 && !defined(VBOX_ONLY_EXTPACKS) \
41 && !defined(VBOX_ONLY_TESTSUITE)
42 ifdef VBOX_WITH_SUPSVC
43 PROGRAMS += VBoxSupSvc
44 endif
45 ifdef VBOX_WITH_VBOXDRV
46 LIBRARIES += SUPR0IdcClient
47 SYSMODS.freebsd += vboxdrv
48 SYSMODS.os2 += VBoxDrv
49 endif
50 INSTALLS.linux += vboxdrv-mod
51 INSTALLS.freebsd += vboxdrv-mod
52
53 #
54 # Include sub-makefile(s).
55 #
56 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
57
58 #
59 # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
60 #
61 ifeq ($(KBUILD_TARGET),linux)
62 include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
63 endif
64 ifeq ($(KBUILD_TARGET),freebsd)
65 include $(PATH_SUB_CURRENT)/freebsd/files_vboxdrv
66 endif
67endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_TESTSUITE
68
69
70#
71# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
72#
73SUPR3_TEMPLATE = VBOXR3NP
74SUPR3_DEFS = \
75 IN_SUP_R3 IN_RT_R3 \
76 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC) \
77 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
78 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,)
79SUPR3_INCS := $(PATH_SUB_CURRENT)
80SUPR3_SOURCES = \
81 SUPLib.cpp \
82 SUPLibSem.cpp \
83 SUPLibTracerA.asm \
84 SUPR3HardenedIPRT.cpp \
85 SUPR3HardenedVerify.cpp \
86 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
87
88#
89# Static version of SUPR3.
90#
91SUPR3Static_TEMPLATE = VBOXR3STATIC
92SUPR3Static_EXTENDS = SUPR3
93
94#
95# The static part of the hardened support library (ring-3).
96#
97SUPR3HardenedStatic_TEMPLATE = VBOXR3HARDENEDLIB
98SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
99SUPR3HardenedStatic_DEFS += \
100 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC,) \
101 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
102 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,)
103SUPR3HardenedStatic_INCS = .
104SUPR3HardenedStatic_SOURCES = \
105 SUPR3HardenedMain.cpp \
106 SUPR3HardenedVerify.cpp \
107 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
108
109#
110# VBoxSupSvc - The system wide service/daemon.
111#
112VBoxSupSvc_TEMPLATE = VBOXR3EXE
113VBoxSupSvc_SOURCES = \
114 SUPSvc.cpp \
115 SUPSvcGlobal.cpp \
116 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
117if1of ($(KBUILD_TARGET), win)
118 VBoxSupSvc_SOURCES += \
119 SUPSvcGrant.cpp
120endif
121ifn1of ($(KBUILD_TARGET), win)
122 VBoxSupSvc_SOURCES += \
123 SUPSvcMain-posix.cpp
124endif
125VBoxSupSvc_LIBS = \
126 $(LIB_RUNTIME)
127
128
129#
130# SUPR0 - The Ring-0 Import library.
131#
132SUPR0_TEMPLATE = VBoxR0
133if1of ($(VBOX_LDR_FMT), pe lx)
134 SUPR0_SOURCES = $(SUPR0_0_OUTDIR)/SUPR0.def
135 SUPR0_CLEAN = $(SUPR0_0_OUTDIR)/SUPR0.def
136$$(SUPR0_0_OUTDIR)/SUPR0.def: \
137 $(PATH_SUB_CURRENT)/SUPDrv.c \
138 $(PATH_SUB_CURRENT)/SUPR0-def-$(VBOX_LDR_FMT).sed \
139 | $$(dir $$@)
140 $(SED) \
141 -f $(dir $<)/SUPR0-def-$(VBOX_LDR_FMT).sed \
142 --output $@ \
143 $<
144endif
145
146
147#
148# SUPR0IdcClient - The Ring-0 IDC client driver library.
149#
150SUPR0IdcClient_TEMPLATE = VBoxR0DrvLib
151SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
152SUPR0IdcClient_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
153SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
154 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
155SUPR0IdcClient_SOURCES = \
156 SUPR0IdcClient.c \
157 SUPR0IdcClientComponent.c \
158 SUPR0IdcClientStubs.c
159
160
161
162if !defined(VBOX_ONLY_DOCS) \
163 && !defined(VBOX_ONLY_EXTPACKS) \
164 && !defined(VBOX_ONLY_TESTSUITE)
165
166ifeq ($(KBUILD_TARGET),os2)
167
168#
169# VBoxDrv.sys - The OS/2 driver.
170#
171VBoxDrv_TEMPLATE = VBOXR0DRV
172VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
173VBoxDrv_INCS := $(PATH_SUB_CURRENT)
174#VBoxDrv_LDFLAGS = -s -t -v
175VBoxDrv_SOURCES = \
176 os2/SUPDrvA-os2.asm \
177 os2/SUPDrv-os2.def
178VBoxDrv_LIBS = \
179 $(VBoxDrvLib_1_TARGET) \
180 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
181 $(VBOX_GCC_LIBGCC) \
182 end
183
184# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
185LIBRARIES += VBoxDrvLib
186VBoxDrvLib_TEMPLATE = VBOXR0DRV
187VBoxDrvLib_INSTTYPE = none
188VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
189VBoxDrvLib_INCS := \
190 . \
191 $(PATH_ROOT)/src/VBox/Runtime/include
192VBoxDrvLib_SOURCES = \
193 os2/SUPDrv-os2.cpp \
194 SUPDrv.c \
195 SUPDrvSem.c
196
197endif # os2
198ifeq ($(KBUILD_TARGET),freebsd)
199
200#
201# vboxdrv.ko - The FreeBSD Kernel Module.
202#
203vboxdrv_TEMPLATE = VBOXR0DRV
204vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
205vboxdrv_INCS := $(PATH_SUB_CURRENT)
206vboxdrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
207vboxdrv_SOURCES := \
208 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
209 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).def \
210 SUPDrv.c \
211 SUPDrvSem.c
212## @todo the SUPDrv-freebsd.def is most probably gonna break it and require build system hacking...
213
214#
215# Targets for installing the freebsd sources.
216#
217vboxdrv-mod_INST = bin/src/vboxdrv/
218vboxdrv-mod_SOURCES = \
219 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
220 $(vboxdrv-mod_0_OUTDIR)/Makefile
221vboxdrv-mod_CLEAN = \
222 $(vboxdrv-mod_0_OUTDIR)/Makefile
223
224$$(vboxdrv-mod_0_OUTDIR)/Makefile: \
225 $(PATH_SUB_CURRENT)/freebsd/Makefile \
226 $$(if $$(eq $$(Support/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
227 | $$(dir $$@)
228 $(call MSG_TOOL,Creating,,$@)
229 $(QUIET)$(RM) -f -- $@
230 ifndef VBOX_WITH_HARDENING
231 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
232 else
233 $(QUIET)$(CP) -f $< $@
234 endif
235
236endif # freebsd
237
238
239#
240# New VBoxDrv target. TODO: Convert all the above to use this!
241#
242if1of ($(KBUILD_TARGET), darwin linux solaris win)
243 ifdef VBOX_WITH_VBOXDRV
244 SYSMODS += VBoxDrv
245 endif
246 VBoxDrv_TEMPLATE = VBOXR0DRV
247 VBoxDrv_NAME.freebsd = vboxdrv
248 VBoxDrv_NAME.linux = vboxdrv
249 VBoxDrv_NAME.solaris = vboxdrv
250 ifdef VBOX_SIGNING_MODE
251 VBoxDrv_INSTTYPE.win = none
252 VBoxDrv_DEBUG_INSTTYPE.win = both
253 endif
254 VBoxDrv_INST.darwin = $(INST_VBOXDRV)Contents/MacOS/
255 VBoxDrv_DEBUG_INST.darwin= $(patsubst %/,%,$(INST_VBOXDRV))
256 VBoxDrv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
257
258 VBoxDrv_DEFS := IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
259 ifdef VBOX_WITH_DTRACE_R0DRV
260 VBoxDrv_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
261 endif
262 #VBoxDrv_DEFS.debug += DEBUG_DARWIN_GIP
263 VBoxDrv_DEFS.darwin := VBOX_WITH_HOST_VMX
264 VBoxDrv_DEFS.linux := \
265 KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE CONFIG_VBOXDRV_AS_MISC
266 ifdef VBOX_LINUX_VERSION_2_4
267 VBoxDrv_DEFS.linux += EXPORT_SYMTAB
268 endif
269 ifdef VBOX_WITH_NETFLT
270 VBoxDrv_DEFS.solaris += VBOX_WITH_NETFLT
271 endif
272 ifdef VBOX_WITH_NATIVE_SOLARIS_LOADING
273 VBoxDrv_DEFS.solaris += VBOX_WITH_NATIVE_SOLARIS_LOADING
274 endif
275 ifdef VBOX_WITHOUT_NATIVE_R0_LOADER
276 VBoxDrv_DEFS.win += VBOX_WITHOUT_NATIVE_R0_LOADER
277 endif
278 ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
279 VBoxDrv_DEFS.win += VBOX_WITH_VMMR0_DISABLE_PREEMPTION
280 endif
281
282 VBoxDrv_INCS = . $(VBoxDrv_0_OUTDIR)
283 VBoxDrv_INCS.darwin = ./darwin
284 VBoxDrv_INCS.linux = $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
285
286 VBoxDrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
287 VBoxDrv_LIBS.linux.debug = $(VBoxDrv_LIBS) $(VBOX_GCC_LIBGCC)
288 VBoxDrv_LIBS.win = \
289 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
290 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
291 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
292
293 #VBoxDrv_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
294 VBoxDrv_LDFLAGS.solaris += -N misc/ctf
295 ifdef VBOX_WITH_NATIVE_DTRACE
296 VBoxDrv_LDFLAGS.solaris += -N drv/dtrace
297 endif
298 VBoxDrv_LDFLAGS.win.x86 = -Entry:DriverEntry@8
299 VBoxDrv_LDFLAGS.win.amd64= -Entry:DriverEntry
300
301 VBoxDrv_SOURCES.darwin = \
302 darwin/SUPDrv-darwin.cpp
303 VBoxDrv_SOURCES.linux = \
304 linux/SUPDrv-linux.c
305 VBoxDrv_SOURCES.solaris = \
306 solaris/SUPDrv-solaris.c
307 VBoxDrv_SOURCES.win = \
308 win/SUPDrv-win.cpp \
309 win/SUPDrvA-win.asm \
310 win/VBoxDrv.rc
311 VBoxDrv_SOURCES = \
312 SUPDrv.d \
313 SUPDrv.c \
314 SUPDrvSem.c \
315 SUPDrvTracer.cpp
316 ifdef VBOX_WITH_NATIVE_DTRACE
317 VBoxDrv_SOURCES += \
318 SUPDrv-dtrace.cpp
319 SUPDrv-dtrace.cpp_DEFS.darwin += VBOX_PATH_MACOSX_DTRACE_H=\"$(VBOX_PATH_MACOSX_SDK)/usr/include/sys/dtrace.h\"
320 endif
321 ifn1of ($(KBUILD_TARGET), linux freebsd)
322 VBoxDrv_SOURCES += \
323 SUPDrvTracerA.asm
324 endif
325 ifndef VBOX_LINUX_VERSION_2_4
326 VBoxDrv_SOURCES.linux += \
327 linux/SUPDrv-linux.mod.c
328 endif
329
330endif
331
332
333
334if1of ($(KBUILD_TARGET), darwin)
335 # Files necessary to make a darwin kernel extension bundle.
336 INSTALLS.darwin += VBoxDrv.kext
337 VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
338 VBoxDrv.kext_SOURCES = $(VBoxDrv.kext_0_OUTDIR)/Info.plist
339 VBoxDrv.kext_CLEAN = $(VBoxDrv.kext_0_OUTDIR)/Info.plist
340
341$$(VBoxDrv.kext_0_OUTDIR)/Info.plist: \
342 $(PATH_SUB_CURRENT)/darwin/Info.plist \
343 $(VBOX_VERSION_MK) | $$(dir $$@)
344 $(call MSG_GENERATE,VBoxDrv,$@,$<)
345 $(QUIET)$(RM) -f $@
346 $(QUIET)$(SED) \
347 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
348 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
349 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
350 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
351 -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
352 -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
353 -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
354 --output $@ \
355 $<
356endif
357
358
359if1of ($(KBUILD_TARGET), darwin solaris)
360 # Common manual loader script.
361 INSTALLS += SUPDrvScripts
362 SUPDrvScripts_INST = $(INST_DIST)
363 SUPDrvScripts_EXEC_SOURCES = \
364 $(KBUILD_TARGET)/load.sh
365endif
366
367
368if1of ($(KBUILD_TARGET), linux)
369 #
370 # Targets for installing the linux sources.
371 #
372 vboxdrv-mod_INST = bin/src/vboxdrv/
373 vboxdrv-mod_SOURCES = \
374 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
375 $(vboxdrv-mod_0_OUTDIR)/Makefile
376 vboxdrv-mod_EXEC_SOURCES = \
377 $(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN)) \
378 $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers
379 vboxdrv-mod_CLEAN = \
380 $(vboxdrv-mod_0_OUTDIR)/Makefile \
381 $(PATH_TARGET)/vboxdrv-mod-1.dep \
382
383 # Scripts needed for building the kernel modules
384 includedep $(PATH_TARGET)/vboxdrv-mod-1.dep
385 $$(vboxdrv-mod_0_OUTDIR)/Makefile: \
386 $(PATH_SUB_CURRENT)/linux/Makefile \
387 $$(if $$(eq $$(Support/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
388 | $$(dir $$@)
389 $(call MSG_TOOL,Creating,,$@)
390 ifndef VBOX_WITH_HARDENING
391 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
392 else
393 $(QUIET)$(CP) -f $< $@
394 endif
395 %$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/vboxdrv-mod-1.dep' 'Support/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
396endif # real linux
397
398
399ifeq ($(KBUILD_TARGET), win)
400 INSTALLS.win += VBoxDrv-inf
401 VBoxDrv-inf_INST = $(INST_BIN)
402 VBoxDrv-inf_MODE = a+r,u+w
403 VBoxDrv-inf_SOURCES = \
404 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
405 VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
406 VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
407
408 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
409 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
410 $(call VBOX_EDIT_INF_FN,$<,$@)
411
412 ifdef VBOX_SIGNING_MODE
413 VBoxDrv-inf_SOURCES += \
414 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
415 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
416
417 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(VBoxDrv_1_TARGET) | $$(dir $$@)
418 $(INSTALL) -m 644 $< $(@D)
419
420 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
421 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
422 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys
423 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
424 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
425 endif # signing
426endif # win
427
428
429endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_TESTSUITE
430include $(FILE_KBUILD_SUB_FOOTER)
431
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