The basic idea is to replace gcc ... file.c ... with gcc -E ... file.c ... -o preproc.c dietc preproc.c > diet.c pass1 diet.c > diet.c pass2 diet.c > diet.c ... gcc ... diet.c ... To assist with this, we provide `scripts/dietcc`, which provides a drop-in replacement for `gcc` that can run your patches. In your build scripts, simply replace `gcc` with the path of `dietcc`. You can insert your own compilation pass into dietcc; read its Python source for examples.