Skip to content

Commit 6c94e37

Browse files
sravnborgLinus Torvalds
authored andcommitted
[PATCH] kbuild: Document newly added lib-y
1 parent e9da59f commit 6c94e37

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

Documentation/kbuild/makefiles.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This document describes the Linux kernel Makefiles.
1111
--- 3.2 Built-in object goals - obj-y
1212
--- 3.3 Loadable module goals - obj-m
1313
--- 3.4 Objects which export symbols
14-
--- 3.5 Library file goals - L_TARGET
14+
--- 3.5 Library file goals - lib-y
1515
--- 3.6 Descending down in directories
1616
--- 3.7 Compilation flags
1717
--- 3.8 Command line dependency
@@ -214,20 +214,33 @@ more details, with real examples.
214214
modules exporting symbols.
215215
See also Documentation/modules.txt.
216216

217-
--- 3.5 Library file goals - L_TARGET
217+
--- 3.5 Library file goals - lib-y
218218

219-
Instead of building a built-in.o file, you may also
220-
build an archive which again contains objects listed in $(obj-y).
221-
This is normally not necessary and only used in lib/ and
222-
arch/$(ARCH)/lib directories.
223-
Only the name lib.a is allowed.
219+
Objects listed with obj-* is used for modules or
220+
are combined in a built-in.o for that specific directory.
221+
There is also the possibility to list objects that will
222+
be included in a library, lib.a.
223+
All objects listed with lib-y are combined in a single
224+
library for that directory.
225+
Objects that are listed in obj-y and additional listed in
226+
lib-y will not be included in the library, since they will anyway
227+
be accessible.
228+
For consistency objects listed in lib-m will be included in lib.a.
229+
230+
Note that the same kbuild makefile may list files to be built-in
231+
and to be part of a library. Therefore the same directory
232+
may contain both a built-in.o and a lib.a file.
224233

225234
Example:
226235
#arch/i386/lib/Makefile
227-
L_TARGET := lib.a
228-
obj-y := checksum.o delay.o
236+
lib-y := checksum.o delay.o
229237

230238
This will create a library lib.a based on checksum.o and delay.o.
239+
For kbuild to actually recognize that there is a lib.a being build
240+
the directory shall be listed in libs-y.
241+
See also "6.3 List directories to visit when descending".
242+
243+
Usage of lib-y is normally restricted to lib/ and arch/*/lib.
231244

232245
--- 3.6 Descending down in directories
233246

@@ -727,7 +740,7 @@ When kbuild executes the following steps are followed (roughly):
727740
head-y, init-y, core-y, libs-y, drivers-y, net-y
728741

729742
$(head-y) list objects to be linked first in vmlinux.
730-
$(libs-y) list directories where a libs.a archive can be located.
743+
$(libs-y) list directories where a lib.a archive can be located.
731744
The rest list directories where a built-in.o object file can be located.
732745

733746
$(init-y) objects will be located after $(head-y).

0 commit comments

Comments
 (0)