[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.118 and 1.141

version 1.118, 1997/10/28 12:40:16 version 1.141, 1998/10/07 17:49:15
Line 13  __initialized__:
Line 13  __initialized__:
   
 .PHONY:         cleanlib libinstall  .PHONY:         cleanlib libinstall
 realinstall:    libinstall  realinstall:    libinstall
 clean cleandir: cleanlib  clean cleandir distclean: cleanlib
   
 .if exists(${.CURDIR}/shlib_version)  .if exists(${.CURDIR}/shlib_version)
 SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major  SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
Line 32  SHLIB_MINOR != . ${.CURDIR}/shlib_versio
Line 32  SHLIB_MINOR != . ${.CURDIR}/shlib_versio
   
 # 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.
 # SHLIB_TYPE:           currently either "ELF" or "a.out".  # OBJECT_FMT:           currently either "ELF" or "a.out", from <bsd.own.mk>
 # SHLIB_SOVERSION:      version number to be compiled into a shared library  # SHLIB_SOVERSION:      version number to be compiled into a shared library
 #                       via -soname. Usualy ${SHLIB_MAJOR} on ELF.  #                       via -soname. Usualy ${SHLIB_MAJOR} on ELF.
 #                       NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}.  #                       NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}.
 # SHLIB_LDSTARTFILE:    ???  # SHLIB_SHFLAGS:        Flags to tell ${LD} to emit  shared library.
 # SHLIB_LDENDTILE:      ??  #                       with ELF, also set shared-lib version for ld.so.
   # SHLIB_LDSTARTFILE:    support .o file, call C++ file-level constructors
   # SHLIB_LDENDFILE:      support .o file, call C++ file-level destructors
 # CPPICFLAGS:   flags for ${CPP} to preprocess  .[sS]  files for ${AS}  # CPPICFLAGS:   flags for ${CPP} to preprocess  .[sS]  files for ${AS}
 # CPICFLAGS:    flags for ${CC} to compile  .[cC] files to .so objects.  # CPICFLAGS:    flags for ${CC} to compile  .[cC] files to .so objects.
 # CAPICFLAGS    flags for {$CC} to compiling .[Ss] files  # CAPICFLAGS    flags for {$CC} to compiling .[Ss] files
Line 45  SHLIB_MINOR != . ${.CURDIR}/shlib_versio
Line 47  SHLIB_MINOR != . ${.CURDIR}/shlib_versio
 # APICFLAGS:    flags for ${AS} to assemble .[sS]  to .so objects.  # APICFLAGS:    flags for ${AS} to assemble .[sS]  to .so objects.
   
 .if (${MACHINE_ARCH} == "alpha")  .if (${MACHINE_ARCH} == "alpha")
                   # Alpha-specific shared library flags
 SHLIB_TYPE=ELF  
 SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o  SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o
 SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o  SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o
 SHLIB_SOVERSION=${SHLIB_MAJOR}  
 CPICFLAGS ?= -fpic -DPIC  CPICFLAGS ?= -fpic -DPIC
 CPPPICFLAGS?= -DPIC  CPPPICFLAGS?= -DPIC
 CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}  CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
 APICFLAGS ?=  APICFLAGS ?=
   
 .elif (${MACHINE_ARCH} == "mips")  .elif (${MACHINE_ARCH} == "mips")
                   # mips-specific shared library flags
 SHLIB_TYPE=ELF  # Still use gnu-derived ld.so on pmax; don't have or need lib<>.so support.
 # still use gnu-derived ld.so on pmax; don't have or need lib<>.so support.  
 SHLIB_LDSTARTFILE=  SHLIB_LDSTARTFILE=
 SHLIB_LDENDFILE=  SHLIB_LDENDFILE=
 SHLIB_SOVERSION=${SHLIB_MAJOR}  
   
 # On mips, all libs need to be compiled with ABIcalls, not just sharedlibs.  # On mips, all libs need to be compiled with ABIcalls, not just sharedlibs.
 CPICFLAGS?=  CPICFLAGS?=
Line 77  AS+= -KPIC
Line 75  AS+= -KPIC
   
 .else  .else
   
 SHLIB_TYPE=a.out  # Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
 SHLIB_LDSTARTFILE=  SHLIB_LDSTARTFILE=
 SHLIB_LDENDFILE=  SHLIB_LDENDFILE=
   SHLIB_SHFLAGS=
 SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}  SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
 CPICFLAGS?= -fpic -DPIC  CPICFLAGS?= -fpic -DPIC
 CPPPICFLAGS?= -DPIC  CPPPICFLAGS?= -DPIC
