clean.sh 1.36 KB
Newer Older
1 2
#!/usr/bin/env bash

3 4
# This file is part of Qtah.
#
5
# Copyright 2015-2017 Bryan Gardiner <bog@khumba.net>
6 7
#
# This program is free software: you can redistribute it and/or modify
8 9 10
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
11 12 13 14
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU Lesser General Public License for more details.
16
#
17
# You should have received a copy of the GNU Lesser General Public License
18 19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

20 21
# Cleans up generated build outputs.

22
set -euo pipefail
23 24 25
projectDir=$(readlink -f "$0")
projectDir=$(dirname "$projectDir")
declare -r projectDir
26 27
. "$projectDir/common.sh"

28 29 30 31
usage() {
    cat <<EOF
clean.sh - Qtah build clean-up script

32
Removes all build outputs created by building Qtah.
33 34 35 36 37 38 39 40
EOF
}

if [[ ${1:-} = --help ]]; then
    usage
    exit 0
fi

41
for pkg in qtah-generator qtah qtah-cpp qtah-examples; do
42 43 44 45
    for variant in "" -qt4 -qt5; do
        p=${pkg}${variant}
        if [[ -d ${projectDir}/${pkg}${variant} ]]; then
            run cd "${projectDir}/${pkg}${variant}"
46 47 48 49
            run cabal clean
        fi
    done
done