Makefile revision 6831f283dbc5c27bde8a8f8bea179b84a5741697
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# Makefile for the VirtualBox Linux Host Network Filter Driver.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# (For 2.6.x this file must be called 'Makefile'!)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# available from http://www.virtualbox.org. This file is free software;
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# you can redistribute it and/or modify it under the terms of the GNU
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# General Public License (GPL) as published by the Free Software
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# additional information or have any questions.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# First, figure out which architecture we're targeting and the build type.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# (We have to support basic cross building (ARCH=i386|x86_64).)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# While at it, warn about BUILD_* vars found to help with user problems.
9040f019271f91b98e1320c0a8c38a42636e3979vboxsyncifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsyncifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
9040f019271f91b98e1320c0a8c38a42636e3979vboxsync ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
9040f019271f91b98e1320c0a8c38a42636e3979vboxsync $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsyncifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
9040f019271f91b98e1320c0a8c38a42636e3979vboxsync $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# override is required by the Debian guys
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # building from this directory
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # kernel base directory
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # build for the current kernel, version check
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(error Error: unable to find the sources of your current Linux kernel. \
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(warning Warning: using /usr/src/linux as the source directory of your \
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # check if versions match -- works only for later 2.6 kernels
6c90795355c6e59ba82e8e5a58e10d686a6d6e65vboxsync VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) --no-print-directory kernelrelease 2> /dev/null || true)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(error Error: /usr/src/linux (version $(VBOX_KERN_VER)) does not match \
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # build for a dedicated kernel, no version check
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(error Error: KERN_DIR does not point to a directory)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(error Error: unable to find the include directory for your current Linux \
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync kernel. Specify KERN_INCL=<directory> and run Make again)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # module install dir, only for current kernel
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync $(error Unable to find the folder to install the support driver to)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsyncelse # neq($(KERNELRELEASE),)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # building from kbuild (make -C <kernel_directory> M=`pwd`)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# debug - show guesses.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# Compiler options
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsyncKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
71e61358090b8d7bad611a6d38786ebd63ed04e1vboxsync# must be consistent with Config.kmk!
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# By default we use remap_pfn_range() kernel API to make kernel pages
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# visible for userland. Unfortuately, it leads to situation that
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# during debug session all structures on that page (such as PVM pointer)
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# are not accessible to the debugger (see #3214).
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# This code enables experimental support
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# for vm_insert_page() kernel API, allowing to export kernel pages
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# to the userland in more debugger-friendly way. Due to stability
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# concerns, not enabled by default yet.
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync# build defs
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
01ea175f55740168d1dd0af3277d3b86a30b4f91vboxsync# important: Don't remove Module.symvers! DKMS does 'make clean' before building ...
19a258565a4d24e5a0af62f626943ac9b898d957vboxsync for f in . linux r0drv r0drv/linux VBox common/err common/string common/log generic math/gcc; \