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