VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk@ 107303

Last change on this file since 107303 was 107303, checked in by vboxsync, 5 weeks ago

Windows/Networking: Removed NDIS 5-based drivers, as we don't support Windows host OSes anymore which require this NDIS version -- only NDIS 6.0+ is supported now [build fix]. bugref:10819

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.6 KB
Line 
1# $Id: Makefile.kmk 107303 2024-12-12 14:56:52Z vboxsync $
2## @file
3# Sub-Makefile for the Network Filter Driver (VBoxNetFlt).
4#
5
6#
7# Copyright (C) 2008-2024 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
27# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28# in the VirtualBox distribution, in which case the provisions of the
29# CDDL are applicable instead of those of the GPL.
30#
31# You may elect to license modified versions of this file under the
32# terms and conditions of either the GPL or the CDDL or both.
33#
34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
36
37SUB_DEPTH = ../../../..
38include $(KBUILD_PATH)/subheader.kmk
39
40
41if1of ($(KBUILD_TARGET), darwin win) # this ifeq must go, see @todo around elif
42 #
43 # The mixed case driver.
44 #
45 ifdef VBOX_WITH_VBOXDRV
46 SYSMODS.darwin += VBoxNetFlt
47 endif
48
49 # The driver.
50 VBoxNetFlt_TEMPLATE = VBoxR0Drv
51 VBoxNetFlt_INST = $(INST_VBOXNETFLT)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/)
52 VBoxNetFlt_DEBUG_INST.darwin = $(patsubst %/,%,$(INST_VBOXNETFLT))
53 VBoxNetFlt_DEFS = IN_RT_R0 IN_SUP_STATIC
54 VBoxNetFlt_INCS = .
55 VBoxNetFlt_SOURCES = \
56 darwin/VBoxNetFlt-darwin.cpp
57 VBoxNetFlt_SOURCES = VBoxNetFlt.c
58 #VBoxNetFlt_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
59 VBoxNetFlt_LIBS = \
60 $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
61
62 darwin/VBoxNetFlt-darwin.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
63
64 # Darwin extras.
65 if "$(KBUILD_TARGET)" == "darwin" && defined(VBOX_WITH_VBOXDRV)
66 INSTALLS += VBoxNetFlt.kext
67 VBoxNetFlt.kext_INST = $(INST_VBOXNETFLT)Contents/
68 VBoxNetFlt.kext_SOURCES = $(VBoxNetFlt.kext_0_OUTDIR)/Contents/Info.plist
69 VBoxNetFlt.kext_CLEAN = $(VBoxNetFlt.kext_0_OUTDIR)/Contents/Info.plist
70 VBoxNetFlt.kext_BLDDIRS = $(VBoxNetFlt.kext_0_OUTDIR)/Contents/
71
72 $$(VBoxNetFlt.kext_0_OUTDIR)/Contents/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
73 $(call MSG_GENERATE,VBoxNetFlt,$@,$<)
74 $(QUIET)$(RM) -f $@
75 $(QUIET)$(SED) \
76 -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
77 -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
78 -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
79 -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
80 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
81 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
82 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
83 --output $@ \
84 $<
85
86 $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxNetFlt)
87
88 INSTALLS.darwin += Scripts-darwin
89 Scripts-darwin_INST = $(INST_DIST)
90 Scripts-darwin_EXEC_SOURCES = \
91 darwin/loadnetflt.sh
92 endif # darwin && host-drivers
93
94 ifeq ($(KBUILD_TARGET),win)
95 #
96 # VBoxNetLwf.sys - The light-weight filter driver for NDIS6 (i.e. Windows only).
97 #
98 ifdef VBOX_WITH_VBOXDRV
99 SYSMODS.win += VBoxNetLwf
100 INSTALLS.win += VBoxNetLwf-inf
101 endif
102 # The driver.
103 VBoxNetLwf_TEMPLATE = VBoxR0Drv
104 VBoxNetLwf_INST = $(INST_VBOXNETFLT)
105 if defined(VBOX_SIGNING_MODE)
106 VBoxNetLwf_INSTTYPE = none
107 VBoxNetLwf_DEBUG_INSTTYPE = both
108 endif
109 VBoxNetLwf_DEFS = IN_RT_R0 IN_SUP_STATIC
110 VBoxNetLwf_DEFS.win = NDISLWF=1 DBG=1
111 # VBoxNetLwf_DEFS.win += VBOXNETFLT_STATIC_CONFIG
112 # VBoxNetLwf_DEFS.win += VBOXNETFLT_NO_PACKET_QUEUE
113 # VBoxNetLwf_DEFS.win += NDIS_MINIPORT_DRIVER NDIS_WDM=1 BINARY_COMPATIBLE=0
114 # ifdef VBOX_LOOPBACK_USEFLAGS
115 # VBoxNetLwf_DEFS.win += VBOX_LOOPBACK_USEFLAGS
116 # endif
117 VBoxNetLwf_DEFS.win.x86 = NDIS60=1
118 VBoxNetLwf_DEFS.win.amd64 = NDIS60=1
119 VBoxNetLwf_DEFS.win.arm64 = NDIS630=1 # The minimum version for non-x86/amd64.
120 VBoxNetLwf_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK_WLH) $(VBOX_WINPSDK_INCS)
121 VBoxNetLwf_INCS = .
122 VBoxNetLwf_SOURCES = \
123 win/drv/VBoxNetLwf-win.cpp \
124 VBoxNetFlt.c \
125 VBoxNetFlt.rc
126 VBoxNetLwf_LDFLAGS.win.x86 := -Entry:DriverEntry@8
127 VBoxNetLwf_LDFLAGS.win.amd64 := -Entry:DriverEntry
128 VBoxNetLwf_LDFLAGS.win.arm64 := -Entry:DriverEntry
129 VBoxNetLwf_LIBS.win = \
130 $(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/ntoskrnl.lib \
131 $(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/hal.lib \
132 $(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/ndis.lib \
133 $(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/netio.lib \
134 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
135 VBoxNetLwf_LIBS.win.arm64 = \
136 $(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/BufferOverflowFastFailK.lib
137 VBoxNetLwf_LIBS = \
138 $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
139
140 # VBoxNetLwf INF & CAT files.
141 VBoxNetLwf-inf_TEMPLATE = VBoxR0DrvInfCat
142 VBoxNetLwf-inf_SOURCES = \
143 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.inf
144 VBoxNetLwf-inf_CLEAN = $(VBoxNetLwf-inf_SOURCES)
145 VBoxNetLwf-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetLwfCat.dir
146
147 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.inf: $(PATH_SUB_CURRENT)/win/drv/VBoxNetLwf.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
148 $(call MSG_GENERATE,VBoxNetLwf-inf,$@,$<)
149 $(call VBOX_EDIT_INF_FN,$<,$@)
150
151 ifdef VBOX_SIGNING_MODE
152 VBoxNetLwf-inf_SOURCES += \
153 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.sys \
154 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.cat
155 # $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwfNobj.dll
156 VBoxNetLwf-inf_SOURCES.win.x86 += \
157 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.cat=>VBoxNetLwf-PreW10.cat
158 VBoxNetLwf-inf_SOURCES.win.amd64 += \
159 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.cat=>VBoxNetLwf-PreW10.cat
160
161 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.sys: $$(VBoxNetLwf_1_TARGET) | $$(dir $$@)
162 $(INSTALL) -m 644 $< $(@D)
163
164 #$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwfNobj.dll: $$(VBoxNetLwfNobj_1_TARGET) | $$(dir $$@)
165 # $(INSTALL) -m 644 $< $(@D)
166
167 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.cat: \
168 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.sys \
169 $(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.inf
170 $(call MSG_TOOL,Inf2Cat,VBoxNetLwf-inf,$@,$<)
171 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
172 endif # VBOX_SIGNING_MODE
173
174
175 #
176 # WinNetConfig - static library with host network interface config API (for the installer)
177 #
178 LIBRARIES.win += WinNetConfigSharedStatic
179 WinNetConfigSharedStatic_TEMPLATE = VBoxR3StaticDllNoAsan
180 WinNetConfigSharedStatic_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
181 WinNetConfigSharedStatic_DEFS = _UNICODE UNICODE
182 WinNetConfigSharedStatic_SOURCES = \
183 win/cfg/VBoxNetCfg.cpp \
184 ../../Main/glue/string.cpp
185
186 # Version for DLLs:
187 LIBRARIES.win += WinNetConfigDll
188 WinNetConfigDll_TEMPLATE = VBoxR3Dll
189 WinNetConfigDll_EXTENDS = WinNetConfigSharedStatic
190
191 # Version for EXEs:
192 LIBRARIES.win += WinNetConfigExe
193 WinNetConfigExe_TEMPLATE = VBoxR3Exe
194 WinNetConfigExe_EXTENDS = WinNetConfigSharedStatic
195
196 #
197 # Template for NetFltInstall and friends.
198 #
199 TEMPLATE_VBoxNetFltR3 = Template for NetAdp6Install and NetAdp6Uninstall
200 TEMPLATE_VBoxNetFltR3_EXTENDS = VBoxR3Exe
201 TEMPLATE_VBoxNetFltR3_SDKS = $(TEMPLATE_VBoxR3Exe_SDKS) ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBoxNtDll VBoxWinNewDevLib
202 TEMPLATE_VBoxNetFltR3_LATE_LIBS = $(TEMPLATE_VBoxR3Exe_LATE_LIBS) \
203 $(WinNetConfigExe_1_TARGET) \
204 $(PATH_STAGE_LIB)/VBoxDrvCfgExe$(VBOX_SUFF_LIB) \
205 $(LIB_RUNTIME) \
206 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
207 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
208
209 #
210 # NetAdp6Install
211 #
212 PROGRAMS.win += NetAdp6Install
213 NetAdp6Install_TEMPLATE = VBoxNetFltR3
214 NetAdp6Install_SOURCES = win/tools/VBoxNetAdpInstall.cpp
215 NetAdp6Install_DEFS = NDIS60=1
216
217 #
218 # NetAdp6Uninstall
219 #
220 PROGRAMS.win += NetAdp6Uninstall
221 NetAdp6Uninstall_TEMPLATE = VBoxNetFltR3
222 NetAdp6Uninstall_SOURCES = win/tools/VBoxNetAdpUninstall.cpp
223 NetAdp6Uninstall_DEFS = NDIS60=1
224
225 #
226 # NetLwfInstall
227 #
228 PROGRAMS.win += NetLwfInstall
229 NetLwfInstall_TEMPLATE = VBoxNetFltR3
230 NetLwfInstall_SOURCES = win/tools/VBoxNetLwfInstall.cpp
231
232 #
233 # NetLwfUninstall
234 #
235 PROGRAMS.win += NetLwfUninstall
236 NetLwfUninstall_TEMPLATE = VBoxNetFltR3
237 NetLwfUninstall_SOURCES = win/tools/VBoxNetLwfUninstall.cpp
238
239 endif # $(KBUILD_TARGET) == win
240else if1of ($(KBUILD_TARGET), solaris freebsd) ## @todo merge this with the mixed case stuff.
241 #
242 # vboxnetflt(.ko/.o/) - The lower case driver.
243 # Note! On Solaris the name has to be <= 8 chars long.
244 # The DEBUG_HASH* stuff is for CONFIG_DYNAMIC_DEBUG-enabled kernels
245 #
246 ifdef VBOX_WITH_VBOXDRV
247 SYSMODS += vboxnetflt
248 vboxnetflt_TEMPLATE = VBoxR0Drv
249 vboxnetflt_NAME.solaris = vboxflt
250 vboxnetflt_DEFS = IN_RT_R0
251 vboxnetflt_DEPS.solaris += $(VBOX_SVN_REV_KMK)
252 vboxnetflt_INCS := \
253 $(PATH_SUB_CURRENT)
254 vboxnetflt_LDFLAGS.solaris += -N drv/vboxdrv -N misc/ctf
255 vboxnetflt_LIBS = \
256 $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
257 ## @todo vboxflt should resolves all the IPRT bits from vboxdrv.
258 #vboxnetflt_LIBS += \
259 # $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
260 vboxnetflt_SOURCES.solaris = solaris/VBoxNetFlt-solaris.c
261 vboxnetflt_SOURCES.freebsd = freebsd/VBoxNetFlt-freebsd.c
262 vboxnetflt_SOURCES = VBoxNetFlt.c
263 solaris/VBoxNetFlt-solaris.c_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
264
265 ifdef VBOX_WITH_NETFLT_CROSSBOW
266 SYSMODS += vboxnetbow
267 vboxnetbow_TEMPLATE = VBoxR0Drv
268 vboxnetbow_NAME = vboxbow
269 vboxnetbow_DEFS = vboxnetflt_DEFS VBOX_WITH_NETFLT_CROSSBOW
270 vboxnetbow_INCS := $(PATH_SUB_CURRENT)
271 vboxnetbow_LDFLAGS += -N drv/vboxdrv -N drv/vnic -N misc/mac -N misc/dls
272 vboxnetbow_LIBS = \
273 $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
274 vboxnetbow_SOURCES.solaris = solaris/VBoxNetFltBow-solaris.c
275 vboxnetbow_SOURCES = VBoxNetFlt.c
276 solaris/VBoxNetFltBow-solaris.c_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
277 endif # VBOX_WITH_NETFLT_CROSSBOW
278 endif # VBOX_WITH_VBOXDRV
279endif # to be removed.
280
281
282ifeq ($(KBUILD_TARGET),linux)
283 #
284 # Install source files for compilation on Linux.
285 # files_vboxnetflt defines VBOX_VBOXNETFLT_SOURCES.
286 #
287 include $(PATH_SUB_CURRENT)/linux/files_vboxnetflt
288 INSTALLS += VBoxNetFlt-src VBoxNetFlt-sh
289 VBoxNetFlt-src_INST = bin/src/vboxnetflt/
290 VBoxNetFlt-src_SOURCES = \
291 $(subst $(DQUOTE),,$(VBOX_VBOXNETFLT_SOURCES)) \
292 $(VBoxNetFlt-src_0_OUTDIR)/Makefile
293 VBoxNetFlt-src_CLEAN = \
294 $(VBoxNetFlt-src_0_OUTDIR)/Makefile \
295 $(PATH_TARGET)/VBoxNetFlt-src-1.dep
296
297 # Scripts needed for building the kernel module.
298
299 includedep $(PATH_TARGET)/VBoxNetFlt-src-1.dep
300 $$(VBoxNetFlt-src_0_OUTDIR)/Makefile: \
301 $(PATH_SUB_CURRENT)/linux/Makefile \
302 $$(if $$(eq $$(VBoxNetFlt/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
303 | $$(dir $$@)
304 $(QUIET)$(RM) -f -- $@
305 ifndef VBOX_WITH_HARDENING
306 $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $<
307 else
308 $(QUIET)$(CP) -f $< $@
309 endif
310 %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/VBoxNetFlt-src-1.dep
311 %$(QUIET2)$(APPEND) '$(PATH_TARGET)/VBoxNetFlt-src-1.dep' 'VBoxNetFlt/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
312
313 #
314 # Build test for the linux host kernel modules.
315 #
316 $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,VBoxNetFlt-src,vboxdrv-src,)
317endif # linux
318
319# Gross hack for FreeBSD 7, should figure this out properly
320## @todo Properly generate opt_netgraph.h
321ifeq ($(KBUILD_TARGET),freebsd)
322 vboxnetflt_DEPS.freebsd += $(PATH_OUT)/opt_netgraph.h
323 $(PATH_OUT)/opt_netgraph.h:
324 echo > $(PATH_OUT)/opt_netgraph.h
325
326 #
327 # Install source files for compilation on FreeBSD.
328 # files_vboxnetflt defines VBOX_VBOXNETFLT_SOURCES.
329 #
330 include $(PATH_SUB_CURRENT)/freebsd/files_vboxnetflt
331 INSTALLS += VBoxNetFlt-src
332 VBoxNetFlt-src_INST = bin/src/vboxnetflt/
333 VBoxNetFlt-src_SOURCES = \
334 $(subst $(DQUOTE),,$(VBOX_VBOXNETFLT_SOURCES)) \
335 $(VBoxNetFlt-src_0_OUTDIR)/Makefile
336 VBoxNetFlt-src_CLEAN = \
337 $(VBoxNetFlt-src_0_OUTDIR)/Makefile
338
339 $$(VBoxNetFlt-src_0_OUTDIR)/Makefile: \
340 $(PATH_SUB_CURRENT)/freebsd/Makefile \
341 $$(if $$(eq $$(VBoxNetFlt/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
342 | $$(dir $$@)
343 $(QUIET)$(RM) -f -- $@
344 $(QUIET)$(CP) -f $< $@
345 ifndef VBOX_WITH_HARDENING
346 $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output [email protected] $@
347 ${QUIET}$(MV) -f [email protected] $@
348 endif
349 ifndef VBOX_WITH_NETFLT_VIMAGE
350 $(QUIET)$(SED) -e "s;-DVIMAGE;;g" --output [email protected] $@
351 ${QUIET}$(MV) -f [email protected] $@
352 endif
353endif # freebsd
354
355include $(FILE_KBUILD_SUB_FOOTER)
356
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