summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/compile.test
blob: b5afa1853fe77cca2214e22b15b9dca07e9f8a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh

SUCCESS=no
QMKSPEC=$1
XPLATFORM=`basename "$1"`
QMAKE_CONFIG=$2
VERBOSE=$3
SRCDIR=$4
OUTDIR=$5
TEST=$6
EXE=`basename "$6"`
DESCRIPTION=$7
shift 7
LFLAGS=""
INCLUDEPATH=""
CXXFLAGS=""
while [ "$#" -gt 0 ]; do
    PARAM=$1
    case $PARAM in
    -framework)
        LFLAGS="$LFLAGS -framework \"$2\""
        shift
        ;;
    -F*|-m*|-x*)
        LFLAGS="$LFLAGS $PARAM"
        CXXFLAGS="$CXXFLAGS $PARAM"
        ;;
    -L*|-l*|-pthread)
	LFLAGS="$LFLAGS $PARAM"
	;;
    -I*)
        INC=`echo $PARAM | sed -e 's/^-I//'`
        INCLUDEPATH="$INCLUDEPATH $INC"
        ;;
    -f*|-D*)
        CXXFLAGS="$CXXFLAGS $PARAM"
        ;;
    -Qoption)
	# Two-argument form for the Sun Compiler
	CXXFLAGS="$CXXFLAGS $PARAM \"$2\""
	shift
	;;
    *)  ;;
    esac
    shift
done

# debuggery
[ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION auto-detection... ($*)"

test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST"

cd "$OUTDIR/$TEST"

make distclean >/dev/null 2>&1
"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"

if [ "$VERBOSE" = "yes" ]; then
    make
else
    make >/dev/null 2>&1
fi

[ -x "$EXE" ] && SUCCESS=yes

# done
if [ "$SUCCESS" != "yes" ]; then
    [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION disabled."
    exit 1
else
    [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION enabled."
    exit 0
fi