1 | # $Id: Makefile.kmk 104668 2024-05-16 10:15:17Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the Network Adapter Driver (VBoxNetAdp).
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2009-2023 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 | VBoxNetAdp6_TEMPLATE = VBoxR0Drv
|
---|
113 | if defined(VBOX_SIGNING_MODE)
|
---|
114 | VBoxNetAdp6_INSTTYPE.win = none
|
---|
115 | VBoxNetAdp6_DEBUG_INSTTYPE.win = both
|
---|
116 | endif
|
---|
117 | VBoxNetAdp6_DEFS = IN_RT_R0 IN_SUP_STATIC
|
---|
118 | VBoxNetAdp6_INCS := $(PATH_SUB_CURRENT)
|
---|
119 | VBoxNetAdp6_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_WLH) $(VBOX_WINPSDK_INCS)
|
---|
120 | VBoxNetAdp6_SOURCES = \
|
---|
121 | win/VBoxNetAdp-win.cpp \
|
---|
122 | win/VBoxNetAdp-win.rc
|
---|
123 | VBoxNetAdp6_DEFS += NDIS_MINIPORT_DRIVER NDIS_WDM=1 BINARY_COMPATIBLE=0
|
---|
124 | VBoxNetAdp6_DEFS += NDIS60_MINIPORT=1 NDIS60=1
|
---|
125 | VBoxNetAdp6_LDFLAGS.win.x86 = -Entry:DriverEntry@8
|
---|
126 | VBoxNetAdp6_LDFLAGS.win.amd64 = -Entry:DriverEntry
|
---|
127 | VBoxNetAdp6_LIBS.win = \
|
---|
128 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
|
---|
129 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
|
---|
130 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ndis.lib \
|
---|
131 | $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
132 | VBoxNetAdp6_LIBS = \
|
---|
133 | $(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
|
---|
134 |
|
---|
135 |
|
---|
136 | INSTALLS.win += VBoxNetAdp6-inf
|
---|
137 | VBoxNetAdp6-inf_TEMPLATE = VBoxR0DrvInfCat
|
---|
138 | VBoxNetAdp6-inf_SOURCES = \
|
---|
139 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf
|
---|
140 | VBoxNetAdp6-inf_CLEAN = $(VBoxNetAdp6-inf_SOURCES)
|
---|
141 | VBoxNetAdp6-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetAdp6Cat.dir
|
---|
142 |
|
---|
143 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf: $(PATH_SUB_CURRENT)/win/VBoxNetAdp6.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
144 | $(call MSG_GENERATE,VBoxNetAdp6-inf,$@,$<)
|
---|
145 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
146 |
|
---|
147 | ifdef VBOX_SIGNING_MODE
|
---|
148 | VBoxNetAdp6-inf_SOURCES += \
|
---|
149 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys \
|
---|
150 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat \
|
---|
151 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat=>VBoxNetAdp6-PreW10.cat
|
---|
152 |
|
---|
153 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys: $$(VBoxNetAdp6_1_TARGET) | $$(dir $$@)
|
---|
154 | $(INSTALL) -m 644 $< $(@D)
|
---|
155 |
|
---|
156 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat: \
|
---|
157 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys \
|
---|
158 | $(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf
|
---|
159 | $(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<)
|
---|
160 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
161 |
|
---|
162 | endif # ifdef VBOX_SIGNING_MODE
|
---|
163 | endif # ifdef VBOX_WITH_VBOXDRV
|
---|
164 |
|
---|
165 | endif #ifeq ($(KBUILD_TARGET), win)
|
---|
166 |
|
---|
167 | ifeq ($(KBUILD_TARGET),linux)
|
---|
168 | #
|
---|
169 | # Install source files for compilation on Linux.
|
---|
170 | # files_vboxnetadp defines VBOX_VBOXNETADP_SOURCES.
|
---|
171 | #
|
---|
172 | INSTALLS += VBoxNetAdp-src
|
---|
173 | include $(PATH_SUB_CURRENT)/linux/files_vboxnetadp
|
---|
174 | VBoxNetAdp-src_INST = bin/src/vboxnetadp/
|
---|
175 | VBoxNetAdp-src_SOURCES = \
|
---|
176 | $(subst $(DQUOTE),,$(VBOX_VBOXNETADP_SOURCES)) \
|
---|
177 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile
|
---|
178 | VBoxNetAdp-src_CLEAN = \
|
---|
179 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile \
|
---|
180 | $(PATH_TARGET)/VBoxNetAdp-src-1.dep
|
---|
181 |
|
---|
182 | # Scripts needed for building the kernel modules
|
---|
183 | includedep $(PATH_TARGET)/VBoxNetAdp-src-1.dep
|
---|
184 | $$(VBoxNetAdp-src_0_OUTDIR)/Makefile: \
|
---|
185 | $(PATH_SUB_CURRENT)/linux/Makefile \
|
---|
186 | $$(if $$(eq $$(VBoxNetAdp/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
|
---|
187 | | $$(dir $$@)
|
---|
188 | $(QUIET)$(RM) -f -- $@
|
---|
189 | ifndef VBOX_WITH_HARDENING
|
---|
190 | $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $<
|
---|
191 | else
|
---|
192 | $(QUIET)$(CP) -f $< $@
|
---|
193 | endif
|
---|
194 | %$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/VBoxNetAdp-src-1.dep' 'VBoxNetAdp/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
|
---|
195 |
|
---|
196 | #
|
---|
197 | # Build test for the linux host kernel modules.
|
---|
198 | #
|
---|
199 | $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,VBoxNetAdp-src,vboxdrv-src,)
|
---|
200 | endif # linux
|
---|
201 |
|
---|
202 | ifeq ($(KBUILD_TARGET),freebsd)
|
---|
203 | #
|
---|
204 | # Install source files for compilation on FreeBSD.
|
---|
205 | # files_vboxnetadp defines VBOX_VBOXNETADP_SOURCES.
|
---|
206 | #
|
---|
207 | INSTALLS += VBoxNetAdp-src
|
---|
208 | include $(PATH_SUB_CURRENT)/freebsd/files_vboxnetadp
|
---|
209 | VBoxNetAdp-src_INST = bin/src/vboxnetadp/
|
---|
210 | VBoxNetAdp-src_SOURCES = \
|
---|
211 | $(subst $(DQUOTE),,$(VBOX_VBOXNETADP_SOURCES)) \
|
---|
212 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile
|
---|
213 | VBoxNetAdp-src_CLEAN = \
|
---|
214 | $(VBoxNetAdp-src_0_OUTDIR)/Makefile
|
---|
215 |
|
---|
216 | $$(VBoxNetAdp-src_0_OUTDIR)/Makefile: \
|
---|
217 | $(PATH_SUB_CURRENT)/freebsd/Makefile \
|
---|
218 | $$(if $$(eq $$(VBoxNetAdp/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
|
---|
219 | | $$(dir $$@)
|
---|
220 | $(QUIET)$(RM) -f -- $@
|
---|
221 | ifndef VBOX_WITH_HARDENING
|
---|
222 | $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $<
|
---|
223 | else
|
---|
224 | $(QUIET)$(CP) -f $< $@
|
---|
225 | endif
|
---|
226 |
|
---|
227 | endif # freebsd
|
---|
228 |
|
---|
229 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|