when tried with '$$$$' now the link line does contains $

MAKETARGET='g++   -o ././libSampleSoD.so -shared
-Wl,-Bsymbolic  -Wl,-rpath,$$ORIGIN:$$ORIGIN/../lib:.:../lib
./obj/debug/sample.o    -ldl
-lpthread -lgcc'

g++   -o ././libSampleSoD.so
-shared    -Wl,-Bsymbolic  -Wl,-rpath,$ORIGIN:$ORIGIN/../lib:.:../lib
./obj/debug/sample.o    -ldl
-lpthread -lgcc

but when i checked the rpath in the binary it shows ':/../lib:.:../lib'. now
the shell is rplacing $ORIGIN. to fix this i changed RPATHFLAG to

RPATHFLAG := \$$$$ORIGIN:\$$$$ORIGIN/../lib:$(RPATHFLAG)

and now the rpath in the binary is showing $ORIGIN.

Thanks Paul for helping.

Mehul

On 8/15/07, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2007-08-15 at 11:16 +0530, m c wrote:
> > tried but it didnt work
>
> > MAKETARGET='g++   -o ././libSampleSoD.so -shared
> -Wl,-Bsymbolic  -Wl,-rpath,$ORIGIN:$ORIGIN/../lib:.:../lib  
> ./obj/debug/sample.o    -ldl
> -lpthread -lgcc'
>
> > g++   -o ././libSampleSoD.so
> -shared    -Wl,-Bsymbolic  -Wl,-rpath,RIGIN:RIGIN/../lib:.:../lib  
> ./obj/debug/sample.o    -ldl
> -lpthread -lgcc
>
> Well, now MAKETARGET is being set properly.
>
> The next problem is that in Make.mk, that variable is recursive (all
> variables taken from the environment are recursive) and so it's expanded
> by make before being passed to the shell:
>
>
> > # allows high level make to set dependencies based on target
> > ${BUILDDIR}/${TARGETNAME}:    ${OBJS}
> >       ${MAKETARGET}
>
> Here when ${MAKETARGET} is expanded, the $ORIGIN value in it will be
> interpreted by make as an expansion of the variable $O (which is empty)
> followed by the string 'RIGIN', which is exactly what you see.
>
> In order to fix THIS you'll have to add an extra level of escaping to
> $ORIGIN, so it survives the second expansion.  Note though!  This means
> you cannot use this variable directly in Makefile; it will only work in
> the sub-makes:
>
>        RPATHFLAG := $$$$ORIGIN:$$$$ORIGIN/../lib:$(RPATHFLAG)
>
> Now the first expansion will leave RPATHFLAG set to '$$ORIGIN:
> $$ORIGIN/../lib:' which will be preserved by the sub-make invocation,
> then will be expanded to '$ORIGIN:$ORIGIN/../lib:' when the sub-make
> runs the command.
>
> --
>
> -------------------------------------------------------------------------------
> Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
> http://www.gnu.org                      http://make.paulandlesley.org
> "Please remain calm...I may be mad, but I am a professional." --Mad
> Scientist
>
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to