Toplevel Makefile refactoring

This allow to only build a particular project: for example `make libextensions` or `make testcpp`, and it only compiles the useful dependencies.