[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.305 and 1.317

version 1.305, 2010/03/02 20:49:18 version 1.317, 2011/09/25 11:20:41
Line 37  MKPROFILE:= no
Line 37  MKPROFILE:= no
 ##### Basic targets  ##### Basic targets
 .PHONY:         checkver libinstall  .PHONY:         checkver libinstall
 realinstall:    checkver libinstall  realinstall:    checkver libinstall
 clean:          cleanlib  
   
 ##### LIB specific flags.  ##### LIB specific flags.
 # XXX: This is needed for programs that link with .a libraries  # XXX: This is needed for programs that link with .a libraries
Line 63  DPADD+=  ${LIBDO.${_lib}}/lib${_lib}.so
Line 62  DPADD+=  ${LIBDO.${_lib}}/lib${_lib}.so
 ##### Build and install rules  ##### Build and install rules
 MKDEP_SUFFIXES?=        .o .po .pico .go .ln  MKDEP_SUFFIXES?=        .o .po .pico .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}  
 .endif  
 .if empty(CXXFLAGS:M-nostdinc++)  
 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
Line 140  SHLIB_FULLVERSION=${SHLIB_MAJOR}
Line 129  SHLIB_FULLVERSION=${SHLIB_MAJOR}
   
 # Data-driven table using make variables to control how shared libraries  # Data-driven table using make variables to control how shared libraries
 # are built for different platforms and object formats.  # are built for different platforms and object formats.
 # OBJECT_FMT:           currently either "ELF" or "a.out", from <bsd.own.mk>  
 # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version  # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
 #                       numbers of shared library  #                       numbers of shared library
 # SHLIB_SOVERSION:      version number to be compiled into a shared library  # SHLIB_SOVERSION:      version number to be compiled into a shared library
Line 168  CPPPICFLAGS?= -DPIC
Line 156  CPPPICFLAGS?= -DPIC
 CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}  CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
 APICFLAGS ?=  APICFLAGS ?=
   
 .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \  .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")      # } {
        ${OBJECT_FMT} == "ELF"                                           # } {  
   
 # If you use -fPIC you need to define BIGPIC to turn on 32-bit  # If you use -fPIC you need to define BIGPIC to turn on 32-bit
 # relocations in asm code  # relocations in asm code
Line 203  MKSHLIBOBJS= no
Line 190  MKSHLIBOBJS= no
 .endif  .endif
   
 # Platform-independent linker flags for ELF shared libraries  # Platform-independent linker flags for ELF shared libraries
 .if ${OBJECT_FMT} == "ELF"  
 SHLIB_SOVERSION=        ${SHLIB_MAJOR}  SHLIB_SOVERSION=        ${SHLIB_MAJOR}
 SHLIB_SHFLAGS=          -Wl,-soname,${_LIB_PREFIX}${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?=     ${_GCC_CRTDIR}/crti.o ${_GCC_CRTBEGINS}  SHLIB_LDSTARTFILE?=     ${_GCC_CRTDIR}/crti.o ${_GCC_CRTBEGINS}
 SHLIB_LDENDFILE?=       ${_GCC_CRTENDS} ${_GCC_CRTDIR}/crtn.o  SHLIB_LDENDFILE?=       ${_GCC_CRTENDS} ${_GCC_CRTDIR}/crtn.o
 .endif  
   
 CFLAGS+=        ${COPTS}  CFLAGS+=        ${COPTS}
 OBJCFLAGS+=     ${OBJCOPTS}  OBJCFLAGS+=     ${OBJCOPTS}
Line 414  LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.l
Line 399  LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.l
 .if ${LIBISPRIVATE} != "no"  .if ${LIBISPRIVATE} != "no"
 # No installation is required  # No installation is required
 libinstall::  libinstall::
 .endif  # ${LIBISPRIVATE} == "no"                                       # {  .endif
   
 .if ${MKDEBUGLIB} != "no"  .if ${MKDEBUGLIB} != "no"
 _LIBS+=lib${LIB}_g.a  _LIBS+=lib${LIB}_g.a
Line 445  _LIBS+=${SOLIB}
Line 430  _LIBS+=${SOLIB}
 SOBJS+=${OBJS:.o=.pico}  SOBJS+=${OBJS:.o=.pico}
 .endif  .endif
 .if defined(SHLIB_FULLVERSION)  .if defined(SHLIB_FULLVERSION)
   _LIB.so:=lib${LIB}.so.${SHLIB_FULLVERSION}
   .if ${MKDEBUG} != "no"
   _LIB.debug:=${_LIB.so}.debug
   .endif
 _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}  _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
 .endif  .endif
 .endif                                                                  # }  .endif                                                                  # }
