Superconductivity, charge-density waves, antiferromagnetism, and phase separation in the Hubbard-Holstein model