6-21. Costs allowed either party or apportioned in discretion of court.
Costs in the following matters shall be taxed against either party, or apportioned among the parties, in the discretion of the court:
(1) Application for years' support, for surviving spouse or children.
(2) Caveats to wills and any action or proceeding which may require the construction of any will or trust agreement, or fix the rights and duties of parties thereunder; provided, that in any caveat proceeding under this subdivision, the court shall allow attorneys' fees for the attorneys of the caveators only if it finds that the proceeding has substantial merit.
(3) Habeas corpus; and the court shall direct what officer shall tax the costs thereof.
(4) In actions for divorce or alimony; and the court may both before and after judgment make such order respecting the payment of such costs as may be incurred by either spouse from the sole and separate estate of either spouse, as may be just.
(5) Application for the establishment, alteration or discontinuance of a public road, cartway or ferry. The board of county commissioners may order the costs incurred before them paid in their discretion.
(6) The compensation of referees and commissioners to take depositions.
(7) All costs and expenses incurred in special proceedings for the division or sale of either real estate or personal property under the Chapter entitled Partition.
(8) In all proceedings under the Chapter entitled Drainage, except as therein otherwise provided.
(9) In proceedings for reallotment of homestead for increase in value, as provided in the Chapter, Civil Procedure.
(10) In proceedings under Article 3 of Chapter 49 of the General Statutes regarding children born out of wedlock.
(11) In custody proceedings under Chapter 50A of the General Statutes.
(12) In actions brought for misappropriation of a trade secret under Article 24 of Chapter 66 of the General Statutes.
The word "costs" as the same appears and is used in this section shall be construed to include reasonable attorneys' fees in such amounts as the court shall in its discretion determine and allow: provided that attorneys' fees in actions for alimony shall not be included in the costs as provided herein, but shall be determined and provided for in accordance with G.S. 50-16.4.