compilation-directory-matcher is a variable defined in `compile.el'.
Its value is

("\\(?:Entering\\|Leavin\\(g\\)\\) directory [`']\\(.+\\)'$" (2 . 1))

A list for tracking when directories are entered or left.
If nil, do not track directories, e.g. if all file names are absolute. The
first element is the REGEXP matching these messages. It can match any number
of variants, e.g. different languages. The remaining elements are all of the
form (DIR . LEAVE). If for any one of these the DIR'th subexpression
matches, that is a directory name. If LEAVE is nil or the corresponding
LEAVE'th subexpression doesn't match, this message is about going into another
directory. If it does match anything, this message is about going back to the
directory we were in before the last entering message. If you change this,
you may also want to change `compilation-page-delimiter'.