Implement flexible target specification

See commit message.
The second FIXME should move down to the OSX specification