Fixed bash compile error.
Updated how .sh and .mk are generated.

- Renamed functions that just output content to stdout gen_* -> emit_*.
- The actual calls are now redirected to the output filename.
Updates to script gen.

- Added support for bash vs sh gen.
- Fixed up dangling references to gen_* to emit_*.