allow both -f and -p at the same time
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 2 Jan 1988 08:04:38 +0000 (00:04 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 2 Jan 1988 08:04:38 +0000 (00:04 -0800)
SCCS-vsn: usr.bin/mkdep/mkdep.sh 5.9

usr/src/usr.bin/mkdep/mkdep.sh

index acd6192..778d56c 100644 (file)
 # software without specific prior written permission. This software
 # is provided ``as is'' without express or implied warranty.
 #
 # software without specific prior written permission. This software
 # is provided ``as is'' without express or implied warranty.
 #
-#      @(#)mkdep.sh    5.8 (Berkeley) %G%
+#      @(#)mkdep.sh    5.9 (Berkeley) %G%
 #
 
 PATH=/bin:/usr/bin:/usr/ucb
 export PATH
 
 #
 
 PATH=/bin:/usr/bin:/usr/ucb
 export PATH
 
+MAKE=Makefile                  # default makefile name is "Makefile"
+
+while :
+       do case "$1" in
+               # -f allows you to select a makefile name
+               -f)
+                       MAKE=$2
+                       shift; shift ;;
+
+               # the -p flag produces "program: program.c" style dependencies
+               # so .o's don't get produced
+               -p)
+                       SED='-e s;\.o;;'
+                       shift ;;
+               *)
+                       break ;;
+       esac
+done
+
 if [ $# = 0 ] ; then
        echo 'usage: mkdep [-p] [-f makefile] [flags] file ...'
        exit 1
 fi
 
 if [ $# = 0 ] ; then
        echo 'usage: mkdep [-p] [-f makefile] [flags] file ...'
        exit 1
 fi
 
-MAKE=Makefile                  # default makefile name is "Makefile"
-case $1 in
-       # -f allows you to select a makefile name
-       -f)
-               MAKE=$2
-               shift; shift ;;
-
-       # the -p flag produces "program: program.c" style dependencies
-       # so .o's don't get produced
-       -p)
-               SED='-e s;\.o;;'
-               shift ;;
-esac
-
 if [ ! -w $MAKE ]; then
        echo "mkdep: no writeable file \"$MAKE\""
        exit 1
 if [ ! -w $MAKE ]; then
        echo "mkdep: no writeable file \"$MAKE\""
        exit 1