IAMTubby
May 20th, 2013, 08:50 AM
Hello,
I have a small question regarding a Makefile. I was able to understand most of the important aspects, but still haven't been able to figure out the meaning of -o $$a $$a.o below.
SRCS = sourceOne.c sourceTwo.c
SOBJ = $(patsubst %.c,%.o,$(SRCS)) #I understand this will translate to sourceOne.o and sourceTwo.o
APP = $(patsubst %.c,%,$(SRCS)) #I understand this will translate to sourceOne and sourceTwo, which will be the names of the eventual executables
$(APP): $(SOBJ) $(LIBSHARED)
@set -e ; \
for a in $(APP) ; do \
$(CC) $(CFLAGS) $(CPPFLAGS) -o $$a $$a.o $(PRJLIB) $(LINKMAP) $(DEPLIBS) ; \
done
#Again, here I understand that basically it generates executables called sourceOne and sourceTwo from sourceOne.o and sourceTwo.o, but what I don't understand is the $$ part.
What exactly does -o $$a $$a.o mean ?
I read that "If you need a literal dollar sign, put in a double dollar sign ($$)". But hmm, still can't relate to this.
Please advise.
Thanks.
I have a small question regarding a Makefile. I was able to understand most of the important aspects, but still haven't been able to figure out the meaning of -o $$a $$a.o below.
SRCS = sourceOne.c sourceTwo.c
SOBJ = $(patsubst %.c,%.o,$(SRCS)) #I understand this will translate to sourceOne.o and sourceTwo.o
APP = $(patsubst %.c,%,$(SRCS)) #I understand this will translate to sourceOne and sourceTwo, which will be the names of the eventual executables
$(APP): $(SOBJ) $(LIBSHARED)
@set -e ; \
for a in $(APP) ; do \
$(CC) $(CFLAGS) $(CPPFLAGS) -o $$a $$a.o $(PRJLIB) $(LINKMAP) $(DEPLIBS) ; \
done
#Again, here I understand that basically it generates executables called sourceOne and sourceTwo from sourceOne.o and sourceTwo.o, but what I don't understand is the $$ part.
What exactly does -o $$a $$a.o mean ?
I read that "If you need a literal dollar sign, put in a double dollar sign ($$)". But hmm, still can't relate to this.
Please advise.
Thanks.