driver/target -> driver/targetmachine and main() cleanup

Straightforward refactorings, see commit messages for details.