bitcoin/bitcoin — pull request #4241 by theuni (2014-05-28 18:35:33+00:00)
Title: RFC: Non-recursive make

I decided to take care of this before handling the libsecp256k1 changes, because this should end up making future work much less tangled.

The point of this work is to avoid having separate logical builds for each directory. That causes complications because one target cannot know about changes in another directory. For example, if bitcoin/net.h changes, the qt target does not know that, and will continue to happily build/link against the stale intermediate libraries.

With a non-recursive system, however, each target is aware of all of its own components. In the example above, changing src/net.h would force a rebuild of all files that include that header, regardless of where they're located. Non-recursive also means that lots of spaghetti can go away, because we can include any dependency anywhere we want.

It also helps with parallelism because multiple targets can be compiling at once. A quick test shows that a fully ccached make -j8 of src/ (eliminating compiler time) is reduced from 20.4 sec to 13.7 sec. A make -j8 without ccache is reduced from 73.6 sec to 62.1.

Good/Simple description of the difference here: https://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html

This is an RFC of the general concept. It's complete and working, but it needs to be broken up logically for easier final review. At this stage I just want to be sure that no one hates the concept too much. There are lots of changes/tweaks that can be added, like skipping some convenience libraries, but the first task is to get parity with what we already have.

Build logic moves from individual Makefile.am's to include files, which the main src/Makefile.am includes. This avoids having to manage a gigantic single Makefile.

Stub Makefiles have been added to imitate previous behavior, for those who may have gotten used to doing a make or clean in specific subdirs. These can be expanded as desired, they're very simple for now.

Most deviations from the original Makefile.am's involve eliminating $(BUILT_SOURCES), so that generated files are created as late as possible, and without requiring a vanilla 'make' (without a target) as they do currently.