[14546] | 1 | #
|
---|
[15816] | 2 | # Makefile for the VirtualBox Linux Guest Drivers.
|
---|
[14546] | 3 | #
|
---|
| 4 |
|
---|
| 5 | #
|
---|
[69500] | 6 | # Copyright (C) 2009-2017 Oracle Corporation
|
---|
[14546] | 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 |
|
---|
[32183] | 17 | ifneq ($(KBUILD_EXTMOD),)
|
---|
| 18 |
|
---|
[57969] | 19 | # Building from kBuild (make -C <kernel_directory> M=`pwd`).
|
---|
| 20 | # KBUILD_EXTMOD is set to $(M) in this case.
|
---|
[32183] | 21 |
|
---|
| 22 | obj-m = vboxguest/ vboxsf/ vboxvideo/
|
---|
| 23 |
|
---|
| 24 | else # ! KBUILD_EXTMOD
|
---|
| 25 |
|
---|
[14655] | 26 | KBUILD_VERBOSE =
|
---|
| 27 |
|
---|
[14546] | 28 | all:
|
---|
[66222] | 29 | @echo "=== Building 'vboxguest' module ==="
|
---|
[21412] | 30 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
|
---|
[21417] | 31 | @if [ -f vboxguest/vboxguest.ko ]; then \
|
---|
| 32 | cp vboxguest/vboxguest.ko .; \
|
---|
| 33 | else \
|
---|
| 34 | cp vboxguest/vboxguest.o .; \
|
---|
| 35 | fi
|
---|
[14546] | 36 | @echo
|
---|
[28998] | 37 | @if [ -d vboxsf ]; then \
|
---|
[21412] | 38 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
[28998] | 39 | cp vboxguest/Module.symvers vboxsf; \
|
---|
[14546] | 40 | fi; \
|
---|
[66222] | 41 | echo "=== Building 'vboxsf' module ==="; \
|
---|
[66077] | 42 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf || exit 1; \
|
---|
[28998] | 43 | if [ -f vboxsf/vboxsf.ko ]; then \
|
---|
| 44 | cp vboxsf/vboxsf.ko .; \
|
---|
[21416] | 45 | else \
|
---|
[28998] | 46 | cp vboxsf/vboxsf.o .; \
|
---|
[21416] | 47 | fi; \
|
---|
[41448] | 48 | echo; \
|
---|
[14546] | 49 | fi
|
---|
[33183] | 50 | @if [ -d vboxvideo ]; then \
|
---|
| 51 | if [ -f vboxguest/Module.symvers ]; then \
|
---|
| 52 | cp vboxguest/Module.symvers vboxvideo; \
|
---|
| 53 | fi; \
|
---|
[66222] | 54 | echo "=== Building 'vboxvideo' module ==="; \
|
---|
[66094] | 55 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || exit 1; \
|
---|
[33183] | 56 | if [ -f vboxvideo/vboxvideo.ko ]; then \
|
---|
| 57 | cp vboxvideo/vboxvideo.ko .; \
|
---|
[66077] | 58 | elif [ -f vboxvideo/vboxvideo.o ]; then \
|
---|
[33183] | 59 | cp vboxvideo/vboxvideo.o .; \
|
---|
| 60 | fi; \
|
---|
[41448] | 61 | echo; \
|
---|
[33183] | 62 | fi
|
---|
[14546] | 63 |
|
---|
[14865] | 64 | install:
|
---|
[21412] | 65 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
|
---|
[28998] | 66 | @if [ -d vboxsf ]; then \
|
---|
| 67 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
|
---|
[14865] | 68 | fi
|
---|
[33183] | 69 | @if [ -d vboxvideo ]; then \
|
---|
| 70 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
|
---|
| 71 | fi
|
---|
[14865] | 72 |
|
---|
[14546] | 73 | clean:
|
---|
[21412] | 74 | @$(MAKE) -C vboxguest clean
|
---|
[28998] | 75 | @if [ -d vboxsf ]; then \
|
---|
| 76 | $(MAKE) -C vboxsf clean; \
|
---|
[14546] | 77 | fi
|
---|
[33183] | 78 | @if [ -d vboxvideo ]; then \
|
---|
| 79 | $(MAKE) -C vboxvideo clean; \
|
---|
| 80 | fi
|
---|
| 81 | rm -f vboxguest.*o vboxsf.*o vboxvideo.*o
|
---|
[14546] | 82 |
|
---|
[36190] | 83 | check:
|
---|
| 84 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
|
---|
| 85 |
|
---|
[14865] | 86 | load:
|
---|
[33183] | 87 | @/sbin/rmmod vboxvideo || true
|
---|
[28999] | 88 | @/sbin/rmmod vboxvfs || true
|
---|
[28998] | 89 | @/sbin/rmmod vboxsf || true
|
---|
[21412] | 90 | @/sbin/rmmod vboxguest || true
|
---|
| 91 | @/sbin/insmod vboxguest.ko
|
---|
[28998] | 92 | @if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
|
---|
[33183] | 93 | @if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
|
---|
[32183] | 94 |
|
---|
| 95 | endif # ! KBUILD_EXTMOD
|
---|