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