Fix pcc build
[harbours.git] / facade / cc
bloba22f3e2268a8dd73202daeb694f176a29d663329
1 #!/bin/sh
3 # CC is a compilation driver, so we should check which stage of compilation
4 # is actually running and select which flags to provide. This makes no
5 # difference for GCC, but e.g. clang warns when a flag is provided that is
6 # unused
8 run_it() {
9 # echo "[CC $PWD]:" "$@"
10 exec "$@"
13 running_pp=false
14 running_cc=false
16 # Guess what is actually running...
17 for flag in "$@"; do
18 case "$flag" in
19 -E) running_pp=true ;;
20 -c|-S) running_cc=true ;;
21 *) ;;
22 esac
23 done
25 # ...and pass the correct flags
26 if $running_pp; then
27 run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC $HSCT_CPPFLAGS "$@"
28 elif $running_cc; then
29 run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC $HSCT_CPPFLAGS $HSCT_CFLAGS "$@"
30 else
31 run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC $HSCT_CPPFLAGS $HSCT_CFLAGS $HSCT_LDFLAGS "$@" $HSCT_LDLIBS