Line 88  APICFLAGS?= -k
Line 87  APICFLAGS?= -k
   
 .endif  .endif
   
   # Platform-independent linker flags for ELF shared libraries
   .if (${OBJECT_FMT} == "ELF")
   SHLIB_SOVERSION=${SHLIB_MAJOR}
   SHLIB_SHFLAGS=-soname lib${LIB}.so.${SHLIB_SOVERSION}
   .endif
   
 CFLAGS+=        ${COPTS}  CFLAGS+=        ${COPTS}
   
 .c.o:  .c.o:
         @echo ${COMPILE.c:Q} ${.IMPSRC}          @echo ${COMPILE.c:Q} ${.IMPSRC}
         @${COMPILE.c} ${.IMPSRC}  -o ${.TARGET}.o          @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
         @${LD} -x -r ${.TARGET}.o -o ${.TARGET}          @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
         @rm -f ${.TARGET}.o          @rm -f ${.TARGET}.o
   
Line 110  CFLAGS+= ${COPTS}
Line 114  CFLAGS+= ${COPTS}
         @rm -f ${.TARGET}.o          @rm -f ${.TARGET}.o
   
 .c.ln:  .c.ln:
         ${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC}          ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
   
 .cc.o .C.o:  .cc.o .C.o:
         @echo ${COMPILE.cc:Q} ${.IMPSRC}          @echo ${COMPILE.cc:Q} ${.IMPSRC}
Line 132  CFLAGS+= ${COPTS}
Line 136  CFLAGS+= ${COPTS}
   
 .m.o:  .m.o:
         @echo ${COMPILE.m:Q} ${.IMPSRC}          @echo ${COMPILE.m:Q} ${.IMPSRC}
         @${COMPILE.m} ${.IMPSRC}  -o ${.TARGET}.o          @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
         @${LD} -x -r ${.TARGET}.o -o ${.TARGET}          @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
         @rm -f ${.TARGET}.o          @rm -f ${.TARGET}.o
   
Line 148  CFLAGS+= ${COPTS}
Line 152  CFLAGS+= ${COPTS}
         @${LD} -x -r ${.TARGET}.o -o ${.TARGET}          @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
         @rm -f ${.TARGET}.o          @rm -f ${.TARGET}.o
   
 .m.ln:  
         ${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC}  
   
 .S.o .s.o:  .S.o .s.o:
         @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}          @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
         @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o          @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
Line 169  CFLAGS+= ${COPTS}
Line 170  CFLAGS+= ${COPTS}
         @${LD} -x -r ${.TARGET}.o -o ${.TARGET}          @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
         @rm -f ${.TARGET}.o          @rm -f ${.TARGET}.o
   
   .if defined(NOPIC) || (defined(LDSTATIC) && ${LDSTATIC} != "") \
 .if !defined(NOPROFILE)          || !defined(NOLINKLIB)
 _LIBS=lib${LIB}.a lib${LIB}_p.a  
 .else  
 _LIBS=lib${LIB}.a  _LIBS=lib${LIB}.a
   .else
   _LIBS=
   .endif
   
   .if !defined(NOPROFILE) && !defined(NOLINKLIB)
   _LIBS+=lib${LIB}_p.a
 .endif  .endif
   
 .if !defined(NOPIC)  .if !defined(NOPIC)
Line 183  _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHL
Line 188  _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHL
 .endif  .endif
 .endif  .endif
   
 .if !defined(NOLINT)  .if !defined(NOLINT) && !defined(NOLINKLIB)
 _LIBS+=llib-l${LIB}.ln  _LIBS+=llib-l${LIB}.ln
 .endif  .endif
   
Line 191  all: ${SRCS} ${_LIBS}
Line 196  all: ${SRCS} ${_LIBS}
   
 __archivebuild: .USE  __archivebuild: .USE
         @rm -f ${.TARGET}          @rm -f ${.TARGET}
         @${AR} cq ${.TARGET} `NM=${NM} lorder ${.ALLSRC} | tsort -q`          @${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
         ${RANLIB} ${.TARGET}          ${RANLIB} ${.TARGET}
   
 __archiveinstall: .USE  __archiveinstall: .USE
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 ${.ALLSRC} \          ${INSTALL} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
                 ${.TARGET}                  ${.ALLSRC} ${.TARGET}
         ${RANLIB} -t ${.TARGET}          ${RANLIB} -t ${.TARGET}
         chmod ${LIBMODE} ${.TARGET}          chmod ${LIBMODE} ${.TARGET}
   
 DPSRCS+=        ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}  DPSRCS+=        ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
 CLEANFILES+=    ${DPSRCS}  CLEANFILES+=    ${DPSRCS}
   .if defined(YHEADER)
   CLEANFILES+=    ${SRCS:M*.y:.y=.h}
   .endif
   
 OBJS+=          ${SRCS:N*.h:N*.sh:R:S/$/.o/g}  OBJS+=          ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
 lib${LIB}.a:: ${OBJS} __archivebuild  lib${LIB}.a:: ${OBJS} __archivebuild