Line 471  _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH
Line 460  _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH
   
 .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}  .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
   
 realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}  realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.debug}
   
 MKARZERO?=no  MKARZERO?=no
   
Line 521  lib${LIB}_g.a:: ${GOBJS} __archivebuild
Line 510  lib${LIB}_g.a:: ${GOBJS} __archivebuild
   
 _LIBLDOPTS=  _LIBLDOPTS=
 .if ${SHLIBDIR} != "/usr/lib"  .if ${SHLIBDIR} != "/usr/lib"
 _LIBLDOPTS+=    -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \  _LIBLDOPTS+=    -Wl,-rpath,${SHLIBDIR} \
                 -R${SHLIBDIR} \                  -L=${SHLIBDIR}
                 -L${DESTDIR}${SHLIBDIR}  
 .elif ${SHLIBINSTALLDIR} != "/usr/lib"  .elif ${SHLIBINSTALLDIR} != "/usr/lib"
 _LIBLDOPTS+=    -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \  _LIBLDOPTS+=    -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
                 -L${DESTDIR}${SHLIBINSTALLDIR}                  -L=${SHLIBINSTALLDIR}
 .endif  .endif
   
 # gcc -shared now adds -lc automatically. For libraries other than libc and  # gcc -shared now adds -lc automatically. For libraries other than libc and
Line 535  _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}$
Line 523  _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}$
 # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not  # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
 # to add standard libraries, not the linker.  # to add standard libraries, not the linker.
 .if !defined(LIB)  .if !defined(LIB)
   .if !empty(LIBC_SO)
 DPLIBC ?= ${DESTDIR}${LIBC_SO}  DPLIBC ?= ${DESTDIR}${LIBC_SO}
   .endif
 .else  .else
 .if ${LIB} != "c" && ${LIB:Mgcc*} == ""  .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
   .if !empty(LIBC_SO)
 DPLIBC ?= ${DESTDIR}${LIBC_SO}  DPLIBC ?= ${DESTDIR}${LIBC_SO}
   .endif
 .else  .else
 LDLIBC ?= -nodefaultlibs  LDLIBC ?= -nodefaultlibs
 .if ${LIB} == "c"  .if ${LIB} == "c"
Line 560  lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL
Line 552  lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL
     ${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)  
         ${LIBCC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}${SHLIBDIR}/ \  
             -Wl,-x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \  
             -Wl,--whole-archive ${SOLIB} \  
             -Wl,--no-whole-archive ${_LDADD.lib${LIB}} \  
             ${_LIBLDOPTS} ${_LDFLAGS.lib${LIB}} \  
             -L${_GCC_LIBGCCDIR}  
 .else  
         ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \          ${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.lib${LIB}}              -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  #  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
Line 583  lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL
Line 565  lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL
 .endif  .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  
 .if ${MKSTRIPIDENT} != "no"  .if ${MKSTRIPIDENT} != "no"
         ${OBJCOPY} -R .ident ${.TARGET}          ${OBJCOPY} -R .ident ${.TARGET}
 .endif  .endif
   
   .if defined(_LIB.debug)
   ${_LIB.debug}: ${_LIB.so}
           ${_MKTARGET_CREATE}
           (  ${OBJCOPY} --only-keep-debug ${_LIB.so} ${_LIB.debug} \
           && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
                   --add-gnu-debuglink=${_LIB.debug} ${_LIB.so} \
           ) || (rm -f ${_LIB.debug}; false)
   .endif
   
 .if !empty(LOBJS)                                                       # {  .if !empty(LOBJS)                                                       # {
 LLIBS?=         -lc  LLIBS?=         -lc
 llib-l${LIB}.ln: ${LOBJS}  llib-l${LIB}.ln: ${LOBJS}
