sed: advanced auto-dependency generation

hi,
can anyone pls help me understand what $@.$$$$ means in the following sed command:
sed 's/\($*\)\.o[ :]*/\1.o $@ :/g' $@.$$$$ $@
thanks!
If that came from a makefile, it means pass the name of the file to be made plus extension .$$ to sed.

If it didn't come from a makefile, I have no idea.
thanks kbw,
yes indeed, it did come from a makefile where the target is %d
so in that case, what would extension .$$ imply...
is it that we need 2 $'s because we are running this command within make?
Last edited on
It's probably a temporary file used in an intermediate step.
after running the command, i did ls $@.$$$$
and it indicates .34923492
any idea what that means....
I have no idea what your makefile is or what it's doing.
I'm trying to create the dependency file, basically following the stuff from this webpage:
under the use the -M option with sed:

http://www.microhowto.info/howto/automatically_generate_makefile_dependencies.html
What's the problem?
the problem is when I run the code, I get the following error:
/bin/sh: foo.d.4325: No such file or directory
make: *** [foo.d] Error 1

this is what my code looks like:
gcc -MM foo.cpp > foo.d.$$
sed 's/\(foo\)\.o[ :]*/\1.o foo.d : /g' <foo.d.$$> foo.d

and my Makefile reads:
CC = gcc
OBJECTS := foo.d

p1: $(OBJECTS)

%.d: %.cpp
$(CC) -MM $< > $@.$$$$
sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' <$@.$$$$> $@
rm -f $@.$$$$

%.o: %.cpp %.d
$(CC) -c $<
Last edited on
Topic archived. No new replies allowed.