-
Notifications
You must be signed in to change notification settings - Fork 51
/
clean_cmake.sh
executable file
·86 lines (52 loc) · 1.74 KB
/
clean_cmake.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /bin/bash
ScriptPath=$0
Dir=$(cd $(dirname "$ScriptPath"); pwd)
Basename=$(basename "$ScriptPath")
CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build}
MakeCmd=${SIS_CMAKE_COMMAND:-make}
# ##########################################################
# command-line handling
while [[ $# -gt 0 ]]; do
case $1 in
--help)
cat << EOF
Pantheios is an efficient, flexible, and robust C/C++ diagnostic logging library
Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
Copyright (c) 2005-2019, Matthew Wilson and Synesis Software
Executes CMake-generated artefacts to clean project
$ScriptPath [ ... flags/options ... ]
Flags/options:
behaviour:
standard flags:
--help
displays this help and terminates
EOF
exit 0
;;
*)
>&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage"
exit 1
;;
esac
shift
done
# ##########################################################
# main()
if [ ! -d "$CMakeDir" ]; then
>&2 echo "$ScriptPath: CMake build directory '$CMakeDir' not found so nothing to do; use script 'prepare_cmake.sh' if you wish to prepare CMake artefacts"
exit 1
else
cd $CMakeDir
if [ ! -f "$CMakeDir/Makefile" ]; then
>&2 echo "$ScriptPath: CMake build directory '$CMakeDir' does not contain expected file 'Makefile', so a clean cannot be performed. It is recommended that you remove all CMake artefacts using script 'remove_cmake_artefacts.sh' followed by regeneration via 'prepare_cmake.sh'"
cd ->/dev/null
exit 1
else
echo "Cleaning build (via command \`$MakeCmd clean\`)"
$MakeCmd clean
status=$?
cd ->/dev/null
exit $status
fi
fi
# ############################## end of file ############################# #