Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
5991f815
Commit
5991f815
authored
Dec 04, 2002
by
Kai Germaschewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kbuild: Build modules as '.ko'
parent
6802d702
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
14 deletions
+27
-14
Makefile
Makefile
+7
-4
scripts/Makefile.build
scripts/Makefile.build
+15
-7
scripts/Makefile.lib
scripts/Makefile.lib
+2
-0
scripts/Makefile.modinst
scripts/Makefile.modinst
+3
-3
No files found.
Makefile
View file @
5991f815
...
...
@@ -162,8 +162,10 @@ PERL = perl
MODFLAGS
=
-DMODULE
CFLAGS_MODULE
=
$(MODFLAGS)
AFLAGS_MODULE
=
$(MODFLAGS)
LDFLAGS_MODULE
=
-r
CFLAGS_KERNEL
=
AFLAGS_KERNEL
=
NOSTDINC_FLAGS
=
-nostdinc
-iwithprefix
include
CPPFLAGS
:=
-D__KERNEL__
-Iinclude
...
...
@@ -174,7 +176,7 @@ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
export
VERSION
PATCHLEVEL
SUBLEVEL
EXTRAVERSION
KERNELRELEASE
ARCH
\
CONFIG_SHELL
TOPDIR
HOSTCC
HOSTCFLAGS
CROSS_COMPILE
AS
LD
CC
\
CPP
AR
NM
STRIP
OBJCOPY
OBJDUMP
MAKE
AWK
GENKSYMS
PERL
UTS_MACHINE
\
HOSTCXX
HOSTCXXFLAGS
LDFLAGS_BLOB
HOSTCXX
HOSTCXXFLAGS
LDFLAGS_BLOB
LDFLAGS_MODULE
export
CPPFLAGS
NOSTDINC_FLAGS
OBJCOPYFLAGS
LDFLAGS
export
CFLAGS
CFLAGS_KERNEL
CFLAGS_MODULE
...
...
@@ -543,7 +545,7 @@ _modinst_:
.PHONY
:
$(patsubst %
,
_modinst_%
,
$(SUBDIRS))
$(patsubst %, _modinst_%, $(SUBDIRS))
:
$(Q)$(MAKE)
-f
scripts/Makefile.modinst
obj
=
$(
patsubst
_modinst_%,%,
$@
)
$(Q)$(MAKE)
-
rR
-
f
scripts/Makefile.modinst
obj
=
$(
patsubst
_modinst_%,%,
$@
)
else
# CONFIG_MODULES
# Modules not configured
...
...
@@ -709,8 +711,9 @@ cmd_rmclean = rm -f $(CLEAN_FILES)
clean
:
archclean $(addprefix _clean_
,
$(clean-dirs))
$(
call
cmd,rmclean
)
@
find
.
$(RCS_FIND_IGNORE)
\
\(
-name
'*.[oas]'
-o
-name
'.*.cmd'
-o
-name
'.*.d'
\
-o
-name
'.*.tmp'
\)
-type
f
-print
| xargs
rm
-f
\(
-name
'*.[oas]'
-o
-name
'*.ko'
-o
-name
'.*.cmd'
\
-o
-name
'.*.d'
-o
-name
'.*.tmp'
\)
-type
f
\
-print
| xargs
rm
-f
# mrproper - delete configuration + modules + core files
#
...
...
scripts/Makefile.build
View file @
5991f815
...
...
@@ -46,7 +46,7 @@ endif
endif
__build
:
$(if $(KBUILD_BUILTIN)
,
$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS))
\
$(if $(KBUILD_MODULES)
,
$(obj-m))
\
$(if $(KBUILD_MODULES)
,
$(obj-m
:.o=.ko
))
\
$(subdir-ym) $(build-targets)
@
:
...
...
@@ -172,21 +172,29 @@ endif
#
# Rule to link composite objects
#
quiet_cmd_link_multi-y
=
LD
$@
cmd_link_multi-y
=
$(LD)
$(LDFLAGS)
$(EXTRA_LDFLAGS)
-r
-o
$@
$(
filter
$(
addprefix
$(obj)
/,
$
(
$(
subst
$(obj)
/,,
$
(
@:.o
=
-objs
)))
$
(
$(
subst
$(obj)
/,,
$
(
@:.o
=
-y
))))
,
$^
)
quiet_cmd_link_multi
=
LD
$(quiet_modtag)
$@
cmd_link_multi
=
$(LD)
$(LDFLAGS)
$(EXTRA_LDFLAGS)
-r
-o
$@
$(
filter
$(
addprefix
$(obj)
/,
$
(
$(
subst
$(obj)
/,,
$
(
@:.o
=
-objs
)))
$
(
$(
subst
$(obj)
/,,
$
(
@:.o
=
-y
))))
,
$^
)
quiet_cmd_link_multi-m
=
LD
[
M]
$@
cmd_link_multi-m
=
$(LD)
$(LDFLAGS)
$(EXTRA_LDFLAGS)
$(LDFLAGS_MODULE)
-o
$@
$(
filter
$(
addprefix
$(obj)
/,
$
(
$(
subst
$(obj)
/,,
$
(
@:.ko
=
-objs
)))
$
(
$(
subst
$(obj)
/,,
$
(
@:.ko
=
-y
))))
,
$^
)
quiet_cmd_link_single-m
=
LD
[
M]
$@
cmd_link_single-m
=
$(LD)
$(LDFLAGS)
$(EXTRA_LDFLAGS)
$(LDFLAGS_MODULE)
-o
$@
$<
# We would rather have a list of rules like
# foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
$(multi-used-y)
:
%.o: $(multi-objs-y) FORCE
$(
call
if_changed,link_multi
)
$(
call
if_changed,link_multi-y
)
$(multi-used-m
:
.o=.ko) : %.ko: $(multi-objs-m) FORCE
$(
call
if_changed,link_multi-m
)
$(
multi-used-m)
:
%.o: $(multi-objs-m)
FORCE
$(
call
if_changed,link_
multi
)
$(
single-used-m
:
.o=.ko) : %.ko: %.o
FORCE
$(
call
if_changed,link_
single-m
)
targets
+=
$
(
multi-used-y
)
$
(
multi-used-m
)
targets
+=
$
(
multi-used-y
)
$
(
multi-used-m
:.o
=
.ko
)
$
(
single-used-m:.o
=
.ko
)
# Compile programs on the host
# ===========================================================================
...
...
scripts/Makefile.lib
View file @
5991f815
...
...
@@ -43,6 +43,7 @@ __obj-m = $(filter-out export.o,$(obj-m))
multi-used-y
:=
$(
sort
$(
foreach
m,
$
(
__obj-y
)
,
$(
if
$(
strip
$
(
$
(
m:.o
=
-objs
))
$
(
$
(
m:.o
=
-y
)))
,
$(m)
)))
multi-used-m
:=
$(
sort
$(
foreach
m,
$
(
__obj-m
)
,
$(
if
$(
strip
$
(
$
(
m:.o
=
-objs
))
$
(
$
(
m:.o
=
-y
)))
,
$(m)
)))
multi-used
:=
$
(
multi-used-y
)
$
(
multi-used-m
)
single-used-m
:=
$(
filter-out
$
(
multi-used-m
)
,
$
(
obj-m
))
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
...
...
@@ -99,6 +100,7 @@ export-objs := $(addprefix $(obj)/,$(export-objs))
subdir-obj-y
:=
$(
addprefix
$(obj)
/,
$
(
subdir-obj-y
))
real-objs-y
:=
$(
addprefix
$(obj)
/,
$
(
real-objs-y
))
real-objs-m
:=
$(
addprefix
$(obj)
/,
$
(
real-objs-m
))
single-used-m
:=
$(
addprefix
$(obj)
/,
$
(
single-used-m
))
multi-used-y
:=
$(
addprefix
$(obj)
/,
$
(
multi-used-y
))
multi-used-m
:=
$(
addprefix
$(obj)
/,
$
(
multi-used-m
))
multi-objs-y
:=
$(
addprefix
$(obj)
/,
$
(
multi-objs-y
))
...
...
scripts/Makefile.modinst
View file @
5991f815
...
...
@@ -15,12 +15,12 @@ include scripts/Makefile.lib
# ==========================================================================
quiet_cmd_modules_install
=
INSTALL
$
(
obj-m
)
quiet_cmd_modules_install
=
INSTALL
$
(
obj-m
:.o
=
.ko
)
cmd_modules_install
=
mkdir
-p
$(MODLIB)
/kernel
&&
\
cp
$
(
obj-m
)
$(MODLIB)
/kernel/
cp
$
(
obj-m
:.o
=
.ko
)
$(MODLIB)
/kernel/
modules_install
:
$(subdir-ym)
ifneq
($(obj-m),)
ifneq
($(obj-m
:.o=.ko
),)
$(
call
cmd,modules_install
)
else
@
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment