All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert P. J. Day <rpjday@crashcourse.ca>
To: u-boot@lists.denx.de
Subject: [U-Boot] want to clarify a couple things about vendor common/ directories
Date: Wed, 13 Apr 2016 08:41:35 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.20.1604130835360.4548@localhost.localdomain> (raw)


  currently refactoring a pile of (closely-related) board support code
and can clearly stuff a lot of duplicate code and header files into a
vendor-specific "common/" directory so just want to make sure i'm
doing this properly.

  first, i can see from the top-level Makefile that a common board
directory is identified specifically by containing a Makefile:

HAVE_VENDOR_COMMON_LIB = $(if $(wildcard
  $(srctree)/board/$(VENDOR)/common/Makefile),y,n)

but not necessarily a Kconfig file.

  (in fact, i can see that of the several vendors that have common/
directories, only ti/common/ has a Kconfig file, so i'm concluding
that a common/ directory containing a Kconfig file is more the
exception rather than the norm. ti/common/ seems like a special case,
in that it contains just some board_detect code, and its Kconfig would
be explicitly sourced by the subset of ti boards for which it's
relevant, so that makes sense. but, as i mentioned, that's the only
example i see.)

  next, when including common header files, it seems clear that board
files need to refer explicitly to that sibling directory, as in:

  #include "../common/qixis.h"

i suppose it might have been possible for the build process to add the
common directory to the include search path for header files, but it's
clear that wasn't done so common header file inclusion *needs* that
"../common/whatever.h" form, correct?

  finally, in terms of pulling in common source files, i'm just going
to be appalled by the occasional form of this:

  amcc/bubinga/flash.c:#include "../common/flash.c"
  amcc/walnut/flash.c:#include "../common/flash.c"
  amcc/bamboo/flash.c:#include "../common/flash.c"
  amcc/luan/flash.c:#include "../common/flash.c"

or is textual inclusion of source files from a common directory
acceptable practice? i normally really dislike this, but is doing that
in this specific context in u-boot considered acceptable?

  in any event, the regular way appears to be having a Makefile
controlling what vendor-common code gets compiled, and Kconfig files
elsewhere allowing the selection of config options to drive that
process, is that about right?

  am i missing anything regarding proper common/ vendor usage?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

             reply	other threads:[~2016-04-13 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 12:41 Robert P. J. Day [this message]
2016-04-13 21:19 ` [U-Boot] want to clarify a couple things about vendor common/ directories Wolfgang Denk
2016-04-14 11:09   ` Robert P. J. Day

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=alpine.LFD.2.20.1604130835360.4548@localhost.localdomain \
    --to=rpjday@crashcourse.ca \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.