VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile@ 19013

Last change on this file since 19013 was 19013, checked in by vboxsync, 16 years ago

VBoxNetAdp: OSE fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.0 KB
Line 
1#
2# Makefile for the VirtualBox Linux Host Virtual Network Adapter Driver.
3# (For 2.6.x this file must be called 'Makefile'!)
4#
5
6#
7#
8# Copyright (C) 2006-2007 Sun Microsystems, Inc.
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19# Clara, CA 95054 USA or visit http://www.sun.com if you need
20# additional information or have any questions.
21#
22
23#
24# First, figure out which architecture we're targeting and the build type.
25# (We have to support basic cross building (ARCH=i386|x86_64).)
26# While at it, warn about BUILD_* vars found to help with user problems.
27#
28ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),)
29 $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.)
30 BUILD_TARGET_ARCH :=
31endif
32ifeq ($(BUILD_TARGET_ARCH),)
33 ifeq ($(ARCH),x86_64)
34 BUILD_TARGET_ARCH := amd64
35 else
36 ifeq ($(ARCH),i386)
37 BUILD_TARGET_ARCH := x86
38 else
39 ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),)
40 BUILD_TARGET_ARCH := amd64
41 else
42 BUILD_TARGET_ARCH := x86
43 endif
44 endif
45 endif
46else
47 $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).)
48endif
49
50ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),)
51 $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.)
52 BUILD_TYPE :=
53endif
54ifeq ($(BUILD_TYPE),)
55 BUILD_TYPE := release
56else
57 $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).)
58endif
59
60# override is required by the Debian guys
61override MODULE = vboxnetadp
62OBJS = \
63 linux/VBoxNetAdp-linux.o \
64 VBoxNetAdp.o \
65 r0drv/alloc-r0drv.o \
66 r0drv/initterm-r0drv.o \
67 r0drv/memobj-r0drv.o \
68 r0drv/mpnotification-r0drv.o \
69 r0drv/powernotification-r0drv.o \
70 r0drv/linux/assert-r0drv-linux.o \
71 r0drv/linux/alloc-r0drv-linux.o \
72 r0drv/linux/initterm-r0drv-linux.o \
73 r0drv/linux/memobj-r0drv-linux.o \
74 r0drv/linux/mp-r0drv-linux.o \
75 r0drv/linux/mpnotification-r0drv-linux.o \
76 r0drv/linux/process-r0drv-linux.o \
77 r0drv/linux/semevent-r0drv-linux.o \
78 r0drv/linux/semeventmulti-r0drv-linux.o \
79 r0drv/linux/semfastmutex-r0drv-linux.o \
80 r0drv/linux/spinlock-r0drv-linux.o \
81 r0drv/linux/thread-r0drv-linux.o \
82 r0drv/linux/thread2-r0drv-linux.o \
83 r0drv/linux/time-r0drv-linux.o \
84 common/err/RTErrConvertFromErrno.o \
85 common/err/RTErrConvertToErrno.o \
86 common/log/log.o \
87 common/log/logellipsis.o \
88 common/log/logrel.o \
89 common/log/logrelellipsis.o \
90 common/log/logcom.o \
91 common/log/logformat.o \
92 common/string/strformat.o \
93 common/string/strformatrt.o \
94 common/string/strformattype.o \
95 common/string/strprintf.o \
96 common/string/strtonum.o \
97 r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
98 generic/RTAssertShouldPanic-generic.o \
99 generic/RTLogWriteStdErr-stub-generic.o \
100 generic/RTLogWriteStdOut-stub-generic.o \
101 generic/RTLogWriteUser-generic.o \
102 generic/uuid-generic.o \
103 VBox/log-vbox.o \
104 VBox/strformat-vbox.o
105ifeq ($(BUILD_TARGET_ARCH),x86)
106OBJS += math/gcc/divdi3.o \
107 math/gcc/moddi3.o \
108 math/gcc/qdivrem.o \
109 math/gcc/udivdi3.o \
110 math/gcc/divdi3.o \
111 math/gcc/umoddi3.o
112endif
113ifeq ($(BUILD_TARGET_ARCH),amd64)
114OBJS += alloc/heapsimple.o
115endif
116
117ifneq ($(MAKECMDGOALS),clean)
118
119ifeq ($(KERNELRELEASE),)
120
121 #
122 # building from this directory
123 #
124
125 # kernel base directory
126 ifndef KERN_DIR
127 # build for the current kernel, version check
128 KERN_DIR := /lib/modules/$(shell uname -r)/build
129 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
130 KERN_DIR := /usr/src/linux
131 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
132 $(error Error: unable to find the sources of your current Linux kernel. \
133 Specify KERN_DIR=<directory> and run Make again)
134 endif
135 $(warning Warning: using /usr/src/linux as the source directory of your \
136 Linux kernel. If this is not correct, specify \
137 KERN_DIR=<directory> and run Make again.)
138 endif
139 # check if versions match -- works only for later 2.6 kernels
140 VBOX_KERN_VER := $(shell $(MAKE) -sC $(KERN_DIR) kernelrelease 2> /dev/null || true)
141 ifneq ($(VBOX_KERN_VER),)
142 ifneq ($(VBOX_KERN_VER),$(shell uname -r))
143 $(error Error: /usr/src/linux (version $(VBOX_KERN_VER)) does not match \
144 the current kernel (version $(shell uname -r)))
145 endif
146 endif
147 else
148 # build for a dedicated kernel, no version check
149 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
150 $(error Error: KERN_DIR does not point to a directory)
151 endif
152 endif
153
154 # includes
155 ifndef KERN_INCL
156 KERN_INCL = $(KERN_DIR)/include
157 endif
158 ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
159 $(error Error: unable to find the include directory for your current Linux \
160 kernel. Specify KERN_INCL=<directory> and run Make again)
161 endif
162
163 # module install dir, only for current kernel
164 ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
165 ifndef MODULE_DIR
166 MODULE_DIR_TST := /lib/modules/$(shell uname -r)
167 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
168 MODULE_DIR := $(MODULE_DIR_TST)/misc
169 else
170 $(error Unable to find the folder to install the support driver to)
171 endif
172 endif # MODULE_DIR unspecified
173 endif
174
175else # neq($(KERNELRELEASE),)
176
177 #
178 # building from kbuild (make -C <kernel_directory> M=`pwd`)
179 #
180
181endif # neq($(KERNELRELEASE),)
182
183# debug - show guesses.
184ifdef DEBUG
185$(warning dbg: KERN_DIR = $(KERN_DIR))
186$(warning dbg: KERN_INCL = $(KERN_INCL))
187$(warning dbg: MODULE_DIR = $(MODULE_DIR))
188endif
189
190KBUILD_VERBOSE ?= 1
191
192#
193# Compiler options
194#
195ifndef INCL
196 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
197 ifndef KBUILD_EXTMOD
198 KBUILD_EXTMOD := $(shell pwd)
199 endif
200 INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
201 export INCL
202endif
203KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
204ifdef VBOX_REDHAT_KABI
205 KFLAGS += -DVBOX_REDHAT_KABI
206endif
207ifeq ($(BUILD_TARGET_ARCH),amd64)
208 KFLAGS += -DRT_ARCH_AMD64
209else
210 KFLAGS += -DRT_ARCH_X86
211endif
212# must be consistent with Config.kmk!
213KFLAGS += -DVBOX_WITH_64_BITS_GUESTS
214ifeq ($(BUILD_TYPE),debug)
215 KFLAGS += -DDEBUG -DDEBUG_$(USER) -g
216 # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
217 KFLAGS += -DIPRT_DEBUG_SEMS
218endif
219
220# By default we use remap_pfn_range() kernel API to make kernel pages
221# visible for userland. Unfortuately, it leads to situation that
222# during debug session all structures on that page (such as PVM pointer)
223# are not accessible to the debugger (see #3214).
224# This code enables experimental support
225# for vm_insert_page() kernel API, allowing to export kernel pages
226# to the userland in more debugger-friendly way. Due to stability
227# concerns, not enabled by default yet.
228ifdef VBOX_USE_INSERT_PAGE
229 KFLAGS += -DVBOX_USE_INSERT_PAGE
230endif
231
232MODULE_EXT := ko
233$(MODULE)-y := $(OBJS)
234
235# build defs
236EXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG)
237
238all: $(MODULE)
239
240obj-m += $(MODULE).o
241
242$(MODULE):
243 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
244
245install: $(MODULE)
246 @mkdir -p $(MODULE_DIR); \
247 install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
248 PATH="$(PATH):/bin:/sbin" depmod -ae; \
249 rm -f /etc/vbox/module_not_compiled
250
251install_rpm: $(MODULE)
252 @mkdir -p $(MODULE_DIR); \
253 install -m 0664 $(MODULE).$(MODULE_EXT) $(MODULE_DIR)
254
255endif # eq($(MAKECMDGOALS),clean)
256
257# important: Don't remove Module.symvers! DKMS does 'make clean' before building ...
258clean:
259 for f in . linux r0drv r0drv/linux VBox common/err common/string common/log generic math/gcc; \
260 do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
261 rm -rf .vboxnetadp* .tmp_ver* vboxnetadp.* Modules.symvers modules.order
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