]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - ubuntu/vbox/vboxvideo/Makefile.include.footer
UBUNTU: ubuntu: vbox -- update to 5.2.0-dfsg-2
[mirror_ubuntu-bionic-kernel.git] / ubuntu / vbox / vboxvideo / Makefile.include.footer
CommitLineData
056a1eb7
SF
1#
2# VirtualBox Guest Additions kernel module Makefile, common parts.
3#
4# See Makefile.include.header for details of how to use this.
5#
6# Copyright (C) 2006-2015 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
17# override is required by the Debian guys
18override MODULE = $(MOD_NAME)
19OBJS = $(MOD_OBJS)
20
056a1eb7
SF
21KBUILD_VERBOSE ?= 1
22
23#
24# Compiler options
25#
26ifndef INCL
27 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
28 ifndef KBUILD_EXTMOD
29 KBUILD_EXTMOD := $(shell pwd)
30 endif
31 INCL += $(MOD_INCL)
32 export INCL
33endif
34KFLAGS := -D__KERNEL__ -DMODULE $(MOD_DEFS)
35ifeq ($(BUILD_TYPE),debug)
36 KFLAGS += -DDEBUG -DDEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) -DDEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
37endif
38
39ifeq ($(KERN_VERSION), 24)
40#
41# 2.4
42#
43
6d209b23
SF
44# Note: while 2.4 kernels could also do "proper" builds from kbuild, the make
45# script needed to support it was somewhat different from 2.6. Since this
46# script works and 2.4 is not a moving target we will not try do do things the
47# "proper" way.
48
056a1eb7
SF
49ifeq ($(BUILD_TARGET_ARCH),amd64)
50 KFLAGS += -mcmodel=kernel
51endif
52
53CFLAGS := -O2 -DVBOX_LINUX_2_4 $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
54MODULE_EXT := o
55
56# 2.4 Module linking
57$(MODULE).o: $(OBJS)
58 $(LD) -o $@ -r $(OBJS)
59
60.PHONY: $(MODULE)
61all: $(MODULE)
62$(MODULE): $(MODULE).o
63
6d209b23
SF
64install: $(MODULE)
65 @mkdir -p $(MODULE_DIR); \
66 install -m 0644 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
67 PATH="$(PATH):/bin:/sbin" depmod -a;
68
69clean:
70 for f in $(sort $(dir $(OBJS))); do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
71 rm -rf .$(MOD_NAME)* .tmp_ver* $(MOD_NAME).* Modules.symvers modules.order
72
73else # ! $(KERN_VERSION), 24
056a1eb7
SF
74#
75# 2.6 and later
76#
77
78MODULE_EXT := ko
79
80$(MODULE)-y := $(OBJS)
81
82# build defs
83EXTRA_CFLAGS += $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
84
85.PHONY: $(MODULE)
86all: $(MODULE)
87
88obj-m += $(MODULE).o
89
90JOBS := $(shell (getconf _NPROCESSORS_ONLN || grep -Ec '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
91ifeq ($(JOBS),0)
92 JOBS := 1
93endif
94
95# OL/UEK: disable module signing for external modules -- we don't have any private key
96$(MODULE):
97 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) -j$(JOBS) modules
98
056a1eb7 99install: $(MODULE)
6d209b23 100 $(MAKE) KBUILD_VERBOSE=$(KBUILD_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
056a1eb7 101
6d209b23 102modules_install: install
056a1eb7
SF
103
104clean:
6d209b23
SF
105 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) clean
106
107.PHONY: $(MODULE) install modules_install clean
108endif