Overlinking in base

Kurt Lidl lidl at pix.net
Fri Nov 7 15:39:19 UTC 2014


Simon J Gerrart wrote:
> Baptiste Daroussin <bapt at freebsd.org> wrote:
>> In the second case we could do it via make(1)
>> LIBADD=	liba libc libc
>> this will open something like a ${PATHTOTHELIB}/link.mk which will define
>> DYNAMIC_ADD
>> STATIC_ADD
>>
>> And this could be recursive.
>
> We do something like that in the Junos build
>
> prog makefile might have DPLIBS+= ${LIBFOO}
> which is exactly equivalent to
>
> LDADD+= -lfoo
> DPADD+= ${LIBFOO}
>
> but ensures that they stay in sync (not so important now with meta
> mode).
>
> bsd.libnames.mk can then have
>
> DPLIBS_libfoo += ${LIBGOO}
> DPLIBS_libgoo += ${LIBZOO}
>
> All of which is processed by dpadd.mk which you can find in
> contrib/bmake/mk
> Though dpadd.mk ignores DPLIBS_libgoo += ${LIBZOO} if LIBZOO has already
> been added.

Wow, I wish I had know that this existed.  I ended up writing an simpler
version of this for some work last year.  This was mostly so we didn't
have to track the same library twice, for both LDADD and DPADD.

I'm totally in favor of something that exposes this to wider usage,
like having it in /usr/share/mk rather than hidden away in the source
tree only.

-Kurt



More information about the freebsd-arch mailing list