[RFC PATCH 0/5] kbuild: build modules from code in multiple directories.

From: NeilBrown
Date: Mon Jun 18 2018 - 00:56:04 EST


This set of patches makes it possible to build a module from
code in multiple directories without needing to list files from one
directory in the Makefile of another directory.

The code was developed for lustre (which is now out-of-tree :-( ) but
can be useful elsewhere, such as for xfs and btrfs and others.

In fs/xfs/Makefile the section:

xfs-y += $(addprefix libxfs/, \
xfs_ag.o \
xfs_alloc.o \
.....

could become

xfs-y += libxfs/

and then in fs/xfs/libxfs/Makefile we would have

modobj-$(CONFIG_XFS_FS) += xfs_ag.o \
xfs_alloc.o \
.....

A similar process could move filenames for scrub/* from the
fs/xfs/Makefile to fs/xfs/scrub/Makefile

Apart from improving modularity, this means that partial makes such
as:

make fs/xfs/libxfs/

or

make fs/xfs/scrub/attr.s

can work.

Comments and review most welcome.

Thanks,
NeilBrown

---

NeilBrown (5):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disable KBUILD_MODNAME when building for mod.a
kbuild: Add documentation for modobj-m


Documentation/kbuild/makefiles.txt | 65 ++++++++++++++++++++++++++++++++++--
scripts/Makefile.build | 57 ++++++++++++++++++++++----------
scripts/Makefile.lib | 63 ++++++++++++++++++++++-------------
3 files changed, 141 insertions(+), 44 deletions(-)

--
Signature