I'm trying to use `latexmk` for the first time in Ubuntu. My project directory is the following:

* Project
	+ src
	+ build
	+ images

In the `src` directory are the `.tex` and `.bib` files. I want the `.aux`, `.bbl`, `.log` etc. files to go into the build directory.

In the root directory I have the following script:

```
#!/bin/sh

if [ $# -gt 0 ];then
    if [ $1 = "-c" ];then
        cd build
        latexmk -c ../src/poly-paper.tex
    fi
else
    cd build
    latexmk -pdf ../src/poly-paper.tex
    mv poly-paper.pdf ..
fi

```

The problem is that using this script causes it to not find the bibliography. My `latexmk` is v4.24 and doesn't support the `-auxdir` commands and I have to do without it so that someone else can compile it too.

Could someone suggest a solution please?

**EDIT:** I didn't know `latexmk` is a simple script, so I installed the newest version but I have problems using the `-auxdir` and `-outdir` commands. The problems is that Ubuntu comes with TexLive 2009 which does not support the `-output-directory` for `pdflatex`.