VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/Makefile@ 74731

Last change on this file since 74731 was 74731, checked in by vboxsync, 6 years ago

Additions/linux/Makefile: allow building individual modules for faster testing.
bugref:4567: Linux kernel driver maintenance
This makefile is used in Additions drivers tarballs and for quick test builds
of kernel modules. Especially in the second case it can save time to build
a specific module under a range of kernels and distributions rather than all
modules.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.8 KB
Line 
1#
2# Makefile for the VirtualBox Linux Guest Drivers.
3#
4
5#
6# Copyright (C) 2009-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
17ifneq ($(KBUILD_EXTMOD),)
18
19# Building from kBuild (make -C <kernel_directory> M=`pwd`).
20# KBUILD_EXTMOD is set to $(M) in this case.
21
22obj-m = vboxguest/ vboxsf/ vboxvideo/
23
24else # ! KBUILD_EXTMOD
25
26KBUILD_VERBOSE =
27
28vboxguest:
29 @echo "=== Building 'vboxguest' module ==="
30 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
31 @if [ -f vboxguest/vboxguest.ko ]; then \
32 cp vboxguest/vboxguest.ko .; \
33 else \
34 cp vboxguest/vboxguest.o .; \
35 fi
36 @echo
37
38vboxsf: vboxguest
39 @if [ -d vboxsf ]; then \
40 if [ -f vboxguest/Module.symvers ]; then \
41 cp vboxguest/Module.symvers vboxsf; \
42 fi; \
43 echo "=== Building 'vboxsf' module ==="; \
44 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf || exit 1; \
45 if [ -f vboxsf/vboxsf.ko ]; then \
46 cp vboxsf/vboxsf.ko .; \
47 else \
48 cp vboxsf/vboxsf.o .; \
49 fi; \
50 echo; \
51 fi
52
53vboxvideo:
54 @if [ -d vboxvideo ]; then \
55 if [ -f vboxguest/Module.symvers ]; then \
56 cp vboxguest/Module.symvers vboxvideo; \
57 fi; \
58 echo "=== Building 'vboxvideo' module ==="; \
59 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || exit 1; \
60 if [ -f vboxvideo/vboxvideo.ko ]; then \
61 cp vboxvideo/vboxvideo.ko .; \
62 elif [ -f vboxvideo/vboxvideo.o ]; then \
63 cp vboxvideo/vboxvideo.o .; \
64 fi; \
65 echo; \
66 fi
67
68all: vboxguest vboxsf vboxvideo
69
70install:
71 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
72 @if [ -d vboxsf ]; then \
73 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
74 fi
75 @if [ -d vboxvideo ]; then \
76 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
77 fi
78
79clean:
80 @$(MAKE) -C vboxguest clean
81 @if [ -d vboxsf ]; then \
82 $(MAKE) -C vboxsf clean; \
83 fi
84 @if [ -d vboxvideo ]; then \
85 $(MAKE) -C vboxvideo clean; \
86 fi
87 rm -f vboxguest.*o vboxsf.*o vboxvideo.*o
88
89check:
90 @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
91
92load:
93 @/sbin/rmmod vboxvideo || true
94 @/sbin/rmmod vboxvfs || true
95 @/sbin/rmmod vboxsf || true
96 @/sbin/rmmod vboxguest || true
97 @/sbin/insmod vboxguest.ko
98 @if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
99 @if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
100
101.PHONY: vboxguest vboxsf vboxvideo all install clean check load
102
103endif # ! KBUILD_EXTMOD
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use