VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/installer/Makefile.test@ 31890

Last change on this file since 31890 was 31637, checked in by vboxsync, 14 years ago

Linux Additions: fix installer

  • Property svn:eol-style set to LF
File size: 2.8 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 Sun Microsystems, Inc.
7#
8# Use only with permission
9#
10
11#
12MODULE = vboxadd_test
13OBJS = test.o
14
15ifneq ($(MAKECMDGOALS),clean)
16
17# kernel base directory
18ifndef KERN_DIR
19 KERN_DIR := /lib/modules/$(shell uname -r)/build
20 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
21 KERN_DIR := /usr/src/linux
22 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
23 $(error Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.)
24 endif
25 $(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.)
26 endif
27else
28 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
29 $(error Error: KERN_DIR does not point to a directory.)
30 endif
31endif
32
33# includes
34ifndef KERN_INCL
35 KERN_INCL = $(KERN_DIR)/include
36endif
37ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
38 $(error Error: unable to find the include directory for your current Linux kernel. Specify KERN_INCL=<directory> and run Make again.)
39endif
40
41# guess kernel version (24 or 26)
42ifeq ($(shell if grep '"2.4.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)
43KERN_VERSION := 24
44else
45KERN_VERSION := 26
46endif
47# KERN_VERSION := $(if $(wildcard $(KERN_DIR)/Rules.make),24,26)
48
49# debug - show guesses.
50ifdef DEBUG
51$(warning dbg: KERN_DIR = $(KERN_DIR))
52$(warning dbg: KERN_INCL = $(KERN_INCL))
53$(warning dbg: MODULE_DIR = $(MODULE_DIR))
54$(warning dbg: KERN_VERSION = $(KERN_VERSION))
55endif
56
57
58#
59# Compiler options
60#
61ifndef INCL
62 INCL := -I$(KERN_INCL) $(addprefix -I, $(EXTRA_INCL))
63 ifndef KBUILD_EXTMOD
64 KBUILD_EXTMOD := $(shell pwd)
65 endif
66 INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
67 export INCL
68endif
69KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -D_X86_ -DIN_RT_R0 -DIN_SUP_R0 \
70 -DVBGL_VBOXGUEST -DVBGL_HGCM -DVBOX_WITH_HGCM
71ifeq ($(BUILD_TYPE),debug)
72KFLAGS += -DDEBUG
73endif
74
75ifeq ($(KERN_VERSION), 24)
76#
77# 2.4
78#
79
80CFLAGS := -DVBOX_LINUX_2_4 $(INCL) $(KFLAGS) $(KDEBUG)
81MODULE_EXT := o
82
83# 2.4 Module linking
84$(MODULE).o: $(OBJS)
85 $(LD) -o $@ -r $(OBJS)
86
87.PHONY: $(MODULE)
88all: $(MODULE)
89$(MODULE): $(MODULE).o
90
91else
92#
93# 2.6 and later
94#
95
96MODULE_EXT := ko
97
98$(MODULE)-y := $(OBJS)
99
100# build defs
101EXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG)
102
103all: $(MODULE)
104
105obj-m += $(MODULE).o
106
107$(MODULE):
108 $(MAKE) KBUILD_VERBOSE=1 -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
109
110endif
111
112endif # eq($(MAKECMDGOALS),clean)
113
114clean:
115 for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
116 rm -rf .vboxdrv* .tmp_ver* vboxdrv.* 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