I think have seen how to do it somewhere but cannot refind it. Example:
gcc -Ldir -lfoo
I want the linker to look for dir/foo not dir/libfoo.a without having to write dir/foo (there are many file in dir needed and running ar first is clumsy).
EDIT: The manual sais
Add directory dir to the list of directories to be searched for -l
and
The only difference between using an -l option and specifying a file name is that -l surrounds library with ‘lib’ and ‘.a’ and searches several directories
I want the behaviour search in directories given by -L and do not clobber the filename. Is that possible.
EDIT 2:
In the ld manual, I found that -l:foo does exactly what I want, and it happens to in gcc. Is that behaviour officially supported?
From
ld
man page:So use the
-l:foo
.