]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - ubuntu/vbox/vboxsf/Makefile.include.footer
UBUNTU: ubuntu: vbox -- update to 5.2.2-dfsg-2
[mirror_ubuntu-bionic-kernel.git] / ubuntu / vbox / vboxsf / Makefile.include.footer
1 # $Id: Makefile.include.footer $
2 ## @file
3 # VirtualBox Guest Additions kernel module Makefile, common parts.
4 #
5 # See Makefile.include.header for details of how to use this.
6 #
7
8 #
9 # Copyright (C) 2006-2017 Oracle Corporation
10 #
11 # This file is part of VirtualBox Open Source Edition (OSE), as
12 # available from http://www.virtualbox.org. This file is free software;
13 # you can redistribute it and/or modify it under the terms of the GNU
14 # General Public License (GPL) as published by the Free Software
15 # Foundation, in version 2 as it comes in the "COPYING" file of the
16 # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 #
19
20 # override is required by the Debian guys
21 override MODULE = $(MOD_NAME)
22 OBJS = $(MOD_OBJS)
23
24 KBUILD_VERBOSE ?= 1
25 LINUX_VERBOSE = $(if $(KBUILD_VERBOSE),1,)
26
27 #
28 # Compiler options
29 #
30 ifndef INCL
31 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
32 ifndef KBUILD_EXTMOD
33 KBUILD_EXTMOD := $(shell pwd)
34 endif
35 INCL += $(MOD_INCL)
36 export INCL
37 endif
38 KFLAGS := -D__KERNEL__ -DMODULE $(MOD_DEFS)
39 ifeq ($(BUILD_TYPE),debug)
40 KFLAGS += -DDEBUG -DDEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) -DDEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
41 endif
42
43 ifeq ($(KERN_VERSION), 24)
44 #
45 # 2.4
46 #
47
48 # Note: while 2.4 kernels could also do "proper" builds from kbuild, the make
49 # script needed to support it was somewhat different from 2.6. Since this
50 # script works and 2.4 is not a moving target we will not try do do things the
51 # "proper" way.
52
53 ifeq ($(BUILD_TARGET_ARCH),amd64)
54 KFLAGS += -mcmodel=kernel
55 endif
56
57 CFLAGS := -O2 -DVBOX_LINUX_2_4 $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
58 MODULE_EXT := o
59
60 # 2.4 Module linking
61 $(MODULE).o: $(OBJS)
62 $(LD) -o $@ -r $(OBJS)
63
64 .PHONY: $(MODULE)
65 all: $(MODULE)
66 $(MODULE): $(MODULE).o
67
68 install: $(MODULE)
69 @mkdir -p $(MODULE_DIR); \
70 install -m 0644 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
71 PATH="$(PATH):/bin:/sbin" depmod -a;
72
73 clean:
74 for f in $(sort $(dir $(OBJS))); do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
75 rm -rf .$(MOD_NAME)* .tmp_ver* $(MOD_NAME).* Modules.symvers modules.order
76
77 else # ! $(KERN_VERSION), 24
78 #
79 # 2.6 and later
80 #
81
82 MODULE_EXT := ko
83
84 $(MODULE)-y := $(OBJS)
85
86 # build defs
87 EXTRA_CFLAGS += $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
88
89 .PHONY: $(MODULE)
90 all: $(MODULE)
91
92 obj-m += $(MODULE).o
93
94 JOBS := $(shell (getconf _NPROCESSORS_ONLN || grep -Ec '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
95 ifeq ($(JOBS),0)
96 JOBS := 1
97 endif
98
99 # OL/UEK: disable module signing for external modules -- we don't have any private key
100 $(MODULE):
101 $(MAKE) V=$(LINUX_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) $(if $(JOBS),-j$(JOBS),) modules
102
103 install: $(MODULE)
104 $(MAKE) V=$(LINUX_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) modules_install
105
106 modules_install: install
107
108 clean:
109 $(MAKE) V=$(LINUX_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) clean
110
111 .PHONY: $(MODULE) install modules_install clean
112 endif