Deductions & credits

Your capital gain is the difference between your cost and your selling proceeds.  

Your adjusted cost basis is what you paid to build the home.  You can include the cost of the land, amounts paid to contractors or for materials, inspections, permits, architect plans  and other required costs.  Allowable adjustments are shown in publication 523 on page 8.  
https://www.irs.gov/publications/p523


You can also adjust the selling price by certain taxes and fees and your real estate commission.  

The difference is your gain.