  We present an analysis of hadroproduction of $J/\psi$ and $\psi(2S)$ at
fixed-target energies in the framework of non-relativistic QCD (NRQCD). Using
both pion- and proton-induced data, a new determination of the color-octet
long-distance matrix elements (LDMEs) is obtained. Compared with previous
results, the contributions from the $q \bar{q}$ and color-octet processes are
significantly enhanced, especially at lower energies. A good agreement between
the pion-induced $J/\psi$ production data and NRQCD calculations using the
newly obtained LDMEs is achieved. We find that the pion-induced charmonium
production data are sensitive to the gluon density of pions, and favor pion
PDFs with relatively large gluon contents at large $x$.
