Add prefix_dir/eprefix_dir to config.

By adding the [e]prefix_dir variables we can drastically simplify code.
Add 'j' and 'cmd' methods to BuildProtocol class

This simplifies code in xyz.py and more importantly in the rules.
Refactor to reduce rules complexity.