Line 219  lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINO
Line 227  lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINO
     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}      ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
         @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)          @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
         @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}          @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
 .if (${SHLIB_TYPE} == "a.out")          $(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
         $(LD) -x -Bshareable -Bforcearchive \              ${SHLIB_LDSTARTFILE} \
             -o ${.TARGET} lib${LIB}_pic.a ${LDADD}  
 .elif (${SHLIB_TYPE} == "ELF")  
         $(LD) -x -shared -o ${.TARGET} \  
             -soname lib${LIB}.so.${SHLIB_SOVERSION}  ${SHLIB_LDSTARTFILE} \  
             --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \              --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \
             ${SHLIB_LDENDFILE}              ${SHLIB_LDENDFILE}
   .if (${OBJECT_FMT} == "ELF")
           rm -f lib${LIB}.so.${SHLIB_MAJOR}
           ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
               lib${LIB}.so.${SHLIB_MAJOR}
           rm -f lib${LIB}.so
           ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
               lib${LIB}.so
 .endif  .endif
   
 LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}  LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
Line 234  LLIBS?=  -lc
Line 245  LLIBS?=  -lc
 llib-l${LIB}.ln: ${LOBJS}  llib-l${LIB}.ln: ${LOBJS}
         @echo building llib-l${LIB}.ln          @echo building llib-l${LIB}.ln
         @rm -f llib-l${LIB}.ln          @rm -f llib-l${LIB}.ln
         @${LINT} -C${LIB} ${LOBJS} ${LLIBS}          @${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
   
 cleanlib:  cleanlib:
         rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}          rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
         rm -f lib${LIB}.a ${OBJS}          rm -f lib${LIB}.a ${OBJS}
         rm -f lib${LIB}_p.a ${POBJS}          rm -f lib${LIB}_p.a ${POBJS}
         rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS}          rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
         rm -f llib-l${LIB}.ln ${LOBJS}          rm -f llib-l${LIB}.ln ${LOBJS}
   
 .if defined(SRCS)  .if defined(SRCS)
Line 252  afterdepend: .depend
Line 263  afterdepend: .depend
 .endif  .endif
   
 .if !target(libinstall)  .if !target(libinstall)
   # Make sure it gets defined, in case NOPIC && NOLINKLIB are defined
   libinstall::
   
   .if !defined(NOLINKLIB)
 libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
 .if !defined(UPDATE)  .if !defined(UPDATE)
 .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a  .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
Line 262  ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
Line 277  ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
   
 .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a  .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
 ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall  ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
   .endif
   
 .if !defined(NOPROFILE)  .if !defined(NOPROFILE) && !defined(NOLINKLIB)
 libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
 .if !defined(UPDATE)  .if !defined(UPDATE)
 .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a  .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
Line 276  ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
Line 292  ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
 ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall  ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
 .endif  .endif
   
 .if !defined(NOPIC)  .if !defined(NOPIC) && !defined(NOPICINSTALL) && !defined(NOLINKLIB)
 libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
 .if !defined(UPDATE)  .if !defined(UPDATE)
 .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a  .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
Line 300  ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB
Line 316  ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB
   
 .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}  .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
 ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}  ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} \          ${INSTALL} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                 ${.TARGET}                  ${.ALLSRC} ${.TARGET}
 .if (${SHLIB_TYPE} == "ELF")  .if (${OBJECT_FMT} == "ELF")
         rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}          rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
         ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \          ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
             ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}              ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
         rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so          rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so
   .if !defined(NOLINKLIB)
         ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \          ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
             ${DESTDIR}${LIBDIR}/lib${LIB}.so              ${DESTDIR}${LIBDIR}/lib${LIB}.so
 .endif  .endif
 .endif  .endif
   .endif
   
 .if !defined(NOLINT)  .if !defined(NOLINT) && !defined(NOLINKLIB)
 libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln  libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
 .if !defined(UPDATE)  .if !defined(UPDATE)
 .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln  .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
Line 323  ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln:
Line 341  ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln:
   
 .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln  .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
 ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln  ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \          ${INSTALL} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
             llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}              ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
 .endif  .endif
 .endif  .endif
   

Legend:
Removed from v.1.118  
changed lines
  Added in v.1.141

CVSweb <webmaster@jp.NetBSD.org>