1 | #
|
---|
2 | # Makefile for the VirtualBox Linux Guest Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | # Copyright (C) 2009-2022 Oracle and/or its affiliates.
|
---|
7 | #
|
---|
8 | # This file is part of VirtualBox base platform packages, as
|
---|
9 | # available from https://www.virtualbox.org.
|
---|
10 | #
|
---|
11 | # This program is free software; you can redistribute it and/or
|
---|
12 | # modify it under the terms of the GNU General Public License
|
---|
13 | # as published by the Free Software Foundation, in version 3 of the
|
---|
14 | # License.
|
---|
15 | #
|
---|
16 | # This program is distributed in the hope that it will be useful, but
|
---|
17 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | # General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | #
|
---|
24 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
25 | #
|
---|
26 |
|
---|
27 | ifneq ($(KERNELRELEASE),)
|
---|
28 |
|
---|
29 | # Building from kBuild (make -C <kernel_directory> M=`pwd`)
|
---|
30 | # or inside a kernel source tree.
|
---|
31 |
|
---|
32 | obj-m = vboxguest/ vboxsf/ vboxvideo/
|
---|
33 |
|
---|
34 | else # ! KERNELRELEASE
|
---|
35 |
|
---|
36 | KBUILD_VERBOSE =
|
---|
37 | ifeq ($(KBUILD_VERBOSE),)
|
---|
38 | VBOX_QUIET := @
|
---|
39 | VBOX_QUIET_SH := @
|
---|
40 | else
|
---|
41 | VBOX_QUIET :=
|
---|
42 | VBOX_QUIET_SH := set -x;
|
---|
43 | endif
|
---|
44 |
|
---|
45 | all: vboxguest vboxsf vboxvideo
|
---|
46 |
|
---|
47 | vboxguest:
|
---|
48 | @echo "=== Building 'vboxguest' module ==="
|
---|
49 | + $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
|
---|
50 | $(VBOX_QUIET_SH)if [ -f vboxguest/vboxguest.ko ]; then \
|
---|
51 | cp vboxguest/vboxguest.ko .; \
|
---|
52 | else \
|
---|
53 | cp vboxguest/vboxguest.o .; \
|
---|
54 | fi
|
---|
55 | @echo
|
---|
56 |
|
---|
57 | vboxsf: vboxguest
|
---|
58 | + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
59 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
60 | cp vboxguest/Module.symvers vboxsf; \
|
---|
61 | fi; \
|
---|
62 | echo "=== Building 'vboxsf' module ==="; \
|
---|
63 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxsf/Module.symvers) -C vboxsf || exit 1; \
|
---|
64 | if [ -f vboxsf/vboxsf.ko ]; then \
|
---|
65 | cp vboxsf/vboxsf.ko .; \
|
---|
66 | else \
|
---|
67 | cp vboxsf/vboxsf.o .; \
|
---|
68 | fi; \
|
---|
69 | echo; \
|
---|
70 | fi
|
---|
71 |
|
---|
72 | vboxvideo:
|
---|
73 | + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
74 | echo "=== Building 'vboxvideo' module ==="; \
|
---|
75 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || exit 1; \
|
---|
76 | if [ -f vboxvideo/vboxvideo.ko ]; then \
|
---|
77 | cp vboxvideo/vboxvideo.ko .; \
|
---|
78 | elif [ -f vboxvideo/vboxvideo.o ]; then \
|
---|
79 | cp vboxvideo/vboxvideo.o .; \
|
---|
80 | fi; \
|
---|
81 | echo; \
|
---|
82 | fi
|
---|
83 |
|
---|
84 | install-vboxguest:
|
---|
85 | + $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
|
---|
86 |
|
---|
87 | install-vboxsf:
|
---|
88 | + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
89 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
|
---|
90 | fi
|
---|
91 |
|
---|
92 | install-vboxvideo:
|
---|
93 | + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
94 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
|
---|
95 | fi
|
---|
96 |
|
---|
97 | install: install-vboxguest install-vboxsf install-vboxvideo
|
---|
98 |
|
---|
99 | clean-vboxguest:
|
---|
100 | + $(VBOX_QUIET)$(MAKE) -C vboxguest clean
|
---|
101 | rm -f vboxguest.*o
|
---|
102 |
|
---|
103 | clean-vboxsf:
|
---|
104 | + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
105 | $(MAKE) -C vboxsf clean; \
|
---|
106 | fi
|
---|
107 | rm -f vboxsf.*o
|
---|
108 |
|
---|
109 | clean-vboxvideo:
|
---|
110 | + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
111 | $(MAKE) -C vboxvideo clean; \
|
---|
112 | fi
|
---|
113 | rm -f vboxvideo.*o
|
---|
114 |
|
---|
115 | clean: clean-vboxguest clean-vboxsf clean-vboxvideo
|
---|
116 |
|
---|
117 | check:
|
---|
118 | $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
|
---|
119 |
|
---|
120 | unload:
|
---|
121 | $(VBOX_QUIET)/sbin/rmmod vboxvideo || true
|
---|
122 | $(VBOX_QUIET)/sbin/rmmod vboxvfs || true
|
---|
123 | $(VBOX_QUIET)/sbin/rmmod vboxsf || true
|
---|
124 | $(VBOX_QUIET)/sbin/rmmod vboxguest || true
|
---|
125 |
|
---|
126 | load: unload
|
---|
127 | $(VBOX_QUIET)/sbin/insmod vboxguest.ko
|
---|
128 | $(VBOX_QUIET)if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
|
---|
129 | $(VBOX_QUIET)if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
|
---|
130 |
|
---|
131 | .PHONY: all install clean check unload load \
|
---|
132 | vboxguest vboxsf vboxvideo \
|
---|
133 | install-vboxguest install-vboxsf install-vboxvideo \
|
---|
134 | clean-vboxguest clean-vboxsf clean-vboxvideo
|
---|
135 |
|
---|
136 | endif # ! KERNELRELEASE
|
---|