Clean .bbl files with latexmk -C

I use TeXLive 2012 and compile with run

``````latexmk -pvc -pdf -quiet test.tex
``````

later I clean the directory with

``````latexmk -C
``````

But `test.bbl` remains. How can I help latexmk to find bbl files?

test.bbl (first lines)

``````% \$ biblatex auxiliary file \$
% \$ biblatex bbl format version 2.1 \$
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
``````
-
You need the `.bbl` file for typesetting the document! –  egreg Nov 19 '12 at 14:27
...I thought latexmk creates it. I never wrote a .bbl file manually. –  Jonas Stein Nov 19 '12 at 15:30
If your document is in final form and you don't need to compile it any more, then you can safely delete the `.bbl` file. –  egreg Nov 19 '12 at 16:52
as long I do not delete it manually with `rm` latexmk ignores changes I made with jabref. –  Jonas Stein Nov 19 '12 at 17:35

By default, `latexmk` treats `.bbl` files as non-regeneratable. This is because the `.bib` from which they are made is not always available. See the documentation for a fuller explanation, especially the explanation of the `\$bibtex_use` variable. To get `latexmk -C` to delete `.bbl` files, put the following in an initialization file:

``````\$bibtex_use = 2;
``````
-
Oh my, you were faster than me by 10 seconds. `:)` In other news, I know that this is probably not the best place to say this, but your awesome work with `latexmk` inspired me to write `arara`. I really admire all the effort you've put into the tool. Thanks a million. –  Paulo Cereda Nov 19 '12 at 18:26
Is `\$bibtex_use = 2;` equivalent to `-bibtex`? –  Jonas Stein Nov 19 '12 at 18:34
Yes. The option `-bibtex` simply sets `\$bibtex_use` to 2. –  John Collins Nov 19 '12 at 22:29
Another option to the presumably canonical answer John gave is specifying `\$clean_ext` in a latexmkrc file, which contains your personalized global options. This file can be in one of the places I outlined in my answer to Latexmk: makeglossaries, Biber and pdfLaTeX / Where to put latexmkrc?. Also see the latexmk manual.
``````\$clean_ext = 'synctex.gz synctex.gz(busy) run.xml tex.bak bbl bcf fdb_latexmk run tdo %R-blx.bib'
(As a result of -- I think -- SyncTeX, latexmk, Texmaker, `biblatex`, Biber, `todonotes`)