Makefile revision c27687da2bcbaefd006c856b0dbc7f749ec01f4e
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# Makefile for the VirtualBox Linux Host Driver.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# (For 2.6.x this file must be called 'Makefile'!)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# available from http://www.virtualbox.org. This file is free software;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# you can redistribute it and/or modify it under the terms of the GNU
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# General Public License (GPL) as published by the Free Software
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# The contents of this file may alternatively be used under the terms
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# of the Common Development and Distribution License Version 1.0
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# VirtualBox OSE distribution, in which case the provisions of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# CDDL are applicable instead of those of the GPL.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# You may elect to license modified versions of this file under the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# terms and conditions of either the GPL or the CDDL or both.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync#
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
f2490dbf97c8247439446844458461b00e50beb0vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync# additional information or have any questions.
482a222498aae619afda0255a7edf4ebda97268cvboxsync#
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync# First, figure out which architecture we're targeting and the build type.
21293ca6a2967f796ed30a6c8492911619476a48vboxsync# (We have to support basic cross building (ARCH=i386|x86_64).)
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync# While at it, warn about BUILD_* vars found to help with user problems.
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync#
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsyncifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync BUILD_TARGET_ARCH :=
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsyncendif
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsyncifeq ($(BUILD_TARGET_ARCH),)
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync ifeq ($(ARCH),x86_64)
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync BUILD_TARGET_ARCH := amd64
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync else
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync ifeq ($(ARCH),i386)
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync BUILD_TARGET_ARCH := x86
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync else
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync BUILD_TARGET_ARCH := amd64
eeb2d581c99b451fb1a26a5870af65981dc9cd5dvboxsync else
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync BUILD_TARGET_ARCH := x86
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync endif
0ce6ae9d6efed5d54222a13bbdabce9e688e4447vboxsync endif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync endif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncelse
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync BUILD_TYPE :=
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifeq ($(BUILD_TYPE),)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync BUILD_TYPE := release
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsyncelse
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# use vm_insert_page() API (if available) to map kernel pages to userland - better debugging
f2490dbf97c8247439446844458461b00e50beb0vboxsyncVBOX_USE_INSERT_PAGE = 1
f2490dbf97c8247439446844458461b00e50beb0vboxsync
f2490dbf97c8247439446844458461b00e50beb0vboxsync# override is required by the Debian guys
f2490dbf97c8247439446844458461b00e50beb0vboxsyncoverride MODULE = vboxdrv
f2490dbf97c8247439446844458461b00e50beb0vboxsyncOBJS = \
f2490dbf97c8247439446844458461b00e50beb0vboxsync linux/SUPDrv-linux.o \
f2490dbf97c8247439446844458461b00e50beb0vboxsync SUPDrv.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/alloc-r0drv.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/initterm-r0drv.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/memobj-r0drv.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/mpnotification-r0drv.o \
e52c9984c4f6b8ea141bc50a3bdaf31941d8cd7dvboxsync r0drv/powernotification-r0drv.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/assert-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/alloc-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/initterm-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/memobj-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/mp-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/mpnotification-r0drv-linux.o \
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync r0drv/linux/process-r0drv-linux.o \
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync r0drv/linux/semevent-r0drv-linux.o \
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync r0drv/linux/semeventmulti-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/semfastmutex-r0drv-linux.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync r0drv/linux/spinlock-r0drv-linux.o \
dc311b529996345ea65d51c87b60b6849642d894vboxsync r0drv/linux/thread-r0drv-linux.o \
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync r0drv/linux/time-r0drv-linux.o \
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync r0drv/linux/timer-r0drv-linux.o \
e52c9984c4f6b8ea141bc50a3bdaf31941d8cd7dvboxsync common/err/RTErrConvertFromErrno.o \
dc311b529996345ea65d51c87b60b6849642d894vboxsync common/log/log.o \
dc311b529996345ea65d51c87b60b6849642d894vboxsync common/log/logellipsis.o \
0a3eb63419e41ef10cd135aeb66dcd6bd6f87cdcvboxsync common/log/logrel.o \
dc311b529996345ea65d51c87b60b6849642d894vboxsync common/log/logrelellipsis.o \
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync common/log/logcom.o \
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync common/log/logformat.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync common/string/strformat.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync common/string/strformatrt.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync common/string/strformattype.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync common/string/strprintf.o \
482a222498aae619afda0255a7edf4ebda97268cvboxsync common/string/strtonum.o \
d19316699d7f91959d88c850fd7e0d64840f39a7vboxsync r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
482a222498aae619afda0255a7edf4ebda97268cvboxsync generic/RTAssertShouldPanic-generic.o \
d020036eb167a2f97f5010276fda5daa3f4773b3vboxsync generic/RTLogWriteStdErr-stub-generic.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync generic/RTLogWriteStdOut-stub-generic.o \
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync generic/RTLogWriteUser-generic.o \
25c5ce7baf4b227ea80250c46d427d0e9fdab4c1vboxsync VBox/log-vbox.o \
25c5ce7baf4b227ea80250c46d427d0e9fdab4c1vboxsync VBox/strformat-vbox.o
d91dc86210d602f51a4701762488a5e696c80a45vboxsyncifeq ($(BUILD_TARGET_ARCH),x86)
d91dc86210d602f51a4701762488a5e696c80a45vboxsyncOBJS += math/gcc/divdi3.o \
2c1d8cd8efdd4c486ff681135035d24111b03af8vboxsync math/gcc/moddi3.o \
59d96bafa78f7257869e30b88f2f98142ef5928evboxsync math/gcc/qdivrem.o \
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync math/gcc/udivdi3.o \
a96ed55e8e1b248965a3d29d6e4c3116979e887bvboxsync math/gcc/divdi3.o \
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync math/gcc/umoddi3.o
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsyncendif
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsyncifeq ($(BUILD_TARGET_ARCH),amd64)
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsyncOBJS += alloc/heapsimple.o
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsyncendif
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsyncifneq ($(MAKECMDGOALS),clean)
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsyncifeq ($(KERNELRELEASE),)
7a2986a2fdd00cd130bcda05a53575fb58874754vboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync #
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync # building from this directory
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync #
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync # kernel base directory
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync ifndef KERN_DIR
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync # build for the current kernel, version check
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync KERN_DIR := /lib/modules/$(shell uname -r)/build
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync KERN_DIR := /usr/src/linux
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync $(error Error: unable to find the sources of your current Linux kernel. \
15760030457c4d8548d42a9d543646b27eae7040vboxsync Specify KERN_DIR=<directory> and run Make again)
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync endif
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync $(warning Warning: using /usr/src/linux as the source directory of your \
7a71f66d53a7dcdf19a7a357e99e560fda812dc3vboxsync Linux kernel. If this is not correct, specify \
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync KERN_DIR=<directory> and run Make again.)
7a71f66d53a7dcdf19a7a357e99e560fda812dc3vboxsync endif
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync # check if versions match -- works only for later 2.6 kernels
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) kernelrelease 2> /dev/null || true)
21293ca6a2967f796ed30a6c8492911619476a48vboxsync ifneq ($(VBOX_KERN_VER),)
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync ifneq ($(VBOX_KERN_VER),$(shell uname -r))
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync $(error Error: /usr/src/linux (version $(VBOX_KERN_VER)) does not match \
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync the current kernel (version $(shell uname -r)))
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync endif
21293ca6a2967f796ed30a6c8492911619476a48vboxsync endif
21293ca6a2967f796ed30a6c8492911619476a48vboxsync else
21293ca6a2967f796ed30a6c8492911619476a48vboxsync # build for a dedicated kernel, no version check
21293ca6a2967f796ed30a6c8492911619476a48vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
2c1d8cd8efdd4c486ff681135035d24111b03af8vboxsync $(error Error: KERN_DIR does not point to a directory)
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync endif
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync endif
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync # includes
7a71f66d53a7dcdf19a7a357e99e560fda812dc3vboxsync ifndef KERN_INCL
f2490dbf97c8247439446844458461b00e50beb0vboxsync KERN_INCL = $(KERN_DIR)/include
d20e5d189feff7841cc3f40e5c9cca8c86b45eb5vboxsync endif
f2490dbf97c8247439446844458461b00e50beb0vboxsync ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
f2490dbf97c8247439446844458461b00e50beb0vboxsync $(error Error: unable to find the include directory for your current Linux \
f2490dbf97c8247439446844458461b00e50beb0vboxsync kernel. Specify KERN_INCL=<directory> and run Make again)
f2490dbf97c8247439446844458461b00e50beb0vboxsync endif
f2490dbf97c8247439446844458461b00e50beb0vboxsync
f2490dbf97c8247439446844458461b00e50beb0vboxsync # module install dir, only for current kernel
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync ifndef MODULE_DIR
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync MODULE_DIR_TST := /lib/modules/$(shell uname -r)
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync MODULE_DIR := $(MODULE_DIR_TST)/misc
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync else
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync $(error Unable to find the folder to install the support driver to)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync endif
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync endif # MODULE_DIR unspecified
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync endif
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync # guess kernel version (24 or 26)
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync KERN_VERSION := $(if $(wildcard $(KERN_DIR)/Rules.make),24,26)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsyncelse # neq($(KERNELRELEASE),)
2c1d8cd8efdd4c486ff681135035d24111b03af8vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync #
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync # building from kbuild (make -C <kernel_directory> M=`pwd`)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync #
eeb2d581c99b451fb1a26a5870af65981dc9cd5dvboxsync
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync # guess kernel version (24 or 26)
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync KERN_VERSION := $(if $(wildcard $(PWD)/Rules.make),24,26)
0ce6ae9d6efed5d54222a13bbdabce9e688e4447vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif # neq($(KERNELRELEASE),)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync# debug - show guesses.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifdef DEBUG
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync$(warning dbg: KERN_DIR = $(KERN_DIR))
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync$(warning dbg: KERN_INCL = $(KERN_INCL))
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync$(warning dbg: MODULE_DIR = $(MODULE_DIR))
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync$(warning dbg: KERN_VERSION = $(KERN_VERSION))
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync# Compiler options
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
ea743ed8b8effc9f3647b76eb109c45788052fa0vboxsyncifndef INCL
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync ifndef KBUILD_EXTMOD
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync KBUILD_EXTMOD := $(shell pwd)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync endif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync export INCL
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifdef VBOX_REDHAT_KABI
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync KFLAGS += -DVBOX_REDHAT_KABI
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifndef CONFIG_VBOXDRV_FIXEDMAJOR
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync KFLAGS += -DCONFIG_VBOXDRV_AS_MISC
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncendif
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifeq ($(BUILD_TARGET_ARCH),amd64)
23ab2e25f17cdd6af9c0448ee70905a8c1c82896vboxsync KFLAGS += -DRT_ARCH_AMD64
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync # must be consistent with Config.kmk!
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync KFLAGS += -DVBOX_WITH_64_BITS_GUESTS
f6dde23cd488aee26203b38ec67220270f5c4273vboxsyncelse
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync KFLAGS += -DRT_ARCH_X86
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsyncendif
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsyncifeq ($(BUILD_TYPE),debug)
43e9355f77c0463e7ace350984bb5a09fb8c50a1vboxsync KFLAGS += -DDEBUG -DDEBUG_$(USER) -g
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync KFLAGS += -DIPRT_DEBUG_SEMS
d07e901177d22a8f66c66f155c423a524ac07776vboxsyncendif
d07e901177d22a8f66c66f155c423a524ac07776vboxsync
d07e901177d22a8f66c66f155c423a524ac07776vboxsync# By default we use remap_pfn_range() kernel API to make kernel pages
d07e901177d22a8f66c66f155c423a524ac07776vboxsync# visible for userland. Unfortuately, it leads to situation that
d07e901177d22a8f66c66f155c423a524ac07776vboxsync# during debug session all structures on that page (such as PVM pointer)
d07e901177d22a8f66c66f155c423a524ac07776vboxsync# are not accessible to the debugger (see #3214).
f48fe310f85f13db0140bef980de1f56c2007957vboxsync# This code enables experimental support
f48fe310f85f13db0140bef980de1f56c2007957vboxsync# for vm_insert_page() kernel API, allowing to export kernel pages
f48fe310f85f13db0140bef980de1f56c2007957vboxsync# to the userland in more debugger-friendly way. Due to stability
f48fe310f85f13db0140bef980de1f56c2007957vboxsync# concerns, not enabled by default yet.
1b186b95b77faa977d3651bbfc13afb3f13e0225vboxsyncifdef VBOX_USE_INSERT_PAGE
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync KFLAGS += -DVBOX_USE_INSERT_PAGE
0b10203d41681eb80716c97a34ed6c3b6d5318ccvboxsyncendif
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsyncifeq ($(KERN_VERSION),24)
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsync# 2.4
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsyncTOPDIR = $(KERN_DIR)
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsyncMODULE_EXT := o
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncEXTRA_CFLAGS := -DVBOX_LINUX_2_4 -DEXPORT_SYMTAB
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync$(MODULE)-objs = $(OBJS)
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsyncelse
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync# 2.6 and later
2bb146bb69b6bb39e697cc915e53f4059c15b1bfvboxsyncMODULE_EXT := ko
2bb146bb69b6bb39e697cc915e53f4059c15b1bfvboxsync$(MODULE)-y := $(OBJS)
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsyncendif
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync# build defs
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsyncEXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncall: $(MODULE)
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsyncobj-m += $(MODULE).o
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync$(MODULE):
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync $(MAKE) KBUILD_VERBOSE=1 -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncifeq ($(KERN_VERSION),24)
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync#
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync# 2.4 Module linking
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync$(MODULE).o: $(OBJS)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync $(LD) -o $@ -r $(OBJS)
5e3a885d489b1c99d79d576813f8f321bae46927vboxsync
include $(KERN_DIR)/Rules.make
endif
install: $(MODULE)
@mkdir -p $(MODULE_DIR); \
install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
PATH="$(PATH):/bin:/sbin" depmod -ae; \
rm -f /etc/vbox/module_not_compiled
install_rpm: $(MODULE)
@mkdir -p $(MODULE_DIR); \
install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
endif # eq($(MAKECMDGOALS),clean)
clean:
for f in . linux r0drv r0drv/linux VBox common/err common/string common/log generic math/gcc; \
do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
rm -rf .vboxdrv* .tmp_ver* vboxdrv.* Module.symvers Modules.symvers