summaryrefslogtreecommitdiff
path: root/scripts/build/fixautomakedepsmagic
blob: ec82bba548ca49c00777db6332bbe6c3642e3d4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

prog=`basename $0`


t=/tmp/$prog.$$

trap 'rm -f ${t} ; exit 1' 1 3 15

while [ $# -gt 0 ]; do
        f=$1
	shift
	sed -e '/^DEPS_MAGIC :=/,/^-include \$/s/^/#/' $f > $t
	c="diff $f $t"
	echo $c
	$c
	tstatus=$?
	if [ $tstatus = 0 ]; then
		echo "$prog":" $f not modified"
	elif [ ! -w $f ]; then
		echo "$prog":" $f not not writable"
	else
		c="cp $t $f"
		echo $c
		$c
	fi
	rm -f $t
done