summaryrefslogtreecommitdiff
path: root/auto-clean
diff options
context:
space:
mode:
authorkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
committerkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
commit065da3509019b15dd0e678072e6be629e5330bef (patch)
tree69c934c9e786ac048b4fbe8f4c4c5571661521f4 /auto-clean
parentd130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff)
downloadlibmcpu-0.4.0.tar.xz
Version 0.4.00.4.0
Diffstat (limited to 'auto-clean')
-rwxr-xr-xauto-clean42
1 files changed, 42 insertions, 0 deletions
diff --git a/auto-clean b/auto-clean
new file mode 100755
index 0000000..346660a
--- /dev/null
+++ b/auto-clean
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+CWD=`pwd`
+
+program=`basename $0`
+
+usage() {
+ cat << EOF
+
+Usage: $program [options]
+
+Options:
+ -h,--help Display this message.
+
+EOF
+}
+
+if [ -f "${CWD}/Makefile" ] ; then
+ make distclean
+fi
+
+gitignore='.gitignore'
+
+if [ -f "$gitignore" ] ; then
+ while read ln; do
+ line=`echo "${ln}" | sed 's,^[ \t],,' | sed 's,[ \t]$,,'`
+ if [ "x$line" != "x" -a "${line:0:1}" != "#" ] ; then
+ if `echo "${line}" | grep -q '\*~$'` ; then
+ find "`dirname "${line}"`" -type f -iname '*~' -print0 | while IFS= read -r -d '' file ; do
+ rm -f "$file"
+ done
+ elif `echo "${line}" | grep -q '\*'` ; then
+ find "`dirname "${line}"`" -type f -iname "`basename "${line}"`" -print0 | while IFS= read -r -d '' file ; do
+ rm -f "$file"
+ done
+ else
+ if [ -d "${line}" ] ; then rm -rf "${line}" ; fi
+ if [ -f "${line}" ] ; then rm -f "${line}" ; fi
+ fi
+ fi
+ done < ${CWD}/${gitignore}
+fi