xref: /netbsd-src/external/bsd/ntp/dist/scripts/build/fixautomakedepsmagic (revision 8585484ef87f5a04d32332313cdb799625f4faf8)
1*8585484eSchristos#!/bin/sh
2*8585484eSchristos
3*8585484eSchristosprog=`basename $0`
4*8585484eSchristos
5*8585484eSchristos
6*8585484eSchristost=/tmp/$prog.$$
7*8585484eSchristos
8*8585484eSchristostrap 'rm -f ${t} ; exit 1' 1 3 15
9*8585484eSchristos
10*8585484eSchristoswhile [ $# -gt 0 ]; do
11*8585484eSchristos        f=$1
12*8585484eSchristos	shift
13*8585484eSchristos	sed -e '/^DEPS_MAGIC :=/,/^-include \$/s/^/#/' $f > $t
14*8585484eSchristos	c="diff $f $t"
15*8585484eSchristos	echo $c
16*8585484eSchristos	$c
17*8585484eSchristos	tstatus=$?
18*8585484eSchristos	if [ $tstatus = 0 ]; then
19*8585484eSchristos		echo "$prog":" $f not modified"
20*8585484eSchristos	elif [ ! -w $f ]; then
21*8585484eSchristos		echo "$prog":" $f not not writable"
22*8585484eSchristos	else
23*8585484eSchristos		c="cp $t $f"
24*8585484eSchristos		echo $c
25*8585484eSchristos		$c
26*8585484eSchristos	fi
27*8585484eSchristos	rm -f $t
28*8585484eSchristosdone
29