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
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue