Optimizing search for TOP dir

Adapting version of the search for TOP dir by James Ladan.
It relies on bash like expansion and avoids calling 'cd' and 'pwd'
commands.
Move setting of 'd' to Makefile

No reason to have this checked in every header so I've moved this (and
simplified) to Makefile.

In addition minor change for info message indicating end of makefiles
reading phase.