VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/module/Makefile.module@ 4860

Last change on this file since 4860 was 4860, checked in by vboxsync, 17 years ago

Activated the full backdoor logger in release builds of the Linux Guest Additions kernel modules

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1#
2# VirtualBox Guest Additions Module Makefile.
3#
4# (For 2.6.x this file must be 'Makefile'!)
5#
6# Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# be useful, but WITHOUT ANY WARRANTY of any kind.
15
16#
17MODULE = vboxadd
18OBJS = \
19 cmc.o \
20 hgcmcall.o \
21 vboxmod.o \
22 GenericRequest.o \
23 HGCMInternal.o \
24 Init.o \
25 PhysHeap.o \
26 SysHlp.o \
27 VMMDev.o \
28 r0drv/alloc-r0drv.o \
29 r0drv/linux/alloc-r0drv-linux.o \
30 r0drv/linux/semaphore-r0drv-linux.o \
31 divdi3.o \
32 moddi3.o \
33 udivdi3.o \
34 umoddi3.o \
35 qdivrem.o \
36 logbackdoor.o \
37 logformat.o \
38 strformat.o \
39 strformatrt.o \
40 strformat-vbox.o
41
42ifneq ($(MAKECMDGOALS),clean)
43
44# kernel base directory
45ifndef KERN_DIR
46 KERN_DIR := /lib/modules/$(shell uname -r)/build
47 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
48 KERN_DIR := /usr/src/linux
49 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
50 $(error Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.)
51 endif
52 $(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.)
53 endif
54else
55 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
56 $(error Error: KERN_DIR does not point to a directory.)
57 endif
58endif
59
60# includes
61ifndef KERN_INCL
62 KERN_INCL = $(KERN_DIR)/include
63endif
64ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
65 $(error Error: unable to find the include directory for your current Linux kernel. Specify KERN_INCL=<directory> and run Make again.)
66endif
67
68# module install dir.
69ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
70 ifndef MODULE_DIR
71 MODULE_DIR_TST := /lib/modules/$(shell uname -r)
72 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
73 MODULE_DIR := $(MODULE_DIR_TST)/misc
74 else
75 $(error Unable to find the folder to install the additions driver to)
76 endif
77 endif # MODULE_DIR unspecified
78endif
79
80# guess kernel version (24 or 26)
81ifeq ($(shell if grep '"2.4.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)
82KERN_VERSION := 24
83else
84KERN_VERSION := 26
85endif
86# KERN_VERSION := $(if $(wildcard $(KERN_DIR)/Rules.make),24,26)
87
88# debug - show guesses.
89ifdef DEBUG
90$(warning dbg: KERN_DIR = $(KERN_DIR))
91$(warning dbg: KERN_INCL = $(KERN_INCL))
92$(warning dbg: MODULE_DIR = $(MODULE_DIR))
93$(warning dbg: KERN_VERSION = $(KERN_VERSION))
94endif
95
96
97#
98# Compiler options
99#
100ifndef INCL
101 INCL := -I$(KERN_INCL) $(addprefix -I, $(EXTRA_INCL))
102 ifndef KBUILD_EXTMOD
103 KBUILD_EXTMOD := $(shell pwd)
104 endif
105 INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
106 export INCL
107endif
108KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -D_X86_ \
109 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DVBGL_VBOXGUEST -DVBOX_HGCM \
110 -DLOG_TO_BACKDOOR -DRT_WITH_VBOX -DIN_MODULE
111ifeq ($(BUILD_TYPE),debug)
112KFLAGS += -DDEBUG
113endif
114
115ifeq ($(KERN_VERSION), 24)
116#
117# 2.4
118#
119
120CFLAGS := -DVBOX_LINUX_2_4 -DEXPORT_SYMTAB $(INCL) $(KFLAGS) $(KDEBUG)
121MODULE_EXT := o
122
123# 2.4 Module linking
124$(MODULE).o: $(OBJS)
125 $(LD) -o $@ -r $(OBJS)
126
127.PHONY: $(MODULE)
128all: $(MODULE)
129$(MODULE): $(MODULE).o
130
131else
132#
133# 2.6 and later
134#
135
136MODULE_EXT := ko
137
138$(MODULE)-y := $(OBJS)
139
140# build defs
141EXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG)
142
143all: $(MODULE)
144
145obj-m += $(MODULE).o
146
147$(MODULE):
148 $(MAKE) KBUILD_VERBOSE=1 -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
149
150endif
151
152install: $(MODULE)
153 @mkdir -p $(MODULE_DIR); \
154 install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
155 PATH="$(PATH):/bin:/sbin" depmod -ae;
156
157endif # eq($(MAKECMDGOALS),clean)
158
159clean:
160 for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
161 rm -rf .vboxadd* .tmp_ver* vboxadd.* Module.symvers Modules.symvers
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette