[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.88 and 1.111

version 1.88, 1997/03/23 00:52:20 version 1.111, 1997/05/27 18:51:12
Line 1 
Line 1 
 #       $NetBSD$  #       $NetBSD$
 #       @(#)bsd.lib.mk  5.26 (Berkeley) 5/2/91  #       @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
   
 .if exists(${.CURDIR}/../Makefile.inc)  .if exists(${.CURDIR}/../Makefile.inc)
 .include "${.CURDIR}/../Makefile.inc"  .include "${.CURDIR}/../Makefile.inc"
 .endif  .endif
   
 .include <bsd.own.mk>                           # for 'NOPIC' definition  .include <bsd.own.mk>
   
   .MAIN:          all
   .PHONY:         cleanlib libinstall
   realinstall:    libinstall
   clean cleandir: 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
 SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor  SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
 .endif  .endif
   
 .MAIN: all  # add additional suffixes not exported.
   # .po is used for profiling object files.
 # prefer .S to a .c, add .po, remove stuff not used in the BSD libraries.  # .so is used for PIC object files.
 # .so used for PIC object files.  .ln used for lint output files.  .SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .F .f .r .y .l .cl .p .h .sh .m4
 .SUFFIXES:  
 .SUFFIXES: .out .o .po .so .S .s .c .cc .C .f .y .l .ln .m4  
   
   
 # Set PICFLAGS to cc flags for producing position-independent code,  # Set PICFLAGS to cc flags for producing position-independent code,
Line 31  SHLIB_MINOR != . ${.CURDIR}/shlib_versio
Line 34  SHLIB_MINOR != . ${.CURDIR}/shlib_versio
 #                       NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}.  #                       NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}.
 # SHLIB_LDSTARTFILE:    ???  # SHLIB_LDSTARTFILE:    ???
 # SHLIB_LDENDTILE:      ??  # SHLIB_LDENDTILE:      ??
 # CPICFLAGS:    flags to compile .c files for .so objects.  # CPPICFLAGS:   flags for ${CPP} to preprocess  .[sS]  files for ${AS}
 # APICFLAGS:    flags to assemble .S files for .so objects.  # CPICFLAGS:    flags for ${CC} to compile  .[cC] files to .so objects.
   # CAPICFLAGS    flags for {$CC} to compiling .[Ss] files
   #                       (usually just ${CPPPICFLAGS} ${CPICFLAGS})
   # APICFLAGS:    flags for ${AS} to assemble .[sS]  to .so objects.
   
 .if (${MACHINE_ARCH} == "alpha")  .if (${MACHINE_ARCH} == "alpha")
   
 SHLIB_TYPE=ELF  SHLIB_TYPE=ELF
 SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o  SHLIB_LDSTARTFILE= ${BUILDDIR}/usr/lib/crtbeginS.o
 SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o  SHLIB_LDENDFILE= ${BUILDDIR}/usr/lib/crtendS.o
 SHLIB_SOVERSION=${SHLIB_MAJOR}  SHLIB_SOVERSION=${SHLIB_MAJOR}
 CPICFLAGS ?= -fpic -DPIC  CPICFLAGS ?= -fpic -DPIC
 APICFLAGS ?= -DPIC  CPPPICFLAGS?= -DPIC
   CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
   APICFLAGS ?=
   
 .elif (${MACHINE_ARCH} == "mips")  .elif (${MACHINE_ARCH} == "mips")
   
Line 69  SHLIB_TYPE=a.out
Line 77  SHLIB_TYPE=a.out
 SHLIB_LDSTARTFILE=  SHLIB_LDSTARTFILE=
 SHLIB_LDENDFILE=  SHLIB_LDENDFILE=
 SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}  SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
 CPICFLAGS?= -fpic -DPIC  CPICFLAGS?= -fpic
 APICFLAGS?= -fpic -DPIC  CPPPICFLAGS?= -DPIC
   CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
   APICFLAGS?= -k
   
 .endif  .endif
   
