Implement flexible target specification

See commit message.
Was this disabled originally for dragonfly?