Makefile revision 0e5731ab59b4ecead38375f26eeea698f00b19fd
f743002678eb67b99bbc29fee116b65d9530fec0wrowe# $Revision$
5c43d2fb853f84497b5ece2d414ef9484aa87e5fsf# VirtualBox Guest Additions Module Makefile.
f21e9e3d0bfb7a507ecc5bc963f2159d693503d1sf# Copyright (C) 2006-2009 Sun Microsystems, Inc.
f21e9e3d0bfb7a507ecc5bc963f2159d693503d1sf# This file is part of VirtualBox Open Source Edition (OSE), as
7f40ab64e74b7d1057b5ee6abc349e32e74b1b4cjim# available from http://www.virtualbox.org. This file is free software;
7f40ab64e74b7d1057b5ee6abc349e32e74b1b4cjim# you can redistribute it and/or modify it under the terms of the GNU
7f40ab64e74b7d1057b5ee6abc349e32e74b1b4cjim# General Public License (GPL) as published by the Free Software
f6b9c755a0b793e8a3a3aebd327ca20a86478117sf# Foundation, in version 2 as it comes in the "COPYING" file of the
f6b9c755a0b793e8a3a3aebd327ca20a86478117sf# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
f6b9c755a0b793e8a3a3aebd327ca20a86478117sf# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
132ee6ac1c26d6e8953836316ba50734eefab47bsf# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
132ee6ac1c26d6e8953836316ba50734eefab47bsf# Clara, CA 95054 USA or visit http://www.sun.com if you need
132ee6ac1c26d6e8953836316ba50734eefab47bsf# additional information or have any questions.
5c43d2fb853f84497b5ece2d414ef9484aa87e5fsf# First, figure out which architecture we're targeting and the build type.
5c43d2fb853f84497b5ece2d414ef9484aa87e5fsf# (We have to support basic cross building (ARCH=i386|x86_64).)
5c43d2fb853f84497b5ece2d414ef9484aa87e5fsf# While at it, warn about BUILD_* vars found to help with user problems.
4f517d09c93a552f177f49ff97e93aa44eb127ebcovenerifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
20eead0b01d51fce0cc17d04b8f98ec38eac68aejim $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
79ccc75d7de4e14e5add1fa73aaabda0f5d33fe6trawick ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
fc1459657a1fde206a847f9028930725d715f8b4trawick $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
e758971371df73b097609b2fd62bc14ad935e096trawickifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
e758971371df73b097609b2fd62bc14ad935e096trawick $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand# override is required by the Debian guys
0448378b899e8df0c060360f17c0af692adf17bchumbedooh # building from this directory
60a765cccbd3f3b5997b65b0034220c79f78369etrawick # kernel base directory
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
91654e263480f0fdc2a03d782ff23f8dad07cf79humbedooh ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
91814c869ca39ce45dfe147307d2a831cac6ecbehumbedooh $(error Error: unable to find the sources of your current Linux kernel. \
79c5787b92ac5f0e1cc82393816c77a006399316trawick $(warning Warning: using /usr/src/linux as the source directory of your \
79c5787b92ac5f0e1cc82393816c77a006399316trawick ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
79c5787b92ac5f0e1cc82393816c77a006399316trawick $(error Error: KERN_DIR does not point to a directory)
099c357f282d4aebf2b32264f7dce6ffc0497c37sf ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf $(error Error: unable to find the include directory for your current Linux \
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf kernel. Specify KERN_INCL=<directory> and run Make again)
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton # module install dir, only for current kernel
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
536e48c08d674acac5d44929318f2ad928edc361jorton ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
e81785da447b469da66f218b3f0244aab507958djorton $(error Unable to find the folder to install the additions driver to)
459eaf0826f995b73a0dc066f59ea10d2824e72dsf # guess kernel version (24 or 26)
459eaf0826f995b73a0dc066f59ea10d2824e72dsf ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)
53e9b27aba029b18be814df40bcf6f0428771d1efuankgelse # neq($(KERNELRELEASE),)
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf # building from kbuild (make -C <kernel_directory> M=`pwd`)
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin # guess kernel version (24 or 26)
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin ifeq ($(shell if echo "$(VERSION).$(PATCHLEVEL)." | grep '2\.4\.' > /dev/null; then echo yes; fi),yes)
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung# debug - show guesses.
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick# Compiler options
cfa64348224b66dd1c9979b809406c4d15b1c137fielding INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
MODULE_EXT := o
$(MODULE):