That's a large piece
Here's how I would do it. For the mortise, a router with a self centering base plate,and 1/2" diameter upspiral bit. Stop the slot short of the ends by about 1/2". Hand chisel the slot square in the corners. A stopped mortise and tenon joint:
For the tenon, if you have a radial arm saw, fit up a dado blade and remove the desired amount of material from each side. If you only have a router then make a "T" square guide to waste away the material. Support the router base opposite the cut with a scrap piece of stock the same thickness, to avoid tipping the router.
Making a tenon on the table saw with a long headboard piece will be awkward and may not be precise. A crosscut sled will help if you have one.