Makefile revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
b897c52f865b2fc4e220e2110b874e59c716456bBob Halley# Makefile for the VirtualBox Linux Host Driver.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# (For 2.6.x this file must be called 'Makefile'!)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# Copyright (C) 2006 InnoTek Systemberatung GmbH
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# This file is part of VirtualBox Open Source Edition (OSE), as
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# available from http://www.virtualbox.org. This file is free software;
b897c52f865b2fc4e220e2110b874e59c716456bBob Halley# you can redistribute it and/or modify it under the terms of the GNU
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# General Public License as published by the Free Software Foundation,
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# distribution. VirtualBox OSE is distributed in the hope that it will
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# be useful, but WITHOUT ANY WARRANTY of any kind.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# If you received this file as part of a commercial VirtualBox
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# distribution, then only the terms of your commercial VirtualBox
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# license agreement apply instead of the previous paragraph.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# Where is everything?
0b72c791466d0807bcf22522b5ddb7da902c2720Bob HalleyKERN_DIR_CUR := /lib/modules/$(shell uname -r)/build
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halleyifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halleyifneq ($(shell if test -d /usr/src/linux; then echo yes; fi),yes)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley$(error Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley$(warning Warning: using /usr/src/linux as the source directory of your Linux kernel. If this is not correct, specify KERN_DIR=<directory> and run Make again.)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley$(info Info: using $(KERN_INCL) as the include directory of your Linux kernel. If this is not correct, specify KERN_INFO=<directory> and run Make again.)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halleyifneq ($(shell if test -d $(KERN_INFO); then echo yes; fi),yes)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley$(error Error: unable to find the include directory for your current Linux kernel. Specify $KERN_INCL=<directory> and run Make again.)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# Module install dir.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halleyifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley$(error Error: could not find the module directory for your current Linux kernel)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# guess kernel version (24 or 26)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob HalleyKERN_VERSION := $(if $(wildcard $(KERN_DIR)/Rules.make),24,26)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# debug - show guesses.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# Compiler options
0b72c791466d0807bcf22522b5ddb7da902c2720Bob HalleyINCL := -I$(KERN_INCL) -I$(shell pwd) -I$(shell pwd)/include -I$(shell pwd)/r0drv/linux
0b72c791466d0807bcf22522b5ddb7da902c2720Bob HalleyKFLAGS := -D__KERNEL__ -DMODULE -D__LINUX__ -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halleyifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley#ifeq ($(BUILD_TYPE),debug) - you'll have to enable this manually to get debug stuff.
MODULE_EXT := o
$(MODULE):