How can I cleanup after failure?

We provision a build target before building a binary, but if the build fails at any point we still want to tear down the server. Without a better way of doing it I moved all the build steps and the cleanup into my Makefile and ended up with this:

dependencies:
  override:
    - make build ; make clean

I would much rather create my build server in pre and tear it down in post and expand my build step into mostly individual commands in override as opposed to running make this way. Is there a way to run commands after failure?