File indexing completed on 2024-11-17 05:08:35

0001 #!/bin/sh
0002 # This script makes a preliminary .cvsignore in the current dir by
0003 # adding some standard stuff according to Makefile.am.
0004 # License: GPL
0005 
0006 addignore() {
0007         test -f .cvsignore || \
0008         ( touch .cvsignore && echo "created new .cvsignore" && cvs add .cvsignore )
0009         grep -q "^$1\$" .cvsignore || \
0010         ( echo "$1" >> .cvsignore && echo "added $1 to .cvsignore" )
0011 }
0012 
0013 recurse=0
0014 if test $# -eq 1; then
0015         if test "$1" = "-r"; then
0016                 recurse=1
0017         fi
0018 fi
0019 
0020 handledir() {
0021         (
0022         cd $1
0023         if test -f Makefile.am; then
0024                 if test $recurse -eq 1; then
0025                         echo "Entering $1"
0026                 fi
0027                 addignore Makefile
0028                 addignore Makefile.in
0029 
0030                 bins=`perl -p -e 's/\\\s*\n/ /g' Makefile.am | grep _PROGRAMS | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`
0031                 if test -n "$bins"; then
0032                         for prog in $bins; do
0033                                 addignore "$prog"
0034                         done
0035                 fi
0036         else
0037                 echo "Skipping $1"
0038         fi
0039         )
0040 }
0041 
0042 
0043 if test -f Makefile.am; then
0044         if test $recurse -eq 1; then
0045                 find . -type d | grep -v CVS | sed -e 's,/$,,' | \
0046                 while read dir; do
0047                         handledir $dir
0048                 done
0049         else
0050                 handledir .
0051         fi
0052 else
0053         echo "No Makefile.am found!"
0054 fi
0055