diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-07-21 21:40:56 +0530 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-07-21 21:40:56 +0530 |
commit | 1e9d8008420e3d191db1e7bab3d2488c96cfbbbb (patch) | |
tree | 8f969bd7eae5bdc48a3b42c54de52075e90151a6 /cmake | |
parent | ae2eea3de35312ff87259c4fa67fb6bd08b21d7b (diff) | |
download | libgd-1e9d8008420e3d191db1e7bab3d2488c96cfbbbb.tar.gz |
cmake: add distclean target
There's no way to properly/fully clean a cmake build when it's configured
in-tree because they only really want to support out-of-tree builds. Add
a custom script to handle this instead.
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/distclean.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/distclean.sh b/cmake/distclean.sh new file mode 100755 index 0000000..0124dd1 --- /dev/null +++ b/cmake/distclean.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# CMake doesn't provide the equiv of "distclean" which makes it impossible to +# properly clean up after it when you build in-tree. This script emulates it. +# It assumes it's run in the dir you want to clean. + +usage() { + cat <<-EOF +Usage: $0 [--automake] + +Clean all the cmake generated output files. + +Options: + --automake Do not clean files autotools also creates +EOF + exit ${1:-0} +} + +AUTOMAKE="false" +while [ $# -ne 0 ]; do + case $1 in + -h|--help) usage ;; + --automake) AUTOMAKE="true" ;; + *) usage 1 ;; + esac + shift +done + +set -x + +find . -maxdepth 3 \ + '(' \ + -name CMakeCache.txt -o \ + -name CMakeFiles -o \ + -name CTestTestfile.cmake -o \ + -name cmake_install.cmake \ + ')' \ + -exec rm -rf {} + +rm -rf \ + Bin Testing \ + CPackConfig.cmake CPackSourceConfig.cmake \ + DartConfiguration.tcl + +if [ "${AUTOMAKE}" = "false" ]; then + find . -maxdepth 3 '!' -wholename './windows/*' -a -name Makefile -exec rm -rf {} + + rm -f src/config.h +fi |