Return to bsd.lib.mk CVS log | 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. |
version 1.200, 2002/04/10 15:05:45 | version 1.207, 2002/09/27 21:37:56 | ||
---|---|---|---|
|
|
||
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 | # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 | ||
.include <bsd.init.mk> | .include <bsd.init.mk> | ||
.include <bsd.shlib.mk> | |||
##### Basic targets | ##### Basic targets | ||
.PHONY: checkver cleanlib libinstall | .PHONY: checkver cleanlib libinstall | ||
|
|
||
# 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(${_SRC_TOP_}/lib/checkver) | exists(${NETBSDSRCDIR}/lib/checkver) | ||
checkver: | checkver: | ||
@(cd ${.CURDIR} && \ | @(cd ${.CURDIR} && \ | ||
sh ${_SRC_TOP_}/lib/checkver -v ${SHLIB_VERSION_FILE} \ | sh ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ | ||
-d ${DESTDIR}${_LIBSODIR} ${LIB}) | -d ${DESTDIR}${_LIBSODIR} ${LIB}) | ||
.endif | .endif | ||
.endif | .endif | ||
|
|
||
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors | # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors | ||
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects. | # FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects. | ||
# 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 pic objects. | ||
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files | # CSHLIBFLAGS: flags for ${CC} to compile .[cC] files to .so objects. | ||
# (usually includes ${CPICFLAGS}) | |||
# CAPICFLAGS: flags for ${CC} to compiling .[Ss] files | |||
# (usually just ${CPPPICFLAGS} ${CPICFLAGS}) | # (usually just ${CPPPICFLAGS} ${CPICFLAGS}) | ||
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. | # APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. | ||
|
|
||
.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 | ||
.elif ${MACHINE_ARCH} == "hppa" | |||
FPICFLAGS ?= -fPIC | |||
CPICFLAGS?= -fPIC -DPIC | |||
CPPPICFLAGS?= -DPIC | |||
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} | |||
APICFLAGS?= -k | |||
# XXX libraries often need the millicode functions in libgcc.a, | |||
# so we have to work around the -nostdlib: | |||
LDADD+= `$(CC) -print-libgcc-file-name` | |||
.else | .else | ||
# Platform-independent flags for NetBSD a.out shared libraries | # Platform-independent flags for NetBSD a.out shared libraries | ||
|
|
||
MKPICLIB?= yes | MKPICLIB?= yes | ||
.if ${MKPICLIB} != "no" | |||
CSHLIBFLAGS+= ${CPICFLAGS} | |||
.endif | |||
.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS) | |||
MKSHLIBOBJS= yes | |||
.else | |||
MKSHLIBOBJS= no | |||
.endif | |||
# 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} | ||
|
|
||
.c.so: | .c.so: | ||
.if defined(COPTS) && !empty(COPTS:M*-g*) | .if defined(COPTS) && !empty(COPTS:M*-g*) | ||
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | ${COMPILE.c} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} | ||
.else | .else | ||
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | @echo ${COMPILE.c:Q} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} | ||
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o | @${COMPILE.c} ${CSHLIBFLAGS} ${.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 | ||
.endif | .endif | ||
|
|
||
.cc.so .C.so: | .cc.so .C.so: | ||
.if defined(COPTS) && !empty(COPTS:M*-g*) | .if defined(COPTS) && !empty(COPTS:M*-g*) | ||
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | ${COMPILE.cc} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} | ||
.else | .else | ||
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | @echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | ||
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o | @${COMPILE.cc} ${CSHLIBFLAGS} ${.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 | ||
.endif | .endif | ||
|
|
||
.m.so: | .m.so: | ||
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*) | .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*) | ||
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | ${COMPILE.m} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} | ||
.else | .else | ||
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} | ||
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o | @${COMPILE.m} ${CSHLIBFLAGS} ${.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 | ||
.endif | .endif | ||
|
|
||
.if ${MKPIC} != "no" | .if ${MKPIC} != "no" | ||
.if ${MKPICLIB} == "no" | .if ${MKPICLIB} == "no" | ||
.if ${MKSHLIBOBJS} != "no" | |||
# make _pic.a, which isn't really pic, | |||
# since it's needed for making shared lib. | |||
# but don't install it. | |||
SOLIB=lib${LIB}_pic.a | |||
SOBJS+=${OBJS:.o=.so} | |||
.else | |||
SOLIB=lib${LIB}.a | SOLIB=lib${LIB}.a | ||
.endif | |||
.else | .else | ||
SOLIB=lib${LIB}_pic.a | SOLIB=lib${LIB}_pic.a | ||
_LIBS+=${SOLIB} | _LIBS+=${SOLIB} | ||
|
|
||
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 | ||
.if defined(DESTDIR) | |||
@${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS} | |||
.else | |||
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS} | @${LINT} -C${LIB} ${.ALLSRC} ${LLIBS} | ||
.endif | .endif | ||
.endif | |||
cleanlib: | cleanlib: | ||
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} | rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} |