Implement flexible target specification

See commit message.
Can this FIXME move down to the target specification?