Using the well-known low-energy effective Lagrangian of QCD --valid for small (non-vanishing) quark masses and a large number of colors-- we study in detail the regions of parameter space where $CP$ is spontaneously broken/unbroken for a vacuum angle $theta= pi$. In the $CP$-broken region there are first order phase transitions as one crosses $theta=pi$, while on the (hyper)surface separating the two regions, there are second order phase transitions signaled by the vanishing of the mass of a pseudo Nambu-Goldstone boson and by a divergent QCD topological susceptibility. The second order point sits at the end of a first order line associated with the $CP$ spontaneous breaking, in the appropriate complex parameter plane. When the effective Lagrangian is extended by the inclusion of an axion these features of QCD imply that standard calculations of the axion potential have to be revised when the QCD parameters fall in the above mentioned $CP$-broken region, in spite of the fact that the axion solves the strong-$CP$ problem. These latter results could be of interest for axionic dark matter calculations if the topological susceptibility of pure Yang-Mills theory falls off sufficiently fast when temperature is increased towards the QCD deconfining transition.