hammer.git: introduce BUILD_BASE

Introduce BUILD_BASE to simplify some expressions.
hammer.git: convert strip_tree.sh to .pl

Convert strip_tree.sh to Perl to improve the performance with large trees.