summaryrefslogtreecommitdiffstats
path: root/usr.bin/mkdep
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1996-04-05 22:13:49 +0000
committerwosch <wosch@FreeBSD.org>1996-04-05 22:13:49 +0000
commit060233b67350d87351fb296b27656442ad41bdc3 (patch)
treebecb551c6b14c5a7c876f91c47bde5ea7cf7c09c /usr.bin/mkdep
parent1c111293c4f15d1ee0fc6c289669b7ed3497d79e (diff)
downloadFreeBSD-src-060233b67350d87351fb296b27656442ad41bdc3.zip
FreeBSD-src-060233b67350d87351fb296b27656442ad41bdc3.tar.gz
$* -> $@
check exit code from $MKDEP_CPP, not sed(1)
Diffstat (limited to 'usr.bin/mkdep')
-rw-r--r--usr.bin/mkdep/mkdep.gcc.sh37
1 files changed, 19 insertions, 18 deletions
diff --git a/usr.bin/mkdep/mkdep.gcc.sh b/usr.bin/mkdep/mkdep.gcc.sh
index e642459..18cee35 100644
--- a/usr.bin/mkdep/mkdep.gcc.sh
+++ b/usr.bin/mkdep/mkdep.gcc.sh
@@ -34,8 +34,7 @@
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
#
-PATH=/bin:/usr/bin
-export PATH
+PATH=/bin:/usr/bin; export PATH
D=.depend # default dependency file is .depend
append=0
@@ -63,13 +62,12 @@ while :
esac
done
-if [ $# = 0 ] ; then
+case $# in 0)
echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...'
- exit 1
-fi
+ exit 1;;
+esac
TMP=/tmp/mkdep$$
-
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
# For C sources, mkdep must use exactly the same cpp and predefined flags
@@ -77,22 +75,25 @@ trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
# pick the cpp. mkdep must be told the cpp to use for exceptional cases.
MKDEP_CPP=${MKDEP_CPP-"cc -E"}
-if [ x$pflag = x ]; then
- $MKDEP_CPP -M $* | sed -e 's; \./; ;g' > $TMP
+if $MKDEP_CPP -M $@ > $TMP; then :
else
- $MKDEP_CPP -M $* | sed -e 's;\.o:;:;' -e 's; \./; ;g' > $TMP
-fi
-
-if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
rm -f $TMP
exit 1
fi
-if [ $append = 1 ]; then
- cat $TMP >> $D
- rm -f $TMP
-else
- mv $TMP $D
-fi
+case x$pflag in
+ x) case $append in
+ 0) sed -e 's; \./; ;g' < $TMP > $D;;
+ *) sed -e 's; \./; ;g' < $TMP >> $D;;
+ esac
+ ;;
+ *) case $append in
+ 0) sed -e 's;\.o:;:;' -e 's; \./; ;g' < $TMP > $D;;
+ *) sed -e 's;\.o:;:;' -e 's; \./; ;g' < $TMP >> $D;;
+ esac
+ ;;
+esac
+
+rm -f $TMP
exit 0
OpenPOWER on IntegriCloud