[sane-devel] Moving certain backends to separate directories

Olaf Meeuwissen paddy-hack at member.fsf.org
Mon Aug 12 13:36:20 BST 2019


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.

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.

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 mailing list