Remove old siding from the wall and old shingles from the roof. Check to see whether the underlying sheathing and structure are solid and free from rot. Any rotten pieces should be replaced.
Install pieces of step flashing against the wall at the same time that you shingle the roof, so that each piece of flashing is underneath the shingle above it. This makes the flashing look better and also allows the water to flow down from the shingle to the flashing, keeping it out of the roof and the wall.
Apply roofing tar to the edges of the underside of each piece of flashing as you install it, for extra protection against leakage.
Nail each piece of flashing to the wall using roofing nails and cover the heads of the roofing nails with roofing tar. Each piece of step flashing is made in an L shape. The corner of the L should be pressed into the joint between the roof and the wall, with one leg of the L extending up the wall and the other extending out onto the roof.
Install siding over the top of the flashing, leaving a 2-inch space between the bottom of the siding and the roof. If you install the siding so its bottom is against the roof, it will absorb moisture from the surface of the roof and rot more quickly.