Re: Building multipart modules with subdirectories...

Keith Owens (kaos@ocs.com.au)
Sat, 04 Aug 2001 20:30:37 +1000


On Fri, 03 Aug 2001 13:40:14 -0500,
"Steven J. Hill" <sjhill@cotw.com> wrote:
>I have driver that is rather complex and in order to maintain it, the
>module is broke up into 17 different subdirectories. I am maintaining it
>and I am trying to integrate it into the kernel build system.

I had the same problem with XFS. Code split over multiple directories,
code in the sub directories had to be compiled for modules but not be
installed as a module, instead the sub directory objects are linked
into the parent directory then the whole is installed as one module.
Is that your problem?

In the parent Makefile

--------

O_TARGET := foo.o
obj-m := $(O_TARGET)
foo_subdirs := sub directory list
subdir-$(CONFIG_FOO_DRV) += $(foo_subdirs)
obj-y += $(foreach dir,$(foo_subdirs),$(dir)/$(dir).o)
....
include $(TOPDIR)/Rules.make

# This is really nasty, but Rules.make was never designed for multi directory
# modules and it can race on parallel build. Keith Owens.
foo.o: $(patsubst %,_modsubdir_%,$(subdir-m))

--------

In each sub directory

--------

O_TARGET := $(notdir $(CURDIR)).o
ifneq ($(MAKECMDGOALS),modules_install)
obj-m := $(O_TARGET)
endif
obj-y += list of sub directory objects

--------

This is so much easier in kbuild 2.5 :).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/