diff --git a/MAKEALL b/MAKEALL
index 5b06c54..d926846 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -784,8 +784,8 @@ build_targets() {
 #-----------------------------------------------------------------------
 
 kill_children() {
-	local pgid=`ps -p $$ --no-headers -o "%r" | tr -d ' '`
-	local children=`pgrep -g $pgid | grep -v $$ | grep -v $pgid`
+	local pgid=`ps -p $$ -o pgid | sed -e "/PGID/d"`
+	local children=`ps -g $pgid -o pid | sed -e "/PID\|$$\|$pgid/d"`
 
 	kill $children 2> /dev/null
 	wait $children 2> /dev/null
