buildtool.py: improve check_stamp() implementation
buildtool.py: check that dependencies are ready before building