VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/linux/Makefile@ 73020

Last change on this file since 73020 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.7 KB
Line 
1#
2# Makefile for the VirtualBox Linux Host Drivers.
3#
4
5#
6# Copyright (C) 2008-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# The contents of this file may alternatively be used under the terms
17# of the Common Development and Distribution License Version 1.0
18# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19# VirtualBox OSE distribution, in which case the provisions of the
20# CDDL are applicable instead of those of the GPL.
21#
22# You may elect to license modified versions of this file under the
23# terms and conditions of either the GPL or the CDDL or both.
24#
25
26ifneq ($(KBUILD_EXTMOD),)
27
28# Building from kBuild (make -C <kernel_directory> M=`pwd`).
29# KBUILD_EXTMOD is set to $(M) in this case.
30
31obj-m = vboxdrv/
32ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxnetflt/Makefile),)
33 obj-m += vboxnetflt/
34endif
35ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxnetadp/Makefile),)
36 obj-m += vboxnetadp/
37endif
38ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxpci/Makefile),)
39 obj-m += vboxpci/
40endif
41else # ! KBUILD_EXTMOD
42
43# convenience Makefile without KBUILD_EXTMOD
44
45KBUILD_VERBOSE =
46
47all:
48 @echo "=== Building 'vboxdrv' module ==="
49 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv
50 @cp vboxdrv/vboxdrv.ko .
51 @echo
52 @if [ -d vboxnetflt ]; then \
53 if [ -f vboxdrv/Module.symvers ]; then \
54 cp vboxdrv/Module.symvers vboxnetflt; \
55 fi; \
56 echo "=== Building 'vboxnetflt' module ==="; \
57 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt || exit 1; \
58 cp vboxnetflt/vboxnetflt.ko .; \
59 echo; \
60 fi
61 @if [ -d vboxnetadp ]; then \
62 if [ -f vboxdrv/Module.symvers ]; then \
63 cp vboxdrv/Module.symvers vboxnetadp; \
64 fi; \
65 echo "=== Building 'vboxnetadp' module ==="; \
66 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp || exit 1; \
67 cp vboxnetadp/vboxnetadp.ko .; \
68 echo; \
69 fi
70 @if [ -d vboxpci ]; then \
71 if [ -f vboxdrv/Module.symvers ]; then \
72 cp vboxdrv/Module.symvers vboxpci; \
73 fi; \
74 echo "=== Building 'vboxpci' module ==="; \
75 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci || exit 1; \
76 cp vboxpci/vboxpci.ko .; \
77 echo; \
78 fi
79
80install:
81 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
82 @if [ -d vboxnetflt ]; then \
83 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
84 fi
85 @if [ -d vboxnetadp ]; then \
86 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
87 fi
88 @if [ -d vboxpci ]; then \
89 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci install; \
90 fi
91
92clean:
93 @$(MAKE) -C vboxdrv clean
94 @if [ -d vboxnetflt ]; then \
95 $(MAKE) -C vboxnetflt clean; \
96 fi
97 @if [ -d vboxnetadp ]; then \
98 $(MAKE) -C vboxnetadp clean; \
99 fi
100 @if [ -d vboxpci ]; then \
101 $(MAKE) -C vboxpci clean; \
102 fi
103 rm -f vboxdrv.ko vboxnetflt.ko vboxnetadp.ko vboxpci.ko
104
105check:
106 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv check
107
108unload:
109 @for module in vboxpci vboxnetadp vboxnetflt vboxdrv; do \
110 if grep "^$$module " /proc/modules >/dev/null; then \
111 echo "Removing previously installed $$module module"; \
112 /sbin/rmmod $$module; \
113 fi; \
114 done
115
116load: unload
117 @for module in vboxdrv vboxnetflt vboxnetadp vboxpci; do \
118 if test -f $$module.ko; then \
119 echo "Installing $$module module"; \
120 /sbin/insmod $$module.ko; \
121 fi; \
122 done
123
124endif # ! KBUILD_EXTMOD
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette