I've been working on the past years on a research compiler suite, which builds several executables and libraries. It has a build system (namely bootstrapper
) that looks into the ./src/bin
directory searching for tools to build, and on ./src/lib
, ./src/rtl
and ./src/std
for libraries, managing the dependencies (only internal dependencies!). Works pretty much like a single makefile for multiple tools (like GCC does). Because of this, they share the same codebase. I've been using a single git repository so far.
Since most tools and libraries are self-contained, I'd like to split the repository into several modules, since most tools don't depend on each other (there are no cyclical dependencies at all, only a couple of hierarchical ones!).
For example, I'd have a core
module with the very basic system, which would look something like this:
./README
./src/bootstrapper.krc
./src/bin/cpp.c
./src/bin/cc.c
./src/lib/cpp/...
./src/lib/cc/...
./src/lib/foo/...
./src/lib/bar/...
Which contains the builder, and that is self-contained; it should generate cpp
, cc
, and the libcpp
, libcc
, libfoo
and libbar
libraries.
I'd like then to have, for example, a ruby
module separated someway, that would look something like:
./src/bin/rbc.c
./src/lib/rbc/...
./src/std/ruby/...
Which would build rbc
, librbc
and libstdruby
... and then a python
module like:
./src/bin/pyc.c
./src/lib/pyc/...
./src/std/python/...
Which would build pyc
, libpyc
, and libstdpython
.
Though both the ruby
and python
hypotetical modules would depend on the core
module, they have no dependency at all on each other (and this is why I'm thinking about splitting my current repository).
Which way could I achieve this? I thought about using different git branches for each module (but I would require several hooks to automatically rebase everything based on their dependencies, like having multiple copies of the core
module and keeping them up to date), multiple git repositories (same problem), and git submodules won't help because I'd need a per-file-basis because of the build system I have...
(Though I prefer git, because I'd like to publish it on GitHub, I don't mind switching to another SCM.)
All tools (bin/example
) depend on the same ./include/bin/main.h
(which would be part of the core
module) that has a lot of macros... each folder on ./src/
actually has a corresponding ./include/
folder too (e.g., ./include/std/ruby/...
).
Here's a pic of somewhat what I described above, as it is currently: