Remove old, flat roofing material. Strip the roof down to the roof decking and wall tops. Leave the decking if it is in good shape and clean; replace it if it is damaged by water or has residue from a roofing membrane adhesive or tar from a built-up roof. Inspect the wall tops and repair or replace any split or damaged boards.
Measure the roof with a tape measure to get the span or width. Divide that by 2 to get the rafter run, the distance each one must cover; a 24-foot-wide house will have a run of 12 feet, for instance. Decide on a pitch or slope, based on the space required in an attic; a 5/12 pitch that rises 5 inches per foot will provide about 5 feet of space under the peak, while a 7/12 provides about 7 feet.
Make gable rafters from 2-by-4-inch framing lumber. Mark one as a pattern. Put the point of a framing square at one end of the board, with the 4-inch edge up. Set the point of the square at the bottom of the board. Align the 12-inch mark on the wide blade and inch mark on the thin tongue for the pitch, 5-inch for a 5/12 roof, at the top of the board. Mark the angle along the tongue for a top cut.
Look up the "length of common rafter" table on the square's blade and find the length differential under the pitch mark; under 5-inch, for instance, it will be 13 or 13 inches for every foot between roof peak and wall. Multiply that differential times the run, 13 times 12 on a 12-foot run, and measure that distance, 156 inches, down the bottom of the board.
Draw a 1-inch vertical line into the bottom of the board at that point. Measure 3 1/2 inches up the board from the bottom of that line and connect that point to the top of the vertical line to create a triangle to fit on top of the house wall. Add any desired overhang, typically 12 to 18 inches, and use the square to mark an end cut. Figure this like the top cut but with the point of the square at the bottom of the board.
Take another 3/4 inch off the top cut mark to make space for a ridge board between rafters. Cut all the angles with a circular saw. Set that rafter on the roof with the triangle on top of the wall cap and the top cut in the center of the roof. Use that rafter as a pattern once if fits properly to mark and cut all needed rafters, two per side spaced 24 inches apart the length of the roof.
Attach 2-by-4-inch bracing boards to stakes in the ground outside the back end wall; lay the tops on the wall. Put a pair of rafters in place on the end and plumb them with a level; nail them through the triangles to the wall caps with 16d framing nails, driven diagonally with a hammer, two on one side of a rafter and one on the other. Fasten both end rafters, let the tops rest loosely together and nail them to the bracing boards to hold them plumb.
Set another pair of rafters at the other end of the roof. Mark a 2-by-6-inch ridge board to go between the rafters the length of the roof. Measure 1 1/2 inches from the end to mark the inside of the first rafter pair. Measure 23 1/4 inches to mark the outside of the second rafter. Mark other rafters 24 inches apart, based on that second rafter line, the length of the roof; the last space may be slightly under 24 inches.
Lift the ridge board to the roof and slide it in place from the bottom between the end rafter tops. Level it with a 4-foot level and nail it in place through the rafter tops, two nails on each rafter. Install all other rafters, working in pairs, setting rafters plumb and keeping the ridge board level. Add metal hurricane clips to the ends of each rafter to tie them to the wall top.
Cover the roof with 4-by-8-foot panels of oriented strand board nailed to rafters with 8d galvanized nails. Lay panels horizontally with the rough side of the OSB up. Cut panels to fit with a circular saw. Overlap panels at the roof peak, so the edge of one goes over the edge of the panel on the other side.
Lay roofing paper over the OSB, stapled in place with a construction stapler, with layers of paper overlapping by 6 inches. Install metal drip edge on the sides and gable ends; nail this with shingle nails under the paper on the eaves, over the paper on the gable edges.
Shingle the roof with three-tab composition shingles. Nail a starter strip at the bottom of the two eaves, four nails per shingle at the top of the strip, with the bottom slightly over the end of the drip edge. Put a row of full shingles with the tabs over the starter strip. Start a second row of full shingles by cutting one tab width off one end, so shingle seams do not align. Cover the roof, alternating full and trimmed shingles at the end. Finish by installing cap shingles over the peak.