URL
https://opencores.org/ocsvn/radiohdl/radiohdl/trunk
Subversion Repositories radiohdl
[/] [radiohdl/] [trunk/] [quartus/] [run_app_clean] - Rev 4
Compare with Previous | Blame | View Log
#!/bin/bash -eu
# -------------------------------------------------------------------------- #
#
# Copyright (C) 2010
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# JIVE (Joint Institute for VLBI in Europe) <http://www.jive.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# -------------------------------------------------------------------------- #
#
# Run this tool with at least the commandline arguments:
# run_app_clean buildset design_name
# example:
# run_app_clean unb2 unb2_minimal
# read generic functions/definitions
. ${RADIOHDL_GEAR}/generic.sh
if [ $# -ne 2 ] && [ $# -ne 3 ]; then
hdl_error $0 "Syntax: run_app_clean <buildset> <project> [<app>]"
fi
# read in the configuration based on the user arguments
buildset=$1
project=$2
app=${3:+$3}
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}
PRJS="${RADIOHDL_BUILD_DIR}"
PRJ=
for prj in ${PRJS}
do
if [ -d "${prj}/${buildset}/quartus/${project}" ]; then
PRJ=${prj}
fi
done
if [ -z "${project}" -o -z "${PRJ}" ]; then
hdl_error $0 "Please enter a valid project name"
fi
if [ -z "${app}" ]; then
hdl_info $0 "No app name passed. Deleting BSP, UNB_LIB and compiled apps."
fi
# if the appdir does not exist. what to do?
# technically it's a failure; you can't clean something that isn't there
# logically one could reason: there is no need to clean something that
# isn't there so the post-condition is the same in both
# situations (exist + clean) vs (!exist + !clean).
# For now I (H. Verkouter) lean towards the logical clause since I think
# a non-fatal failure at this stage should not break other scripts
appdir="${PRJ}/${buildset}/quartus/${project}/software/${app}"
if [ -d "${appdir}" ]; then
hdl_exec $0 msg=no rm -Rf ${appdir}
fi
hdl_info $0 "Done."