Makefile revision 0dfc79e0666da4c8853deda18a14ebf5819d0d78
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# Makefile for the VirtualBox Linux Host Driver.
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# Copyright (C) 2006-2010 Oracle Corporation
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# This file is part of VirtualBox Open Source Edition (OSE), as
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# available from http://www.virtualbox.org. This file is free software;
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# you can redistribute it and/or modify it under the terms of the GNU
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# General Public License (GPL) as published by the Free Software
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# Foundation, in version 2 as it comes in the "COPYING" file of the
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# The contents of this file may alternatively be used under the terms
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# of the Common Development and Distribution License Version 1.0
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari# VirtualBox OSE distribution, in which case the provisions of the
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari# CDDL are applicable instead of those of the GPL.
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# You may elect to license modified versions of this file under the
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# terms and conditions of either the GPL or the CDDL or both.
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari# First, figure out which architecture we're targeting and the build type.
100ddc17625c25a9ffe83737edc53db7538b41ffDaniel Calegari# (We have to support basic cross building (ARCH=i386|x86_64).)
100ddc17625c25a9ffe83737edc53db7538b41ffDaniel Calegari# While at it, warn about BUILD_* vars found to help with user problems.
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegariifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegariifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari BUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH_DEF)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegariifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari# override is required by the Debian guys
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari r0drv/generic/semspinmutex-r0drv-generic.o \
8e8b5741985d2dcb109a000757b34fe84098e978Daniel Calegari r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari # building from this directory
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari # kernel base directory
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari # build for the current kernel, version check
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari KERN_DIR := /lib/modules/$(shell uname -r)/build
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari $(error Error: unable to find the sources of your current Linux kernel. \
15042bad71a157e77c0a1893759f9027b2673a1eDaniel Calegari Specify KERN_DIR=<directory> and run Make again)
VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) --no-print-directory kernelrelease 2> /dev/null || true)
export INCL
# must be consistent with Config.kmk!
$(MODULE):