samoht/assemblage — pull request #152 by samoht (2014-12-16 21:25:24+00:00)
Title: First steps to make the Makefile backend bootstrap again.

Support for dynamic inter-module dependency discovering. A bit
hackish, but not too much actually. With that patch, the library
bootstrap again, yay!

The current scheme to turn our pretty applicative DSL into a monadic monstruosity:

- add a `.prepare` step, which goal is to symlink all the source
files into the build dir . This need some kind of convolutions
and is done partly in the backend, as Assemblage has only access to
the reverse information in the project description. But the current
solution is not too bad and generic enough (I think).

- to compile a ml or mli your first need to build the corresponding
ml-deps or mli-dep (very similar to ocamlbuild, ocp-build and
other).

- to generate a ml-deps or mli-deps you must first prepare all the
include directories (ie. .prepare). This ensure that ocamldep
has all the relevant information to compute correct dynamic
dependencies.

- And finally, the final trick is to `-include` all the ml-deps and
mli-deps to lazily add the new depenencies infered by ocamldep.

This is all (relatively) standard in the Makefile world and it seems
to work fine on my relatively limited testing.