version 1.187, 2001/10/25 19:32:15 |
version 1.202, 2002/05/07 01:45:45 |
|
|
# $NetBSD$ |
# $NetBSD$ |
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 |
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 |
|
|
.if !target(__initialized__) |
.include <bsd.init.mk> |
__initialized__: |
|
.if exists(${.CURDIR}/../Makefile.inc) |
|
.include "${.CURDIR}/../Makefile.inc" |
|
.endif |
|
.include <bsd.own.mk> |
|
.include <bsd.obj.mk> |
|
.include <bsd.depall.mk> |
|
.MAIN: all |
|
.endif |
|
|
|
|
##### Basic targets |
.PHONY: checkver cleanlib libinstall |
.PHONY: checkver cleanlib libinstall |
realinstall: checkver libinstall |
realinstall: checkver libinstall |
clean: cleanlib |
clean: cleanlib |
|
|
|
##### Build and install rules |
|
CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include} |
|
CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++} |
|
|
.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 23 SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; |
|
Line 19 SHLIB_TEENY != . ${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(${BSDSRCDIR}/lib/checkver) |
exists(${NETBSDSRCDIR}/lib/checkver) |
checkver: |
checkver: |
@(cd ${.CURDIR} && \ |
@(cd ${.CURDIR} && \ |
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ |
sh ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ |
-d ${DESTDIR}${LIBDIR} ${LIB}) |
-d ${DESTDIR}${_LIBSODIR} ${LIB}) |
.endif |
.endif |
.endif |
.endif |
|
|
|
|
|
|
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \ |
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \ |
${OBJECT_FMT} == "ELF" |
${OBJECT_FMT} == "ELF" |
|
# If you use -fPIC you need to define BIGPIC to turn on 32-bit |
|
# relocations in asm code |
FPICFLAGS ?= -fPIC |
FPICFLAGS ?= -fPIC |
CPICFLAGS ?= -fPIC -DPIC |
CPICFLAGS ?= -fPIC -DPIC |
CPPPICFLAGS?= -DPIC |
CPPPICFLAGS?= -DPIC -DBIGPIC |
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} |
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} |
APICFLAGS ?= -KPIC |
APICFLAGS ?= -KPIC -DBIGPIC |
|
|
.else |
.else |
|
|
Line 339 ALLOBJS=${POBJS} ${SOBJS} |
|
Line 336 ALLOBJS=${POBJS} ${SOBJS} |
|
ALLOBJS+=${LOBJS} |
ALLOBJS+=${LOBJS} |
.endif |
.endif |
|
|
.NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} |
.NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} |
|
|
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} |
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} |
|
|
Line 349 __archivebuild: .USE |
|
Line 346 __archivebuild: .USE |
|
${RANLIB} ${.TARGET} |
${RANLIB} ${.TARGET} |
|
|
__archiveinstall: .USE |
__archiveinstall: .USE |
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \ |
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET} |
${UPDATE:D:U-a "${RANLIB} -t"} ${.ALLSRC} ${.TARGET} |
${RANLIB} -t ${.TARGET} |
|
chmod ${LIBMODE} ${.TARGET} |
__archivesymlinkpic: .USE |
|
${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} |
|
|
DPSRCS+= ${SRCS:M*.[ly]:C/..$/.c/} |
DPSRCS+= ${SRCS:M*.[ly]:C/\..$/.c/} |
CLEANFILES+= ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}} |
CLEANFILES+= ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}} |
|
|
lib${LIB}.a:: ${OBJS} __archivebuild |
lib${LIB}.a:: ${OBJS} __archivebuild |
Line 375 lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL |
|
Line 373 lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL |
|
${SHLIB_LDSTARTFILE} \ |
${SHLIB_LDSTARTFILE} \ |
--whole-archive ${SOLIB} \ |
--whole-archive ${SOLIB} \ |
--no-whole-archive ${LDADD} \ |
--no-whole-archive ${LDADD} \ |
-L${DESTDIR}${LIBDIR} -R${LIBDIR} \ |
-L${DESTDIR}${_LIBSODIR} -L${DESTDIR}${LIBDIR} \ |
|
-R${_LIBSODIR} -R${LIBDIR} \ |
${SHLIB_LDENDFILE} |
${SHLIB_LDENDFILE} |
.else |
.else |
$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ |
$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ |
Line 384 lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL |
|
Line 383 lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL |
|
${SHLIB_LDENDFILE} |
${SHLIB_LDENDFILE} |
.endif |
.endif |
.if ${OBJECT_FMT} == "ELF" |
.if ${OBJECT_FMT} == "ELF" |
|
# We don't use INSTALL_SYMLINK here because this is just |
|
# happening inside the build directory/objdir. XXX Why does |
|
# this spend so much effort on libraries that aren't live??? XXX |
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp |
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} |
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp |
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp |
|
|
.if ${MKLINKLIB} != "no" |
.if ${MKLINKLIB} != "no" |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
|
|
.if !defined(UPDATE) |
.if !defined(UPDATE) |
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a) |
|
${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE |
.endif |
.endif |
|
${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall |
|
.else |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a) |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a) |
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE |
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE |
.endif |
.endif |
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall |
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall |
.endif |
.endif |
|
.endif |
|
|
.if ${MKPROFILE} != "no" |
.if ${MKPROFILE} != "no" |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
|
|
.if !defined(UPDATE) |
.if !defined(UPDATE) |
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a) |
|
${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE |
.endif |
.endif |
|
${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall |
|
.else |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a) |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a) |
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE |
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE |
.endif |
.endif |
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall |
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall |
.endif |
.endif |
|
.endif |
|
|
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" |
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
|
|
.if !defined(UPDATE) |
.if !defined(UPDATE) |
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a) |
|
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE |
.endif |
.endif |
|
.if ${MKPICLIB} == "no" |
|
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic |
|
.else |
|
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall |
|
.endif |
|
.else |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a) |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a) |
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE |
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE |
.endif |
.endif |
.if ${MKPICLIB} == "no" |
.if ${MKPICLIB} == "no" |
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: |
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic |
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
|
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
|
.else |
.else |
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall |
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall |
.endif |
.endif |
.endif |
.endif |
|
.endif |
|
|
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) |
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) |
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION} |
libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} |
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION} |
.PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} |
|
|
.if !defined(UPDATE) |
.if !defined(UPDATE) |
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION} |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION}) |
|
${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE |
.endif |
.endif |
|
${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION} |
|
.else |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION}) |
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION}) |
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE |
${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE |
|
.endif |
|
${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION} |
|
.endif |
|
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
|
${.ALLSRC} ${.TARGET} |
|
.if ${_LIBSODIR} != ${LIBDIR} |
|
${INSTALL_SYMLINK} ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \ |
|
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION} |
.endif |
.endif |
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION} |
|
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \ |
|
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET} |
|
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR) |
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR) |
/sbin/ldconfig -m ${LIBDIR} |
/sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR} |
.endif |
.endif |
.if ${OBJECT_FMT} == "ELF" |
.if ${OBJECT_FMT} == "ELF" |
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\ |
${INSTALL_SYMLINK} lib${LIB}.so.${SHLIB_FULLVERSION} \ |
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp |
${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR} |
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\ |
.if ${_LIBSODIR} != ${LIBDIR} |
|
${INSTALL_SYMLINK} ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \ |
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR} |
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR} |
|
.endif |
.if ${MKLINKLIB} != "no" |
.if ${MKLINKLIB} != "no" |
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\ |
${INSTALL_SYMLINK} lib${LIB}.so.${SHLIB_FULLVERSION} \ |
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp |
${DESTDIR}${_LIBSODIR}/lib${LIB}.so |
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\ |
.if ${_LIBSODIR} != ${LIBDIR} |
|
${INSTALL_SYMLINK} ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \ |
${DESTDIR}${LIBDIR}/lib${LIB}.so |
${DESTDIR}${LIBDIR}/lib${LIB}.so |
.endif |
.endif |
.endif |
.endif |
.endif |
.endif |
|
.endif |
|
|
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS) |
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS) |
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln |
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln |
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln |
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln |
|
|
.if !defined(UPDATE) |
.if !defined(UPDATE) |
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln |
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln) |
|
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE |
.endif |
.endif |
|
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln |
|
.else |
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln) |
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln) |
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE |
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE |
.endif |
.endif |
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln |
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln |
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \ |
.endif |
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR} |
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
|
${.ALLSRC} ${DESTDIR}${LINTLIBDIR} |
.endif |
.endif |
.endif |
.endif |
|
|
|
##### Pull in related .mk logic |
.include <bsd.man.mk> |
.include <bsd.man.mk> |
.include <bsd.nls.mk> |
.include <bsd.nls.mk> |
.include <bsd.files.mk> |
.include <bsd.files.mk> |
Line 516 ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: |
|
Line 549 ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: |
|
.include <bsd.dep.mk> |
.include <bsd.dep.mk> |
.include <bsd.sys.mk> |
.include <bsd.sys.mk> |
|
|
# Make sure all of the standard targets are defined, even if they do nothing. |
${TARGETS}: # ensure existence |
lint regress: |
|