Fixing Makefile so that it puts the -thread flag on the right place.