May 12, 2011 at 8:26pm UTC
hi,
can anyone pls help me understand what $@.$$$$ means in the following sed command:
sed 's/\($*\)\.o[ :]*/\1.o $@ :/g' $@.$$$$ $@
thanks!
May 12, 2011 at 8:46pm UTC
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.
May 13, 2011 at 12:44am UTC
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 May 13, 2011 at 1:06am UTC
May 13, 2011 at 8:01am UTC
It's probably a temporary file used in an intermediate step.
May 13, 2011 at 4:00pm UTC
after running the command, i did ls $@.$$$$
and it indicates .34923492
any idea what that means....
May 13, 2011 at 10:19pm UTC
I have no idea what your makefile is or what it's doing.
May 14, 2011 at 1:23am UTC
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 May 14, 2011 at 1:40am UTC