forked from skuhl/opengl-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.sh
executable file
·71 lines (62 loc) · 2.08 KB
/
cleanup.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
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
function cleandir()
{
echo
echo "=== Cleaning ${1}"
# If makefile still exists, try "make clean"
if [[ -e Makefile ]]; then
make --quiet -C "${1}" clean
fi
rm -vrf "${1}/CMakeFiles"
rm -vf "${1}/CMakeCache.txt"
rm -vf "${1}/Makefile"
rm -vf "${1}/cmake_install.cmake"
# Visual studio files
rm -vrf "${1}"/*.dir
rm -vrf "${1}/Debug"
rm -vf "${1}"/*.vcxproj
rm -vf "${1}"/*.vcxproj.filters
rm -vf "${1}"/*.vcxproj.user
rm -vrf "${1}/.vs"
rm -vf "${1}/opengl-examples.VC.db"
rm -vf "${1}/opengl-examples.sln"
rm -vrf "${1}/Win32"
# Text editor backup files:
rm -vf *~ \#*\#
}
# Get the directory that this script is in (might not be the same as
# the current working directory).
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Clean top level directory first so 'make clean' will work.
cleandir "${THIS_DIR}"
# Clean subdirectories
for D in *; do # For each file and directory
if [ -d "${D}" ]; then # If it is a directory
if [[ -e "${D}/CMakeLists.txt" ]]; then # if CMakeLists file is present. We don't want to run in the bin folder because that makefile isn't generated by cmake.
cleandir "${THIS_DIR}/${D}"
fi
fi
done
echo
echo "=== Cleaning other files"
rm -vrf "${THIS_DIR}/doxygen-docs"
rm -vf "${THIS_DIR}/bin/"*.frag "${THIS_DIR}/bin/"*.vert
# These files shouldn't be here, but if someone accidentally puts them there, it breaks 'make' in the bin folder.
rm -vf "${THIS_DIR}/bin/CMakeCache.txt" "${THIS_DIR}/bin/cmake_install.cmake"
# Linux:
rm -vf "${THIS_DIR}/bin/"*libOVR*.so*
# Mac:
rm -vrf "${THIS_DIR}/bin/"*.dSYM
# Windows:
rm -vrf "${THIS_DIR}/bin/Debug"
# Find any log files anywhere in this tree and delete them.
find "${THIS_DIR}" -type f \( -name 'log.txt' -o -name 'log-ivs-left.txt' -o -name 'log-ivs-right.txt' \) -exec rm -vf "{}" \;
if [[ -x "${THIS_DIR}/.git" && -x /usr/bin/git ]]; then
echo
echo
echo "Consider removing the following files because they are not in the git repo and are not ignored:"
echo
pushd "${THIS_DIR}" > /dev/null
git ls-files --others --exclude-standard
popd > /dev/null
fi