VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/linux/Makefile@ 78446

Last change on this file since 78446 was 78446, checked in by vboxsync, 6 years ago

Installer/Linux: remove last uses of KBUILD_EXTMOD to simplify building in-tree.
Currently we use the Make variable KBUILD_EXTMOD to distinguish between builds
inside the Linux kernel kbuild system and outside of it. However, if our
kernel modules are build inside a kernel tree as part of a kernel build this
does not work, as they are no longer external modules. So replace those
checks with checks against KERNELRELEASE, and remove other uses of the
variable while we are at it. Said other uses are inside the host module
top-level Make file. I am not actually aware of any users of this file,
though if we ever build those modules as part of a kernel build it might be
useful.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.1 KB
Line 
1#
2# Makefile for the VirtualBox Linux Host Drivers.
3#
4
5#
6# Copyright (C) 2008-2019 Oracle Corporation
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# The contents of this file may alternatively be used under the terms
17# of the Common Development and Distribution License Version 1.0
18# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19# VirtualBox OSE distribution, in which case the provisions of the
20# CDDL are applicable instead of those of the GPL.
21#
22# You may elect to license modified versions of this file under the
23# terms and conditions of either the GPL or the CDDL or both.
24#
25
26ifneq ($(KERNELRELEASE),)
27
28# Building from kBuild (make -C <kernel_directory> M=`pwd`),
29# or inside a kernel source tree.
30
31obj-m = vboxdrv/
32ifneq ($(wildcard $(CURDIR)/vboxnetflt/Makefile),)
33 obj-m += vboxnetflt/
34endif
35ifneq ($(wildcard $(CURDIR)/vboxnetadp/Makefile),)
36 obj-m += vboxnetadp/
37endif
38ifneq ($(wildcard $(CURDIR)/vboxpci/Makefile),)
39 obj-m += vboxpci/
40endif
41
42else # ! KERNELRELEASE
43
44# convenience Makefile without KERNELRELEASE
45
46KBUILD_VERBOSE ?=
47KERN_VER ?= $(shell uname -r)
48.PHONY: all install clean check unload load vboxdrv vboxnetflt vboxnetadp \
49 vboxpci
50
51all: vboxdrv vboxnetflt vboxnetadp vboxpci
52
53# We want to build on Linux 2.6.18 and later kernels.
54ifneq ($(filter-out 1.% 2.0.% 2.1.% 2.2.% 2.3.% 2.4.% 2.5.%,$(KERN_VER)),)
55
56vboxdrv:
57 @echo "=== Building 'vboxdrv' module ==="
58 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv
59 @cp vboxdrv/vboxdrv.ko .
60 @echo
61
62vboxnetflt: vboxdrv
63 @if [ -d vboxnetflt ]; then \
64 if [ -f vboxdrv/Module.symvers ]; then \
65 cp vboxdrv/Module.symvers vboxnetflt; \
66 fi; \
67 echo "=== Building 'vboxnetflt' module ==="; \
68 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt || exit 1; \
69 cp vboxnetflt/vboxnetflt.ko .; \
70 echo; \
71 fi
72
73vboxnetadp: vboxdrv
74 @if [ -d vboxnetadp ]; then \
75 if [ -f vboxdrv/Module.symvers ]; then \
76 cp vboxdrv/Module.symvers vboxnetadp; \
77 fi; \
78 echo "=== Building 'vboxnetadp' module ==="; \
79 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp || exit 1; \
80 cp vboxnetadp/vboxnetadp.ko .; \
81 echo; \
82 fi
83
84vboxpci: vboxdrv
85 @if [ -d vboxpci ]; then \
86 if [ -f vboxdrv/Module.symvers ]; then \
87 cp vboxdrv/Module.symvers vboxpci; \
88 fi; \
89 echo "=== Building 'vboxpci' module ==="; \
90 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci || exit 1; \
91 cp vboxpci/vboxpci.ko .; \
92 echo; \
93 fi
94
95install:
96 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
97 @if [ -d vboxnetflt ]; then \
98 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
99 fi
100 @if [ -d vboxnetadp ]; then \
101 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
102 fi
103 @if [ -d vboxpci ]; then \
104 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci install; \
105 fi
106
107else
108
109vboxdrv:
110vboxnetflt:
111vboxnetadp:
112vboxpci:
113install:
114
115endif
116
117clean:
118 @$(MAKE) -C vboxdrv clean
119 @if [ -d vboxnetflt ]; then \
120 $(MAKE) -C vboxnetflt clean; \
121 fi
122 @if [ -d vboxnetadp ]; then \
123 $(MAKE) -C vboxnetadp clean; \
124 fi
125 @if [ -d vboxpci ]; then \
126 $(MAKE) -C vboxpci clean; \
127 fi
128 rm -f vboxdrv.ko vboxnetflt.ko vboxnetadp.ko vboxpci.ko
129
130check:
131 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv check
132
133unload:
134 @for module in vboxpci vboxnetadp vboxnetflt vboxdrv; do \
135 if grep "^$$module " /proc/modules >/dev/null; then \
136 echo "Removing previously installed $$module module"; \
137 /sbin/rmmod $$module; \
138 fi; \
139 done
140
141load: unload
142 @for module in vboxdrv vboxnetflt vboxnetadp vboxpci; do \
143 if test -f $$module.ko; then \
144 echo "Installing $$module module"; \
145 /sbin/insmod $$module.ko; \
146 fi; \
147 done
148
149endif # ! KERNELRELEASE
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