The Bucks, who have gutted their team and have plenty of cap space, are shaping up as the leading suitor for J.R. Smith.

But if Smith leaves the Knicks to get more bucks in Milwaukee, he will find himself in a rebuilding program. That’s the decision the Freehold, N.J., native, has to make.

Take less to stay with the hometown Knicks, who can offer a four-year, roughly $25 million contract — which comes to $6.25 million a season after yearly raises — or follow the “green’’ jerseys of Milwaukee or another under-the-cap club willing to make a four-year commitment. The market value is being set for him to get an offer of at least $7 million per year.

The Racine (Wis.) Journal Times reported a week ago the backcourt-challenged Bucks would make a run at Smith and are waiting until they come to an agreement with restricted free-agent point guard Brandon Jennings. The Suns also could make a play for Smith with their cap space, and a source said the Pistons have minimal