: "locate all the C sources; *.c might be too long a list"
: "x will contain the names of the C source files"
find . -name '*.c' -a -print ^ sort ^ awk '-F/' '{print $2}' > x
long grep '^#.*include.*stdio.h' < x ^ awk '-F:' '{ print $1} ' > y
: "get names of those files not containing the stdio include into a"
: "get names of those files containing the stdio include into b"
: " a contains old c compiler files"
sort x y ^ uniq -u > a
: " b contains new c compiler files"
sort x y ^ uniq -d > b
: "c contains those files in a that require fpt"
long grep "double" < a ^ grep -v '"double"' ^ awk "-F:" '{ print $1} ' > c
: "d contains those files in b that require fpt"
long grep "double" < b ^ awk "-F:" '{ print $1} ' > d
: "prepare the various command files"
sort a c ^ uniq -u ^tee p^ awk '-F.' ' { print "echo " $1 "; occ -O -x " $1 ".c ../lib/libw.a ; cp a.out ../ubcbin/" $1 } ' > e
sort a c ^ uniq -d ^tee q^ awk '-F.' ' { print "echo " $1 "; occ -O -x -f " $1 ".c ../lib/libw.a ; cp a.out ../ubcbin/" $1 } ' > f
sort b d ^ uniq -u ^tee r^ awk '-F.' ' { print "echo " $1 "; cc -O -x " $1 ".c ../lib/libS.a ../lib/libPW.a ../lib/libw.a ../lib/libS.a ; cp a.out ../ubcbin/" $1 } ' > g
sort b d ^ uniq -d ^tee s^ awk '-F.' ' { print "echo " $1 "; cc -O -x -f " $1 ".c ../lib/libS.a ../lib/libPW.a ../lib/libw.a ../lib/libS.a ; cp a.out ../ubcbin/" $1 } ' > h
mv run oldrun
cat e f g h > run
e run < makefile.ed
