The three arguments passed to the .do script are:
- $1: the target name (eg. mytarget.a.b)
- $2: the basename of the target, minus its extension (eg. mytarget)
- $3: a temporary filename that the .do script should write its output to.
file do-file $2
----------- ---------------- ----------
file.a.b.c file.a.b.c.do file.a.b.c
file.a.b.c default.a.b.c.do file
file.a.b.c default.b.c.do file.a
file.a.b.c default.c.do file.a.b
file.a.b.c default.do file.a.b.c
cat >default.do <<EOF
echo "\$0" "\$2" >&2
EOF
redo file.a.b.c
mv default.do default.c.do
redo file.a.b.c
mv default.c.do default.b.c.do
redo file.a.b.c
mv default.b.c.do default.a.b.c.do
redo file.a.b.c
mv default.a.b.c.do file.a.b.c.do
redo file.a.b.c
rm file.a.b.c.do