Makefile revision e91f2a55ed5a30342ec79ce273f3f4bad8283336
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# VirtualBox Guest Additions Module Makefile.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# Copyright (C) 2006-2010 Oracle Corporation
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# This file is part of VirtualBox Open Source Edition (OSE), as
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# available from http://www.virtualbox.org. This file is free software;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# you can redistribute it and/or modify it under the terms of the GNU
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# General Public License (GPL) as published by the Free Software
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# Foundation, in version 2 as it comes in the "COPYING" file of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# First, figure out which architecture we're targeting and the build type.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# (We have to support basic cross building (ARCH=i386|x86_64).)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# While at it, warn about BUILD_* vars found to help with user problems.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor# override is required by the Debian guys
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor generic/RTSemEventMultiWaitNoResume-2-ex-generic.o \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor # building from this directory
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor # kernel base directory
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor KERN_DIR := /lib/modules/$(shell uname -r)/build
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(error Error: unable to find the sources of your current Linux kernel. \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor Specify KERN_DIR=<directory> and run Make again)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(warning Warning: using /usr/src/linux as the source directory of your \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor $(error Error: KERN_DIR does not point to a directory)
ifeq ($(shell if echo "$(VERSION).$(PATCHLEVEL)." | grep '2\.4\.' > /dev/null; then echo yes; fi),yes)
export INCL
MODULE_EXT := o
EXTRA_CFLAGS += -include $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h $(INCL) $(KFLAGS) $(KDEBUG)
$(MODULE):