Makefile revision 71e61358090b8d7bad611a6d38786ebd63ed04e1
bf52162f2d05c1fb1a107c7ef108de73f739b3edpquerna# Makefile for the VirtualBox Linux Host Network Filter Driver.
09359a90ff115fc5eeb96e1e5c78a58dd9fc59d3jim# (For 2.6.x this file must be called 'Makefile'!)
00f8426677a7975dc809e4ccb11241c543ec8a0esf# Copyright (C) 2006-2007 Sun Microsystems, Inc.
00f8426677a7975dc809e4ccb11241c543ec8a0esf# This file is part of VirtualBox Open Source Edition (OSE), as
3ef519991d73cff6763052b5a44c206bda01541dsf# available from http://www.virtualbox.org. This file is free software;
3ef519991d73cff6763052b5a44c206bda01541dsf# you can redistribute it and/or modify it under the terms of the GNU
3ef519991d73cff6763052b5a44c206bda01541dsf# General Public License (GPL) as published by the Free Software
3ef519991d73cff6763052b5a44c206bda01541dsf# Foundation, in version 2 as it comes in the "COPYING" file of the
3ef519991d73cff6763052b5a44c206bda01541dsf# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
512bc8626ede860ea2ef329e6c2ffbd6ceba3903sf# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
f82baabbe731507742af2f7ba41463dbbc7911e9sf# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
f82baabbe731507742af2f7ba41463dbbc7911e9sf# Clara, CA 95054 USA or visit http://www.sun.com if you need
f82baabbe731507742af2f7ba41463dbbc7911e9sf# additional information or have any questions.
686555019e71b355e835166dfefbec33f7fb6f90rjung# First, figure out which architecture we're targeting and the build type.
686555019e71b355e835166dfefbec33f7fb6f90rjung# (We have to support basic cross building (ARCH=i386|x86_64).)
686555019e71b355e835166dfefbec33f7fb6f90rjung# While at it, warn about BUILD_* vars found to help with user problems.
eda40bb2debf78c913552346127358797665cf7frjung $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
5b43275cebfb0ff9961ac462f3a96f7fe612d327rjung ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
dc610ff4888acc61dc6c8de2b8974a4dce9c074fsf $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
b08558bf6a64f9501ad3eca34eaf4d978bd928cfsfifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
b08558bf6a64f9501ad3eca34eaf4d978bd928cfsf $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
3fa816e4832a1c70600bdfd6fc5ef60e9f1c18bbsf $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
950e3163cb42ba1e9c8f9d93f4505f580cbc71f4jorton# override is required by the Debian guys
bf99d597a964add76124fc185892e04733a02969sf # building from this directory
876167dba234e2c7065895c87b77a8c57bdcf754sf # kernel base directory
9d4ce88bcd21b01619a31c53db11a51c2a1e9717sf # build for the current kernel, version check
2792ea4d5c772a6bc19dece2e098b8125bf7184cjim ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
2792ea4d5c772a6bc19dece2e098b8125bf7184cjim ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
2792ea4d5c772a6bc19dece2e098b8125bf7184cjim $(error Error: unable to find the sources of your current Linux kernel. \
59a3c1e7880d3eab0d182735ff47758b9860411fminfrin $(warning Warning: using /usr/src/linux as the source directory of your \
b3e63c395d671f14a096d7e888dbfd2caf93a663sf # check if versions match -- works only for later 2.6 kernels
b3e63c395d671f14a096d7e888dbfd2caf93a663sf VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) kernelrelease 2> /dev/null || true)
6f88aef8511bf8ccf170bec41b82b6346c8b1ac7sf $(error Error: /usr/src/linux (version $(VBOX_KERN_VER)) does not match \
83c89da783ba8bdaef50ec1912443f7fad3556acjim # build for a dedicated kernel, no version check
5152ceef718c8d39291557205cb2a98f436ce87frjung ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
5152ceef718c8d39291557205cb2a98f436ce87frjung $(error Error: KERN_DIR does not point to a directory)
3eb3f27d2d93942bd4230c231aab4eb16a316384jim # includes
0a2424312d9f02479a38e96dcbb170a77c218852rjung ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
6137a8d5cdc62f1d4dad8cbf720feaa35f42a596covener $(error Error: unable to find the include directory for your current Linux \
6137a8d5cdc62f1d4dad8cbf720feaa35f42a596covener kernel. Specify KERN_INCL=<directory> and run Make again)
80a98c87d804ac7c0ea52d3f3b4676e559b49087igalic # module install dir, only for current kernel
80a98c87d804ac7c0ea52d3f3b4676e559b49087igalic ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
925a6d92173ab96cdb0a8976c7aac13ef809e218trawick ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
e19d3a1e487aa73e0850658d3773f748aefba7f7sf $(error Unable to find the folder to install the support driver to)
b8e5134b5779bf5505a9e5241cf8c930cc4aac5esfelse # neq($(KERNELRELEASE),)
b1677ce80314e41b74bdd8d50c13ac159f3c09f4sf # building from kbuild (make -C <kernel_directory> M=`pwd`)
31eeb74b832eea054c7a42081c1afdeccd987e5etrawick# debug - show guesses.
490993ea2eda52d4fdacff247eb2657296c86f71trawick# Compiler options
6ec154950417d0b32082f6590ffa3acc3e0c3d49sf INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
6ec154950417d0b32082f6590ffa3acc3e0c3d49sfKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
977c4527be5a21182f24fc22a40a79d576a52f86trawick# must be consistent with Config.kmk!
7fef9f66804ea10d5bf343cdd3d607465e8340cajim # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
3770ed746d69c7a4111cba9966169bd5d7a509a6poirier# By default we use remap_pfn_range() kernel API to make kernel pages
3770ed746d69c7a4111cba9966169bd5d7a509a6poirier# visible for userland. Unfortuately, it leads to situation that
3770ed746d69c7a4111cba9966169bd5d7a509a6poirier# during debug session all structures on that page (such as PVM pointer)
7bd92b29516bc4bf7351d35aa447dbe68f1e8bb4jorton# are not accessible to the debugger (see #3214).
7bd92b29516bc4bf7351d35aa447dbe68f1e8bb4jorton# This code enables experimental support
7bd92b29516bc4bf7351d35aa447dbe68f1e8bb4jorton# for vm_insert_page() kernel API, allowing to export kernel pages
a81c0c1ae464b2063a21b45f80c9da8d89bb840ecovener# to the userland in more debugger-friendly way. Due to stability
a81c0c1ae464b2063a21b45f80c9da8d89bb840ecovener# concerns, not enabled by default yet.
efc81fe729a2b7401028387da184b4a98f0b854atrawick# build defs
cfd376e3e25eb609c30773a0897c97b2a9a76130fuankg $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
29ecbd9db1622e74964264d078336f7604d65093jim install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
59d316b83d42d2a07e25c20d8c35a07b369618bdsf# important: Don't remove Module.symvers! DKMS does 'make clean' before building ...
59d316b83d42d2a07e25c20d8c35a07b369618bdsf for f in . linux r0drv r0drv/linux VBox common/err common/string common/log generic math/gcc; \