1 | # $Id: Makefile.kmk 14015 2008-11-10 13:57:45Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the Network Filter Driver (VBoxNetFlt).
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2008 Sun Microsystems, Inc.
|
---|
8 | #
|
---|
9 | # Sun Microsystems, Inc. confidential
|
---|
10 | # All rights reserved
|
---|
11 | #
|
---|
12 |
|
---|
13 | SUB_DEPTH = ../../../..
|
---|
14 | include $(KBUILD_PATH)/subheader.kmk
|
---|
15 |
|
---|
16 |
|
---|
17 | if1of ($(KBUILD_TARGET), darwin win)
|
---|
18 | #
|
---|
19 | # VBoxNetFlt.sys - The mixed case driver.
|
---|
20 | #
|
---|
21 | SYSMODS += VBoxNetFlt
|
---|
22 | VBoxNetFlt_TEMPLATE = VBOXR0DRV
|
---|
23 | VBoxNetFlt_INST = $(INST_VBOXNETFLT)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/)
|
---|
24 | if defined(VBOX_SIGNING_MODE) && "$(KBUILD_TARGET)" == "win"
|
---|
25 | VBoxNetFlt_NOINST = true
|
---|
26 | endif
|
---|
27 | VBoxNetFlt_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) IN_SUP_STATIC
|
---|
28 | VBoxNetFlt_SDKS.win = W2K3DDK WINPSDKINCS
|
---|
29 | VBoxNetFlt_INCS := $(PATH_SUB_CURRENT)
|
---|
30 | VBoxNetFlt_SOURCES.darwin = darwin/VBoxNetFlt-darwin.cpp
|
---|
31 | VBoxNetFlt_SOURCES.win = \
|
---|
32 | win/VBoxNetFlt-win.c \
|
---|
33 | win/VBoxNetFltPt-win.c \
|
---|
34 | win/VBoxNetFlt-win.rc
|
---|
35 | ifdef VBOX_NETFLT_ONDEMAND_BIND
|
---|
36 | VBoxNetFlt_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND
|
---|
37 | else
|
---|
38 | VBoxNetFlt_SOURCES.win += win/VBoxNetFltMp-win.c
|
---|
39 | endif
|
---|
40 | VBoxNetFlt_SOURCES = VBoxNetFlt.c
|
---|
41 | VBoxNetFlt_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
|
---|
42 | VBoxNetFlt_LDFLAGS.win.x86 = -Entry:DriverEntry@8
|
---|
43 | VBoxNetFlt_LDFLAGS.win.amd64 = -Entry:DriverEntry
|
---|
44 | VBoxNetFlt_SOURCES.win.amd64 += win/VBoxNetFltA-win.asm
|
---|
45 | VBoxNetFlt_DEFS.win.amd64 += RT_WITH_W64_UNWIND_HACK
|
---|
46 | VBoxNetFlt_LIBS.win = \
|
---|
47 | $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
|
---|
48 | $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
|
---|
49 | $(PATH_SDK_W2K3DDK_LIB)/ndis.lib \
|
---|
50 | $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
51 | VBoxNetFlt_LIBS = \
|
---|
52 | $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
|
---|
53 |
|
---|
54 |
|
---|
55 | # Darwin extras.
|
---|
56 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
57 | INSTALLS += VBoxNetFlt.kext
|
---|
58 | VBoxNetFlt.kext_INST = $(INST_VBOXNETFLT)Contents/
|
---|
59 | VBoxNetFlt.kext_SOURCES = \
|
---|
60 | $(PATH_VBoxNetFlt.kext)/Info.plist
|
---|
61 | VBoxNetFlt.kext_CLEAN = \
|
---|
62 | $(PATH_VBoxNetFlt.kext)/Info.plist
|
---|
63 |
|
---|
64 | $$(PATH_VBoxNetFlt.kext)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
|
---|
65 | $(call MSG_GENERATE,VBoxNetFlt,$@,$<)
|
---|
66 | $(xQUIET)$(RM) -f $@
|
---|
67 | $(xQUIET)$(SED) \
|
---|
68 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
69 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
70 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
71 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
72 | --output $@ \
|
---|
73 | $<
|
---|
74 |
|
---|
75 | INSTALLS.darwin += Scripts-darwin
|
---|
76 | Scripts-darwin_INST = $(INST_DIST)
|
---|
77 | Scripts-darwin_SOURCES = \
|
---|
78 | darwin/loadnetflt.sh
|
---|
79 | endif # darwin
|
---|
80 |
|
---|
81 |
|
---|
82 | # Windows extras.
|
---|
83 | INSTALLS.win += VBoxNetFlt-inf
|
---|
84 | VBoxNetFlt-inf_INST = $(INST_BIN)
|
---|
85 | VBoxNetFlt-inf_MODE = a+r,u+w
|
---|
86 | VBoxNetFlt-inf_SOURCES = \
|
---|
87 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf \
|
---|
88 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt_m.inf
|
---|
89 | VBoxNetFlt-inf_CLEAN = $(VBoxNetFlt-inf_SOURCES)
|
---|
90 | VBoxNetFlt-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetFltCat.dir
|
---|
91 |
|
---|
92 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf: $(PATH_SUB_CURRENT)/win/VBoxNetFlt.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
93 | $(call MSG_GENERATE,VBoxNetFlt-inf,$@,$<)
|
---|
94 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
95 |
|
---|
96 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt_m.inf: $(PATH_SUB_CURRENT)/win/VBoxNetFlt_m.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
97 | $(call MSG_GENERATE,VBoxNetFlt-inf,$@,$<)
|
---|
98 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
99 |
|
---|
100 | ifdef VBOX_SIGNING_MODE
|
---|
101 | VBoxNetFlt-inf_SOURCES += \
|
---|
102 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys \
|
---|
103 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat
|
---|
104 |
|
---|
105 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys: $$(TARGET_VBoxNetFlt) | $$(dir $$@)
|
---|
106 | $(INSTALL) -m 644 $< $(@D)
|
---|
107 |
|
---|
108 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat: \
|
---|
109 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf \
|
---|
110 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt_m.inf \
|
---|
111 | $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat
|
---|
112 | $(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<)
|
---|
113 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
114 | endif # signing
|
---|
115 |
|
---|
116 | #
|
---|
117 | # WinNetConfig - static library with host network interface config API
|
---|
118 | #
|
---|
119 | LIBRARIES.win += WinNetConfig
|
---|
120 | WinNetConfig_TEMPLATE = VBOXR3STATIC
|
---|
121 | WinNetConfig_DEFS = _WIN32_WINNT=0x0500 _UNICODE UNICODE
|
---|
122 | WinNetConfig_SDKS = WINPSDK W2K3DDK
|
---|
123 | WinNetConfig_SOURCES = \
|
---|
124 | win/WinNetConfig.cpp
|
---|
125 |
|
---|
126 | else if1of ($(KBUILD_TARGET), linux solaris)
|
---|
127 | #
|
---|
128 | # vboxnetflt(.ko/.o/) - The lower case driver.
|
---|
129 | # Note! On Solaris the name has to be <= 8 chars long.
|
---|
130 | #
|
---|
131 | SYSMODS += vboxnetflt
|
---|
132 | vboxnetflt_TEMPLATE = VBOXR0DRV
|
---|
133 | vboxnetflt_NAME.solaris = vboxflt
|
---|
134 | vboxnetflt_DEFS.linux = KBUILD_MODNAME=KBUILD_STR\(vboxnetflt\) KBUILD_BASENAME=KBUILD_STR\(vboxnetflt\) MODULE
|
---|
135 | vboxnetflt_DEFS = IN_RT_R0
|
---|
136 | vboxnetflt_DEFS.solaris += VBOX_SVN_REV=$(VBOX_SVN_REV)
|
---|
137 | vboxnetflt_DEPS.solaris += $(VBOX_SVN_REV_KMK)
|
---|
138 | vboxnetflt_NOINST = true
|
---|
139 | vboxnetflt_INCS.linux := \
|
---|
140 | $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
|
---|
141 | vboxnetflt_INCS := \
|
---|
142 | $(PATH_SUB_CURRENT)
|
---|
143 | vboxnetflt_LDFLAGS.solaris += -N drv/vboxdrv
|
---|
144 | ifdef VBOXNETFLT_SOLARIS_USE_NETINFO
|
---|
145 | vboxnetflt_DEFS.solaris += VBOXNETFLT_SOLARIS_USE_NETINFO
|
---|
146 | vboxnetflt_LDFLAGS.solaris += -N misc/neti
|
---|
147 | endif
|
---|
148 | vboxnetflt_LIBS = \
|
---|
149 | $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
|
---|
150 | ## @todo vboxflt should resolves all the IPRT bits from vboxdrv.
|
---|
151 | #vboxnetflt_LIBS += \
|
---|
152 | # $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
|
---|
153 | vboxnetflt_SOURCES.linux = linux/VBoxNetFlt-linux.c
|
---|
154 | vboxnetflt_SOURCES.solaris = solaris/VBoxNetFlt-solaris.c
|
---|
155 | vboxnetflt_SOURCES = VBoxNetFlt.c
|
---|
156 |
|
---|
157 | endif
|
---|
158 |
|
---|
159 | ifeq ($(KBUILD_TARGET),linux)
|
---|
160 | #
|
---|
161 | # Install source files for compliation on Linux.
|
---|
162 | # files_vboxnetflt defines VBOX_VBOXNETFLT_SOURCES.
|
---|
163 | #
|
---|
164 | include $(PATH_SUB_CURRENT)/linux/files_vboxnetflt
|
---|
165 | INSTALLS += VBoxNetFlt-src VBoxNetFlt-sh
|
---|
166 | VBoxNetFlt-src_INST = bin/src/vboxnetflt/
|
---|
167 | VBoxNetFlt-src_MODE = a+r,u+w
|
---|
168 | VBoxNetFlt-src_SOURCES = $(subst ",,$(VBOX_VBOXNETFLT_SOURCES)) #"
|
---|
169 | VBoxNetFlt-src_SOURCES+= \
|
---|
170 | $(if $(VBOX_OSE),,$(PATH_VBoxNetFlt-src)/dkms.conf) \
|
---|
171 | $(PATH_VBoxNetFlt-src)/Makefile
|
---|
172 | VBoxNetFlt-src_CLEAN = \
|
---|
173 | $(PATH_VBoxNetFlt-src)/dkms.conf \
|
---|
174 | $(PATH_VBoxNetFlt-src)/Makefile
|
---|
175 |
|
---|
176 | VBoxNetFlt-sh_INST = bin/src/vboxnetflt/
|
---|
177 | VBoxNetFlt-sh_MODE = a+rx,u+w
|
---|
178 | VBoxNetFlt-sh_SOURCES = $(PATH_VBoxNetFlt-sh)/build_in_tmp
|
---|
179 | VBoxNetFlt-sh_CLEAN = $(PATH_VBoxNetFlt-sh)/build_in_tmp
|
---|
180 |
|
---|
181 |
|
---|
182 | includedep $(PATH_TARGET)/VBoxNetFlt-src-1.dep
|
---|
183 | $$(PATH_VBoxNetFlt-src)/Makefile: \
|
---|
184 | $(PATH_SUB_CURRENT)/linux/Makefile \
|
---|
185 | $$(if $$(eq $$(VBoxNetFlt/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
|
---|
186 | | $$(dir $$@)
|
---|
187 | ifndef VBOX_WITH_HARDENING
|
---|
188 | $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
|
---|
189 | else
|
---|
190 | $(QUIET)$(CP) -f $< $@
|
---|
191 | endif
|
---|
192 | %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/VBoxNetFlt-src-1.dep
|
---|
193 | %$(QUIET2)$(APPEND) '$(PATH_TARGET)/VBoxNetFlt-src-1.dep' 'VBoxNetFlt/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
|
---|
194 |
|
---|
195 | ## Scripts needed for building the kernel modules
|
---|
196 |
|
---|
197 | $$(PATH_VBoxNetFlt-sh)/build_in_tmp: \
|
---|
198 | $(PATH_ROOT)/src/VBox/HostDrivers/Support/linux/build_in_tmp \
|
---|
199 | $(VBOX_VERSION_STAMP) \
|
---|
200 | | $$(dir $$@)
|
---|
201 | $(call MSG_TOOL,Creating,,$@)
|
---|
202 | $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxnetflt;g" --output $@ $<
|
---|
203 | $(QUIET)chmod 0755 $@
|
---|
204 |
|
---|
205 | $$(PATH_VBoxNetFlt-src)/dkms.conf: \
|
---|
206 | $(PATH_SUB_CURRENT)/dkms.conf \
|
---|
207 | $(VBOX_VERSION_STAMP) \
|
---|
208 | | $$(dir $$@)
|
---|
209 | $(call MSG_TOOL,Creating,,$@)
|
---|
210 | $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" --output $@ $<
|
---|
211 |
|
---|
212 | endif # linux
|
---|
213 |
|
---|
214 | include $(KBUILD_PATH)/subfooter.kmk
|
---|
215 |
|
---|