1 | # $Id: Makefile.kmk 106646 2024-10-24 09:10:13Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the Network Adapter Driver (VBoxNetAdp).
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2009-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 |
|
---|
37 | SUB_DEPTH = ../../../..
|
---|
38 | include $(KBUILD_PATH)/subheader.kmk
|
---|
39 |
|
---|
40 | if1of ($(KBUILD_TARGET), solaris darwin freebsd)
|
---|
41 | #
|
---|
42 | # VBoxNetAdp - Virtual Network Adapter
|
---|
43 | # Note! On Solaris the name has to be <= 8 chars long.
|
---|
44 | #
|
---|
45 | ifdef VBOX_WITH_VBOXDRV
|
---|
46 | SYSMODS += VBoxNetAdp
|
---|
47 | VBoxNetAdp_TEMPLATE = VBoxR0Drv
|
---|
48 | VBoxNetAdp_INST = $(INST_VBOXNETADP)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/)
|
---|
49 | VBoxNetAdp_DEBUG_INST.darwin = $(patsubst %/,%,$(INST_VBOXNETADP))
|
---|
50 | VBoxNetAdp_NAME.solaris = vboxnet
|
---|
51 | VBoxNetAdp_NAME.freebsd = vboxnetadp
|
---|
52 | VBoxNetAdp_DEPS.solaris += $(VBOX_SVN_REV_KMK)
|
---|
53 | VBoxNetAdp_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) IN_SUP_STATIC
|
---|
54 | #VBoxNetAdp_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
55 | VBoxNetAdp_LDFLAGS.solaris += -N misc/gld -N drv/vboxdrv
|
---|
56 | VBoxNetAdp_INCS = \
|
---|
57 | .
|
---|
58 | VBoxNetAdp_SOURCES.darwin = \
|
---|
59 | darwin/VBoxNetAdp-darwin.cpp \
|
---|
60 | VBoxNetAdp.c
|
---|
61 | VBoxNetAdp_SOURCES.solaris = \
|
---|
62 | solaris/VBoxNetAdp-solaris.c
|
---|
63 | VBoxNetAdp_SOURCES.freebsd = \
|
---|
64 | freebsd/VBoxNetAdp-freebsd.c \
|
---|
65 | VBoxNetAdp.c
|
---|
66 | VBoxNetAdp_SOURCES =
|
---|
67 | #VBoxNetAdp_SOURCES = \
|
---|
68 | # VBoxNetAdp.c
|
---|
69 | VBoxNetAdp_LIBS += \
|
---|
70 | $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
|
---|
71 | endif
|
---|
72 | endif
|
---|
73 |
|
---|
74 | #
|
---|
75 | # Darwin extras.
|
---|
76 | #
|
---|
77 | if "$(KBUILD_TARGET)" == "darwin" && defined(VBOX_WITH_VBOXDRV)
|
---|
78 | INSTALLS += VBoxNetAdp.kext
|
---|
79 | VBoxNetAdp.kext_INST = $(INST_VBOXNETADP)Contents/
|
---|
80 | VBoxNetAdp.kext_SOURCES = $(VBoxNetAdp.kext_0_OUTDIR)/Contents/Info.plist
|
---|
81 | VBoxNetAdp.kext_CLEAN = $(VBoxNetAdp.kext_0_OUTDIR)/Contents/Info.plist
|
---|
82 | VBoxNetAdp.kext_BLDDIRS = $(VBoxNetAdp.kext_0_OUTDIR)/Contents/
|
---|
83 |
|
---|
84 | $$(VBoxNetAdp.kext_0_OUTDIR)/Contents/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
|
---|
85 | $(call MSG_GENERATE,VBoxNetAdp,$@,$<)
|
---|
86 | $(QUIET)$(RM) -f $@
|
---|
87 | $(QUIET)$(SED) \
|
---|
88 | -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
|
---|
89 | -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
|
---|
90 | -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
|
---|
91 | -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
|
---|
92 | -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
|
---|
93 | -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
|
---|
94 | -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
|
---|
95 | --output $@ \
|
---|
96 | $<
|
---|
97 |
|
---|
98 | $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxNetAdp)
|
---|
99 |
|
---|
100 | INSTALLS.darwin += Scripts-darwin-adp
|
---|
101 | Scripts-darwin-adp_INST = $(INST_DIST)
|
---|
102 | Scripts-darwin-adp_EXEC_SOURCES = \
|
---|
103 | darwin/loadnetadp.sh
|
---|
104 | endif # darwin && host-drivers
|
---|
105 |
|
---|
106 | ifeq ($(KBUILD_TARGET),win)
|
---|
107 | #
|
---|
108 | # VBoxNetAdp6.sys - The VirtualBox Adapter miniport driver.
|
---|
109 | #
|
---|
110 | ifdef VBOX_WITH_VBOXDRV
|
---|
111 | SYSMODS.win += VBoxNetAdp6
|
---|
112 | INSTALLS.win += VBoxNetAdp6-inf
|
---|
113 |
|
---|
114 | # The driver.
|
---|
115 | VBoxNetAdp6_TEMPLATE = VBoxR0Drv
|
---|
116 | ifdef VBOX_SIGNING_MODE
|
---|
117 | VBoxNetAdp6_INSTTYPE.win = none
|
---|
118 | VBoxNetAdp6_DEBUG_INSTTYPE.win = both
|
---|
119 | endif
|
---|
120 | VBoxNetAdp6_DEFS = IN_RT_R0 IN_SUP_STATIC
|
---|
121 | VBoxNetAdp6_DEFS += NDIS_MINIPORT_DRIVER NDIS_WDM=1 BINARY_COMPATIBLE=0
|
---|
122 | VBoxNetAdp6_DEFS.win.x86 := NDIS60_MINIPORT=1 NDIS60=1
|
---|
123 | VBoxNetAdp6_DEFS.win.amd64 := NDIS60_MINIPORT=1 NDIS60=1
|
---|
124 | VBoxNetAdp6_DEFS.win.arm64 := NDIS630_MINIPORT=1 NDIS630=1
|
---|
125 | VBoxNetAdp6_INCS := $(PATH_SUB_CURRENT)
|
---|
126 | VBoxNetAdp6_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_WLH) $(VBOX_WINPSDK_INCS)
|
---|
127 | VBoxNetAdp6_SOURCES = \
|
---|
128 | win/VBoxNetAdp-win.cpp \
|
---|
129 | win/VBoxNetAdp-win.rc
|
---|
130 | VBoxNetAdp6_LDFLAGS.win.x86 = -Entry:DriverEntry@8
|
---|
131 | VBoxNetAdp6_LDFLAGS.win.amd64 = -Entry:DriverEntry
|
---|
132 | VBoxNetAdp6_LDFLAGS.win.arm64 = -Entry:DriverEntry
|
---|
133 | VBoxNetAdp6_LIBS.win = \
|
---|
134 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
|
---|
135 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
|
---|
136 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ndis.lib \
|
---|
137 | $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
138 | VBoxNetAdp6_LIBS = \
|
---|
139 | $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
|
---|
140 | VBoxNetAdp6_LIBS.win.arm64 = \
|
---|
141 | $(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/BufferOverflowFastFailK.lib
|
---|
142 |
|
---|
143 | # VBoxNetAdp6 INF & CAT files.
|
---|
144 | VBoxNetAdp6-inf_TEMPLATE = VBoxR0DrvInfCat
|
---|
145 | VBoxNetAdp6-inf_SOURCES = \
|
---|
146 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf
|
---|
147 | VBoxNetAdp6-inf_CLEAN = $(VBoxNetAdp6-inf_SOURCES)
|
---|
148 | VBoxNetAdp6-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetAdp6Cat.dir
|
---|
149 |
|
---|
150 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf: $(PATH_SUB_CURRENT)/win/VBoxNetAdp6.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
151 | $(call MSG_GENERATE,VBoxNetAdp6-inf,$@,$<)
|
---|
152 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
153 |
|
---|
154 | ifdef VBOX_SIGNING_MODE
|
---|
155 | VBoxNetAdp6-inf_SOURCES += \
|
---|
156 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys \
|
---|
157 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat
|
---|
158 | VBoxNetAdp6-inf_SOURCES.win.x86 += \
|
---|
159 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat=>VBoxNetAdp6-PreW10.cat
|
---|
160 | VBoxNetAdp6-inf_SOURCES.win.amd64 += \
|
---|
161 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat=>VBoxNetAdp6-PreW10.cat
|
---|
162 |
|
---|
163 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys: $$(VBoxNetAdp6_1_TARGET) | $$(dir $$@)
|
---|
164 | $(INSTALL) -m 644 $< $(@D)
|
---|
165 |
|
---|
166 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat: \
|
---|
167 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys \
|
---|
168 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf
|
---|
169 | $(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<)
|
---|
170 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
171 | endif # VBOX_SIGNING_MODE
|
---|
172 | endif # VBOX_WITH_VBOXDRV
|
---|
173 | endif # $(KBUILD_TARGET) == win
|
---|
174 |
|
---|
175 | ifeq ($(KBUILD_TARGET),linux)
|
---|
176 | #
|
---|
177 | # Install source files for compilation on Linux.
|
---|
178 | # files_vboxnetadp defines VBOX_VBOXNETADP_SOURCES.
|
---|
179 | #
|
---|
180 | INSTALLS += VBoxNetAdp-src
|
---|
181 | include $(PATH_SUB_CURRENT)/linux/files_vboxnetadp
|
---|
182 | VBoxNetAdp-src_INST = bin/src/vboxnetadp/
|
---|
183 | VBoxNetAdp-src_SOURCES = \
|
---|
184 | $(subst $(DQUOTE),,$(VBOX_VBOXNETADP_SOURCES)) \
|
---|
185 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile
|
---|
186 | VBoxNetAdp-src_CLEAN = \
|
---|
187 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile \
|
---|
188 | $(PATH_TARGET)/VBoxNetAdp-src-1.dep
|
---|
189 |
|
---|
190 | # Scripts needed for building the kernel modules
|
---|
191 | includedep $(PATH_TARGET)/VBoxNetAdp-src-1.dep
|
---|
192 | $$(VBoxNetAdp-src_0_OUTDIR)/Makefile: \
|
---|
193 | $(PATH_SUB_CURRENT)/linux/Makefile \
|
---|
194 | $$(if $$(eq $$(VBoxNetAdp/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
|
---|
195 | | $$(dir $$@)
|
---|
196 | $(QUIET)$(RM) -f -- $@
|
---|
197 | ifndef VBOX_WITH_HARDENING
|
---|
198 | $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $<
|
---|
199 | else
|
---|
200 | $(QUIET)$(CP) -f $< $@
|
---|
201 | endif
|
---|
202 | %$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/VBoxNetAdp-src-1.dep' 'VBoxNetAdp/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
|
---|
203 |
|
---|
204 | #
|
---|
205 | # Build test for the linux host kernel modules.
|
---|
206 | #
|
---|
207 | $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,VBoxNetAdp-src,vboxdrv-src,)
|
---|
208 | endif # linux
|
---|
209 |
|
---|
210 | ifeq ($(KBUILD_TARGET),freebsd)
|
---|
211 | #
|
---|
212 | # Install source files for compilation on FreeBSD.
|
---|
213 | # files_vboxnetadp defines VBOX_VBOXNETADP_SOURCES.
|
---|
214 | #
|
---|
215 | INSTALLS += VBoxNetAdp-src
|
---|
216 | include $(PATH_SUB_CURRENT)/freebsd/files_vboxnetadp
|
---|
217 | VBoxNetAdp-src_INST = bin/src/vboxnetadp/
|
---|
218 | VBoxNetAdp-src_SOURCES = \
|
---|
219 | $(subst $(DQUOTE),,$(VBOX_VBOXNETADP_SOURCES)) \
|
---|
220 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile
|
---|
221 | VBoxNetAdp-src_CLEAN = \
|
---|
222 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile
|
---|
223 |
|
---|
224 | $$(VBoxNetAdp-src_0_OUTDIR)/Makefile: \
|
---|
225 | $(PATH_SUB_CURRENT)/freebsd/Makefile \
|
---|
226 | $$(if $$(eq $$(VBoxNetAdp/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
|
---|
227 | | $$(dir $$@)
|
---|
228 | $(QUIET)$(RM) -f -- $@
|
---|
229 | ifndef VBOX_WITH_HARDENING
|
---|
230 | $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $<
|
---|
231 | else
|
---|
232 | $(QUIET)$(CP) -f $< $@
|
---|
233 | endif
|
---|
234 |
|
---|
235 | endif # freebsd
|
---|
236 |
|
---|
237 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|