Fix pcc build
[harbours.git] / facade / cxx
blob239be6b8b1e3f170c5871c746e841d1045160a61
1 #!/bin/sh
3 # CXX 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 "[CXX $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_CXX $HSCT_CPPFLAGS "$@"
28 elif $running_cc; then
29 run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CXX $HSCT_CPPFLAGS $HSCT_CXXFLAGS "$@"
30 else
31 run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CXX $HSCT_CPPFLAGS $HSCT_CXXFLAGS $HSCT_LDFLAGS "$@" $HSCT_LDLIBS