diff options
author | Joseph Mingrone <jrm@FreeBSD.org> | 2024-09-06 02:11:27 +0000 |
---|---|---|
committer | Joseph Mingrone <jrm@FreeBSD.org> | 2024-09-06 02:36:15 +0000 |
commit | 75d9de99aec2d9f3bdc495c91bbd6d7a2392e2a3 (patch) | |
tree | 99d6c086833d530e5d1d33a8128961f8149843f0 /mkdep | |
parent | 51a183021fce3928d24b11c319d2787f5a15ae87 (diff) |
Diffstat (limited to 'mkdep')
-rwxr-xr-x | mkdep | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -1,4 +1,4 @@ -#!/bin/sh - +#!/bin/sh -e # # Copyright (c) 1994, 1996 # The Regents of the University of California. All rights reserved. @@ -63,20 +63,20 @@ if [ $# = 0 ] ; then exit 1 fi -if [ ! -w $MAKE ]; then +if [ ! -w "$MAKE" ]; then echo "mkdep: no writeable file \"$MAKE\"" exit 1 fi -TMP=/tmp/mkdep$$ +TMP=${TMPDIR:-/tmp}/mkdep$$ -trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 +trap 'rm -f "$TMP" ; exit 1' HUP INT QUIT PIPE TERM -cp $MAKE ${MAKE}.bak +cp "$MAKE" "${MAKE}.bak" -sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP +sed -e '/DO NOT DELETE THIS LINE/,$d' < "$MAKE" > "$TMP" -cat << _EOF_ >> $TMP +cat << _EOF_ >> "$TMP" # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. @@ -94,23 +94,25 @@ _EOF_ # Construct a list of source files with paths relative to the source directory. # sources="" -for srcfile in $* +for srcfile in "$@" do sources="$sources $SOURCE_DIRECTORY/$srcfile" done # XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait" -$CC $DEPENDENCY_CFLAG $flags $sources | +# $flags and $sources are meant to expand +# shellcheck disable=SC2086 +"$CC" "$DEPENDENCY_CFLAG" $flags $sources | sed " s; \./; ;g - $SED" >> $TMP + $SED" >> "$TMP" -cat << _EOF_ >> $TMP +cat << _EOF_ >> "$TMP" # IF YOU PUT ANYTHING HERE IT WILL GO AWAY _EOF_ # copy to preserve permissions -cp $TMP $MAKE -rm -f ${MAKE}.bak $TMP +cp "$TMP" "$MAKE" +rm -f "${MAKE}.bak" "$TMP" exit 0 |