Implement flexible target specification

See commit message.
osx => macos

This also needs `eliminate_frame_pointer` to false I believe