# $Id: Makefile.kmk 13854 2008-11-05 13:05:58Z vboxsync $ ## @file # Sub-Makefile for the Network Filter Driver (VBoxNetFlt). # # # Copyright (C) 2008 Sun Microsystems, Inc. # # Sun Microsystems, Inc. confidential # All rights reserved # SUB_DEPTH = ../../../.. include $(KBUILD_PATH)/subheader.kmk if1of ($(KBUILD_TARGET), darwin win) # # VBoxNetFlt.sys - The mixed case driver. # SYSMODS += VBoxNetFlt VBoxNetFlt_TEMPLATE = VBOXR0DRV VBoxNetFlt_INST = $(INST_VBOXNETFLT)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/) if defined(VBOX_SIGNING_MODE) && "$(KBUILD_TARGET)" == "win" VBoxNetFlt_NOINST = true endif VBoxNetFlt_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) IN_SUP_STATIC VBoxNetFlt_SDKS.win = W2K3DDK WINPSDKINCS VBoxNetFlt_INCS := $(PATH_SUB_CURRENT) VBoxNetFlt_SOURCES.darwin = darwin/VBoxNetFlt-darwin.cpp VBoxNetFlt_SOURCES.win = \ win/VBoxNetFlt-win.c \ win/VBoxNetFltPt-win.c \ win/VBoxNetFlt-win.rc ifdef VBOX_NETFLT_ONDEMAND_BIND VBoxNetFlt_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND else VBoxNetFlt_SOURCES.win += win/VBoxNetFltMp-win.c endif VBoxNetFlt_SOURCES = VBoxNetFlt.c VBoxNetFlt_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded VBoxNetFlt_LDFLAGS.win.x86 = -Entry:DriverEntry@8 VBoxNetFlt_LDFLAGS.win.amd64 = -Entry:DriverEntry VBoxNetFlt_SOURCES.win.amd64 += win/VBoxNetFltA-win.asm VBoxNetFlt_DEFS.win.amd64 += RT_WITH_W64_UNWIND_HACK VBoxNetFlt_LIBS.win = \ $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \ $(PATH_SDK_W2K3DDK_LIB)/hal.lib \ $(PATH_SDK_W2K3DDK_LIB)/ndis.lib \ $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) VBoxNetFlt_LIBS = \ $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB) # Darwin extras. ifeq ($(KBUILD_TARGET),darwin) INSTALLS += VBoxNetFlt.kext VBoxNetFlt.kext_INST = $(INST_VBOXNETFLT)Contents/ VBoxNetFlt.kext_SOURCES = \ $(PATH_VBoxNetFlt.kext)/Info.plist VBoxNetFlt.kext_CLEAN = \ $(PATH_VBoxNetFlt.kext)/Info.plist $$(PATH_VBoxNetFlt.kext)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@) $(call MSG_GENERATE,VBoxNetFlt,$@,$<) $(xQUIET)$(RM) -f $@ $(xQUIET)$(SED) \ -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \ -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \ -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \ -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \ --output $@ \ $< INSTALLS.darwin += Scripts-darwin Scripts-darwin_INST = $(INST_DIST) Scripts-darwin_SOURCES = \ darwin/loadnetflt.sh endif # darwin # Windows extras. INSTALLS.win += VBoxNetFlt-inf VBoxNetFlt-inf_INST = $(INST_BIN) VBoxNetFlt-inf_MODE = a+r,u+w VBoxNetFlt-inf_SOURCES = \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt_m.inf VBoxNetFlt-inf_CLEAN = $(VBoxNetFlt-inf_SOURCES) VBoxNetFlt-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetFltCat.dir $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf: $(PATH_SUB_CURRENT)/win/VBoxNetFlt.inf $(MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,VBoxNetFlt-inf,$@,$<) $(call VBOX_EDIT_INF_FN,$<,$@) $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt_m.inf: $(PATH_SUB_CURRENT)/win/VBoxNetFlt_m.inf $(MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,VBoxNetFlt-inf,$@,$<) $(call VBOX_EDIT_INF_FN,$<,$@) ifdef VBOX_SIGNING_MODE VBoxNetFlt-inf_SOURCES += \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.sys: $$(TARGET_VBoxNetFlt) | $$(dir $$@) $(INSTALL) -m 644 $< $(@D) $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat: \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.inf \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt_m.inf \ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat $(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<) $(call VBOX_MAKE_CAT_FN, $(@D),$@) endif # signing # # WinNetConfig - static library with host network interface config API # LIBRARIES.win += WinNetConfig WinNetConfig_TEMPLATE = VBOXR3STATIC WinNetConfig_DEFS = _WIN32_WINNT=0x0500 _UNICODE UNICODE WinNetConfig_SDKS = WINPSDK W2K3DDK WinNetConfig_SOURCES = \ win/WinNetConfig.cpp else if1of ($(KBUILD_TARGET), linux solaris) # # vboxnetflt(.ko/.o/) - The lower case driver. # Note! On Solaris the name has to be <= 8 chars long. # SYSMODS += vboxnetflt vboxnetflt_TEMPLATE = VBOXR0DRV vboxnetflt_NAME.solaris = vboxflt vboxnetflt_DEFS.linux = KBUILD_MODNAME=KBUILD_STR\(vboxnetflt\) KBUILD_BASENAME=KBUILD_STR\(vboxnetflt\) MODULE vboxnetflt_DEFS = IN_RT_R0 vboxnetflt_DEFS.solaris += VBOX_SVN_REV=$(VBOX_SVN_REV) vboxnetflt_DEPS.solaris += $(VBOX_SVN_REV_KMK) vboxnetflt_INCS.linux := \ $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux vboxnetflt_INCS := \ $(PATH_SUB_CURRENT) vboxnetflt_LDFLAGS.solaris += -N drv/vboxdrv ifdef VBOXNETFLT_SOLARIS_USE_NETINFO vboxnetflt_DEFS.solaris += VBOXNETFLT_SOLARIS_USE_NETINFO vboxnetflt_LDFLAGS.solaris += -N misc/neti endif vboxnetflt_LIBS = \ $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB) ## @todo vboxflt should resolves all the IPRT bits from vboxdrv. #vboxnetflt_LIBS += \ # $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) vboxnetflt_SOURCES.linux = linux/VBoxNetFlt-linux.c vboxnetflt_SOURCES.solaris = solaris/VBoxNetFlt-solaris.c vboxnetflt_SOURCES = VBoxNetFlt.c endif ifeq ($(KBUILD_TARGET),linux) # # Install source files for compliation on Linux. # files_vboxnetflt defines VBOX_VBOXNETFLT_SOURCES. # include $(PATH_SUB_CURRENT)/linux/files_vboxnetflt INSTALLS += VBoxNetFlt-src VBoxNetFlt-src_INST = bin/src/vboxnetflt/ VBoxNetFlt-src_MODE = a+r,u+w VBoxNetFlt-src_SOURCES = $(subst ",,$(VBOX_VBOXNETFLT_SOURCES)) #" VBoxNetFlt-src_SOURCES+= $(PATH_VBoxNetFlt-src)/Makefile VBoxNetFlt-src_CLEAN = $(PATH_VBoxNetFlt-src)/Makefile includedep $(PATH_TARGET)/VBoxNetFlt-src-1.dep $$(PATH_VBoxNetFlt-src)/Makefile: \ $(PATH_SUB_CURRENT)/linux/Makefile \ $$(if $$(eq $$(VBoxNetFlt/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \ | $$(dir $$@) ifndef VBOX_WITH_HARDENING $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $< else $(QUIET)$(CP) -f $< $@ endif %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/VBoxNetFlt-src-1.dep %$(QUIET2)$(APPEND) '$(PATH_TARGET)/VBoxNetFlt-src-1.dep' 'VBoxNetFlt/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)' ## Scripts needed for building the kernel modules ### @todo generate these else where and move them from OTHERS to vboxmod-bin (which btw installs NOBIN files contrary to its name). # #$(PATH_BIN)/src/build_in_tmp: \ # $(PATH_SUB_CURRENT)/linux/build_in_tmp \ # $(VBOX_VERSION_STAMP) # $(call MSG_TOOL,Creating,,$@) # $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxdrv;g" --output $@ $< # $(QUIET)chmod 0755 $@ # #$(PATH_BIN)/src/dkms.conf: \ # $(PATH_SUB_CURRENT)/linux/dkms.conf \ # $(VBOX_VERSION_STAMP) # $(call MSG_TOOL,Creating,,$@) # $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" --output $@ $< endif # linux include $(KBUILD_PATH)/subfooter.kmk