Hook script to run only for --release builds?

I want to have a hook script to only perform steps when we are building a release, i.e. --release flag has been specified. Is there a standard way to do that ?