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,2 +1,2 @@
redo-ifchange md-to-man $1.md.tmp
redo-ifchange md-to-man $2.md.tmp
. ./md-to-man $1 $2 $3

View file

@ -1,3 +1,3 @@
redo-ifchange ../version/vars $1.md
redo-ifchange ../version/vars $2.md
. ../version/vars
sed -e "s/%VERSION%/$TAG/" -e "s/%DATE%/$DATE/" $1.md
sed -e "s/%VERSION%/$TAG/" -e "s/%DATE%/$DATE/" $2.md

View file

@ -1,8 +1,8 @@
redo-ifchange md2man.py
if ./md2man.py </dev/null >/dev/null; then
echo './md2man.py $1.md.tmp'
echo './md2man.py $2.md.tmp'
else
echo "Warning: md2man.py missing modules; can't generate manpages." >&2
echo "Warning: try this: sudo easy_install markdown BeautifulSoup" >&2
echo 'echo Skipping: $1.1 >&2'
echo 'echo Skipping: $2.1 >&2'
fi

View file

@ -48,10 +48,10 @@ of .h files it depends on. You can pass this information
along to redo-ifchange, so if any of those headers are
changed or deleted, your .c file will be rebuilt:
redo-ifchange $1.c
gcc -o $3 -c $1.c \
-MMD -MF $1.deps
read DEPS <$1.deps
redo-ifchange $2.c
gcc -o $3 -c $2.c \
-MMD -MF $2.deps
read DEPS <$2.deps
redo-ifchange ${DEPS#*:}
This is much less confusing than the equivalent

View file

@ -104,6 +104,14 @@ dependencies.
output message. This makes it easier to figure out
which sub-instance of redo is doing what.
--old-args
: old versions of redo provided different definitions of
the $1 and $2 parameters to .do scripts. The new
version is compatible with djb's original
specification. This option goes back to the old
definitions so you can use .do scripts you haven't yet
converted to the new style.
# DISCUSSION
@ -156,8 +164,8 @@ redo does not have this problem.)
The three arguments passed to the .do script are:
- $1: the basename of the target (eg. mytarget.a.b)
- $2: the extension of the target, if any (eg. .c.d)
- $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.
@ -165,7 +173,7 @@ Instead of using $3, the .do script may also write the
produced data to stdout.
If the .do file is in the same directory as the target, $1
and $3 are guaranteed to be simple filenames (with no path
is guaranteed to be a simple filename (with no path
component). If the .do file is in a parent directory of
the target, $1 and $3 will be relative paths (ie. will
contain slashes).