OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_14/usb_fpga_2_14/trunk

Subversion Repositories usb_fpga_2_14

[/] [usb_fpga_2_14/] [trunk/] [examples/] [ucecho/] [fpga-2.14/] [clean.sh] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
#!/bin/bash
2
 
3
# This files / directories will be removed
4
rms="fpga.hw *.cache *.data/wt *.runs/.jobs *.runs/synth_*/* *.runs/impl_*/*"
5
# This files / directories in *.srcs/sources_*/ip/*/ will be removed
6
ip_rms="_tmp log.txt */docs */example_design */user_design/log.txt"
7
# Files with this extensions are not removed
8
keepext="vhd v xdc ucf bit bin"
9
 
10
# This sould not be edited.
11
list_files() {
12
    if [ "$2" != "" ]; then
13
        echo "$1"
14
        for i in $2; do
15
            echo "  $i"
16
        done
17
    fi
18
}
19
 
20
check_ext() {
21
    f=${1##*.}
22
    for e in $keepext; do
23
        if [ "$e" = "$f" ]; then
24
            return 0
25
        fi
26
    done
27
    return 1
28
}
29
 
30
rmfiles=""
31
keepfiles=""
32
rmdirs=""
33
for i in $ip_rms; do
34
    for j in *.srcs/sources_*/ip/*/$i; do
35
        if [ -d "$j" ]; then
36
            rmdirs+=" $j"
37
        fi
38
        if [ -f "$j" ]; then
39
            if check_ext "$j"; then
40
                keepfiles+=" $j"
41
            else
42
                rmfiles+=" $j"
43
            fi
44
        fi
45
    done
46
done
47
 
48
for j in $rms; do
49
    if [ -d "$j" ]; then
50
        rmdirs+=" $j"
51
    fi
52
    if [ -f "$j" ]; then
53
        if check_ext "$j"; then
54
            keepfiles+=" $j"
55
        else
56
            rmfiles+=" $j"
57
        fi
58
    fi
59
done
60
 
61
list_files "This files will NOT be removed:" "$keepfiles"
62
list_files "This directories will be removed:" "$rmdirs"
63
list_files "This files will be removed:" "$rmfiles"
64
 
65
if [ "$rmfiles" == "" -a "$rmdirs" == "" ]; then
66
    c="yes"
67
else
68
    echo -n 'Confirm this by entering "yes": '
69
    read c
70
fi
71
 
72
if [ "$c" == "yes" ]; then
73
    rm -fr  *.runs/impl_*/.* 2>/dev/null
74
    rm -fr  *.runs/synth_*/.* 2>/dev/null
75
    [ "$rmfiles" != "" ] && rm $rmfiles
76
    [ "$rmdirs" != "" ] && rm -r $rmdirs
77
    exit 0
78
fi
79
exit 1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.