1 | #
|
---|
2 | # Makefile for the VirtualBox Linux Guest Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | # Copyright (C) 2009-2017 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 |
|
---|
28 | all:
|
---|
29 | @echo "=== Building 'vboxguest' module ==="
|
---|
30 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
|
---|
31 | @if [ -f vboxguest/vboxguest.ko ]; then \
|
---|
32 | cp vboxguest/vboxguest.ko .; \
|
---|
33 | else \
|
---|
34 | cp vboxguest/vboxguest.o .; \
|
---|
35 | fi
|
---|
36 | @echo
|
---|
37 | @if [ -d vboxsf ]; then \
|
---|
38 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
39 | cp vboxguest/Module.symvers vboxsf; \
|
---|
40 | fi; \
|
---|
41 | echo "=== Building 'vboxsf' module ==="; \
|
---|
42 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf || exit 1; \
|
---|
43 | if [ -f vboxsf/vboxsf.ko ]; then \
|
---|
44 | cp vboxsf/vboxsf.ko .; \
|
---|
45 | else \
|
---|
46 | cp vboxsf/vboxsf.o .; \
|
---|
47 | fi; \
|
---|
48 | echo; \
|
---|
49 | fi
|
---|
50 | @if [ -d vboxvideo ]; then \
|
---|
51 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
52 | cp vboxguest/Module.symvers vboxvideo; \
|
---|
53 | fi; \
|
---|
54 | echo "=== Building 'vboxvideo' module ==="; \
|
---|
55 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || exit 1; \
|
---|
56 | if [ -f vboxvideo/vboxvideo.ko ]; then \
|
---|
57 | cp vboxvideo/vboxvideo.ko .; \
|
---|
58 | elif [ -f vboxvideo/vboxvideo.o ]; then \
|
---|
59 | cp vboxvideo/vboxvideo.o .; \
|
---|
60 | fi; \
|
---|
61 | echo; \
|
---|
62 | fi
|
---|
63 |
|
---|
64 | install:
|
---|
65 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
|
---|
66 | @if [ -d vboxsf ]; then \
|
---|
67 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
|
---|
68 | fi
|
---|
69 | @if [ -d vboxvideo ]; then \
|
---|
70 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
|
---|
71 | fi
|
---|
72 |
|
---|
73 | clean:
|
---|
74 | @$(MAKE) -C vboxguest clean
|
---|
75 | @if [ -d vboxsf ]; then \
|
---|
76 | $(MAKE) -C vboxsf clean; \
|
---|
77 | fi
|
---|
78 | @if [ -d vboxvideo ]; then \
|
---|
79 | $(MAKE) -C vboxvideo clean; \
|
---|
80 | fi
|
---|
81 | rm -f vboxguest.*o vboxsf.*o vboxvideo.*o
|
---|
82 |
|
---|
83 | check:
|
---|
84 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
|
---|
85 |
|
---|
86 | load:
|
---|
87 | @/sbin/rmmod vboxvideo || true
|
---|
88 | @/sbin/rmmod vboxvfs || true
|
---|
89 | @/sbin/rmmod vboxsf || true
|
---|
90 | @/sbin/rmmod vboxguest || true
|
---|
91 | @/sbin/insmod vboxguest.ko
|
---|
92 | @if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
|
---|
93 | @if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
|
---|
94 |
|
---|
95 | endif # ! KBUILD_EXTMOD
|
---|