Set outdir correctly when compiling to non ebin directories

Otherwise the beam file will be written to the wrong directory the second
time you save/compile it.