Makefile revision 505c3dddcf03c6c1e5c9edc0d0c2c6234572e4fa
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# Makefile for the VirtualBox Linux Host Driver.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# (For 2.6.x this file must be called 'Makefile'!)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync#
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# available from http://www.virtualbox.org. This file is free software;
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# you can redistribute it and/or modify it under the terms of the GNU
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# General Public License (GPL) as published by the Free Software
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
6ec4e1827eab6a424d672ef0e5a17b065e52db20vboxsync# The contents of this file may alternatively be used under the terms
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# of the Common Development and Distribution License Version 1.0
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# VirtualBox OSE distribution, in which case the provisions of the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# CDDL are applicable instead of those of the GPL.
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# You may elect to license modified versions of this file under the
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# terms and conditions of either the GPL or the CDDL or both.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# additional information or have any questions.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# First, figure out which architecture we're targeting and the build type.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# (We have to support basic cross building (ARCH=i386|x86_64).)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# While at it, warn about BUILD_* vars found to help with user problems.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TARGET_ARCH :=
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TARGET_ARCH),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifeq ($(ARCH),x86_64)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TARGET_ARCH := amd64
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync else
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifeq ($(ARCH),i386)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TARGET_ARCH := x86
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync else
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TARGET_ARCH := amd64
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync else
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TARGET_ARCH := x86
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncelse
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TYPE :=
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TYPE),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync BUILD_TYPE := release
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncelse
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# override is required by the Debian guys
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncoverride MODULE = vboxdrv
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncOBJS = \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync linux/SUPDrv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync SUPDrv.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/alloc-r0drv.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/initterm-r0drv.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/memobj-r0drv.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/mpnotification-r0drv.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/alloc-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/initterm-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/memobj-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/mp-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/mpnotification-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/process-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/semevent-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/semeventmulti-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/semfastmutex-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/spinlock-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/thread-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/time-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/timer-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/err/RTErrConvertFromErrno.o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TARGET_ARCH),x86)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncOBJS += math/gcc/divdi3.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync math/gcc/moddi3.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync math/gcc/qdivrem.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync math/gcc/udivdi3.o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TARGET_ARCH),amd64)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncOBJS += alloc/heapsimple.o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TYPE),debug)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncOBJS += common/log/log.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/log/logcom.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/log/logformat.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/string/strformat.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/string/strformatrt.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/string/strformattype.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/string/strprintf.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync common/string/strtonum.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync generic/RTLogWriteStdErr-stub-generic.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync generic/RTLogWriteStdOut-stub-generic.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync generic/RTLogWriteUser-generic.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync VBox/log-vbox.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync VBox/strformat-vbox.o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TARGET_ARCH),x86)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncOBJS += math/gcc/divdi3.o \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync math/gcc/umoddi3.o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif # debug
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifneq ($(MAKECMDGOALS),clean)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(KERNELRELEASE),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync #
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # building from this directory
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync #
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # kernel base directory
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifndef KERN_DIR
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # build for the current kernel, version check
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KERN_DIR := /lib/modules/$(shell uname -r)/build
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KERN_DIR := /usr/src/linux
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(error Error: unable to find the sources of your current Linux kernel. \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync Specify KERN_DIR=<directory> and run Make again)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(warning Warning: using /usr/src/linux as the source directory of your \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync Linux kernel. If this is not correct, specify \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KERN_DIR=<directory> and run Make again.)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # check if versions match -- works only for later 2.6 kernels
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) kernelrelease 2> /dev/null || true)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(VBOX_KERN_VER),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(VBOX_KERN_VER),$(shell uname -r))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(error Error: /usr/src/linux (version $(VBOX_KERN_VER)) does not match \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync the current kernel (version $(shell uname -r)))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync else
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # build for a dedicated kernel, no version check
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(error Error: KERN_DIR does not point to a directory)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # includes
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifndef KERN_INCL
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KERN_INCL = $(KERN_DIR)/include
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(error Error: unable to find the include directory for your current Linux \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync kernel. Specify KERN_INCL=<directory> and run Make again)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # module install dir, only for current kernel
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifndef MODULE_DIR
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync MODULE_DIR_TST := /lib/modules/$(shell uname -r)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync MODULE_DIR := $(MODULE_DIR_TST)/misc
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync else
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(error Unable to find the folder to install the support driver to)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif # MODULE_DIR unspecified
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # guess kernel version (24 or 26)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KERN_VERSION := $(if $(wildcard $(KERN_DIR)/Rules.make),24,26)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncelse # neq($(KERNELRELEASE),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync #
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # building from kbuild (make -C <kernel_directory> M=`pwd`)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync #
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # guess kernel version (24 or 26)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KERN_VERSION := $(if $(wildcard $(PWD)/Rules.make),24,26)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif # neq($(KERNELRELEASE),)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# debug - show guesses.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifdef DEBUG
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(warning dbg: KERN_DIR = $(KERN_DIR))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(warning dbg: KERN_INCL = $(KERN_INCL))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(warning dbg: MODULE_DIR = $(MODULE_DIR))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(warning dbg: KERN_VERSION = $(KERN_VERSION))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# Compiler options
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifndef INCL
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync ifndef KBUILD_EXTMOD
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KBUILD_EXTMOD := $(shell pwd)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync endif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync export INCL
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifdef VBOX_REDHAT_KABI
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KFLAGS += -DVBOX_REDHAT_KABI
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifndef CONFIG_VBOXDRV_FIXEDMAJOR
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KFLAGS += -DCONFIG_VBOXDRV_AS_MISC
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TARGET_ARCH),amd64)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KFLAGS += -DRT_ARCH_AMD64
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncelse
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KFLAGS += -DRT_ARCH_X86
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(BUILD_TYPE),debug)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KFLAGS += -DDEBUG -DDEBUG_$(USER)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync KFLAGS += -DIPRT_DEBUG_SEMS
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync## @todo why is there a space before 24 here?
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(KERN_VERSION), 24)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# 2.4
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncTOPDIR = $(KERN_DIR)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncMODULE_EXT := o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncEXTRA_CFLAGS := -DVBOX_LINUX_2_4 -DEXPORT_SYMTAB
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(MODULE)-objs = $(OBJS)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncelse
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# 2.6 and later
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncMODULE_EXT := ko
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(MODULE)-y := $(OBJS)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# build defs
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncEXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncall: $(MODULE)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncobj-m += $(MODULE).o
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(MODULE):
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(MAKE) KBUILD_VERBOSE=1 -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncifeq ($(KERN_VERSION), 24)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync# 2.4 Module linking
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync#
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync$(MODULE).o: $(OBJS)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync $(LD) -o $@ -r $(OBJS)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncinclude $(KERN_DIR)/Rules.make
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncinstall: $(MODULE)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync @mkdir -p $(MODULE_DIR); \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync PATH="$(PATH):/bin:/sbin" depmod -ae; \
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync rm -f /etc/vbox/module_not_compiled
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncinstall_rpm: $(MODULE)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync @mkdir -p $(MODULE_DIR); \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncendif # eq($(MAKECMDGOALS),clean)
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsyncclean:
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync for f in . linux r0drv r0drv/linux VBox common/string common/log generic math/gcc; \
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync rm -rf .vboxdrv* .tmp_ver* vboxdrv.* Module.symvers Modules.symvers
a33af978add1a03aab11b2895f441af5cb2a11a6vboxsync