1 | #
|
---|
2 | # VirtualBox Guest Additions kernel module Makefile, common parts.
|
---|
3 | #
|
---|
4 | # (For 2.6.x, the main file must be called 'Makefile'!)
|
---|
5 | #
|
---|
6 | # Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
7 | #
|
---|
8 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | # available from http://www.virtualbox.org. This file is free software;
|
---|
10 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | # General Public License (GPL) as published by the Free Software
|
---|
12 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | #
|
---|
16 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
17 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
18 | # additional information or have any questions.
|
---|
19 | #
|
---|
20 |
|
---|
21 | #
|
---|
22 | # These file should be included by the Makefiles for any kernel modules we
|
---|
23 | # build as part of the Guest Additions. The intended way of doing this is as
|
---|
24 | # follows:
|
---|
25 | #
|
---|
26 | # # Linux kbuild sets this to our source directory if we are called from
|
---|
27 | # # there
|
---|
28 | # obj ?= $(CURDIR)
|
---|
29 | # include $(obj)/Makefile.include.header
|
---|
30 | # MOD_NAME = <name of the module to be built, without extension>
|
---|
31 | # MOD_OBJS = <list of object files which should be included>
|
---|
32 | # MOD_FLAGS = <any additional CFLAGS which this module needs>
|
---|
33 | # include $(obj)/Makefile.include.footer
|
---|
34 | #
|
---|
35 | # The kmk kBuild define KBUILD_TARGET_ARCH is available.
|
---|
36 | #
|
---|
37 | # @todo the shared folders module Makefile also includes the following bits.
|
---|
38 | # Integrate them if necessary.
|
---|
39 | # MOD_FLAGS += -DEXPORT_SYMTAB -DVBGL_VBOXGUEST -DRT_WITH_VBOX
|
---|
40 | #
|
---|
41 | # # special hack for Fedora Core 6 2.6.18 (fc6), rhel5 2.6.18 (el5),
|
---|
42 | # # ClarkConnect 4.3 (cc4) and ClarkConnect 5 (v5)
|
---|
43 | # ifeq ($(KERNELRELEASE),)
|
---|
44 | # KFLAGS += $(foreach inc,$(KERN_INCL),\
|
---|
45 | # $(if $(wildcard $(inc)/linux/utsrelease.h),\
|
---|
46 | # $(if $(shell grep '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h; \
|
---|
47 | # grep '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h; \
|
---|
48 | # grep '"2.6.18.*v5.*"' $(inc)/linux/utsrelease.h; \
|
---|
49 | # grep '"2.6.18.*cc4.*"' $(inc)/linux/utsrelease.h),\
|
---|
50 | # -DKERNEL_FC6,),))
|
---|
51 | # else
|
---|
52 | # KFLAGS += $(if $(shell echo "$(KERNELRELEASE)"|grep '2.6.18.*fc6.*';\
|
---|
53 | # echo "$(KERNELRELEASE)"|grep '2.6.18.*el5.*';\
|
---|
54 | # echo "$(KERNELRELEASE)"|grep '2.6.18.*v5.*';\
|
---|
55 | # echo "$(KERNELRELEASE)"|grep '2.6.18.*cc4.*'),\
|
---|
56 | # -DKERNEL_FC6,)
|
---|
57 | # endif
|
---|
58 | #
|
---|
59 | ## important: Don't remove Module.symvers! DKMS does 'make clean' before building ...
|
---|
60 | # rm -rf .vboxvfs* .tmp_ver* vboxvfs.* Modules.symvers modules.order
|
---|
61 | #
|
---|
62 |
|
---|
63 | #
|
---|
64 | # First, figure out which architecture we're targeting and the build type.
|
---|
65 | # (We have to support basic cross building (ARCH=i386|x86_64).)
|
---|
66 | # While at it, warn about BUILD_* vars found to help with user problems.
|
---|
67 | #
|
---|
68 | ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
|
---|
69 | $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
|
---|
70 | BUILD_TARGET_ARCH :=
|
---|
71 | endif
|
---|
72 | ifeq ($(BUILD_TARGET_ARCH),)
|
---|
73 | ifeq ($(ARCH),x86_64)
|
---|
74 | BUILD_TARGET_ARCH := amd64
|
---|
75 | else
|
---|
76 | ifeq ($(ARCH),i386)
|
---|
77 | BUILD_TARGET_ARCH := x86
|
---|
78 | else
|
---|
79 | ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
|
---|
80 | BUILD_TARGET_ARCH := amd64
|
---|
81 | else
|
---|
82 | BUILD_TARGET_ARCH := x86
|
---|
83 | endif
|
---|
84 | endif
|
---|
85 | endif
|
---|
86 | else
|
---|
87 | $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
|
---|
88 | endif
|
---|
89 |
|
---|
90 | ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
|
---|
91 | $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
|
---|
92 | BUILD_TYPE :=
|
---|
93 | endif
|
---|
94 | ifeq ($(BUILD_TYPE),)
|
---|
95 | BUILD_TYPE := release
|
---|
96 | else
|
---|
97 | $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
|
---|
98 | endif
|
---|