1#!/usr/bin/env bash 2 3# Source file. 4src="$(printf %q "$1")" 5shift 6 7# Output file the compiler expects. 8out="$(printf %q "$1")" 9shift 10 11# Create the file the compiler expects. It will check syntax. 12>"$out" 13 14cpp='cpp' 15opts='' 16while test "$#" != 0; do 17 case "$1" in 18 # Extract the option for the path to cpp. 19 --cpp) shift; cpp="$(printf %q "$1")" ;; 20 # Extract the option for our own output file. 21 --out) shift; out="$(printf %q "$1")" ;; 22 # Collect the rest of the command line. 23 *) opts="$opts $(printf %q "$1")" ;; 24 esac 25 shift 26done 27 28# Execute the real preprocessor tool. 29eval "exec $cpp $src $out $opts" 30