VirtualBox

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

Last change on this file since 85939 was 85939, checked in by vboxsync, 4 years ago

Additions/linux/Makefile, HostDrivers/linux/Makefile: Many cleanups in the Linux kernel module Makefiles, making them more uniform, and allow install of individual modules. Additionally, allow building of the kernel modules straight from the respective subdirectory (no dependencies across directories, so vboxdrv/vboxguest still needs to be built first, otherwise you end up with undefined symbols). Finally some parallelization improvements. At the top level still uses the Module.symvers copying and somewhat quirky KBUILD_EXTRA_SYMBOLS pointing to the copy, because this is backwards compatible to before KBUILD_EXTRA_SYMBOLS was invented.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.6 KB
Line 
1#
2# Makefile for the VirtualBox Linux Guest Drivers.
3#
4
5#
6# Copyright (C) 2009-2020 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 ($(KERNELRELEASE),)
18
19# Building from kBuild (make -C <kernel_directory> M=`pwd`)
20# or inside a kernel source tree.
21
22obj-m = vboxguest/ vboxsf/ vboxvideo/
23
24else # ! KERNELRELEASE
25
26KBUILD_VERBOSE =
27 ifeq ($(KBUILD_VERBOSE),)
28VBOX_QUIET := @
29VBOX_QUIET_SH := @
30 else
31VBOX_QUIET :=
32VBOX_QUIET_SH := set -x;
33 endif
34
35all: vboxguest vboxsf vboxvideo
36
37vboxguest:
38 @echo "=== Building 'vboxguest' module ==="
39 + $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest
40 $(VBOX_QUIET_SH)if [ -f vboxguest/vboxguest.ko ]; then \
41 cp vboxguest/vboxguest.ko .; \
42 else \
43 cp vboxguest/vboxguest.o .; \
44 fi
45 @echo
46
47vboxsf: vboxguest
48 + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
49 if [ -f vboxguest/Module.symvers ]; then \
50 cp vboxguest/Module.symvers vboxsf; \
51 fi; \
52 echo "=== Building 'vboxsf' module ==="; \
53 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxsf/Module.symvers) -C vboxsf || exit 1; \
54 if [ -f vboxsf/vboxsf.ko ]; then \
55 cp vboxsf/vboxsf.ko .; \
56 else \
57 cp vboxsf/vboxsf.o .; \
58 fi; \
59 echo; \
60 fi
61
62vboxvideo: vboxguest
63 + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
64 if [ -f vboxguest/Module.symvers ]; then \
65 cp vboxguest/Module.symvers vboxvideo; \
66 fi; \
67 echo "=== Building 'vboxvideo' module ==="; \
68 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) KBUILD_EXTRA_SYMBOLS=$(abspath vboxvideo/Module.symvers) -C vboxvideo || exit 1; \
69 if [ -f vboxvideo/vboxvideo.ko ]; then \
70 cp vboxvideo/vboxvideo.ko .; \
71 elif [ -f vboxvideo/vboxvideo.o ]; then \
72 cp vboxvideo/vboxvideo.o .; \
73 fi; \
74 echo; \
75 fi
76
77install_vboxguest:
78 + $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest install
79
80install_vboxsf:
81 + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
82 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf install; \
83 fi
84
85install_vboxvideo:
86 + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
87 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo install; \
88 fi
89
90install: install_vboxguest install_vboxsf install_vboxvideo
91
92clean_vboxguest:
93 + $(VBOX_QUIET)$(MAKE) -C vboxguest clean
94 rm -f vboxguest.*o
95
96clean_vboxsf:
97 + $(VBOX_QUIET_SH)if [ -d vboxsf ]; then \
98 $(MAKE) -C vboxsf clean; \
99 fi
100 rm -f vboxsf.*o
101
102clean_vboxvideo:
103 + $(VBOX_QUIET_SH)if [ -d vboxvideo ]; then \
104 $(MAKE) -C vboxvideo clean; \
105 fi
106 rm -f vboxvideo.*o
107
108clean: clean_vboxguest clean_vboxsf clean_vboxvideo
109
110check:
111 $(VBOX_QUIET)$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest check
112
113unload:
114 $(VBOX_QUIET)/sbin/rmmod vboxvideo || true
115 $(VBOX_QUIET)/sbin/rmmod vboxvfs || true
116 $(VBOX_QUIET)/sbin/rmmod vboxsf || true
117 $(VBOX_QUIET)/sbin/rmmod vboxguest || true
118
119load: unload
120 $(VBOX_QUIET)/sbin/insmod vboxguest.ko
121 $(VBOX_QUIET)if [ -f vboxsf.ko ]; then /sbin/insmod vboxsf.ko; fi
122 $(VBOX_QUIET)if [ -f vboxvideo.ko ]; then /sbin/insmod vboxvideo.ko; fi
123
124.PHONY: all install clean check unload load \
125 vboxguest vboxsf vboxvideo \
126 install_vboxguest install_vboxsf install_vboxvideo \
127 clean_vboxguest clean_vboxsf clean_vboxvideo
128
129endif # ! KERNELRELEASE
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