We can use the $ORIGIN
"special" path to have a path relative to the executable with
-Wl,-rpath,'$ORIGIN'
in bash or -Wl,-rpath,'$$ORIGIN'
in Makefile
note that you need quotes around it to avoid having the shell interpret it as a variable, and if you try to do this in a
Makefile
, you need$$
to avoid having make interpret the$
as well