Build system for a highly modular portable open source project [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionWe have an Open Source software project in the very beginning. The program is thought to be highly modular: for example, the underlying database can be either sqlite, postgre, or berkley, depending 开发者_Go百科on the preferences of the end-user.
Only one systematic approach I'm confident with, is to use Autotools (GNU build system). I would like to know however, do exist any promising alternative to it? It must be Open Source and be highly portable. It should also avoid all shortages of Autotools system, e.g. lack of concurrency support (configure script is very slow).
You can very well build stuff concurrently with autotools. You just need to avoid doing recursive make for the stuff you want to build in parallel. The basic idea is to have a Makefile.am
like:
bin_PROGRAMS =
noinst_LDLIBRARIES =
SUBDIRS = sub1 sub2 .
include here1/Makefile-files
include here2/Makefile-files
and here1/Makefile-files
like:
bin_PROGRAMS += here1
noinst_LDLIBRARIES += libhere1.la
here1_SOURCES = here1/src1.c here1/src2.c here1/src3.c
libhere1_la_SOURCES = here1/lib1.c here1/lib2.c
Then the stuff in the subdirectories sub1/
and sub2/
will be built separately from the current directory and before it (even though the respective builds might do stuff in parallel with the same trick!), and then the current directory will start building the stuff in the current dir's Makefile.am
and here[12]/Makefile-files
in parallel.
E.g. libgphoto2
use that mechanism to build 50+ camera drivers in parallel after a few prerequesites have been built. This significantly speeds up the total build time.
OK, the configure
script itself will not be sped up by this, but at least this will still do cross-compiling (unlike some of the alternative build systems). (You are listing portable as one of your requirements, and that often implies cross-compilation.)
Consider also using CMAKE for highly modular projects.
精彩评论