]> git.neil.brown.name Git - history.git/commit
Simplify linking/building objects in subdirectories
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Wed, 22 May 2002 06:26:29 +0000 (01:26 -0500)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Wed, 22 May 2002 06:26:29 +0000 (01:26 -0500)
commitaa2ac86495439a62809d841b9effcf0e1e1c8759
tree91c93386cac1e501ee959e9eecca06e4760cddd1
parente6d19c6ab5f0f54d15277be9933183050d01ce2c
Simplify linking/building objects in subdirectories

New-style Makefiles have a nice way of declaring objects
which need to be built either built-in or as modules:

        obj-$(CONFIG_EEPRO100) += eepro100.o

However, handling objects in subdirectories, which need to be
built and linked is not as nice:

        subdir-$(CONFIG_E100) += e100

        ifeq ($(CONFIG_E100),y)
          obj-y += e100/built-in.o
        endif

This means we descend into the subdirectory when building
vmlinux / modules, depending on CONFIG_XXX. When we are building
vmlinux we also need to link whatever has been built in the
subdirectory, so we add it to $(obj-y) at the appropriate place
(link order is important).

Now, the extension below allows to rewrite the second case into

         obj-$(CONFIG_E100) += e100/

which looks much nicer ;-) Existing behavior is not changed, and the
only prerequisite to using the extension above is that the O_TARGET in
the subdir is named "built-in.o".
Rules.make