• Kai Germaschewski's avatar
    Simplify linking/building objects in subdirectories · aa2ac864
    Kai Germaschewski authored
    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".
    aa2ac864
Rules.make 11.1 KB