Makefile revision d8b66c9f4ecb096e1f2308d74df4d6a1220c3b98
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# Makefile for the VirtualBox Linux Host Virtual Network Adapter Driver.
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync# (For 2.6.x this file must be called 'Makefile'!)
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# Copyright (C) 2006-2011 Oracle Corporation
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# available from http://www.virtualbox.org. This file is free software;
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# you can redistribute it and/or modify it under the terms of the GNU
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# General Public License (GPL) as published by the Free Software
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync# First, figure out which architecture we're targeting and the build type.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync# (We have to support basic cross building (ARCH=i386|x86_64).)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync# While at it, warn about BUILD_* vars found to help with user problems.
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsyncifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsyncifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsyncifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
5a07658d13590eba51dd98ef335a73d2a11edaa7vboxsync# override is required by the Debian guys
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync # building from this directory
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync # kernel base directory
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync # build for the current kernel, version check
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync $(error Error: unable to find the sources of your current Linux kernel. \
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync $(warning Warning: using /usr/src/linux as the source directory of your \
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync $(error Error: KERN_DIR does not point to a directory)
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
730f8be51b729e8a3c1e32c756cd0f4ec088dd4dvboxsync $(error Error: unable to find the include directory for your current Linux \
610972deee47d5e5229ccdb6c86cbb332d2b4626vboxsync kernel. Specify KERN_INCL=<directory> and run Make again)
18745d2ecb6a9d5f83c1c7a6f823847b9c3b4f57vboxsync # module install dir, only for current kernel
e2a74585316778e8df03715924c81e4f32292f5evboxsync ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
18745d2ecb6a9d5f83c1c7a6f823847b9c3b4f57vboxsync ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync $(error Unable to find the folder to install the support driver to)
18745d2ecb6a9d5f83c1c7a6f823847b9c3b4f57vboxsyncelse # neq($(KERNELRELEASE),)
18745d2ecb6a9d5f83c1c7a6f823847b9c3b4f57vboxsync # building from kbuild (make -C <kernel_directory> M=`pwd`)
8cb6f31c3048428b42c7370dfbb20e4de7254f40vboxsync# debug - show guesses.
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# Compiler options
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxnetadp,/ /include /r0drv/linux)
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync MANGLING := $(KBUILD_EXTMOD)/vboxnetadp/include/VBox/SUPDrvMangling.h
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync MANGLING := $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsyncKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING \
bcd589d9db90b68d3af5d6839c1d613bb64d4c04vboxsync# must be consistent with Config.kmk!
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync #KFLAGS += -DIPRT_DEBUG_SEMS
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# By default we use remap_pfn_range() kernel API to make kernel pages
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# visible for userland. Unfortunately, it leads to situation that
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# during debug session all structures on that page (such as PVM pointer)
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# are not accessible to the debugger (see #3214).
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# This code enables experimental support
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# for vm_insert_page() kernel API, allowing to export kernel pages
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# to the userland in more debugger-friendly way. Due to stability
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# concerns, not enabled by default yet.
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsync# build defs
6ba96ad7028e4d559a5998de4bab0b71a8251c99vboxsyncEXTRA_CFLAGS += -include $(MANGLING) $(INCL) $(KFLAGS) $(KDEBUG)
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync# OL/UEK: disable module signing for external modules -- we don't have any private key
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) CONFIG_MODULE_SIG= -C $(KERN_DIR) modules
cbc215af8423a8326b27143c59c5d8fc9ffb0279vboxsync install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsync install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
2f4c1bacd54af5063c3185cc8eab03e4e8ef9b90vboxsyncelse # eq ($(MAKECMDGOALS),clean)
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync find . \( -name \*.o -o -name \*.cmd \) -print0 | xargs -0 rm -f
ece707b8d97e63ed54d4b48d7a8d841187e0023cvboxsync rm -rf .tmp_ver* $(MODULE).* Module.symvers Modules.symvers modules.order