Line 129  CFLAGS+= ${COPTS}
Line 139  CFLAGS+= ${COPTS}
         @rm -f ${.TARGET}.o          @rm -f ${.TARGET}.o
   
 .S.so .s.so:  .S.so .s.so:
         @echo ${COMPILE.S:Q} ${APICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}          @echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
         @${COMPILE.S} ${APICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o          @${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.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 152  _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHL
Line 162  _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHL
 _LIBS+=llib-l${LIB}.ln  _LIBS+=llib-l${LIB}.ln
 .endif  .endif
   
 all: ${_LIBS} _SUBDIRUSE  all: ${SRCS} ${_LIBS}
   
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}  __archivebuild: .USE
           @rm -f ${.TARGET}
           @${AR} cq ${.TARGET} `NM=${NM} lorder ${.ALLSRC} | tsort -q`
           ${RANLIB} ${.TARGET}
   
   __archiveinstall: .USE
           ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 ${.ALLSRC} \
                   ${.TARGET}
           ${RANLIB} -t ${.TARGET}
           chmod ${LIBMODE} ${.TARGET}
   
 lib${LIB}.a:: ${OBJS}  DPSRCS+=        ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
   CLEANFILES+=    ${DPSRCS}
   
   OBJS+=          ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
   lib${LIB}.a:: ${OBJS} __archivebuild
         @echo building standard ${LIB} library          @echo building standard ${LIB} library
         @rm -f lib${LIB}.a  .if defined(OBJDIR)
         @${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort -q`          @echo install -d ${BUILDDIR}${LIBDIR}
         ${RANLIB} lib${LIB}.a          @install -d ${BUILDDIR}${LIBDIR}
           @echo ${BUILDDIR}${LIBDIR}/${.TARGET} '->' `pwd`/${.TARGET};
           @rm -f ${BUILDDIR}${LIBDIR}/${.TARGET};
           @ln -s `pwd`/${.TARGET} ${BUILDDIR}${LIBDIR}/${.TARGET};
   .endif
   
 POBJS+= ${OBJS:.o=.po}  POBJS+=         ${OBJS:.o=.po}
 lib${LIB}_p.a:: ${POBJS}  lib${LIB}_p.a:: ${POBJS} __archivebuild
         @echo building profiled ${LIB} library          @echo building profiled ${LIB} library
         @rm -f lib${LIB}_p.a  .if defined(OBJDIR)
         @${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q`          @echo install -d ${BUILDDIR}${LIBDIR}
         ${RANLIB} lib${LIB}_p.a          @install -d ${BUILDDIR}${LIBDIR}
           @echo ${BUILDDIR}${LIBDIR}/${.TARGET} '->' `pwd`/${.TARGET};
           @rm -f ${BUILDDIR}${LIBDIR}/${.TARGET};
           @ln -s `pwd`/${.TARGET} ${BUILDDIR}${LIBDIR}/${.TARGET};
   .endif
   
 SOBJS+= ${OBJS:.o=.so}  SOBJS+=         ${OBJS:.o=.so}
 lib${LIB}_pic.a:: ${SOBJS}  lib${LIB}_pic.a:: ${SOBJS} __archivebuild
         @echo building shared object ${LIB} library          @echo building shared object ${LIB} library
         @rm -f lib${LIB}_pic.a  .if defined(OBJDIR)
         @${AR} cq lib${LIB}_pic.a `lorder ${SOBJS} | tsort -q`          @echo install -d ${BUILDDIR}${LIBDIR}
         ${RANLIB} lib${LIB}_pic.a          @install -d ${BUILDDIR}${LIBDIR}
           @echo ${BUILDDIR}${LIBDIR}/${.TARGET} '->' `pwd`/${.TARGET};
           @rm -f ${BUILDDIR}${LIBDIR}/${.TARGET};
           @ln -s `pwd`/${.TARGET} ${BUILDDIR}${LIBDIR}/${.TARGET};
   .endif
   
 lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD} \  lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD} \
     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}      ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
Line 182  lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINO
Line 217  lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINO
         @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}          @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
 .if (${SHLIB_TYPE} == "a.out")  .if (${SHLIB_TYPE} == "a.out")
         $(LD) -x -Bshareable -Bforcearchive \          $(LD) -x -Bshareable -Bforcearchive \
             -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}              -o ${.TARGET} lib${LIB}_pic.a ${LDADD}
 .elif (${SHLIB_TYPE} == "ELF")  .elif (${SHLIB_TYPE} == "ELF")
         $(LD) -x -shared -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \          $(LD) -x -shared -o ${.TARGET} \
             -soname lib${LIB}.so.${SHLIB_SOVERSION}  ${SHLIB_LDSTARTFILE} \              -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}
 .endif  .endif
   .if defined(OBJDIR)
           @echo install -d ${BUILDDIR}${LIBDIR}
           @install -d ${BUILDDIR}${LIBDIR}
           @echo ${BUILDDIR}${LIBDIR}/${.TARGET} '->' `pwd`/${.TARGET};
           @rm -f ${BUILDDIR}${LIBDIR}/${.TARGET};
           @ln -s `pwd`/${.TARGET} ${BUILDDIR}${LIBDIR}/${.TARGET};
   .if (${SHLIB_TYPE} == "ELF")
           rm -f ${BUILDDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
           ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
               ${BUILDDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
           rm -f ${BUILDDIR}${LIBDIR}/lib${LIB}.so
           ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
               ${BUILDDIR}${LIBDIR}/lib${LIB}.so
   .endif  # SHLIB_TYPE == ELF
   .endif  # defined(OBJDIR)
   
 LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}  LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
 LLIBS?= -lc  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} ${LOBJS} ${LLIBS}
   
 .if !target(clean)  
 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}
