[BACK]Return to bsd.lib.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/share/mk/bsd.lib.mk between version 1.280 and 1.301

version 1.280, 2008/05/03 14:36:06 version 1.301, 2009/12/12 21:33:50
Line 7 
Line 7 
 # Pull in <bsd.sys.mk> here so we can override its .c.o rule  # Pull in <bsd.sys.mk> here so we can override its .c.o rule
 .include <bsd.sys.mk>  .include <bsd.sys.mk>
   
 .if ${MKPRIVATELIB} != "no"  LIBISMODULE?=   no
   LIBISPRIVATE?=  no
   LIBISCXX?=      no
   
   _LIB_PREFIX=    lib
   
   .if ${LIBISMODULE} != "no"
   _LIB_PREFIX=    # empty
   MKDEBUGLIB:=    no
   MKLINT:=        no
   MKPICINSTALL:=  no
   MKPROFILE:=     no
   MKSTATICLIB:=   no
   .endif
   
   .if ${LIBISPRIVATE} != "no"
 MKDEBUGLIB:=    no  MKDEBUGLIB:=    no
 MKLINT:=        no  MKLINT:=        no
   MKPICINSTALL:=  no
   . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
   MKSTATICLIB:=   no
   . else
 MKPIC:=         no  MKPIC:=         no
   . endif
 MKPROFILE:=     no  MKPROFILE:=     no
 .endif  .endif
   
Line 20  realinstall: checkver libinstall
Line 40  realinstall: checkver libinstall
 clean:          cleanlib  clean:          cleanlib
   
 ##### LIB specific flags.  ##### LIB specific flags.
 COPTS+=     ${COPTS.lib${LIB}}  # XXX: This is needed for programs that link with .a libraries
 CPPFLAGS+=  ${CPPFLAGS.lib${LIB}}  # Perhaps a more correct solution is to always generate _pic.a
 CXXFLAGS+=  ${CXXFLAGS.lib${LIB}}  # files or always have a shared library.
 OBJCOPTS+=  ${OBJCOPTS.lib${LIB}}  .if defined(MKPIE) && (${MKPIE} != "no")
 LDADD+=     ${LDADD.lib${LIB}}  CFLAGS+=        ${PIE_CFLAGS}
 LDFLAGS+=   ${LDFLAGS.lib${LIB}}  AFLAGS+=        ${PIE_AFLAGS}
 LDSTATIC+=  ${LDSTATIC.lib${LIB}}  .endif
   
 ##### Libraries that this may depend upon.  ##### Libraries that this may depend upon.
 .if defined(LIBDPLIBS) && ${MKPIC} != "no"                              # {  .if defined(LIBDPLIBS) && ${MKPIC} != "no"                              # {
Line 41  DPADD+=  ${LIBDO.${_lib}}/lib${_lib}.so
Line 61  DPADD+=  ${LIBDO.${_lib}}/lib${_lib}.so
 .endif                                                                  # }  .endif                                                                  # }
   
 ##### Build and install rules  ##### Build and install rules
 MKDEP_SUFFIXES?=        .o .po .so .ln  MKDEP_SUFFIXES?=        .o .po .so .go .ln
   
   # Use purely kernel private headers in rump builds
   .if !defined(RUMPKERNEL)
   .if empty(CPPFLAGS:M-nostdinc)
 CPPFLAGS+=      ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}  CPPFLAGS+=      ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
   .endif
   .if empty(CXXFLAGS:M-nostdinc++)
 CXXFLAGS+=      ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++}  CXXFLAGS+=      ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++}
   .endif
   .endif
   
 .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})              # {  .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})              # {
 SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major  SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
 SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor  SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
 SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny  SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
   
   DPADD+= ${SHLIB_VERSION_FILE}
   
 # Check for higher installed library versions.  # Check for higher installed library versions.
 .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \  .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
         exists(${NETBSDSRCDIR}/lib/checkver)          exists(${NETBSDSRCDIR}/lib/checkver)
 checkver:  checkver:
         @(cd ${.CURDIR} && \          @(cd ${.CURDIR} && \
               HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
             ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \              ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
                     -d ${DESTDIR}${_LIBSODIR} ${LIB})                      -d ${DESTDIR}${_LIBSODIR} ${LIB})
 .endif  .endif
Line 172  MKSHLIBOBJS= no
Line 203  MKSHLIBOBJS= no
 # Platform-independent linker flags for ELF shared libraries  # Platform-independent linker flags for ELF shared libraries
 .if ${OBJECT_FMT} == "ELF"  .if ${OBJECT_FMT} == "ELF"
 SHLIB_SOVERSION=        ${SHLIB_MAJOR}  SHLIB_SOVERSION=        ${SHLIB_MAJOR}
 SHLIB_SHFLAGS=          -Wl,-soname,lib${LIB}.so.${SHLIB_SOVERSION}  SHLIB_SHFLAGS=          -Wl,-soname,${_LIB_PREFIX}${LIB}.so.${SHLIB_SOVERSION}
 SHLIB_SHFLAGS+=         -Wl,--warn-shared-textrel  SHLIB_SHFLAGS+=         -Wl,--warn-shared-textrel
 SHLIB_LDSTARTFILE?=     ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGINS}  SHLIB_LDSTARTFILE?=     ${_GCC_CRTDIR}/crti.o ${_GCC_CRTBEGINS}
 SHLIB_LDENDFILE?=       ${_GCC_CRTENDS} ${DESTDIR}/usr/lib/crtn.o  SHLIB_LDENDFILE?=       ${_GCC_CRTENDS} ${_GCC_CRTDIR}/crtn.o
 .endif  .endif
   
 CFLAGS+=        ${COPTS}  CFLAGS+=        ${COPTS}
Line 342  STOBJS+=${OBJS}
Line 373  STOBJS+=${OBJS}
   
 LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}  LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
   
 .if ${MKPRIVATELIB} != "no"  .if ${LIBISPRIVATE} != "no"
 # No installation is required  # No installation is required
 libinstall::  libinstall::
 .else   # ${MKPRIVATELIB} == "no"                                       # {  .endif  # ${LIBISPRIVATE} == "no"                                       # {
   
 .if ${MKDEBUGLIB} != "no"  .if ${MKDEBUGLIB} != "no"
 _LIBS+=lib${LIB}_g.a  _LIBS+=lib${LIB}_g.a
Line 384  _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
Line 415  _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
 _LIBS+=llib-l${LIB}.ln  _LIBS+=llib-l${LIB}.ln
 .endif  .endif
   
 .endif  # ${MKPRIVATELIB} == "no"                                       # }  
   
 ALLOBJS=  ALLOBJS=
 .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \  .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
         || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"          || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
Line 406  _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH
Line 435  _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH
   
 realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}  realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
   
   MKARZERO?=no
   
   .if ${MKARZERO} == "yes"
   _ARFL=crsD
   _ARRANFL=sD
   _INSTRANLIB=
   .else
   _ARFL=crs
   _ARRANFL=s
   _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
   .endif
   
   # If you change this, please consider reflecting the change in
   # the override in sys/rump/Makefile.rump.
 .if !target(__archivebuild)  .if !target(__archivebuild)
 __archivebuild: .USE  __archivebuild: .USE
         ${_MKTARGET_BUILD}          ${_MKTARGET_BUILD}
         rm -f ${.TARGET}          rm -f ${.TARGET}
         ${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`          ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
         ${RANLIB} ${.TARGET}  
 .endif  .endif
   
 .if !target(__archiveinstall)  .if !target(__archiveinstall)
 __archiveinstall: .USE  __archiveinstall: .USE
         ${_MKTARGET_INSTALL}          ${_MKTARGET_INSTALL}
         ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \          ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
             ${empty(PRESERVE):?-a "${RANLIB} -t":} ${.ALLSRC} ${.TARGET}              ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
 .endif  .endif
   
 __archivesymlinkpic: .USE  __archivesymlinkpic: .USE
Line 467  LDADD+= -lgcc_pic
Line 509  LDADD+= -lgcc_pic
 .endif  .endif
 .endif  .endif
   
   .if ${LIBISCXX} != "no"
   LIBCC:= ${CXX}
   .else
   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} \  lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}      ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
         ${_MKTARGET_BUILD}          ${_MKTARGET_BUILD}
         rm -f lib${LIB}.so.${SHLIB_FULLVERSION}          rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
 .if defined(DESTDIR)  .if defined(DESTDIR)
         ${CC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \          ${LIBCC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}${SHLIBDIR}/ \
             ${_LIBLDOPTS} \              -Wl,-x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
             -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \  
             -Wl,--whole-archive ${SOLIB} \              -Wl,--whole-archive ${SOLIB} \
             -Wl,--no-whole-archive ${LDADD} \              -Wl,--no-whole-archive ${_LDADD.lib${LIB}} \
               ${_LIBLDOPTS} ${_LDFLAGS.lib${LIB}} \
             -L${_GCC_LIBGCCDIR}              -L${_GCC_LIBGCCDIR}
 .else  .else
         ${CC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} \          ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \
             -o ${.TARGET} ${_LIBLDOPTS} \              -o ${.TARGET} ${_LIBLDOPTS} \
             -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}              -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${_LDADD.lib${LIB}}
 .endif  .endif
 .if ${OBJECT_FMT} == "ELF"  .if ${OBJECT_FMT} == "ELF"
 #  We don't use INSTALL_SYMLINK here because this is just  #  We don't use INSTALL_SYMLINK here because this is just
 #  happening inside the build directory/objdir. XXX Why does  #  happening inside the build directory/objdir. XXX Why does
 #  this spend so much effort on libraries that aren't live??? XXX  #  this spend so much effort on libraries that aren't live??? XXX
   .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
       "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
         ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp          ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
         mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}          mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
   .endif
         ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp          ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
         mv -f lib${LIB}.so.tmp lib${LIB}.so          mv -f lib${LIB}.so.tmp lib${LIB}.so
 .endif  .endif
   .if ${MKSTRIPIDENT} != "no"
           ${OBJCOPY} -R .ident ${.TARGET}
   .endif
   
 .if !empty(LOBJS)                                                       # {  .if !empty(LOBJS)                                                       # {
 LLIBS?=         -lc  LLIBS?=         -lc
Line 601  ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib
Line 658  ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib
 .endif  .endif
   
 .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)  .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
 libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}  _LIB_SO_TGT=            ${DESTDIR}${_LIBSODIR}/${_LIB_PREFIX}${LIB}.so
 .PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}  _LIB_SO_TGTLIBDIR=         ${DESTDIR}${LIBDIR}/${_LIB_PREFIX}${LIB}.so
   
   libinstall:: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
   .PRECIOUS: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
   
 .if ${MKUPDATE} == "no"  .if ${MKUPDATE} == "no"
 .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})  .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! .MADE
 .endif  .endif
 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
 .else  .else
 .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})  .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: .MADE
 .endif  .endif
 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
 .endif  .endif
         ${_MKTARGET_INSTALL}          ${_MKTARGET_INSTALL}
         ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \          ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                 ${.ALLSRC} ${.TARGET}                  ${.ALLSRC} ${.TARGET}
 .if ${_LIBSODIR} != ${LIBDIR}  .if ${_LIBSODIR} != ${LIBDIR}
         ${INSTALL_SYMLINK} \          ${INSTALL_SYMLINK} -l r \
                 -l r ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \                  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
                 ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}                  ${_LIB_SO_TGTLIBDIR}.${SHLIB_FULLVERSION}
 .endif  .endif
 .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)  .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
         /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}          /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
 .endif  .endif
 .if ${OBJECT_FMT} == "ELF"  .if ${OBJECT_FMT} == "ELF"
   .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
       "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
         ${INSTALL_SYMLINK} \          ${INSTALL_SYMLINK} \
                 lib${LIB}.so.${SHLIB_FULLVERSION} \                  ${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
                 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR}                  ${_LIB_SO_TGT}.${SHLIB_MAJOR}
 .if ${_LIBSODIR} != ${LIBDIR}  .if ${_LIBSODIR} != ${LIBDIR}
         ${INSTALL_SYMLINK} \          ${INSTALL_SYMLINK} -l r \
                 -l r ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \                  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
                 ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}                  ${_LIB_SO_TGTLIBDIR}.${SHLIB_MAJOR}
   .endif
 .endif  .endif
 .if ${MKLINKLIB} != "no"  .if ${MKLINKLIB} != "no"
         ${INSTALL_SYMLINK} \          ${INSTALL_SYMLINK} \
                 lib${LIB}.so.${SHLIB_FULLVERSION} \                  ${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
                 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so                  ${_LIB_SO_TGT}
 .if ${_LIBSODIR} != ${LIBDIR}  .if ${_LIBSODIR} != ${LIBDIR}
         ${INSTALL_SYMLINK} \          ${INSTALL_SYMLINK} -l r \
                 -l r ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \                  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
                 ${DESTDIR}${LIBDIR}/lib${LIB}.so                  ${_LIB_SO_TGTLIBDIR}
 .endif  .endif
 .endif  .endif
 .endif  .endif
Line 670  ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln:
Line 733  ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln:
 .endif  # !target(libinstall)                                           # }  .endif  # !target(libinstall)                                           # }
   
 ##### Pull in related .mk logic  ##### Pull in related .mk logic
   LINKSOWN?= ${LIBOWN}
   LINKSGRP?= ${LIBGRP}
   LINKSMODE?= ${LIBMODE}
 .include <bsd.man.mk>  .include <bsd.man.mk>
 .include <bsd.nls.mk>  .include <bsd.nls.mk>
 .include <bsd.files.mk>  .include <bsd.files.mk>

Legend:
Removed from v.1.280  
changed lines
  Added in v.1.301

CVSweb <webmaster@jp.NetBSD.org>