1 | #
|
---|
2 | # Makefile for the VirtualBox Linux Guest Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | # Copyright (C) 2009-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 |
|
---|
17 | ifneq ($(KBUILD_EXTMOD),)
|
---|
18 |
|
---|
19 | # Building from kBuild (make -C <kernel_directory> M=`pwd`).
|
---|
20 | # KBUILD_EXTMOD is set to $(M) in this case.
|
---|
21 |
|
---|
22 | obj-m = vboxguest/ vboxsf/ vboxvideo/
|
---|
23 |
|
---|
24 | else # ! KBUILD_EXTMOD
|
---|
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 | vboxguest:
|
---|
36 | @echo "=== Building 'vboxguest' module ==="
|
---|
37 | $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
|
---|
38 | $(VBOX_QUIET_SH)if [ -f vboxguest/vboxguest.ko ]; then \
|
---|
39 | cp vboxguest/vboxguest.ko .; \
|
---|
40 | else \
|
---|
41 | cp vboxguest/vboxguest.o .; \
|
---|
42 | fi
|
---|
43 | @echo
|
---|
44 |
|
---|
45 | vboxsf: vboxguest
|
---|
46 | $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
47 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
48 | cp vboxguest/Module.symvers vboxsf; \
|
---|
49 | fi; \
|
---|
50 | echo "=== Building 'vboxsf' module ==="; \
|
---|
51 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf || exit 1; \
|
---|
52 | if [ -f vboxsf/vboxsf.ko ]; then \
|
---|
53 | cp vboxsf/vboxsf.ko .; \
|
---|
54 | else \
|
---|
55 | cp vboxsf/vboxsf.o .; \
|
---|
56 | fi; \
|
---|
57 | echo; \
|
---|
58 | fi
|
---|
59 |
|
---|
60 | vboxvideo:
|
---|
61 | $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
62 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
63 | cp vboxguest/Module.symvers vboxvideo; \
|
---|
64 | fi; \
|
---|
65 | echo "=== Building 'vboxvideo' module ==="; \
|
---|
66 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || exit 1; \
|
---|
67 | if [ -f vboxvideo/vboxvideo.ko ]; then \
|
---|
68 | cp vboxvideo/vboxvideo.ko .; \
|
---|
69 | elif [ -f vboxvideo/vboxvideo.o ]; then \
|
---|
70 | cp vboxvideo/vboxvideo.o .; \
|
---|
71 | fi; \
|
---|
72 | echo; \
|
---|
73 | fi
|
---|
74 |
|
---|
75 | all: vboxguest vboxsf vboxvideo
|
---|
76 |
|
---|
77 | install:
|
---|
78 | $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
|
---|
79 | $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
80 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
|
---|
81 | fi
|
---|
82 | $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
83 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
|
---|
84 | fi
|
---|
85 |
|
---|
86 | clean:
|
---|
87 | $(VBOX_QUIET)$(MAKE) -C vboxguest clean
|
---|
88 | $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
|
---|
89 | $(MAKE) -C vboxsf clean; \
|
---|
90 | fi
|
---|
91 | $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
|
---|
92 | $(MAKE) -C vboxvideo clean; \
|
---|
93 | fi
|
---|
94 | rm -f vboxguest.*o vboxsf.*o vboxvideo.*o
|
---|
95 |
|
---|
96 | check:
|
---|
97 | $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
|
---|
98 |
|
---|
99 | load:
|
---|
100 | $(VBOX_QUIET)/sbin/rmmod vboxvideo || true
|
---|
101 | $(VBOX_QUIET)/sbin/rmmod vboxvfs || true
|
---|
102 | $(VBOX_QUIET)/sbin/rmmod vboxsf || true
|
---|
103 | $(VBOX_QUIET)/sbin/rmmod vboxguest || true
|
---|
104 | $(VBOX_QUIET)/sbin/insmod vboxguest.ko
|
---|
105 | $(VBOX_QUIET)if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
|
---|
106 | $(VBOX_QUIET)if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
|
---|
107 |
|
---|
108 | .PHONY: vboxguest vboxsf vboxvideo all install clean check load
|
---|
109 |
|
---|
110 | endif # ! KBUILD_EXTMOD
|
---|