Rule 40. Defenses and Objections Made by Pleading or Motion

Every defense, in law or fact, to a claim for relief in any pleading shall be asserted in the responsive pleading thereto if one is required, except that the following defenses may, at the option of the pleader, be made by motion:
(a) Lack of jurisdiction, and
(b) failure to state a claim upon which relief can be granted. If a pleading sets forth a claim for relief to which the adverse party is not required to file a responsive pleading, then such party may assert at the trial any defense in law or fact to that claim for relief. If, on a motion asserting failure to state a claim on which relief can be granted, matters outside the pleading are to be presented, then the motion shall be treated as one for summary judgment and disposed of as provided in Rule 121, and the parties shall be given an opportunity to present all material made pertinent to a motion under Rule 121.