Line 605  lint: ${LOBJS}
Line 595  lint: ${LOBJS}
         ${LINT} ${LINTFLAGS} ${LOBJS}          ${LINT} ${LINTFLAGS} ${LOBJS}
 .endif  .endif
   
 cleanlib: .PHONY  # If the number of entries in CLEANFILES is too large, then the
         rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}  # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
         rm -f lib${LIB}.a ${STOBJS}  # failed (Argument list too long)".  Avoid that by splitting the
         rm -f lib${LIB}_p.a ${POBJS}  # files to clean into several lists using different variable names.
         rm -f lib${LIB}_g.a ${GOBJS}  # __cleanuse is an internal target in bsd.clean.mk; the way we
         rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}  # use it here mimics the way it's used by the clean target in
         rm -f ${STOBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp} ${GOBJS:=.tmp}  # bsd.clean.mk.
         rm -f llib-l${LIB}.ln ${LOBJS}  #
   clean: libclean1 libclean2 libclean3 libclean4 libclean5
   libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
   libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
   libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
   libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
   libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
   CLEANFILES+= a.out [Ee]rrs mklog core *.core
   LIBCLEANFILES1+= lib${LIB}.a   ${STOBJS} ${STOBJS:=.tmp}
   LIBCLEANFILES2+= lib${LIB}_p.a ${POBJS}  ${POBJS:=.tmp}
   LIBCLEANFILES3+= lib${LIB}_g.a ${GOBJS}  ${GOBJS:=.tmp}
   LIBCLEANFILES4+= lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${_LIB.debug}
   LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
   LIBCLEANFILES5+= llib-l${LIB}.ln ${LOBJS}
   
 .if !target(libinstall)                                                 # {  .if !target(libinstall)                                                 # {
 # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no  # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
Line 721  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib
Line 723  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib
                 ${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \                  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
                 ${_LIB_SO_TGTLIBDIR}.${SHLIB_FULLVERSION}                  ${_LIB_SO_TGTLIBDIR}.${SHLIB_FULLVERSION}
 .endif  .endif
 .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)  
         /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}  
 .endif  
 .if ${OBJECT_FMT} == "ELF"  
 .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \  .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"      "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
         ${INSTALL_SYMLINK} \          ${INSTALL_SYMLINK} \
Line 747  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib
Line 745  ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib
 .endif  .endif
 .endif  .endif
 .endif  .endif
   
   .if defined(_LIB.debug)
   libinstall:: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
   .PRECIOUS: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
   
   ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}: ${_LIB.debug}
           ${_MKTARGET_INSTALL}
           ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
                   ${.ALLSRC} ${.TARGET}
 .endif  .endif
   
 .if ${MKLINT} != "no" && !empty(LOBJS)  .if ${MKLINT} != "no" && !empty(LOBJS)
Line 780  LINKSMODE?= ${LIBMODE}
Line 787  LINKSMODE?= ${LIBMODE}
 .include <bsd.inc.mk>  .include <bsd.inc.mk>
 .include <bsd.links.mk>  .include <bsd.links.mk>
 .include <bsd.dep.mk>  .include <bsd.dep.mk>
   .include <bsd.clang-analyze.mk>
   .include <bsd.clean.mk>
   
 ${TARGETS}:     # ensure existence  ${TARGETS}:     # ensure existence

Legend:
Removed from v.1.305  
changed lines
  Added in v.1.317

CVSweb <webmaster@jp.NetBSD.org>