diff --git a/bin/rmdepall b/bin/rmdepall
index 8345ecbad44bbbef23e39b5054f3525c7f5c585f..cd5cadacfcc3ff06ccc7ede1904917d4a2de3b8f 100755
--- a/bin/rmdepall
+++ b/bin/rmdepall
@@ -1,2 +1,12 @@
 #!/bin/sh
-find . \( -name '*.dep' \) -print | xargs -t rm
+
+if [ $# -eq 0 ]; then
+    find . \( -name '*.dep' \) -print | xargs -t rm
+elif [ $# -eq 1 ]; then
+    echo "Removing all dep files containing $1..."
+    find . -name '*.dep' -exec grep "$1" '{}' \; | sed -e 's/:.*//' | xargs -t rm
+else
+    echo "Usage: `basename $0`        to remove all .dep files"
+    echo "       `basename $0` <file> to remove all .dep files referring to <file>"
+    exit 1
+fi