Line 205  cleanlib:
Line 254  cleanlib:
         rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS}          rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS}
         rm -f llib-l${LIB}.ln ${LOBJS}          rm -f llib-l${LIB}.ln ${LOBJS}
   
 clean: _SUBDIRUSE cleanlib  
 cleandir: _SUBDIRUSE cleanlib  
 .else  
 cleandir: _SUBDIRUSE clean  
 .endif  
   
 .if defined(SRCS)  .if defined(SRCS)
 afterdepend: .depend  afterdepend: .depend
         @(TMP=/tmp/_depend$$$$; \          @(TMP=/tmp/_depend$$$$; \
Line 219  afterdepend: .depend
Line 262  afterdepend: .depend
             mv $$TMP .depend)              mv $$TMP .depend)
 .endif  .endif
   
 .if !target(install)  .if !target(libinstall)
 .if !target(beforeinstall)  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
 beforeinstall:  .if !defined(UPDATE)
   .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
 .endif  .endif
   .if !defined(BUILD)
   ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
   .endif
   
   .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
   ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
   
 realinstall:  
 #       ranlib lib${LIB}.a  
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \  
             ${DESTDIR}${LIBDIR}  
         ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a  
         chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a  
 .if !defined(NOPROFILE)  .if !defined(NOPROFILE)
 #       ranlib lib${LIB}_p.a  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \  .if !defined(UPDATE)
             lib${LIB}_p.a ${DESTDIR}${LIBDIR}  .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
         ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a  .endif
         chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a  .if !defined(BUILD)
   ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
 .endif  .endif
   
   .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
   ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
   .endif
   
 .if !defined(NOPIC)  .if !defined(NOPIC)
 #       ranlib lib${LIB}_pic.a  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \  .if !defined(UPDATE)
             lib${LIB}_pic.a ${DESTDIR}${LIBDIR}  .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
         ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a  .endif
         chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a  .if !defined(BUILD)
   ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
 .endif  .endif
   
   .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
   ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
   .endif
   
 .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)  .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \  libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
             lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}  .if !defined(UPDATE)
   .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
   .endif
   .if !defined(BUILD)
   ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: .MADE
   .endif
   
   .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}
           ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} \
                   ${.TARGET}
 .if (${SHLIB_TYPE} == "ELF")  .if (${SHLIB_TYPE} == "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} \
Line 256  realinstall:
Line 322  realinstall:
             ${DESTDIR}${LIBDIR}/lib${LIB}.so              ${DESTDIR}${LIBDIR}/lib${LIB}.so
 .endif  .endif
 .endif  .endif
   
 .if !defined(NOLINT)  .if !defined(NOLINT)
   libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
   .if !defined(UPDATE)
   .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
   .endif
   .if !defined(BUILD)
   ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
   .endif
   
   .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
   ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
         ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \          ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
             llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}              llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
 .endif  .endif
 .if defined(LINKS) && !empty(LINKS)  
         @set ${LINKS}; \  
         while test $$# -ge 2; do \  
                 l=${DESTDIR}$$1; \  
                 shift; \  
                 t=${DESTDIR}$$1; \  
                 shift; \  
                 echo $$t -\> $$l; \  
                 rm -f $$t; \  
                 ln $$l $$t; \  
         done; true  
 .endif  
 .if defined(SYMLINKS) && !empty(SYMLINKS)  
         @set ${SYMLINKS}; \  
         while test $$# -ge 2; do \  
                 l=$$1; \  
                 shift; \  
                 t=${DESTDIR}$$1; \  
                 shift; \  
                 echo $$t -\> $$l; \  
                 rm -f $$t; \  
                 ln -s $$l $$t; \  
         done; true  
 .endif  
   
 install: maninstall _SUBDIRUSE  
 maninstall: afterinstall  
 afterinstall: realinstall  
 realinstall: beforeinstall  
 .endif  .endif
   
 .if !defined(NOMAN)  .if !defined(NOMAN)
Line 300  realinstall: beforeinstall
Line 348  realinstall: beforeinstall
 .endif  .endif
   
 .include <bsd.obj.mk>  .include <bsd.obj.mk>
   .include <bsd.files.mk>
   .include <bsd.inc.mk>
   .include <bsd.links.mk>
 .include <bsd.dep.mk>  .include <bsd.dep.mk>
 .include <bsd.subdir.mk>  .include <bsd.subdir.mk>
 .include <bsd.sys.mk>  .include <bsd.sys.mk>

Legend:
Removed from v.1.88  
changed lines
  Added in v.1.111

CVSweb <webmaster@jp.NetBSD.org>