diff --git a/Documentation/redo-ifchange.md b/Documentation/redo-ifchange.md index 9405d73..0e53e7e 100644 --- a/Documentation/redo-ifchange.md +++ b/Documentation/redo-ifchange.md @@ -48,11 +48,11 @@ 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$2 - gcc -o $3 -c $1$2 \ - -MMD -MF $1.deps -MT DELETE_ME - redo-ifchange $(sed -e 's,^DELETE_ME:,,' \ - -e 's,\\,,' $1.deps) + redo-ifchange $1.c + gcc -o $3 -c $1.c \ + -MMD -MF $1.deps + read DEPS <$1.deps + redo-ifchange ${DEPS#*:} This is much less confusing than the equivalent autodependency mechanism in `make`(1), because make diff --git a/README.md b/README.md index 3661901..325cb01 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,9 @@ The easiest way to show it is with an example. Create a file called default.o.do: redo-ifchange $1.c - gcc -MD -MF $3.deps.tmp -c -o $3 $1.c - DEPS=$(sed -e "s/^$3://" -e 's/\\//g' <$3.deps.tmp) - rm -f $3.deps.tmp - redo-ifchange $DEPS + gcc -MD -MF $1.d -c -o $3 $1.c + read DEPS <$1.d + redo-ifchange ${DEPS#*:} Create a file called myprog.do: diff --git a/t/example/CC.do b/t/example/CC.do index c45013a..c62bd31 100644 --- a/t/example/CC.do +++ b/t/example/CC.do @@ -3,9 +3,9 @@ redo-ifchange config.sh exec >$3 cat <<-EOF redo-ifchange \$1.c - gcc $CFLAGS -MD -MF \$3.deps.tmp -o \$3 -c \$1.c - DEPS=\$(sed -e "s/^\$3://" -e 's/\\\\//g' <\$3.deps.tmp) - rm -f \$3.deps.tmp - redo-ifchange \$DEPS + gcc $CFLAGS -MD -MF \$3.deps -o \$3 -c \$1.c + read DEPS <\$3.deps + rm -f \$3.deps + redo-ifchange \${DEPS#*:} EOF chmod +x $3