1 | #
|
---|
2 | # Makefile for the VirtualBox Linux Host Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | #
|
---|
7 | # Copyright (C) 2008-2011 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 | ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxpci/Makefile),)
|
---|
30 | obj-m += vboxpci/
|
---|
31 | endif
|
---|
32 | else # ! KBUILD_EXTMOD
|
---|
33 |
|
---|
34 | # convenience Makefile without DKMS
|
---|
35 |
|
---|
36 | KBUILD_VERBOSE =
|
---|
37 |
|
---|
38 | all:
|
---|
39 | @echo "*** Building 'vboxdrv' module ***"
|
---|
40 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv
|
---|
41 | @cp vboxdrv/vboxdrv.ko .
|
---|
42 | @echo
|
---|
43 | @if [ -d vboxnetflt ]; then \
|
---|
44 | if [ -f vboxdrv/Module.symvers ]; then \
|
---|
45 | cp vboxdrv/Module.symvers vboxnetflt; \
|
---|
46 | fi; \
|
---|
47 | echo "*** Building 'vboxnetflt' module ***"; \
|
---|
48 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt; \
|
---|
49 | cp vboxnetflt/vboxnetflt.ko .; \
|
---|
50 | echo; \
|
---|
51 | fi
|
---|
52 | @if [ -d vboxnetadp ]; then \
|
---|
53 | if [ -f vboxdrv/Module.symvers ]; then \
|
---|
54 | cp vboxdrv/Module.symvers vboxnetadp; \
|
---|
55 | fi; \
|
---|
56 | echo "*** Building 'vboxnetadp' module ***"; \
|
---|
57 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp; \
|
---|
58 | cp vboxnetadp/vboxnetadp.ko .; \
|
---|
59 | echo; \
|
---|
60 | fi
|
---|
61 | @if [ -d vboxpci ]; then \
|
---|
62 | if [ -f vboxdrv/Module.symvers ]; then \
|
---|
63 | cp vboxdrv/Module.symvers vboxpci; \
|
---|
64 | fi; \
|
---|
65 | echo "*** Building 'vboxpci' module ***"; \
|
---|
66 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci; \
|
---|
67 | cp vboxpci/vboxpci.ko .; \
|
---|
68 | echo; \
|
---|
69 | fi
|
---|
70 |
|
---|
71 | install:
|
---|
72 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
|
---|
73 | @if [ -d vboxnetflt ]; then \
|
---|
74 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
|
---|
75 | fi
|
---|
76 | @if [ -d vboxnetadp ]; then \
|
---|
77 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
|
---|
78 | fi
|
---|
79 | @if [ -d vboxpci ]; then \
|
---|
80 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci install; \
|
---|
81 | fi
|
---|
82 |
|
---|
83 | clean:
|
---|
84 | @$(MAKE) -C vboxdrv clean
|
---|
85 | @if [ -d vboxnetflt ]; then \
|
---|
86 | $(MAKE) -C vboxnetflt clean; \
|
---|
87 | fi
|
---|
88 | @if [ -d vboxnetadp ]; then \
|
---|
89 | $(MAKE) -C vboxnetadp clean; \
|
---|
90 | fi
|
---|
91 | @if [ -d vboxpci ]; then \
|
---|
92 | $(MAKE) -C vboxpci clean; \
|
---|
93 | fi
|
---|
94 | rm -f vboxdrv.ko vboxnetflt.ko vboxnetadp.ko vboxpci.ko
|
---|
95 |
|
---|
96 | check:
|
---|
97 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv check
|
---|
98 |
|
---|
99 | unload:
|
---|
100 | @for module in vboxpci vboxnetadp vboxnetflt vboxdrv; do \
|
---|
101 | if grep "^$$module " /proc/modules >/dev/null; then \
|
---|
102 | echo "Removing previously installed $$module module"; \
|
---|
103 | /sbin/rmmod $$module; \
|
---|
104 | fi; \
|
---|
105 | done
|
---|
106 |
|
---|
107 | load: unload
|
---|
108 | @for module in vboxdrv vboxnetflt vboxnetadp vboxpci; do \
|
---|
109 | if test -f $$module.ko; then \
|
---|
110 | echo "Installing $$module module"; \
|
---|
111 | /sbin/insmod $$module.ko; \
|
---|
112 | fi; \
|
---|
113 | done
|
---|
114 |
|
---|
115 | endif # ! KBUILD_EXTMOD
|
---|