Change definitions of $1,$2,$3 to match djb's redo.

If you use "redo --old-args", it will switch back to the old
(apenwarr-style) arguments for now, to give you time to update your .do
scripts.  This option will go away eventually.

Note: minimal/do doesn't understand the --old-args option.  If you're using
minimal/do in your project, keep using the old one until you update your use
of $1/$2, and then update to the new one.

apenwarr-style default.o.do:
   $1      foo
   $2      .o
   $3      whatever.tmp

djb-style default.o.do:
   $1      foo.o
   $2      foo
   $3      whatever.tmp

apenwarr-style foo.o.do:
   $1      foo.o
   $2      ""
   $3      whatever.tmp

djb-style foo.o.do:
   $1      foo.o
   $2      foo.o  (I think?)
   $3      whatever.tmp
This commit is contained in:
Avery Pennarun 2011-12-31 02:45:38 -05:00
commit 21f88094d5
27 changed files with 84 additions and 68 deletions

View file

@ -1,3 +1,3 @@
DEPS=$(./seq 100 | sed 's/$/.n2/')
redo-ifchange $DEPS
echo n1-$1
echo n1-$2

View file

@ -1,6 +1,6 @@
echo n2-$1
echo $1 >>$1.count
echo $1 >>in.countall
echo n2-$2
echo $2 >>$2.count
echo $2 >>in.countall
# we deliberately use 'redo' here instead of redo-ifchange, because this *heavily*
# stresses redo's locking when building in parallel. We end up with 100

View file

@ -1,3 +1,3 @@
[ "$1" = "test" ]
[ "$2" = ".args" ]
[ "$1" = "test.args" ]
[ "$2" = "test" ]
[ "$3" != "test.args" ]

View file

@ -1,3 +1,3 @@
redo-ifchange $1$2.c
redo-ifchange $1.c
echo c.do
cat $1$2.c
cat $1.c

View file

@ -1,10 +1,10 @@
if [ -e "$1$2.a" -o -e "default$2.a" ]; then
redo-ifchange "$1$2.a"
if [ -e "$1.a" -o -e "default${1#$2}.a" ]; then
redo-ifchange "$1.a"
echo a-to-b
cat "$1$2.a"
cat "$1.a"
else
redo-ifchange "$1$2.b"
redo-ifchange "$1.b"
echo b-to-b
cat "$1$2.b"
cat "$1.b"
fi
../sleep 1.1

View file

@ -1,4 +1,4 @@
redo-ifchange $1$2.b
redo-ifchange $1.b
echo b-to-cc
cat $1$2.b
cat $1.b
../sleep 1.2

View file

@ -1,4 +1,4 @@
redo-ifchange $1$2.c
redo-ifchange $1.c
echo c-to-c
cat $1$2.c
cat $1.c
../sleep 1.3

View file

@ -1 +1 @@
echo default.y.z $1 $2
echo default.y.z $2 ${1#$2}

View file

@ -1 +1 @@
echo file $1 $2
echo file $2 ${1#$2}

View file

@ -1 +1 @@
echo default $1 $2
echo default $2 ${1#$2}

View file

@ -1,2 +1,2 @@
echo default.x.y.z $1 $2
echo default.x.y.z $2 ${1#$2}

View file

@ -1 +1 @@
echo default.z $1 $2
echo default.z $2 ${1#$2}

View file

@ -1 +1 @@
echo root $1 $2 "$(dirname $3)"
echo root $2 ${1#$2} "$(dirname $3)"

View file

@ -1,3 +1,3 @@
redo-ifchange $1.in
redo-ifchange $2.in
echo $$
echo $$ >>$1.log
echo $$ >>$2.log

View file

@ -2,8 +2,8 @@ redo-ifchange config.sh
. ./config.sh
exec >$3
cat <<-EOF
redo-ifchange \$1.c
gcc $CFLAGS -MD -MF \$3.deps -o \$3 -c \$1.c
redo-ifchange \$2.c
gcc $CFLAGS -MD -MF \$3.deps -o \$3 -c \$2.c
read DEPS <\$3.deps
rm -f \$3.deps
redo-ifchange \${DEPS#*:}

View file

@ -1,3 +1,3 @@
[ "$1" = "test2.args" ]
[ "$2" = "" ]
[ "$2" = "test2.args" ]
[ "$3" != "test2.args" ]