VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/Makefile.include.footer@ 36583

最後變更 在這個檔案從36583是 36583,由 vboxsync 提交於 14 年 前

Additions/linux/installer: clean-up in the VBoxGuest kernel makefile

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.9 KB
 
1#
2# VirtualBox Guest Additions kernel module Makefile, common parts.
3#
4# (For 2.6.x, the main file must be called 'Makefile'!)
5#
6# Copyright (C) 2006-2011 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.alldomusa.eu.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#
18# These file should be included by the Makefiles for any kernel modules we
19# build as part of the Guest Additions. The intended way of doing this is as
20# follows:
21#
22# include Makefile.include
23# MOD_NAME = <name of the module to be built, without extension>
24# MOD_OBJS = <list of object files which should be included>
25# MOD_DEFS = <any additional defines which this module needs>
26# MOD_INCL = <any additional include paths which this module needs>
27# MOD_CFLAGS = <any additional CFLAGS which this module needs>
28# MOD_CLEAN = <list of directories that the clean target should look at>
29#
30# The kmk kBuild define KBUILD_TARGET_ARCH is available.
31#
32# @todo the shared folders module Makefile also includes the following bits.
33# Integrate them if necessary.
34# MOD_CFLAGS += -DEXPORT_SYMTAB -DVBGL_VBOXGUEST -DRT_WITH_VBOX
35#
36# # special hack for Fedora Core 6 2.6.18 (fc6), rhel5 2.6.18 (el5),
37# # ClarkConnect 4.3 (cc4) and ClarkConnect 5 (v5)
38# ifeq ($(KERNELRELEASE),)
39# KFLAGS += $(foreach inc,$(KERN_INCL),\
40# $(if $(wildcard $(inc)/linux/utsrelease.h),\
41# $(if $(shell grep '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h; \
42# grep '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h; \
43# grep '"2.6.18.*v5.*"' $(inc)/linux/utsrelease.h; \
44# grep '"2.6.18.*cc4.*"' $(inc)/linux/utsrelease.h),\
45# -DKERNEL_FC6,),))
46# else
47# KFLAGS += $(if $(shell echo "$(KERNELRELEASE)"|grep '2.6.18.*fc6.*';\
48# echo "$(KERNELRELEASE)"|grep '2.6.18.*el5.*';\
49# echo "$(KERNELRELEASE)"|grep '2.6.18.*v5.*';\
50# echo "$(KERNELRELEASE)"|grep '2.6.18.*cc4.*'),\
51# -DKERNEL_FC6,)
52# endif
53#
54## important: Don't remove Module.symvers! DKMS does 'make clean' before building ...
55# rm -rf .vboxsf* .tmp_ver* vboxsf.* Modules.symvers modules.order
56#
57
58
59
60# override is required by the Debian guys
61override MODULE = $(MOD_NAME)
62OBJS = $(MOD_OBJS)
63
64ifneq ($(MAKECMDGOALS),clean)
65
66KBUILD_VERBOSE ?= 1
67
68#
69# Compiler options
70#
71ifndef INCL
72 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))
73 ifndef KBUILD_EXTMOD
74 KBUILD_EXTMOD := $(shell pwd)
75 endif
76 INCL += $(MOD_INCL)
77 export INCL
78endif
79KFLAGS := -D__KERNEL__ -DMODULE $(MOD_DEFS)
80ifeq ($(BUILD_TYPE),debug)
81 KFLAGS += -DDEBUG
82endif
83
84ifeq ($(KERN_VERSION), 24)
85#
86# 2.4
87#
88
89ifeq ($(BUILD_TARGET_ARCH),amd64)
90 KFLAGS += -mcmodel=kernel
91endif
92
93CFLAGS := -O2 -DVBOX_LINUX_2_4 $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
94MODULE_EXT := o
95
96# 2.4 Module linking
97$(MODULE).o: $(OBJS)
98 $(LD) -o $@ -r $(OBJS)
99
100.PHONY: $(MODULE)
101all: $(MODULE)
102$(MODULE): $(MODULE).o
103
104else
105#
106# 2.6 and later
107#
108
109MODULE_EXT := ko
110
111$(MODULE)-y := $(OBJS)
112
113# build defs
114EXTRA_CFLAGS += $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
115
116all: $(MODULE)
117
118obj-m += $(MODULE).o
119
120$(MODULE):
121 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules
122
123endif
124
125install: $(MODULE)
126 @mkdir -p $(MODULE_DIR); \
127 install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
128 PATH="$(PATH):/bin:/sbin" depmod -a;
129
130endif # eq($(MAKECMDGOALS),clean)
131
132# important: Don't remove Module.symvers! DKMS does 'make clean' before building ...
133clean:
134 for f in $(MOD_CLEAN); do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
135 rm -rf .$(MOD_NAME)* .tmp_ver* $(MOD_NAME).* Modules.symvers modules.order
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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