-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathautoclean.sh
executable file
·62 lines (49 loc) · 1.26 KB
/
autoclean.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#
# Author : Olivier Delhomme
# Licence : GNU GPL v3
#
##
# Deletes all files passed in arguments
#
function delete_files {
for file in "${@}"; do
if test -f "${file}"; then
echo "${file}"
rm -f "${file}"
fi
done
}
##
# Deletes all directories (and their content) passed in arguments
#
function delete_dirs {
for dir in "${@}"; do
if test -d "${dir}"; then
echo "${dir}"
rm -fr "${dir}"
fi
done
}
##
# Prints the command being executed and deletes files in the whole
# project ($1 is the argument to find files to be deleted)
#
function delete_files_everywhere {
for file in "${@}"; do
echo "find . -name ${file} -exec rm -f {} \;"
find . -name "${file}" -exec rm -f {} \;
done
}
##
# Real start of the script
if [ -f Makefile ];
then
make distclean
fi;
delete_files "aclocal.m4" "config.guess" "config.sub" "depcomp" "install-sh"
delete_files "ltmain.sh" "missing" "configure" "config.status" "config.log"
delete_files "libtool" "compile"
delete_dirs "autom4te.cache" 'packaging/debian/cdpfgl*'
delete_files_everywhere '*~' '*#' '*.gcd[ao]' '*.gcov' '*.gcno'
delete_files_everywhere "gmon.out" "Makefile" "Makefile.in" ".libs" ".deps"