NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: default make rules

On Tue, Sep 18, 2012 at 8:25 PM, James K. Lowden
<> wrote:
> How does make compose CXXFLAGS and LDFLAGS by default?
> $ touch src.C
> $ CXXFLAGS=cxxflags LDFLAGS=ldflags make -n src
> c++ cxxflags  ldflags -o src src.C
> In general that's not good because the linker options need to follow
> the source filename on the command line.  Otherwise at least some
> symbols will be missed sometimes.

Nope.  What need to follow the source filename are the libraries, no
the linker options.  That's why there usually is a LIBS variable
(LDLIBS in NetBSD) that contains the -l and .a arguments, and LDFLAGS
contains only things like -L or rpaths.

> AFAICT this is controlled by /usr/share/mk/

But this is later used as:

${} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}

Julio Merino / @jmmv

Home | Main Index | Thread Index | Old Index