The ABC model is a driven diffusive exclusion model, composed of three species of particles that hop on a ring with local asymmetric rates. In the weak asymmetry limit, where the asymmetry vanishes with the length of the system, the model exhibits a phase transition between a homogenous state and a phase separated state. We derive the exact solution for the density profiles of the three species in the hydrodynamic limit for arbitrary average densities. The solution yields the complete phase diagram of the model and allows the study of the nature of the first order phase transition found for average densities that deviate significantly from the equal densities point.PACS numbers: 05.50.+q, 05.70.Ln and 64.60.Cn