public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kbuild@vger.kernel.org
Cc: intel-gfx@lists.freedesktop.org
Subject: better kbuild support for drivers spanning multiple directories?
Date: Wed, 31 Jul 2019 16:51:24 +0300	[thread overview]
Message-ID: <87pnlqmhwj.fsf@intel.com> (raw)


Hi -

The drm/i915 [1][2] driver has grown quite big over the years: 400+
files with a total sloccount of 175k lines. A flat directory structure
just wasn't manageable anymore, and we opted to add subdirectories,
despite the general recommendation [3] not to do this.

Mostly, it works all right, with some quirks. For example, things like

	$ make drivers/gpu/drm/i915/<subdir>/<file>.o

do not work out of the box; we need to add subdir Makefiles to do things
like:

	subdir-ccflags-y += -I$(srctree)/$(src)/..

and include them using obj-y += <subdir>/ in the top level Makefile.

But the main problem really is having to have a top level Makefile
specifying everything, instead of being able to recurse into
subdirectoris with, say, lib-y += <subdir>/, and having that build a lib
within the subdirectory that gets linked into the parent level module.

Is there a better way? Could we have a better way?

BR,
Jani.


[1] drivers/gpu/drm/i915
[2] https://cgit.freedesktop.org/drm/drm-tip/tree/drivers/gpu/drm/i915
[3] Documentation/kbuild/modules.rst section 4.3


-- 
Jani Nikula, Intel Open Source Graphics Center

                 reply	other threads:[~2019-07-31 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnlqmhwj.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox