Source-Changes-HG archive

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

[src/trunk]: src/share/mk When PROGS / LIBS are used, you can pass each PROG ...



details:   https://anonhg.NetBSD.org/src/rev/c65f5d495684
branches:  trunk
changeset: 749792:c65f5d495684
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Tue Dec 08 15:18:42 2009 +0000

description:
When PROGS / LIBS are used, you can pass each PROG / LIB specific parameters
to ${LD} via:

        ${LDADD.${PROG}}
        ${LDFLAGS.${PROG}}
        ${LDSTATIC.${PROG}}
        ${LDADD.${LIB}}
        ${LDFLAGS.${LIB}}

OTOH you can't pass parameters to ${CC}, because in suffix rules make(1) only
knows the name of ${.IMPSRC} and ${.TARGET}; it's users' responsivility to
define ${CC} parameters to all the sources of a given ${PROG} / ${LIB}.

Should address bin/42381.

(Bug in this commit log was pointed out by mrg@.)

diffstat:

 share/mk/bsd.lib.mk  |  20 ++++++++------------
 share/mk/bsd.prog.mk |  13 +------------
 2 files changed, 9 insertions(+), 24 deletions(-)

diffs (79 lines):

diff -r 9803dc2e569c -r c65f5d495684 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Tue Dec 08 13:49:08 2009 +0000
+++ b/share/mk/bsd.lib.mk       Tue Dec 08 15:18:42 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.lib.mk,v 1.299 2009/11/27 11:44:36 tsutsui Exp $
+#      $NetBSD: bsd.lib.mk,v 1.300 2009/12/08 15:18:42 uebayasi Exp $
 #      @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
 
 .include <bsd.init.mk>
@@ -47,13 +47,6 @@
 CFLAGS+=        ${PIE_CFLAGS}
 AFLAGS+=        ${PIE_AFLAGS}
 .endif
-COPTS+=     ${COPTS.lib${LIB}}
-CPPFLAGS+=  ${CPPFLAGS.lib${LIB}}
-CXXFLAGS+=  ${CXXFLAGS.lib${LIB}}
-OBJCOPTS+=  ${OBJCOPTS.lib${LIB}}
-LDADD+=     ${LDADD.lib${LIB}}
-LDFLAGS+=   ${LDFLAGS.lib${LIB}}
-LDSTATIC+=  ${LDSTATIC.lib${LIB}}
 
 ##### Libraries that this may depend upon.
 .if defined(LIBDPLIBS) && ${MKPIC} != "no"                             # {
@@ -522,6 +515,9 @@
 LIBCC:=        ${CC}
 .endif
 
+_LDADD.lib${LIB}=      ${LDADD} ${LDADD.lib${LIB}}
+_LDFLAGS.lib${LIB}=    ${LDFLAGS} ${LDFLAGS.lib${LIB}}
+
 lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
        ${_MKTARGET_BUILD}
@@ -530,13 +526,13 @@
        ${LIBCC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
            -Wl,-x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
            -Wl,--whole-archive ${SOLIB} \
-           -Wl,--no-whole-archive ${LDADD} \
-           ${_LIBLDOPTS} ${LDFLAGS} \
+           -Wl,--no-whole-archive ${_LDADD.lib${LIB}} \
+           ${_LIBLDOPTS} ${_LDFLAGS.lib${LIB}} \
            -L${_GCC_LIBGCCDIR}
 .else
-       ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} \
+       ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \
            -o ${.TARGET} ${_LIBLDOPTS} \
-           -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}
+           -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${_LDADD.lib${LIB}}
 .endif
 .if ${OBJECT_FMT} == "ELF"
 #  We don't use INSTALL_SYMLINK here because this is just
diff -r 9803dc2e569c -r c65f5d495684 share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk      Tue Dec 08 13:49:08 2009 +0000
+++ b/share/mk/bsd.prog.mk      Tue Dec 08 15:18:42 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.prog.mk,v 1.243 2009/11/27 11:44:36 tsutsui Exp $
+#      $NetBSD: bsd.prog.mk,v 1.244 2009/12/08 15:18:42 uebayasi Exp $
 #      @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
 
 .ifndef HOSTPROG
@@ -265,18 +265,7 @@
 .endif
 
 ##### PROG specific flags.
-COPTS+=     ${COPTS.${_P}}
-CPPFLAGS+=  ${CPPFLAGS.${_P}}
-CXXFLAGS+=  ${CXXFLAGS.${_P}}
-OBJCOPTS+=  ${OBJCOPTS.${_P}}
-LDADD+=     ${LDADD.${_P}}
-LDFLAGS+=   ${LDFLAGS.${_P}}
-LDSTATIC+=  ${LDSTATIC.${_P}}
 
-_COPTS.${_P}=          ${COPTS}    ${COPTS.${_P}}
-_CPPFLAGS.${_P}=       ${CPPFLAGS} ${CPPFLAGS.${_P}}
-_CXXFLAGS.${_P}=       ${CXXFLAGS} ${CXXFLAGS.${_P}}
-_OBJCOPTS.${_P}=       ${OBJCOPTS} ${OBJCOPTS.${_P}}
 _LDADD.${_P}=          ${LDADD}    ${LDADD.${_P}}
 _LDFLAGS.${_P}=                ${LDFLAGS}  ${LDFLAGS.${_P}}
 _LDSTATIC.${_P}=       ${LDSTATIC} ${LDSTATIC.${_P}}



Home | Main Index | Thread Index | Old Index