VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/Makefile-footer.gmk@ 96399

最後變更 在這個檔案從96399是 95417,由 vboxsync 提交於 3 年 前

linux/Makefile-footer.gmk: Better comments regarding LLVM/clang. bugref:10247

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.6 KB
 
1# $Id: Makefile-footer.gmk 95417 2022-06-29 01:17:33Z vboxsync $
2## @file
3# VirtualBox Guest Additions kernel module Makefile, common parts.
4#
5# See Makefile-header.gmk for details of how to use this.
6#
7
8#
9# Copyright (C) 2006-2022 Oracle Corporation
10#
11# This file is part of VirtualBox Open Source Edition (OSE), as
12# available from http://www.alldomusa.eu.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
20VBOXMOD_0_TARGET = $(VBOXMOD_NAME)
21
22KBUILD_VERBOSE ?= 1 # Variable belongs to our kBuild, not the linux one.
23VBOX_LNX_VERBOSE = $(if $(KBUILD_VERBOSE),1,)
24
25#
26# Compiler options
27#
28VBOXMOD_0_KFLAGS := -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE $(addprefix -D,$(VBOXMOD_DEFS))
29ifeq ($(VBOX_KBUILD_TARGET_ARCH),amd64)
30VBOXMOD_0_KFLAGS += -DRT_ARCH_AMD64
31else
32VBOXMOD_0_KFLAGS += -DRT_ARCH_X86
33endif
34
35ifeq ($(VBOX_KBUILD_TYPE),debug)
36# The -Wno-array-bounds is because of a bug in gcc 4.something, see
37# https://sourceware.org/bugzilla/show_bug.cgi?id=10001
38 VBOXMOD_0_KFLAGS += -DDEBUG -DDEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) -DDEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
39 ifeq ($(shell expr $(KERN_VER) : '[23]\.'),0)
40 VBOXMOD_0_KFLAGS += -Werror -Wall -Wno-array-bounds
41# clang objects to calls to __builtin_frame_address with a non-zero argument
42# on general principles in -Wall mode. The x86 linux kernel has two such calls
43# in the thread_info.h / arch_within_stack_frames(), though probably safe.
44 ifndef ($(LLVM),) # (This is how the Linux root Makefile (since 5.7) does the test.)
45 VBOXMOD_0_KFLAGS += -Wno-frame-address
46 endif
47 endif
48endif
49
50ifeq ($(VBOX_KERN_GROKS_EXTMOD),)
51#
52# Pre 2.6.6
53#
54# Note: While pre 2.6.6 kernels could also do "proper" builds from kbuild, the
55# make script needed to support it was somewhat different from 2.6. Since this
56# script works and pre-2.6.6 is not a moving target we will not try do do things
57# the "proper" way.
58#
59VBOXMOD_EXT := o
60
61 ifeq ($(VBOX_KBUILD_TARGET_ARCH),amd64)
62VBOXMOD_0_KFLAGS += -mcmodel=kernel
63 endif
64 ifeq ($(KERN_VERSION),24)
65VBOXMOD_0_KFLAGS += -DVBOX_LINUX_2_4
66 endif
67
68CFLAGS := -O2 $(VBOXMOD_CFLAGS) $(addprefix -I,$(KERN_INCL) $(VBOXMOD_INCL)) $(VBOXMOD_0_KFLAGS) $(KDEBUG)
69
70# 2.4 Module linking
71$(VBOXMOD_0_TARGET).$(VBOXMOD_EXT): $(VBOXMOD_OBJS)
72 $(LD) -o $@ -r $(VBOXMOD_OBJS)
73
74all: $(VBOXMOD_0_TARGET)
75$(VBOXMOD_0_TARGET): $(VBOXMOD_0_TARGET).$(VBOXMOD_EXT)
76
77install: $(VBOXMOD_0_TARGET)
78 @mkdir -p $(MODULE_DIR); \
79 install -m 0644 -o root -g root $(VBOXMOD_0_TARGET).$(VBOXMOD_EXT) $(MODULE_DIR); \
80 PATH="$(PATH):/bin:/sbin" depmod -a; sync
81
82clean:
83 for f in $(sort $(dir $(VBOXMOD_OBJS))); do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
84 rm -rf .$(VBOXMOD_NAME)* .tmp_ver* $(VBOXMOD_NAME).* Modules.symvers modules.order
85
86.PHONY: all $(VBOXMOD_0_TARGET) install clean
87
88else # VBOX_KERN_GROKS_EXTMOD
89#
90# 2.6.6 and later
91#
92VBOXMOD_EXT := ko
93
94# build defs
95EXTRA_CFLAGS += $(VBOXMOD_CFLAGS) $(addprefix -I,$(KERN_INCL) $(VBOXMOD_INCL)) $(VBOXMOD_0_KFLAGS) $(KDEBUG)
96$(VBOXMOD_0_TARGET)-y := $(VBOXMOD_OBJS)
97obj-m += $(VBOXMOD_0_TARGET).o
98
99# Trigger parallel make job.
100 ifndef VBOX_NOJOBS
101JOBS := $(shell (getconf _NPROCESSORS_ONLN || grep -Ec '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
102 ifeq ($(JOBS),0)
103 override JOBS := 1
104 endif
105 else
106JOBS :=
107 endif
108
109VBOX_SUBDIR_VAR=$(if $(VBOX_KERN_GROKS_SUBDIRS),SUBDIRS,M)
110
111# OL/UEK: CONFIG_MODULE_SIG= disables module signing for external modules.
112# Ubuntu 18.04.3: CONFIG_MODULE_SIG_ALL= disables signing of all modules.
113# We disable signing because we don't have any private key and want to leave
114# the key handling and secure boot config to the user.
115 ifndef VBOX_ALLOW_MODULE_SIGNING
116VBOX_DISABLE_SIGN=CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL=
117 endif
118
119# rules:
120all: $(VBOXMOD_0_TARGET)
121
122$(VBOXMOD_0_TARGET):
123 $(MAKE) V=$(VBOX_LNX_VERBOSE) $(VBOX_DISABLE_SIGN) -C $(KERN_DIR) $(VBOX_SUBDIR_VAR)=$(CURDIR) SRCROOT=$(CURDIR) $(if $(JOBS),-j$(JOBS),) modules
124
125install: $(VBOXMOD_0_TARGET)
126 $(MAKE) V=$(VBOX_LNX_VERBOSE) $(VBOX_DISABLE_SIGN) -C $(KERN_DIR) $(VBOX_SUBDIR_VAR)=$(CURDIR) SRCROOT=$(CURDIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) modules_install
127
128modules_install: install
129
130clean:
131 $(MAKE) V=$(VBOX_LNX_VERBOSE) $(VBOX_DISABLE_SIGN) -C $(KERN_DIR) $(VBOX_SUBDIR_VAR)=$(CURDIR) SRCROOT=$(CURDIR) clean
132
133.PHONY: all $(VBOXMOD_0_TARGET) install modules_install clean
134endif # VBOX_KERN_GROKS_EXTMOD
135
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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