5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# Makefile for the VirtualBox Linux Host PCI Driver.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# (For 2.6.x this file must be called 'Makefile'!)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# Copyright (C) 2011 Oracle Corporation
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# available from http://www.virtualbox.org. This file is free software;
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# you can redistribute it and/or modify it under the terms of the GNU
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# General Public License (GPL) as published by the Free Software
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# First, figure out which architecture we're targeting and the build type.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# (We have to support basic cross building (ARCH=i386|x86_64).)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# While at it, warn about BUILD_* vars found to help with user problems.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF))
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# override is required by the Debian guys
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync # building from this directory
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync # kernel base directory
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync # build for the current kernel, version check
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(error Error: unable to find the sources of your current Linux kernel. \
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(warning Warning: using /usr/src/linux as the source directory of your \
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(error Error: KERN_DIR does not point to a directory)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(error Error: unable to find the include directory for your current Linux \
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync kernel. Specify KERN_INCL=<directory> and run Make again)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync # module install dir, only for current kernel
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync $(error Unable to find the folder to install the support driver to)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncelse # neq($(KERNELRELEASE),)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync # building from kbuild (make -C <kernel_directory> M=`pwd`)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# debug - show guesses.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# Compiler options
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxpci,/ /include /r0drv/linux)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync MANGLING := $(KBUILD_EXTMOD)/vboxpci/include/VBox/SUPDrvMangling.h
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync MANGLING := $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncKFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# must be consistent with Config.kmk!
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync #KFLAGS += -DIPRT_DEBUG_SEMS
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# By default we use remap_pfn_range() kernel API to make kernel pages
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# visible for userland. Unfortunately, it leads to situation that
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# during debug session all structures on that page (such as PVM pointer)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# are not accessible to the debugger (see #3214).
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# This code enables experimental support
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# for vm_insert_page() kernel API, allowing to export kernel pages
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# to the userland in more debugger-friendly way. Due to stability
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# concerns, not enabled by default yet.
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync# build defs
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncEXTRA_CFLAGS += -include $(MANGLING) $(INCL) $(KFLAGS) $(KDEBUG)
00019d7a7381b029a3c17229f14c24a3a7b07a94vboxsync# OL/UEK: disable module signing for external modules -- we don't have any private key
00019d7a7381b029a3c17229f14c24a3a7b07a94vboxsync $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) CONFIG_MODULE_SIG= -C $(KERN_DIR) modules
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsyncelse # eq ($(MAKECMDGOALS),clean)
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync find . \( -name \*.o -o -name \*.cmd \) -print0 | xargs -0 rm -f
5cbc8e6f19327d4705c3e80af1f97ce630dd11devboxsync rm -rf .tmp_ver* $(MODULE).* Module.symvers Modules.symvers modules.order