VirtualBox

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

Last change on this file since 86607 was 85943, checked in by vboxsync, 4 years ago

Additions/linux/Makefile,HostDrivers/linux/Makefile: Restored '-' in per-module recipes in the GAs, applied that to the host side too. (Don't know why this instictively looks weird, but using dashes in recipes rather than underscores seems to be what the GNU guys are doing too. Underscores are for variabels.)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.7 KB
Line 
1#
2# Makefile for the VirtualBox Linux Host Drivers.
3#
4
5#
6# Copyright (C) 2008-2020 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 \
49 vboxdrv vboxnetflt vboxnetadp vboxpci \
50 install-vboxdrv install-vboxnetflt install-vboxnetadp install-vboxpci \
51 clean-vboxdrv clean-vboxnetflt clean-vboxnetadp clean-vboxpci
52
53all: vboxdrv vboxnetflt vboxnetadp vboxpci
54
55# We want to build on Linux 2.6.18 and later kernels.
56ifneq ($(filter-out 1.% 2.0.% 2.1.% 2.2.% 2.3.% 2.4.% 2.5.%,$(KERN_VER)),)
57
58vboxdrv:
59 @echo "=== Building 'vboxdrv' module ==="
60 +@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv
61 @cp vboxdrv/vboxdrv.ko .
62 @echo
63
64vboxnetflt: vboxdrv
65 +@if [ -d vboxnetflt ]; then \
66 if [ -f vboxdrv/Module.symvers ]; then \
67 cp vboxdrv/Module.symvers vboxnetflt; \
68 fi; \
69 echo "=== Building 'vboxnetflt' module ==="; \
70 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxnetflt/Module.symvers) -C vboxnetflt || exit 1; \
71 cp vboxnetflt/vboxnetflt.ko .; \
72 echo; \
73 fi
74
75vboxnetadp: vboxdrv
76 +@if [ -d vboxnetadp ]; then \
77 if [ -f vboxdrv/Module.symvers ]; then \
78 cp vboxdrv/Module.symvers vboxnetadp; \
79 fi; \
80 echo "=== Building 'vboxnetadp' module ==="; \
81 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxnetadp/Module.symvers) -C vboxnetadp || exit 1; \
82 cp vboxnetadp/vboxnetadp.ko .; \
83 echo; \
84 fi
85
86vboxpci: vboxdrv
87 +@if [ -d vboxpci ]; then \
88 if [ -f vboxdrv/Module.symvers ]; then \
89 cp vboxdrv/Module.symvers vboxpci; \
90 fi; \
91 echo "=== Building 'vboxpci' module ==="; \
92 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxpci/Module.symvers) -C vboxpci || exit 1; \
93 cp vboxpci/vboxpci.ko .; \
94 echo; \
95 fi
96
97install-vboxdrv:
98 +@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
99
100install-vboxnetflt:
101 +@if [ -d vboxnetflt ]; then \
102 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
103 fi
104
105install-vboxnetadp:
106 +@if [ -d vboxnetadp ]; then \
107 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
108 fi
109
110install-vboxpci:
111 +@if [ -d vboxpci ]; then \
112 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci install; \
113 fi
114
115install: install-vboxdrv install-vboxnetflt install-vboxnetadp install-vboxpci
116
117else
118
119vboxdrv:
120vboxnetflt:
121vboxnetadp:
122vboxpci:
123install:
124
125endif
126
127clean-vboxdrv:
128 +@$(MAKE) -C vboxdrv clean
129 rm -rf vboxdrv.ko
130
131clean-vboxnetflt:
132 +@if [ -d vboxnetflt ]; then \
133 $(MAKE) -C vboxnetflt clean; \
134 fi
135 rm -rf vboxnetflt.ko
136
137clean-vboxnetadp:
138 +@if [ -d vboxnetadp ]; then \
139 $(MAKE) -C vboxnetadp clean; \
140 fi
141 rm -rf vboxnetadp.ko
142
143clean-vboxpci:
144 +@if [ -d vboxpci ]; then \
145 $(MAKE) -C vboxpci clean; \
146 fi
147 rm -f vboxpci.ko
148
149clean: clean-vboxdrv clean-vboxnetflt clean-vboxnetadp clean-vboxpci
150
151check:
152 +@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv check
153
154unload:
155 @for module in vboxpci vboxnetadp vboxnetflt vboxdrv; do \
156 if grep "^$$module " /proc/modules >/dev/null; then \
157 echo "Removing previously installed $$module module"; \
158 /sbin/rmmod $$module; \
159 fi; \
160 done
161
162load: unload
163 @for module in vboxdrv vboxnetflt vboxnetadp vboxpci; do \
164 if test -f $$module.ko; then \
165 echo "Installing $$module module"; \
166 /sbin/insmod $$module.ko; \
167 fi; \
168 done
169
170endif # ! 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