VirtualBox

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

Last change on this file since 2676 was 2676, checked in by vboxsync, 17 years ago

some inf2cat work (needs selfsign update so not enabled).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.1 KB
Line 
1# $Id: Makefile.kmk 2676 2007-05-16 17:20:50Z 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
22DEPTH ?= ../../../..
23SUB_DEPTH = ..
24include $(PATH_KBUILD)/subheader.kmk
25
26#
27# Targets
28#
29LIBRARIES += SUPR3
30ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
31LIBRARIES += SUPR0
32endif
33ifdef VBOX_WITH_VBOXDRV
34SYSMODS.darwin += VBoxDrv
35SYSMODS.linux += vboxdrv
36SYSMODS.win += VBoxDrv
37SYSMODS.os2 += VBoxDrv
38endif
39
40INSTALLS.linux = vboxmod-bin vboxmod-sh
41
42#
43# Include sub-makefile(s).
44#
45include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
46
47#
48# Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
49#
50include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
51
52vboxmod-bin_INST = bin/src/
53vboxmod-bin_MODE = a+r,u+w
54vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
55
56vboxmod-sh_INST = bin/src/
57vboxmod-sh_MODE = a+rx,u+w
58vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
59
60#
61# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
62#
63ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
64# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
65SUPR3_TEMPLATE = VBOXR3NP
66else
67SUPR3_TEMPLATE = VBOXR3
68endif
69SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
70SUPR3_INCS := $(PATH_SUB_CURRENT)
71SUPR3_INCS.l4 = $(L4_INCDIR)
72ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
73SUPR3_SOURCES = \
74 SUPLib.cpp \
75 $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
76else
77SUPR3_SOURCES = \
78 SUPLib.cpp \
79 win32/SUPLib-win32.cpp
80endif
81
82#
83# SUPR0 - The Ring-0 Import / Thunk library.
84#
85SUPR0_TEMPLATE = VBOXR0
86ifeq ($(VBOX_LDR_FMT),pe)
87SUPR0_SOURCES += SUPR0.def
88endif
89ifeq ($(VBOX_LDR_FMT),lx)
90SUPR0_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]*/ /' $< > $@.tmp
93 $(MV) -f $@.tmp $@
94endif
95
96
97#
98# VBoxDrv.sys - The Windows driver.
99#
100ifeq ($(BUILD_TARGET),win)
101VBoxDrv_TEMPLATE = VBOXR0DRV
102VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
103VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
104VBoxDrv_INCS := $(PATH_SUB_CURRENT)
105VBoxDrv_SOURCES = \
106 SUPDRVShared.c
107VBoxDrv_SOURCES.x86 = \
108 win32/SUPDrv-win32.cpp \
109 win32/SUPDrvA-win32.asm
110VBoxDrv_SOURCES.amd64 = \
111 win64/SUPDrv-win64.cpp \
112 win64/SUPDrvA-win64.asm
113VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
114VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
115VBoxDrv_LIBS = \
116 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
117 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
118 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
119
120INSTALLS += VBoxDrvInf
121VBoxDrvInf_INST = $(INST_BIN)
122 ifndef VBOX_LATER_TODAY #ndef VBOX_SIGNING_MODE
123VBoxDrvInf_SOURCES = win32/VBoxDrv.inf
124 else
125VBoxDrvInf_SOURCES = \
126 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
127 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
128
129VBoxDrvInf_CLEAN += \
130 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat \
131 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
132 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
133
134$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: win32/VBoxDrv.inf Makefile.kmk
135 $(RM) -f $@
136 $(MKDIR) -p $(@D)
137ifeq ($(BUILD_TARGET_ARCH),amd64)
138 $(SED) \
139 -e 's/^\;CatalogFile=/CatalogFile.NTamd64=/' \
140 -e 's/^\%INNOTEK%=INNOTEK *$$/%INNOTEK%=INNOTEK, NTamd64/' \
141 -e 's/^\[VBoxDrv_Service\] *$$/\[VBoxDrv_Service.NTamd64\]/' \
142 -e 's/^\;amd64 *//' \
143 $< > $@
144else
145 $(SED) -e 's/^\;CatalogFile=/CatalogFile=/' $< > $@
146endif
147
148$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: $$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf $$(TARGET_VBoxDrv)
149 $(RM) -f $(@D)/VBoxDrv.cat
150 $(INSTALL) -m 644 $(TARGET_VBoxDrv) $(@D)
151 ifeq ($(BUILD_TARGET_ARCH),amd64)
152 C:Inf2Cat.exe /driver:$(@D) /verbose /os:XP_X64,Server2003_X64,Vista_X64
153 else
154 C:Inf2Cat.exe /driver:$(@D) /verbose /os:2000,XP_X86,Server2003_X86,Vista_X86
155 endif
156 $(MV) $(@D)/vboxdrv.cat $@
157 endif
158endif
159
160
161#
162# vboxdrv.ko - The Linux Kernel Module.
163#
164ifeq ($(BUILD_TARGET),linux)
165vboxdrv_TEMPLATE = VBOXR0DRV
166vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
167vboxdrv_INCS := $(PATH_SUB_CURRENT)
168vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
169vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
170vboxdrv_SOURCES = \
171 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
172 SUPDRVShared.c
173ifndef VBOX_LINUX_VERSION_2_4
174vboxdrv_SOURCES += \
175 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
176endif
177endif # real linux
178
179
180#
181# VBoxDrv.kext - The Darwin Kernel Extension.
182#
183ifeq ($(BUILD_TARGET),darwin)
184VBoxDrv_TEMPLATE = VBOXR0DRV
185VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
186VBoxDrv_DEFS += DEBUG_DARWIN_GIP
187VBoxDrv_INCS := $(PATH_SUB_CURRENT)
188VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
189VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
190VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
191VBoxDrv_SOURCES = \
192 SUPDRVShared.c \
193 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
194
195INSTALLS += VBoxDrv.kext
196VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
197VBoxDrv.kext_SOURCES = \
198 $(PATH_TARGET)/Info.plist
199
200$(PATH_TARGET)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
201 $(call MSG_GENERATE,VBoxDrv,$@,$<)
202 $(xQUIET)$(RM) -f $@
203 $(xQUIET)$(SED) \
204 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
205 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
206 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
207 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
208 $< > $@
209
210INSTALLS += Scripts
211Scripts_INST = $(INST_DIST)
212Scripts_SOURCES = \
213 darwin/load.sh
214
215endif
216
217
218#
219# VBoxDrv.sys - The OS/2 driver.
220#
221ifeq ($(BUILD_TARGET),os2)
222VBoxDrv_TEMPLATE = VBOXR0DRV
223VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
224VBoxDrv_INCS := $(PATH_SUB_CURRENT)
225#VBoxDrv_LDFLAGS = -s -t -v
226VBoxDrv_SOURCES = \
227 os2/SUPDrvA-os2.asm \
228 os2/SUPDrv-os2.def
229VBoxDrv_LIBS = \
230 $(TARGET_VBoxDrvLib) \
231 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
232 $(VBOX_GCC_LIBGCC) \
233 end
234
235# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
236LIBRARIES += VBoxDrvLib
237VBoxDrvLib_TEMPLATE = VBOXR0DRV
238VBoxDrvLib_NOINST = 1
239VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
240VBoxDrvLib_INCS := \
241 $(PATH_SUB_CURRENT) \
242 $(PATH_TARGET) \
243 $(PATH_ROOT)/src/VBox/Runtime/include
244VBoxDrvLib_SOURCES = \
245 os2/SUPDrv-os2.cpp \
246 SUPDRVShared.c
247endif
248
249include $(PATH_KBUILD)/subfooter.kmk
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use