1 |
4 |
danv |
#!/bin/bash -eu
|
2 |
|
|
# -------------------------------------------------------------------------- #
|
3 |
|
|
#
|
4 |
|
|
# Copyright (C) 2010
|
5 |
|
|
# ASTRON (Netherlands Institute for Radio Astronomy)
|
6 |
|
|
# JIVE (Joint Institute for VLBI in Europe)
|
7 |
|
|
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
8 |
|
|
#
|
9 |
|
|
# This program is free software: you can redistribute it and/or modify
|
10 |
|
|
# it under the terms of the GNU General Public License as published by
|
11 |
|
|
# the Free Software Foundation, either version 3 of the License, or
|
12 |
|
|
# (at your option) any later version.
|
13 |
|
|
#
|
14 |
|
|
# This program is distributed in the hope that it will be useful,
|
15 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
# GNU General Public License for more details.
|
18 |
|
|
#
|
19 |
|
|
# You should have received a copy of the GNU General Public License
|
20 |
|
|
# along with this program. If not, see .
|
21 |
|
|
#
|
22 |
|
|
# -------------------------------------------------------------------------- #
|
23 |
|
|
#
|
24 |
|
|
|
25 |
|
|
# Run this tool with at least the commandline arguments:
|
26 |
|
|
# run_app_clean buildset design_name
|
27 |
|
|
# example:
|
28 |
|
|
# run_app_clean unb2 unb2_minimal
|
29 |
|
|
|
30 |
|
|
# read generic functions/definitions
|
31 |
|
|
. ${RADIOHDL_GEAR}/generic.sh
|
32 |
|
|
|
33 |
|
|
if [ $# -ne 2 ] && [ $# -ne 3 ]; then
|
34 |
|
|
hdl_error $0 "Syntax: run_app_clean []"
|
35 |
|
|
fi
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
# read in the configuration based on the user arguments
|
39 |
|
|
buildset=$1
|
40 |
|
|
project=$2
|
41 |
|
|
app=${3:+$3}
|
42 |
|
|
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}
|
43 |
|
|
|
44 |
|
|
PRJS="${RADIOHDL_BUILD_DIR}"
|
45 |
|
|
PRJ=
|
46 |
|
|
for prj in ${PRJS}
|
47 |
|
|
do
|
48 |
|
|
if [ -d "${prj}/${buildset}/quartus/${project}" ]; then
|
49 |
|
|
PRJ=${prj}
|
50 |
|
|
fi
|
51 |
|
|
done
|
52 |
|
|
if [ -z "${project}" -o -z "${PRJ}" ]; then
|
53 |
|
|
hdl_error $0 "Please enter a valid project name"
|
54 |
|
|
fi
|
55 |
|
|
|
56 |
|
|
if [ -z "${app}" ]; then
|
57 |
|
|
hdl_info $0 "No app name passed. Deleting BSP, UNB_LIB and compiled apps."
|
58 |
|
|
fi
|
59 |
|
|
|
60 |
|
|
# if the appdir does not exist. what to do?
|
61 |
|
|
# technically it's a failure; you can't clean something that isn't there
|
62 |
|
|
# logically one could reason: there is no need to clean something that
|
63 |
|
|
# isn't there so the post-condition is the same in both
|
64 |
|
|
# situations (exist + clean) vs (!exist + !clean).
|
65 |
|
|
# For now I (H. Verkouter) lean towards the logical clause since I think
|
66 |
|
|
# a non-fatal failure at this stage should not break other scripts
|
67 |
|
|
appdir="${PRJ}/${buildset}/quartus/${project}/software/${app}"
|
68 |
|
|
|
69 |
|
|
if [ -d "${appdir}" ]; then
|
70 |
|
|
hdl_exec $0 msg=no rm -Rf ${appdir}
|
71 |
|
|
fi
|
72 |
|
|
hdl_info $0 "Done."
|