1 | #
|
---|
2 | # Makefile for the VirtualBox Linux Guest Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | # Copyright (C) 2009-2022 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 |
|
---|
17 | ifneq ($(KERNELRELEASE),)
|
---|
18 |
|
---|
19 | # Building from kBuild (make -C <kernel_directory> M=`pwd`)
|
---|
20 | # or inside a kernel source tree.
|
---|
21 |
|
---|
22 | obj-m = vboxguest/ vboxsf/ vboxvideo/
|
---|
23 |
|
---|
24 | else # ! KERNELRELEASE
|
---|
25 |
|
---|
26 | KBUILD_VERBOSE =
|
---|
27 | ifeq ($(KBUILD_VERBOSE),)
|
---|
28 | VBOX_QUIET := @
|
---|
29 | VBOX_QUIET_SH := @
|
---|
30 | else
|
---|
31 | VBOX_QUIET :=
|
---|
32 | VBOX_QUIET_SH := set -x;
|
---|
33 | endif
|
---|
34 |
|
---|
35 | all: vboxguest vboxsf vboxvideo
|
---|
36 |
|
---|
37 | vboxguest:
|
---|
38 | @echo "=== Building 'vboxguest' module ==="
|
---|
39 | + $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
|
---|
40 | $(VBOX_QUIET_SH)if [ -f vboxguest/vboxguest.ko ]; then \
|
---|
41 | cp vboxguest/vboxguest.ko .; \
|
---|
42 | else \
|
---|
43 | cp vboxguest/vboxguest.o .; \
|
---|
44 | fi
|
---|
45 | @echo
|
---|
46 |
|
---|
47 | vboxsf: vboxguest
|
---|
48 | + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
49 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
50 | cp vboxguest/Module.symvers vboxsf; \
|
---|
51 | fi; \
|
---|
52 | echo "=== Building 'vboxsf' module ==="; \
|
---|
53 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxsf/Module.symvers) -C vboxsf || exit 1; \
|
---|
54 | if [ -f vboxsf/vboxsf.ko ]; then \
|
---|
55 | cp vboxsf/vboxsf.ko .; \
|
---|
56 | else \
|
---|
57 | cp vboxsf/vboxsf.o .; \
|
---|
58 | fi; \
|
---|
59 | echo; \
|
---|
60 | fi
|
---|
61 |
|
---|
62 | vboxvideo:
|
---|
63 | + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
64 | echo "=== Building 'vboxvideo' module ==="; \
|
---|
65 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || exit 1; \
|
---|
66 | if [ -f vboxvideo/vboxvideo.ko ]; then \
|
---|
67 | cp vboxvideo/vboxvideo.ko .; \
|
---|
68 | elif [ -f vboxvideo/vboxvideo.o ]; then \
|
---|
69 | cp vboxvideo/vboxvideo.o .; \
|
---|
70 | fi; \
|
---|
71 | echo; \
|
---|
72 | fi
|
---|
73 |
|
---|
74 | install-vboxguest:
|
---|
75 | + $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
|
---|
76 |
|
---|
77 | install-vboxsf:
|
---|
78 | + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
79 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
|
---|
80 | fi
|
---|
81 |
|
---|
82 | install-vboxvideo:
|
---|
83 | + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
84 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
|
---|
85 | fi
|
---|
86 |
|
---|
87 | install: install-vboxguest install-vboxsf install-vboxvideo
|
---|
88 |
|
---|
89 | clean-vboxguest:
|
---|
90 | + $(VBOX_QUIET)$(MAKE) -C vboxguest clean
|
---|
91 | rm -f vboxguest.*o
|
---|
92 |
|
---|
93 | clean-vboxsf:
|
---|
94 | + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
95 | $(MAKE) -C vboxsf clean; \
|
---|
96 | fi
|
---|
97 | rm -f vboxsf.*o
|
---|
98 |
|
---|
99 | clean-vboxvideo:
|
---|
100 | + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
101 | $(MAKE) -C vboxvideo clean; \
|
---|
102 | fi
|
---|
103 | rm -f vboxvideo.*o
|
---|
104 |
|
---|
105 | clean: clean-vboxguest clean-vboxsf clean-vboxvideo
|
---|
106 |
|
---|
107 | check:
|
---|
108 | $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
|
---|
109 |
|
---|
110 | unload:
|
---|
111 | $(VBOX_QUIET)/sbin/rmmod vboxvideo || true
|
---|
112 | $(VBOX_QUIET)/sbin/rmmod vboxvfs || true
|
---|
113 | $(VBOX_QUIET)/sbin/rmmod vboxsf || true
|
---|
114 | $(VBOX_QUIET)/sbin/rmmod vboxguest || true
|
---|
115 |
|
---|
116 | load: unload
|
---|
117 | $(VBOX_QUIET)/sbin/insmod vboxguest.ko
|
---|
118 | $(VBOX_QUIET)if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
|
---|
119 | $(VBOX_QUIET)if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
|
---|
120 |
|
---|
121 | .PHONY: all install clean check unload load \
|
---|
122 | vboxguest vboxsf vboxvideo \
|
---|
123 | install-vboxguest install-vboxsf install-vboxvideo \
|
---|
124 | clean-vboxguest clean-vboxsf clean-vboxvideo
|
---|
125 |
|
---|
126 | endif # ! KERNELRELEASE
|
---|