diff options
author | Matt Mooney <mfm@muteddisk.com> | 2010-08-05 14:23:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 16:21:23 -0400 |
commit | 4f8272802739f5c6ce6b0a548810a181d2f1b652 (patch) | |
tree | 69c257ac7ad3be55414ab36f2ec318d942eecf2b /Documentation/kbuild/makefiles.txt | |
parent | c7825cfac6f34e66797905f365761f66fd51ebda (diff) |
Documentation: update kbuild loadable modules goals & examples
Update section 3.3 Loadable module goals - obj-m, from $(<module_name>-objs)
to $(<module_name>-y) for easier addition of conditional objects to the
module. The examples are also updated to reflect the current state of
each Makefile used.
Signed-off-by: matt mooney <mfm@muteddisk.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/kbuild/makefiles.txt')
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 71c602d61680..f29dca374aa2 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -187,34 +187,35 @@ more details, with real examples. | |||
187 | Note: In this example $(CONFIG_ISDN_PPP_BSDCOMP) evaluates to 'm' | 187 | Note: In this example $(CONFIG_ISDN_PPP_BSDCOMP) evaluates to 'm' |
188 | 188 | ||
189 | If a kernel module is built from several source files, you specify | 189 | If a kernel module is built from several source files, you specify |
190 | that you want to build a module in the same way as above. | 190 | that you want to build a module in the same way as above; however, |
191 | 191 | kbuild needs to know which object files you want to build your | |
192 | Kbuild needs to know which the parts that you want to build your | 192 | module from, so you have to tell it by setting a $(<module_name>-y) |
193 | module from, so you have to tell it by setting an | 193 | variable. |
194 | $(<module_name>-objs) variable. | ||
195 | 194 | ||
196 | Example: | 195 | Example: |
197 | #drivers/isdn/i4l/Makefile | 196 | #drivers/isdn/i4l/Makefile |
198 | obj-$(CONFIG_ISDN) += isdn.o | 197 | obj-$(CONFIG_ISDN_I4L) += isdn.o |
199 | isdn-objs := isdn_net_lib.o isdn_v110.o isdn_common.o | 198 | isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o |
200 | 199 | ||
201 | In this example, the module name will be isdn.o. Kbuild will | 200 | In this example, the module name will be isdn.o. Kbuild will |
202 | compile the objects listed in $(isdn-objs) and then run | 201 | compile the objects listed in $(isdn-y) and then run |
203 | "$(LD) -r" on the list of these files to generate isdn.o. | 202 | "$(LD) -r" on the list of these files to generate isdn.o. |
204 | 203 | ||
205 | Kbuild recognises objects used for composite objects by the suffix | 204 | Due to kbuild recognizing $(<module_name>-y) for composite objects, |
206 | -objs, and the suffix -y. This allows the Makefiles to use | 205 | you can use the value of a CONFIG_ symbol to optionally include an |
207 | the value of a CONFIG_ symbol to determine if an object is part | 206 | object file as part of a composite object. |
208 | of a composite object. | ||
209 | 207 | ||
210 | Example: | 208 | Example: |
211 | #fs/ext2/Makefile | 209 | #fs/ext2/Makefile |
212 | obj-$(CONFIG_EXT2_FS) += ext2.o | 210 | obj-$(CONFIG_EXT2_FS) += ext2.o |
213 | ext2-y := balloc.o bitmap.o | 211 | ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \ |
214 | ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o | 212 | namei.o super.o symlink.o |
215 | 213 | ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o xattr_user.o \ | |
216 | In this example, xattr.o is only part of the composite object | 214 | xattr_trusted.o |
217 | ext2.o if $(CONFIG_EXT2_FS_XATTR) evaluates to 'y'. | 215 | |
216 | In this example, xattr.o, xattr_user.o and xattr_trusted.o are only | ||
217 | part of the composite object ext2.o if $(CONFIG_EXT2_FS_XATTR) | ||
218 | evaluates to 'y'. | ||
218 | 219 | ||
219 | Note: Of course, when you are building objects into the kernel, | 220 | Note: Of course, when you are building objects into the kernel, |
220 | the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, | 221 | the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, |