1 | #
|
---|
2 | # Makefile for the VirtualBox FreeBSD Host Drivers.
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | # Copyright (C) 2008-2023 Oracle and/or its affiliates.
|
---|
7 | #
|
---|
8 | # This file is part of VirtualBox base platform packages, as
|
---|
9 | # available from https://www.virtualbox.org.
|
---|
10 | #
|
---|
11 | # This program is free software; you can redistribute it and/or
|
---|
12 | # modify it under the terms of the GNU General Public License
|
---|
13 | # as published by the Free Software Foundation, in version 3 of the
|
---|
14 | # License.
|
---|
15 | #
|
---|
16 | # This program is distributed in the hope that it will be useful, but
|
---|
17 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | # General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | #
|
---|
24 | # The contents of this file may alternatively be used under the terms
|
---|
25 | # of the Common Development and Distribution License Version 1.0
|
---|
26 | # (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | # in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | # CDDL are applicable instead of those of the GPL.
|
---|
29 | #
|
---|
30 | # You may elect to license modified versions of this file under the
|
---|
31 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | #
|
---|
33 | # SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | #
|
---|
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 |
|
---|
62 |
|
---|
63 | install:
|
---|
64 | @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
|
---|
65 | @if [ -d vboxnetflt ]; then \
|
---|
66 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
|
---|
67 | fi
|
---|
68 | @if [ -d vboxnetadp ]; then \
|
---|
69 | $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
|
---|
70 | fi
|
---|
71 |
|
---|
72 | clean:
|
---|
73 | @$(MAKE) -C vboxdrv clean
|
---|
74 | @if [ -d vboxnetflt ]; then \
|
---|
75 | $(MAKE) -C vboxnetflt clean; \
|
---|
76 | fi
|
---|
77 | @if [ -d vboxnetadp ]; then \
|
---|
78 | $(MAKE) -C vboxnetadp clean; \
|
---|
79 | fi
|
---|
80 | rm -f vboxdrv.ko vboxnetflt.ko vboxnetadp.ko
|
---|
81 |
|
---|
82 | load:
|
---|
83 | @for module in vboxnetadp vboxnetflt vboxdrv; do \
|
---|
84 | if kldstat -n "$$module" >/dev/null; then \
|
---|
85 | echo "Removing previously installed $$module module"; \
|
---|
86 | /sbin/kldunload $$module; \
|
---|
87 | fi; \
|
---|
88 | done
|
---|
89 | @for module in vboxdrv vboxnetflt vboxnetadp; do \
|
---|
90 | if test -f $$module.ko; then \
|
---|
91 | echo "Installing $$module module"; \
|
---|
92 | /sbin/kldload ./$$module.ko; \
|
---|
93 | fi; \
|
---|
94 | done
|
---|