1 | #
|
---|
2 | # Makefile for the VirtualBox Linux Host Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | #
|
---|
7 | # Copyright (C) 2008-2010 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | ifneq ($(KBUILD_EXTMOD),)
|
---|
19 |
|
---|
20 | # DKMS
|
---|
21 |
|
---|
22 | obj-m = vboxdrv/
|
---|
23 | ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxnetflt/Makefile),)
|
---|
24 | obj-m += vboxnetflt/
|
---|
25 | endif
|
---|
26 | ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxnetadp/Makefile),)
|
---|
27 | obj-m += vboxnetadp/
|
---|
28 | endif
|
---|
29 |
|
---|
30 | else # ! KBUILD_EXTMOD
|
---|
31 |
|
---|
32 | # convenience Makefile without DKMS
|
---|
33 |
|
---|
34 | KBUILD_VERBOSE =
|
---|
35 |
|
---|
36 | all:
|
---|
37 | @echo "*** Building 'vboxdrv' module ***"
|
---|
38 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv
|
---|
39 | @cp vboxdrv/vboxdrv.ko .
|
---|
40 | @echo
|
---|
41 | @if [ -d vboxnetflt ]; then \
|
---|
42 | if [ -f vboxdrv/Module.symvers ]; then \
|
---|
43 | cp vboxdrv/Module.symvers vboxnetflt; \
|
---|
44 | fi; \
|
---|
45 | echo "*** Building 'vboxnetflt' module ***"; \
|
---|
46 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt; \
|
---|
47 | cp vboxnetflt/vboxnetflt.ko .; \
|
---|
48 | echo; \
|
---|
49 | fi
|
---|
50 | @if [ -d vboxnetadp ]; then \
|
---|
51 | if [ -f vboxdrv/Module.symvers ]; then \
|
---|
52 | cp vboxdrv/Module.symvers vboxnetadp; \
|
---|
53 | fi; \
|
---|
54 | echo "*** Building 'vboxnetadp' module ***"; \
|
---|
55 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp; \
|
---|
56 | cp vboxnetadp/vboxnetadp.ko .; \
|
---|
57 | echo; \
|
---|
58 | fi
|
---|
59 |
|
---|
60 |
|
---|
61 | install:
|
---|
62 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
|
---|
63 | @if [ -d vboxnetflt ]; then \
|
---|
64 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
|
---|
65 | fi
|
---|
66 | @if [ -d vboxnetadp ]; then \
|
---|
67 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
|
---|
68 | fi
|
---|
69 |
|
---|
70 | clean:
|
---|
71 | @$(MAKE) -C vboxdrv clean
|
---|
72 | @if [ -d vboxnetflt ]; then \
|
---|
73 | $(MAKE) -C vboxnetflt clean; \
|
---|
74 | fi
|
---|
75 | @if [ -d vboxnetadp ]; then \
|
---|
76 | $(MAKE) -C vboxnetadp clean; \
|
---|
77 | fi
|
---|
78 | rm -f vboxdrv.ko vboxnetflt.ko vboxnetadp.ko
|
---|
79 |
|
---|
80 | unload:
|
---|
81 | @for module in vboxnetadp vboxnetflt vboxdrv; do \
|
---|
82 | if grep "^$$module " /proc/modules >/dev/null; then \
|
---|
83 | echo "Removing previously installed $$module module"; \
|
---|
84 | /sbin/rmmod $$module; \
|
---|
85 | fi; \
|
---|
86 | done
|
---|
87 |
|
---|
88 | load: unload
|
---|
89 | @for module in vboxdrv vboxnetflt vboxnetadp; do \
|
---|
90 | if test -f $$module.ko; then \
|
---|
91 | echo "Installing $$module module"; \
|
---|
92 | /sbin/insmod $$module.ko; \
|
---|
93 | fi; \
|
---|
94 | done
|
---|
95 |
|
---|
96 | endif # ! KBUILD_EXTMOD
|
---|