break out special local mail processing (e.g., mapping to the
[unix-history] / usr / src / usr.bin / mkdep / mkdep.gcc.sh
index cb96b3f..ba5ccb1 100644 (file)
@@ -1,11 +1,11 @@
 #!/bin/sh -
 #
 #!/bin/sh -
 #
-# Copyright (c) 1991 The Regents of the University of California.
-# All rights reserved.
+# Copyright (c) 1991, 1993
+#      The Regents of the University of California.  All rights reserved.
 #
 # %sccs.include.redist.sh%
 #
 #
 # %sccs.include.redist.sh%
 #
-#      @(#)mkdep.gcc.sh        5.3 (Berkeley) %G%
+#      @(#)mkdep.gcc.sh        8.1 (Berkeley) %G%
 #
 
 PATH=/bin:/usr/bin:/usr/ucb
 #
 
 PATH=/bin:/usr/bin:/usr/ucb
@@ -13,6 +13,7 @@ export PATH
 
 D=.depend                      # default dependency file is .depend
 append=0
 
 D=.depend                      # default dependency file is .depend
 append=0
+pflag=
 
 while :
        do case "$1" in
 
 while :
        do case "$1" in
@@ -29,7 +30,7 @@ while :
                # the -p flag produces "program: program.c" style dependencies
                # so .o's don't get produced
                -p)
                # the -p flag produces "program: program.c" style dependencies
                # so .o's don't get produced
                -p)
-                       SED='s;\.o;;'
+                       pflag=p
                        shift ;;
                *)
                        break ;;
                        shift ;;
                *)
                        break ;;
@@ -45,7 +46,11 @@ TMP=/tmp/mkdep$$
 
 trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
 
 
 trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
 
-cpp -M $* > $TMP
+if [ x$pflag = x ]; then
+       cpp -M $* | sed -e 's; \./; ;g' > $TMP
+else
+       cpp -M $* | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
+fi
 
 if [ $? != 0 ]; then
        echo 'mkdep: compile failed.'
 
 if [ $? != 0 ]; then
        echo 'mkdep: compile failed.'