Specifically I want to use latexmk to compile a LaTeX document that uses the
glossaries package to produce a glossary. Currently I'm using this rather clumsy sequence of commands:
makeglossaries document latexmk -pdf document.tex makeglossaries document latexmk -pdf document.tex
The first run of makeglossaries is required to produce files that the
glossaries package needs, or otherwise causes latexmk to fail, but there's still no data in the (non-existant) .aux file, so that first makeglossaries invocation produces nothing (except for an empty file).
So, how to do this using latexmk alone (and let that deal with invoking makeglossaries at the right time)?