VirtualBox

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

Last change on this file since 16637 was 16368, checked in by vboxsync, 16 years ago

NetFlt/win: enable pure DIFX install

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.5 KB
Line 
1# $Id: Makefile.kmk 16368 2009-01-29 14:16:50Z vboxsync $
2## @file
3# Sub-Makefile for the Network Filter Driver (VBoxNetFlt).
4#
5
6#
7# Copyright (C) 2008 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18# Clara, CA 95054 USA or visit http://www.sun.com if you need
19# additional information or have any questions.
20#
21
22SUB_DEPTH = ../../../..
23include $(KBUILD_PATH)/subheader.kmk
24
25
26if1of ($(KBUILD_TARGET), darwin win)
27#
28# VBoxNetFlt.sys - The mixed case driver.
29#
30SYSMODS += VBoxNetFlt
31VBoxNetFlt_TEMPLATE = VBOXR0DRV
32VBoxNetFlt_INST = $(INST_VBOXNETFLT)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/)
33if defined(VBOX_SIGNING_MODE) && "$(KBUILD_TARGET)" == "win"
34 VBoxNetFlt_NOINST = true
35endif
36VBoxNetFlt_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) IN_SUP_STATIC
37VBoxNetFlt_SDKS.win = W2K3DDK WINPSDKINCS
38VBoxNetFlt_INCS := $(PATH_SUB_CURRENT)
39VBoxNetFlt_SOURCES.darwin = darwin/VBoxNetFlt-darwin.cpp
40VBoxNetFlt_SOURCES.win = \
41 win/VBoxNetFlt-win.c \
42 win/VBoxNetFltPt-win.c \
43 win/VBoxNetFlt-win.rc
44ifdef VBOX_NETFLT_ONDEMAND_BIND
45 VBoxNetFlt_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND
46else
47 VBoxNetFlt_DEFS.win += VBOXNETFLT_STATIC_CONFIG
48 VBoxNetFlt_SOURCES.win += win/VBoxNetFltMp-win.c
49endif
50VBoxNetFlt_SOURCES = VBoxNetFlt.c
51VBoxNetFlt_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
52VBoxNetFlt_LDFLAGS.win.x86 = -Entry:DriverEntry@8
53VBoxNetFlt_LDFLAGS.win.amd64 = -Entry:DriverEntry
54VBoxNetFlt_SOURCES.win.amd64 += win/VBoxNetFltA-win.asm
55VBoxNetFlt_DEFS.win.amd64 += RT_WITH_W64_UNWIND_HACK
56VBoxNetFlt_LIBS.win = \
57 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
58 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
59 $(PATH_SDK_W2K3DDK_LIB)/ndis.lib \
60 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
61VBoxNetFlt_LIBS = \
62 $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
63
64
65# Darwin extras.
66ifeq ($(KBUILD_TARGET),darwin)
67INSTALLS += VBoxNetFlt.kext
68VBoxNetFlt.kext_INST = $(INST_VBOXNETFLT)Contents/
69VBoxNetFlt.kext_SOURCES = \
70 $(PATH_VBoxNetFlt.kext)/Info.plist
71VBoxNetFlt.kext_CLEAN = \
72 $(PATH_VBoxNetFlt.kext)/Info.plist
73
74$$(PATH_VBoxNetFlt.kext)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
75 $(call MSG_GENERATE,VBoxNetFlt,$@,$<)
76 $(xQUIET)$(RM) -f $@
77 $(xQUIET)$(SED) \
78 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
79 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
80 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
81 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
82 --output $@ \
83 $<
84
85INSTALLS.darwin += Scripts-darwin
86Scripts-darwin_INST = $(INST_DIST)
87Scripts-darwin_SOURCES = \
88 darwin/loadnetflt.sh
89endif # darwin
90
91
92ifeq ($(KBUILD_TARGET),win)
93#
94# Windows extras.
95#
96INSTALLS.win += VBoxNetFlt-inf
97VBoxNetFlt-inf_INST = $(INST_BIN)
98VBoxNetFlt-inf_MODE = a+r,u+w
99VBoxNetFlt-inf_SOURCES = \
100 $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf \
101 $(PATH_TARGET)/VBoxNetFltMpCat.dir/VBoxNetFlt_m.inf
102VBoxNetFlt-inf_CLEAN = $(VBoxNetFlt-inf_SOURCES)
103VBoxNetFlt-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetFltCat.dir $(PATH_TARGET)/VBoxNetFltMpCat.dir
104
105$(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf: $(PATH_SUB_CURRENT)/win/VBoxNetFlt.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
106 $(call MSG_GENERATE,VBoxNetFlt-inf,$@,$<)
107 $(call VBOX_EDIT_INF_FN,$<,$@)
108
109$(PATH_TARGET)/VBoxNetFltMpCat.dir/VBoxNetFlt_m.inf: $(PATH_SUB_CURRENT)/win/VBoxNetFlt_m.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
110 $(call MSG_GENERATE,VBoxNetFlt-inf,$@,$<)
111 $(call VBOX_EDIT_INF_FN,$<,$@)
112
113 ifdef VBOX_SIGNING_MODE
114VBoxNetFlt-inf_SOURCES += \
115 $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys \
116 $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat \
117 $(PATH_TARGET)/VBoxNetFltMpCat.dir/VBoxNetFlt_m.cat
118
119$(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys: $$(TARGET_VBoxNetFlt) | $$(dir $$@)
120 $(INSTALL) -m 644 $< $(@D)
121
122$(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFltNotify.dll: $$(TARGET_VBoxNetFltNotify) | $$(dir $$@)
123 $(INSTALL) -m 644 $< $(@D)
124
125$(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat: \
126 $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys \
127 $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFltNotify.dll \
128 $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf
129 $(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<)
130 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
131
132$(PATH_TARGET)/VBoxNetFltMpCat.dir/VBoxNetFlt_m.cat: \
133 $(PATH_TARGET)/VBoxNetFltMpCat.dir/VBoxNetFlt_m.inf
134 $(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<)
135 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
136
137 endif # signing
138
139#
140# WinNetConfig - static library with host network interface config API
141#
142LIBRARIES.win += WinNetConfig
143WinNetConfig_TEMPLATE = VBOXR3STATIC
144WinNetConfig_DEFS = _WIN32_WINNT=0x0501 _UNICODE UNICODE
145WinNetConfig_SDKS = WINPSDK W2K3DDK
146WinNetConfig_SOURCES = \
147 win/WinNetConfig.cpp
148
149#
150# NetFltInstall
151#
152PROGRAMS.win += NetFltInstall
153NetFltInstall_TEMPLATE = VBOXR3STATIC
154NetFltInstall_SDKS = WINPSDK W2K3DDK VBOX_NTDLL
155NetFltInstall_SOURCES = win/NetFltInstall.cpp
156NetFltInstall_LIBS = $(TARGET_WinNetConfig)
157
158
159#
160# NetFltUninstall
161#
162PROGRAMS.win += NetFltUninstall
163NetFltUninstall_TEMPLATE = VBOXR3STATIC
164NetFltUninstall_SDKS = WINPSDK W2K3DDK VBOX_NTDLL
165NetFltUninstall_SOURCES = win/NetFltUninstall.cpp
166NetFltUninstall_LIBS = $(TARGET_WinNetConfig)
167
168
169#
170# VBoxNetFltNotify
171#
172DLLS.win += VBoxNetFltNotify
173VBoxNetFltNotify_TEMPLATE = VBOXR3STATIC
174VBoxNetFltNotify_SDKS = WINPSDK W2K3DDK VBOX_NTDLL
175VBoxNetFltNotify_DEFS = _WIN32_WINNT=0x0500 WIN32 _ATL_STATIC_REGISTRY
176VBoxNetFltNotify_INCS = \
177 $(PATH_VBoxNetFltNotify)
178VBoxNetFltNotify_SOURCES = \
179 win/notifyobj/VBoxNetFltNotify.cpp \
180 win/notifyobj/VBoxNetFltNotify.def \
181 win/notifyobj/VBoxNetFltNotify.rc
182VBoxNetFltNotify_LIBS = \
183 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
184#VBoxNetFltNotify_INTERMEDIATES =
185VBoxNetFltNotify_DEPS = \
186 $(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn_i.c \
187 $(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn_p.c \
188 $(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn.h \
189 $(PATH_VBoxNetFltNotify)/dlldata.c \
190 $(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn.tlb
191VBoxNetFltNotify_CLEAN = $(VBoxNetFltNotify_DEPS)
192
193VBOXNETFLT_NOTIFY_IDL ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard \
194 $(PATH_SDK_WINPSDK_BIN)/Midl.Exe\
195 $(PATH_SDK_WINPSDK)/Bin/Midl.Exe\
196 $(PATH_DEVTOOLS)/win.x86/bin/midl.exe\
197 ) Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK))
198
199$$(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn_i.c \
200+ $$(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn_p.c \
201+ $$(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn.h \
202+ $$(PATH_VBoxNetFltNotify)/dlldata.c \
203+ $$(PATH_VBoxNetFltNotify)/VBoxNetFltNotifyn.tlb: \
204 $(PATH_SUB_CURRENT)/win/notifyobj/VBoxNetFltNotifyn.idl \
205 | $$(dir $$@)
206 $(VBOXNETFLT_NOTIFY_IDL) /nologo \
207 /out $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_VBoxNetFltNotify)) \
208 /cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL)_CC))) \
209 $(addprefix /I , $(call VBOX_FN_MAKE_WIN_PATH,$(SDK_W2K3DDK_INCS))) \
210 $(call VBOX_FN_MAKE_WIN_PATH,$<)
211endif #ifeq ($(KBUILD_TARGET), win)
212
213else if1of ($(KBUILD_TARGET), linux solaris) ## @todo merge this with the mixed case stuff.
214#
215# vboxnetflt(.ko/.o/) - The lower case driver.
216# Note! On Solaris the name has to be <= 8 chars long.
217#
218 ifdef VBOX_WITH_VBOXDRV
219SYSMODS += vboxnetflt
220vboxnetflt_TEMPLATE = VBOXR0DRV
221vboxnetflt_NAME.solaris = vboxflt
222vboxnetflt_DEFS.linux = KBUILD_MODNAME=KBUILD_STR\(vboxnetflt\) KBUILD_BASENAME=KBUILD_STR\(vboxnetflt\) MODULE
223vboxnetflt_DEFS = IN_RT_R0
224vboxnetflt_DEFS.solaris += VBOX_SVN_REV=$(VBOX_SVN_REV)
225vboxnetflt_DEPS.solaris += $(VBOX_SVN_REV_KMK)
226vboxnetflt_NOINST.linux = true
227vboxnetflt_INCS.linux := \
228 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
229vboxnetflt_INCS := \
230 $(PATH_SUB_CURRENT)
231vboxnetflt_LDFLAGS.solaris += -N drv/vboxdrv
232ifdef VBOXNETFLT_SOLARIS_USE_NETINFO
233 vboxnetflt_DEFS.solaris += VBOXNETFLT_SOLARIS_USE_NETINFO
234 vboxnetflt_LDFLAGS.solaris += -N misc/neti
235endif
236vboxnetflt_LIBS = \
237 $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
238## @todo vboxflt should resolves all the IPRT bits from vboxdrv.
239#vboxnetflt_LIBS += \
240# $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
241vboxnetflt_SOURCES.linux = linux/VBoxNetFlt-linux.c
242vboxnetflt_SOURCES.solaris = solaris/VBoxNetFlt-solaris.c
243vboxnetflt_SOURCES = VBoxNetFlt.c
244 endif
245
246endif
247
248ifeq ($(KBUILD_TARGET),linux)
249 #
250 # Install source files for compliation on Linux.
251 # files_vboxnetflt defines VBOX_VBOXNETFLT_SOURCES.
252 #
253 include $(PATH_SUB_CURRENT)/linux/files_vboxnetflt
254 INSTALLS += VBoxNetFlt-src VBoxNetFlt-sh
255 VBoxNetFlt-src_INST = bin/src/vboxnetflt/
256 VBoxNetFlt-src_MODE = a+r,u+w
257 VBoxNetFlt-src_SOURCES = $(subst ",,$(VBOX_VBOXNETFLT_SOURCES)) #"
258 VBoxNetFlt-src_SOURCES+= \
259 $(if $(VBOX_OSE),,\
260 $(PATH_VBoxNetFlt-src)/dkms.conf) \
261 $(PATH_VBoxNetFlt-src)/Makefile
262 VBoxNetFlt-src_CLEAN = \
263 $(PATH_VBoxNetFlt-src)/dkms.conf \
264 $(PATH_VBoxNetFlt-src)/Makefile \
265 $(PATH_TARGET)/VBoxNetFlt-src-1.dep
266
267 VBoxNetFlt-sh_INST = bin/src/vboxnetflt/
268 VBoxNetFlt-sh_MODE = a+rx,u+w
269 VBoxNetFlt-sh_SOURCES = \
270 $(PATH_VBoxNetFlt-sh)/build_in_tmp \
271 $(if $(VBOX_OSE),,\
272 $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers)
273 VBoxNetFlt-sh_CLEAN = $(PATH_VBoxNetFlt-sh)/build_in_tmp
274
275
276includedep $(PATH_TARGET)/VBoxNetFlt-src-1.dep
277$$(PATH_VBoxNetFlt-src)/Makefile: \
278 $(PATH_SUB_CURRENT)/linux/Makefile \
279 $$(if $$(eq $$(VBoxNetFlt/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
280 | $$(dir $$@)
281ifndef VBOX_WITH_HARDENING
282 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
283else
284 $(QUIET)$(CP) -f $< $@
285endif
286 %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/VBoxNetFlt-src-1.dep
287 %$(QUIET2)$(APPEND) '$(PATH_TARGET)/VBoxNetFlt-src-1.dep' 'VBoxNetFlt/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
288
289## Scripts needed for building the kernel modules
290
291$$(PATH_VBoxNetFlt-sh)/build_in_tmp: \
292 $(PATH_ROOT)/src/VBox/HostDrivers/linux/build_in_tmp \
293 $(VBOX_VERSION_STAMP) \
294 | $$(dir $$@)
295 $(call MSG_TOOL,Creating,,$@)
296 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxnetflt;g" --output $@ $<
297 $(QUIET)chmod 0755 $@
298
299$$(PATH_VBoxNetFlt-src)/dkms.conf: \
300 $(PATH_SUB_CURRENT)/linux/dkms.conf \
301 $(VBOX_VERSION_STAMP) \
302 | $$(dir $$@)
303 $(call MSG_TOOL,Creating,,$@)
304 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" --output $@ $<
305
306endif # linux
307
308include $(KBUILD_PATH)/subfooter.kmk
309
310
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