Makefile revision 0280e4ae13799a3136778dc90efa5841a3f40cf2
8495845a800cf09321436aed996188c9a92cd647bnicholes# $Revision$
8495845a800cf09321436aed996188c9a92cd647bnicholes## @file
8495845a800cf09321436aed996188c9a92cd647bnicholes# Makefile for the VirtualBox Linux Host Driver.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# Copyright (C) 2006-2007 Sun Microsystems, Inc.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# This file is part of VirtualBox Open Source Edition (OSE), as
8495845a800cf09321436aed996188c9a92cd647bnicholes# available from http://www.virtualbox.org. This file is free software;
8495845a800cf09321436aed996188c9a92cd647bnicholes# you can redistribute it and/or modify it under the terms of the GNU
8495845a800cf09321436aed996188c9a92cd647bnicholes# General Public License (GPL) as published by the Free Software
8495845a800cf09321436aed996188c9a92cd647bnicholes# Foundation, in version 2 as it comes in the "COPYING" file of the
8495845a800cf09321436aed996188c9a92cd647bnicholes# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8495845a800cf09321436aed996188c9a92cd647bnicholes# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# The contents of this file may alternatively be used under the terms
8495845a800cf09321436aed996188c9a92cd647bnicholes# of the Common Development and Distribution License Version 1.0
8495845a800cf09321436aed996188c9a92cd647bnicholes# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8495845a800cf09321436aed996188c9a92cd647bnicholes# VirtualBox OSE distribution, in which case the provisions of the
8495845a800cf09321436aed996188c9a92cd647bnicholes# CDDL are applicable instead of those of the GPL.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# You may elect to license modified versions of this file under the
8495845a800cf09321436aed996188c9a92cd647bnicholes# terms and conditions of either the GPL or the CDDL or both.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
8495845a800cf09321436aed996188c9a92cd647bnicholes# Clara, CA 95054 USA or visit http://www.sun.com if you need
8495845a800cf09321436aed996188c9a92cd647bnicholes# additional information or have any questions.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# First, figure out which architecture we're targeting and the build type.
8495845a800cf09321436aed996188c9a92cd647bnicholes# (We have to support basic cross building (ARCH=i386|x86_64).)
8495845a800cf09321436aed996188c9a92cd647bnicholes# While at it, warn about BUILD_* vars found to help with user problems.
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TARGET_ARCH_DEF := amd64
8495845a800cf09321436aed996188c9a92cd647bnicholeselse
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TARGET_ARCH_DEF := x86
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholesifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
8495845a800cf09321436aed996188c9a92cd647bnicholes $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TARGET_ARCH :=
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(BUILD_TARGET_ARCH),)
8495845a800cf09321436aed996188c9a92cd647bnicholes ifeq ($(ARCH),x86_64)
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TARGET_ARCH := amd64
8495845a800cf09321436aed996188c9a92cd647bnicholes else
8495845a800cf09321436aed996188c9a92cd647bnicholes ifeq ($(ARCH),i386)
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TARGET_ARCH := x86
8495845a800cf09321436aed996188c9a92cd647bnicholes else
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH_DEF)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholeselse
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
8495845a800cf09321436aed996188c9a92cd647bnicholes $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholes
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankgifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
8495845a800cf09321436aed996188c9a92cd647bnicholes $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TYPE :=
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(BUILD_TYPE),)
8495845a800cf09321436aed996188c9a92cd647bnicholes BUILD_TYPE := release
8495845a800cf09321436aed996188c9a92cd647bnicholeselse
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(BUILD_TYPE),release)
8495845a800cf09321436aed996188c9a92cd647bnicholes $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes# override is required by the Debian guys
8495845a800cf09321436aed996188c9a92cd647bnicholesoverride MODULE = vboxdrv
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankgOBJS = \
8495845a800cf09321436aed996188c9a92cd647bnicholes linux/SUPDrv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes SUPDrv.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes SUPDrvSem.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/alloc-r0drv.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/initterm-r0drv.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/memobj-r0drv.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/mpnotification-r0drv.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/powernotification-r0drv.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/assert-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/alloc-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/initterm-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/memobj-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/memuserkernel-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/mp-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/mpnotification-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/process-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/semevent-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/semeventmulti-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/semfastmutex-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/spinlock-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/thread-r0drv-linux.o \
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankg r0drv/linux/thread2-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/time-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/timer-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/generic/semspinmutex-r0drv-generic.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/checksum/ipv4.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/checksum/ipv6.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/err/RTErrConvertFromErrno.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/err/RTErrConvertToErrno.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/log/log.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/log/logellipsis.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/log/logrel.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/log/logrelellipsis.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/log/logcom.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/log/logformat.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/RTAssertMsg1Weak.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/RTAssertMsg2.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/RTAssertMsg2Add.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/RTAssertMsg2AddWeak.o \
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankg common/misc/RTAssertMsg2AddWeakV.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/RTAssertMsg2Weak.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/RTAssertMsg2WeakV.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/assert.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/handletable.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/misc/handletablectx.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/string/strformat.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/string/strformatrt.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/string/strformattype.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/string/strprintf.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes common/string/strtonum.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes generic/RTAssertShouldPanic-generic.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes generic/RTLogWriteStdErr-stub-generic.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes generic/RTLogWriteStdOut-stub-generic.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes generic/RTLogWriteUser-generic.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes generic/uuid-generic.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes VBox/log-vbox.o
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(BUILD_TARGET_ARCH),x86)
8495845a800cf09321436aed996188c9a92cd647bnicholesOBJS += math/gcc/divdi3.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes math/gcc/moddi3.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes math/gcc/qdivrem.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes math/gcc/udivdi3.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes math/gcc/divdi3.o \
8495845a800cf09321436aed996188c9a92cd647bnicholes math/gcc/umoddi3.o
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankgifeq ($(BUILD_TARGET_ARCH),amd64)
8495845a800cf09321436aed996188c9a92cd647bnicholesOBJS += alloc/heapsimple.o
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholesifneq ($(MAKECMDGOALS),clean)
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(KERNELRELEASE),)
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankg
8495845a800cf09321436aed996188c9a92cd647bnicholes #
8495845a800cf09321436aed996188c9a92cd647bnicholes # building from this directory
8495845a800cf09321436aed996188c9a92cd647bnicholes #
8495845a800cf09321436aed996188c9a92cd647bnicholes
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes # kernel base directory
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes ifndef KERN_DIR
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes # build for the current kernel, version check
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes KERN_DIR := /lib/modules/$(shell uname -r)/build
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes KERN_DIR := /usr/src/linux
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes $(error Error: unable to find the sources of your current Linux kernel. \
8495845a800cf09321436aed996188c9a92cd647bnicholes Specify KERN_DIR=<directory> and run Make again)
fd780f0b6767d731e4b45c03dbbe9b9c1cbd2a8dbnicholes endif
fa296e0ab15d4d7e59d657c16acef0fd10e4affdbnicholes $(warning Warning: using /usr/src/linux as the source directory of your \
fa296e0ab15d4d7e59d657c16acef0fd10e4affdbnicholes Linux kernel. If this is not correct, specify \
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankg KERN_DIR=<directory> and run Make again.)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankg # check if versions match -- works only for later 2.6 kernels
8495845a800cf09321436aed996188c9a92cd647bnicholes VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) --no-print-directory kernelrelease 2> /dev/null || true)
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(VBOX_KERN_VER),)
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(VBOX_KERN_VER),$(shell uname -r))
8495845a800cf09321436aed996188c9a92cd647bnicholes $(error Error: /usr/src/linux (version $(VBOX_KERN_VER)) does not match \
8495845a800cf09321436aed996188c9a92cd647bnicholes the current kernel (version $(shell uname -r)))
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes else
8495845a800cf09321436aed996188c9a92cd647bnicholes # build for a dedicated kernel, no version check
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
8495845a800cf09321436aed996188c9a92cd647bnicholes $(error Error: KERN_DIR does not point to a directory)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes # includes
8495845a800cf09321436aed996188c9a92cd647bnicholes ifndef KERN_INCL
8495845a800cf09321436aed996188c9a92cd647bnicholes KERN_INCL = $(KERN_DIR)/include
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
8495845a800cf09321436aed996188c9a92cd647bnicholes $(error Error: unable to find the include directory for your current Linux \
8495845a800cf09321436aed996188c9a92cd647bnicholes kernel. Specify KERN_INCL=<directory> and run Make again)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes # module install dir, only for current kernel
8495845a800cf09321436aed996188c9a92cd647bnicholes ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
8495845a800cf09321436aed996188c9a92cd647bnicholes ifndef MODULE_DIR
8495845a800cf09321436aed996188c9a92cd647bnicholes MODULE_DIR_TST := /lib/modules/$(shell uname -r)
8495845a800cf09321436aed996188c9a92cd647bnicholes ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
8495845a800cf09321436aed996188c9a92cd647bnicholes MODULE_DIR := $(MODULE_DIR_TST)/misc
8495845a800cf09321436aed996188c9a92cd647bnicholes else
8495845a800cf09321436aed996188c9a92cd647bnicholes $(error Unable to find the folder to install the support driver to)
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes endif # MODULE_DIR unspecified
8495845a800cf09321436aed996188c9a92cd647bnicholes endif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholeselse # neq($(KERNELRELEASE),)
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes #
8495845a800cf09321436aed996188c9a92cd647bnicholes # building from kbuild (make -C <kernel_directory> M=`pwd`)
8495845a800cf09321436aed996188c9a92cd647bnicholes #
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholesendif # neq($(KERNELRELEASE),)
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes# debug - show guesses.
8495845a800cf09321436aed996188c9a92cd647bnicholesifdef DEBUG
8495845a800cf09321436aed996188c9a92cd647bnicholes$(warning dbg: KERN_DIR = $(KERN_DIR))
8495845a800cf09321436aed996188c9a92cd647bnicholes$(warning dbg: KERN_INCL = $(KERN_INCL))
8495845a800cf09321436aed996188c9a92cd647bnicholes$(warning dbg: MODULE_DIR = $(MODULE_DIR))
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholesKBUILD_VERBOSE ?= 1
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholes# Compiler options
8495845a800cf09321436aed996188c9a92cd647bnicholes#
8495845a800cf09321436aed996188c9a92cd647bnicholesifndef INCL
8495845a800cf09321436aed996188c9a92cd647bnicholes INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
8495845a800cf09321436aed996188c9a92cd647bnicholes ifndef KBUILD_EXTMOD
8495845a800cf09321436aed996188c9a92cd647bnicholes KBUILD_EXTMOD := $(shell pwd)
de2feca197f3b0aaff5c201dffda04aea8a47adcfuankg endif
8495845a800cf09321436aed996188c9a92cd647bnicholes INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
8495845a800cf09321436aed996188c9a92cd647bnicholes export INCL
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholesKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
8495845a800cf09321436aed996188c9a92cd647bnicholesifdef VBOX_REDHAT_KABI
8495845a800cf09321436aed996188c9a92cd647bnicholes KFLAGS += -DVBOX_REDHAT_KABI
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholesifndef CONFIG_VBOXDRV_FIXEDMAJOR
8495845a800cf09321436aed996188c9a92cd647bnicholes KFLAGS += -DCONFIG_VBOXDRV_AS_MISC
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(BUILD_TARGET_ARCH),amd64)
8495845a800cf09321436aed996188c9a92cd647bnicholes KFLAGS += -DRT_ARCH_AMD64
8495845a800cf09321436aed996188c9a92cd647bnicholeselse
8495845a800cf09321436aed996188c9a92cd647bnicholes KFLAGS += -DRT_ARCH_X86
f2f3f241c00a7a4bd597e57a19023940e072918abnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholes# must be consistent with Config.kmk!
8495845a800cf09321436aed996188c9a92cd647bnicholesKFLAGS += -DVBOX_WITH_64_BITS_GUESTS
8495845a800cf09321436aed996188c9a92cd647bnicholesifeq ($(BUILD_TYPE),debug)
8495845a800cf09321436aed996188c9a92cd647bnicholes KFLAGS += -DDEBUG -DDEBUG_$(USER) -g
8495845a800cf09321436aed996188c9a92cd647bnicholes # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
8495845a800cf09321436aed996188c9a92cd647bnicholes KFLAGS += -DIPRT_DEBUG_SEMS
8495845a800cf09321436aed996188c9a92cd647bnicholesendif
8495845a800cf09321436aed996188c9a92cd647bnicholes
8495845a800cf09321436aed996188c9a92cd647bnicholes# 2.6 and later
8495845a800cf09321436aed996188c9a92cd647bnicholesMODULE_EXT := ko
8495845a800cf09321436aed996188c9a92cd647bnicholes$(MODULE)-y := $(OBJS)
8495845a800cf09321436aed996188c9a92cd647bnicholes
# build defs
EXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG)
all: $(MODULE)
obj-m += $(MODULE).o
$(MODULE):
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
install: $(MODULE)
@mkdir -p $(MODULE_DIR); \
install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
PATH="$(PATH):/bin:/sbin" depmod -a; \
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/generic 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 modules.order