#! /usr/bin/env bash
# Put this script, along with centrinel on your path, then pass it to make:
#
# $ make CC=centrinelcc
#
# Use REAL_CC to specify the real compiler. If unset, cc from the path will be
# invoked.
#
# The script first runs the real compiler and if returns with exit code 0, runs
# centrinel.
#
# If make invokes the compiler to do linking, centrinel will note that no
# source files are specified and will return with exit code 0.

# set -x

if [ "z$REAL_CC" = "z" ]; then
    REAL_CC=cc
fi

($REAL_CC "$@") && exec centrinel -- "$@"
