  We derive the gravitational waveform and gravitational-wave energy flux
generated by a binary star system of compact objects (neutron stars or black
holes), accurate through second post-Newtonian order ($O[(v/c)^4] \sim
O[(Gm/rc^2)^2]$) beyond the lowest-order quadrupole approximation. We cast the
Einstein equations into the form of a flat-spacetime wave equation together
with a harmonic gauge condition, and solve it formally as a retarded integral
over the past null cone of the chosen field point. The part of this integral
that involves the matter sources and the near-zone gravitational field is
evaluated in terms of multipole moments using standard techniques; the
remainder of the retarded integral, extending over the radiation zone, is
evaluated in a novel way. The result is a manifestly convergent and finite
procedure for calculating gravitational radiation to arbitrary orders in a
post-Newtonian expansion. Through second post-Newtonian order, the radiation is
also shown to propagate toward the observer along true null rays of the
asymptotically Schwarzschild spacetime, despite having been derived using flat
spacetime wave equations. The method cures defects that plagued previous
``brute- force'' slow-motion approaches to the generation of gravitational
radiation, and yields results that agree perfectly with those recently obtained
by a mixed post-Minkowskian post-Newtonian method. We display explicit formulae
for the gravitational waveform and the energy flux for two-body systems, both
in arbitrary orbits and in circular orbits. In an appendix, we extend the
formalism to bodies with finite spatial extent, and derive the spin corrections
to the waveform and energy loss.
