  Ergodic optimization aims to describe dynamically invariant probability
measures that maximize the integral of a given function. For a wide class of
intrinsically ergodic subshifts over a finite alphabet, we show that the space
of continuous functions on the shift space splits into two subsets: one is a
$G_\delta$ dense set for which all maximizing measures have `relatively small'
entropy; the other is contained in the closure of the set of functions having
uncountably many, fully supported ergodic measures with `relatively large'
entropy. This result considerably generalizes and unifies the results of Morris
(2010) and Shinoda (2018), and applies to a wide class of intrinsically ergodic
non-Markov symbolic dynamics without Bowen's specification property, including
any transitive piecewise monotonic interval map, some coded shifts and
multidimensional $\beta$-transformations. Along with these examples of
application, we provide an example of an intrinsically ergodic subshift with
positive obstruction entropy to specification.
