Years of use and exposure to moisture can weaken exterior door and window joints.
The first task is to close up any joints that have worked loose and secure them with dowels. Scrape loose dirt or old glue from the gaps and squeeze glue into them. Have a clamp ready to force the parts together. Various large clamps are available, including web clamps - these have a web strap which is wrapped around the parts and tightened. Remember to protect the wood with old offcuts so that the clamp doesn't "bite" the wood and spoil it.
Tighten the clamp until the joint is a tight fit. Now drill two holes of the same diameter as the dowels in the frame as shown in the picture. Glue and hammer in the dowels. Leave to dry overnight, trim the tops flush and paint to match in with the work.