Simplify autodependency examples.
Turns out we don't need sed to process the output of gcc -MD. We can just
do this:
read DEPS <filename.deps
The 'read' command in sh actually handles backslashes correctly, so we don't
have to sed them out after all. And then a simple ${DEPS#*:} removes the
"target:" prefix from the dependency line, and we're done!
This commit is contained in:
parent
ea7057d9b6
commit
a2bce72255
3 changed files with 12 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue