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
...
@@ -162,8 +162,10 @@ PERL = perl
MODFLAGS
=
-DMODULE
MODFLAGS
=
-DMODULE
CFLAGS_MODULE
=
$(MODFLAGS)
CFLAGS_MODULE
=
$(MODFLAGS)
AFLAGS_MODULE
=
$(MODFLAGS)
AFLAGS_MODULE
=
$(MODFLAGS)
LDFLAGS_MODULE
=
-r
CFLAGS_KERNEL
=
CFLAGS_KERNEL
=
AFLAGS_KERNEL
=
AFLAGS_KERNEL
=
NOSTDINC_FLAGS
=
-nostdinc
-iwithprefix
include
NOSTDINC_FLAGS
=
-nostdinc
-iwithprefix
include
CPPFLAGS
:=
-D__KERNEL__
-Iinclude
CPPFLAGS
:=
-D__KERNEL__
-Iinclude
...
@@ -174,7 +176,7 @@ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
...
@@ -174,7 +176,7 @@ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
export
VERSION
PATCHLEVEL
SUBLEVEL
EXTRAVERSION
KERNELRELEASE
ARCH
\
export
VERSION
PATCHLEVEL
SUBLEVEL
EXTRAVERSION
KERNELRELEASE
ARCH
\
CONFIG_SHELL
TOPDIR
HOSTCC
HOSTCFLAGS
CROSS_COMPILE
AS
LD
CC
\
CONFIG_SHELL
TOPDIR
HOSTCC
HOSTCFLAGS
CROSS_COMPILE
AS
LD
CC
\
CPP
AR
NM
STRIP
OBJCOPY
OBJDUMP
MAKE
AWK
GENKSYMS
PERL
UTS_MACHINE
\
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
CPPFLAGS
NOSTDINC_FLAGS
OBJCOPYFLAGS
LDFLAGS
export
CFLAGS
CFLAGS_KERNEL
CFLAGS_MODULE
export
CFLAGS
CFLAGS_KERNEL
CFLAGS_MODULE
...
@@ -543,7 +545,7 @@ _modinst_:
...
@@ -543,7 +545,7 @@ _modinst_:
.PHONY
:
$(patsubst %
,
_modinst_%
,
$(SUBDIRS))
.PHONY
:
$(patsubst %
,
_modinst_%
,
$(SUBDIRS))
$(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
else
# CONFIG_MODULES
# Modules not configured
# Modules not configured
...
@@ -709,8 +711,9 @@ cmd_rmclean = rm -f $(CLEAN_FILES)
...
@@ -709,8 +711,9 @@ cmd_rmclean = rm -f $(CLEAN_FILES)
clean
:
archclean $(addprefix _clean_
,
$(clean-dirs))
clean
:
archclean $(addprefix _clean_
,
$(clean-dirs))
$(
call
cmd,rmclean
)
$(
call
cmd,rmclean
)
@
find
.
$(RCS_FIND_IGNORE)
\
@
find
.
$(RCS_FIND_IGNORE)
\
\(
-name
'*.[oas]'
-o
-name
'.*.cmd'
-o
-name
'.*.d'
\
\(
-name
'*.[oas]'
-o
-name
'*.ko'
-o
-name
'.*.cmd'
\
-o
-name
'.*.tmp'
\)
-type
f
-print
| xargs
rm
-f
-o
-name
'.*.d'
-o
-name
'.*.tmp'
\)
-type
f
\
-print
| xargs
rm
-f
# mrproper - delete configuration + modules + core files
# mrproper - delete configuration + modules + core files
#
#
...
...
scripts/Makefile.build
View file @
5991f815
...
@@ -46,7 +46,7 @@ endif
...
@@ -46,7 +46,7 @@ endif
endif
endif
__build
:
$(if $(KBUILD_BUILTIN)
,
$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS))
\
__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)
$(subdir-ym) $(build-targets)
@
:
@
:
...
@@ -172,21 +172,29 @@ endif
...
@@ -172,21 +172,29 @@ endif
#
#
# Rule to link composite objects
# 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)
$@
quiet_cmd_link_multi-m
=
LD
[
M]
$@
cmd_link_multi
=
$(LD)
$(LDFLAGS)
$(EXTRA_LDFLAGS)
-r
-o
$@
$(
filter
$(
addprefix
$(obj)
/,
$
(
$(
subst
$(obj)
/,,
$
(
@:.o
=
-objs
)))
$
(
$(
subst
$(obj)
/,,
$
(
@:.o
=
-y
))))
,
$^
)
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
# We would rather have a list of rules like
# foo.o: $(foo-objs)
# foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
# on the set of all their parts
$(multi-used-y)
:
%.o: $(multi-objs-y) FORCE
$(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
$(
single-used-m
:
.o=.ko) : %.ko: %.o
FORCE
$(
call
if_changed,link_
multi
)
$(
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
# Compile programs on the host
# ===========================================================================
# ===========================================================================
...
...
scripts/Makefile.lib
View file @
5991f815
...
@@ -43,6 +43,7 @@ __obj-m = $(filter-out export.o,$(obj-m))
...
@@ -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-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-m
:=
$(
sort
$(
foreach
m,
$
(
__obj-m
)
,
$(
if
$(
strip
$
(
$
(
m:.o
=
-objs
))
$
(
$
(
m:.o
=
-y
)))
,
$(m)
)))
multi-used
:=
$
(
multi-used-y
)
$
(
multi-used-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
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
# objects depend on those (obviously)
...
@@ -99,6 +100,7 @@ export-objs := $(addprefix $(obj)/,$(export-objs))
...
@@ -99,6 +100,7 @@ export-objs := $(addprefix $(obj)/,$(export-objs))
subdir-obj-y
:=
$(
addprefix
$(obj)
/,
$
(
subdir-obj-y
))
subdir-obj-y
:=
$(
addprefix
$(obj)
/,
$
(
subdir-obj-y
))
real-objs-y
:=
$(
addprefix
$(obj)
/,
$
(
real-objs-y
))
real-objs-y
:=
$(
addprefix
$(obj)
/,
$
(
real-objs-y
))
real-objs-m
:=
$(
addprefix
$(obj)
/,
$
(
real-objs-m
))
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-y
:=
$(
addprefix
$(obj)
/,
$
(
multi-used-y
))
multi-used-m
:=
$(
addprefix
$(obj)
/,
$
(
multi-used-m
))
multi-used-m
:=
$(
addprefix
$(obj)
/,
$
(
multi-used-m
))
multi-objs-y
:=
$(
addprefix
$(obj)
/,
$
(
multi-objs-y
))
multi-objs-y
:=
$(
addprefix
$(obj)
/,
$
(
multi-objs-y
))
...
...
scripts/Makefile.modinst
View file @
5991f815
...
@@ -15,12 +15,12 @@ include scripts/Makefile.lib
...
@@ -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
&&
\
cmd_modules_install
=
mkdir
-p
$(MODLIB)
/kernel
&&
\
cp
$
(
obj-m
)
$(MODLIB)
/kernel/
cp
$
(
obj-m
:.o
=
.ko
)
$(MODLIB)
/kernel/
modules_install
:
$(subdir-ym)
modules_install
:
$(subdir-ym)
ifneq
($(obj-m),)
ifneq
($(obj-m
:.o=.ko
),)
$(
call
cmd,modules_install
)
$(
call
cmd,modules_install
)
else
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