#!/usr/bin/env sh

if ! qmake -v; then
    printf '%s\n' 'ERROR: qmake not found, cannot build Qt GUI' > /dev/stderr
    exit 1
fi

rm -f .qmake.stash qt5check qt5check-makefile qt5check.o

qmake qt5check.pro
make --file=qt5check-makefile

if ! ./qt5check; then
    printf '%s\n' 'ERROR: Insufficient Qt5 system' > /dev/stderr
    exit 1
fi

rm -f .qmake.stash qt5check qt5check-makefile qt5check.o

printf '%s\n' 'qt5check finished successfully'
