In calculating cost basis for primary home sale, are all the closing costs deducted from the price of the sold home?

If not all closing costs what exactly can be deducted?