We consider the transverse-momentum distribution of heavy flavours in hadronic collisions. We present a formalism in which large transverse-momentum logarithms are resummed at the next-to-leading level, and mass effects are included exactly up to order α_strong^3, so as to retain predictivity at both small and large transverse momenta. As an example, we apply our formalism to b production at the Tevatron.