A teenager has been handed an indefinite jail sentence after murdering his partner's four-month-old baby.