gendep.sh (397B)
1 #!/bin/sh 2 3 set -e 4 5 rm -f makefile $$.tmp 6 trap "rm -f $$.mk $$.tmp" 0 2 3 7 8 re='\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)' 9 10 echo $@ | 11 tr ' ' '\n' | 12 sed "s/$re/\1-\2-\3/" | 13 sort -u | 14 (cat Makefile 15 echo 16 while read i 17 do 18 cat <<EOF >> $$.tmp 19 mkdir -p ../../rootdir/lib/scc/crt/$i 20 cp $i/crt.o ../../rootdir/lib/scc/crt/$i/ 21 EOF 22 echo all: $i/crt.o 23 done 24 echo all: 25 cat $$.tmp) > $$.mk && mv $$.mk makefile