erlang: Cleanup and improve build script