Split lengthy DoBuildTarget() function into understandable units.