Fixed runtime errors in the rules
Changed tool build dir to be a configurable variable