[sane-devel] Moving certain backends to separate directories
paddy-hack at member.fsf.org
Sat Aug 17 09:20:36 BST 2019
Louis Lagendijk writes:
> hi Olaf, Povilas
> On Tue, 2019-08-13 at 19:34 +0300, Povilas Kanapickas wrote:
>> Hi Olaf,
>> On 8/12/19 3:36 PM, Olaf Meeuwissen wrote:
>> > Hi Povilas,
>> > Povilas Kanapickas writes:
>> > > Hi,
>> > >
>> > > The genesys backend on the current master comprises of 42 files. I
>> > > propose to move it under `backend/genesys`? The same could eventually be
>> > > done to other larger backends (or maybe even all backends) as the
>> > > `backend` directory is becoming hard to navigate.
>> > I agree that for backends that consist of more than a "handful" of files
>> > it may be convenient/desirable to move them into a directory of their
>> > own below backend/. If doing so, we would need a naming convention and
>> > what you suggest, using the backend's name as the directory name, makes
>> > sense and works fine.
>> It's great that we agree.
>> > Moving things to a dedicated backend/$BACKEND_NAME directory also makes
>> > it slightly more convenient to limit searches and may make recompiling a
>> > bit more performant (depending on how you integrate the build bits).
>> > One question though, what are you're thoughts on the automake end of
>> > this approach? There are a couple of options here:
>> > - add a SUBDIRS variable to backend/Makefile.am and write a dedicated
>> > Makefile.am for your backend. This approach will not be able to
>> > benefit from any common settings in backend/Makefile.am but keeps it
>> > content focussed on the backend at hand.
>> > - just insert the directory name everywhere in backend/Makefile.am for
>> > files related to your backend. This simply makes that file a tad
>> > more verbose. You'd still be able to benefit from common settings
>> > but backend/Makefile.am would still have to cater to all backends.
>> > - extract the backend/Makefile.am bits for your backend into a snippet
>> > for inclusion in backend/Makefile.am. The snippet could either live
>> > in backend/ or in backend/$BACKEND_NAME. In both cases I would call
>> > it $BACKEND_NAME.am and in both cases it would have to include the
>> > $BACKEND_NAME directory in file names. This approach would be able
>> > to benefit from common settings in backend/Makefile.am and keep focus
>> > on the backend at hand nevertheless.
>> I think that for the beginning it could probably make sense just to edit
>> backend/Makefile.am and insert the directory name there. We could
>> explore more complex options later.
> For the backend developers option 1 (SUBDIRS) is easier as it allows
> one to cd into the backend directory and call make on that directory
> only (if I understand it correctly). But this will be a fair amount of
> work. For now just editing backend/Makefile.am will do.
Yes, you understand correctly and that's what I had more or less in mind
when I wrote "may make recompiling a bit more performant (depending on
how you integrate the build bits)".
As for reusing common bits, putting the include logic upside down, one
could prepare a backend/common-bits.am and include that file from one's
backend/$BACKEND_NAME/Makefile.am. Actually, one might even want to
make it a collections of *defaults* that can be overridden by the
And come to think of it, all three approaches can be mixed so each
backend can choose whatever suits its developer(s) best. That might get
a tad confusing though.
Anyway, let's keep things simple at first and see how the second
approach works out for the genesys backend.
Hope this helps,
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13 F43E B8A4 A88A F84A 2DD9
Support Free Software https://my.fsf.org/donate
Join the Free Software Foundation https://my.fsf.org/join
More information about the sane-devel