Motherwell have signed former Everton and Scotland striker James McFadden on a contract that runs until the end of the season.