Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/share/mk/bsd.lib.mk,v rcsdiff: /ftp/cvs/cvsroot/src/share/mk/bsd.lib.mk,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.197 retrieving revision 1.207 diff -u -p -r1.197 -r1.207 --- src/share/mk/bsd.lib.mk 2002/02/11 21:15:00 1.197 +++ src/share/mk/bsd.lib.mk 2002/09/27 21:37:56 1.207 @@ -1,7 +1,8 @@ -# $NetBSD: bsd.lib.mk,v 1.197 2002/02/11 21:15:00 mycroft Exp $ +# $NetBSD: bsd.lib.mk,v 1.207 2002/09/27 21:37:56 thorpej Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include +.include ##### Basic targets .PHONY: checkver cleanlib libinstall @@ -19,10 +20,10 @@ SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; # Check for higher installed library versions. .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \ - exists(${BSDSRCDIR}/lib/checkver) + exists(${NETBSDSRCDIR}/lib/checkver) checkver: @(cd ${.CURDIR} && \ - sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ + sh ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ -d ${DESTDIR}${_LIBSODIR} ${LIB}) .endif .endif @@ -87,8 +88,10 @@ SHLIB_FULLVERSION=${SHLIB_MAJOR} # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors # FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects. # CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} -# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects. -# CAPICFLAGS flags for {$CC} to compiling .[Ss] files +# CPICFLAGS: flags for ${CC} to compile .[cC] files to pic objects. +# 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}) # APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. @@ -116,13 +119,25 @@ MKPICLIB= no .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \ ${OBJECT_FMT} == "ELF" - +# If you use -fPIC you need to define BIGPIC to turn on 32-bit +# relocations in asm code FPICFLAGS ?= -fPIC CPICFLAGS ?= -fPIC -DPIC -CPPPICFLAGS?= -DPIC +CPPPICFLAGS?= -DPIC -DBIGPIC CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} 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 # Platform-independent flags for NetBSD a.out shared libraries @@ -138,6 +153,16 @@ APICFLAGS?= -k 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 .if ${OBJECT_FMT} == "ELF" SHLIB_SOVERSION= ${SHLIB_MAJOR} @@ -171,10 +196,10 @@ FFLAGS+= ${FOPTS} .c.so: .if defined(COPTS) && !empty(COPTS:M*-g*) - ${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + ${COMPILE.c} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} .else - @echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o + @echo ${COMPILE.c:Q} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.c} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o .endif @@ -204,10 +229,10 @@ FFLAGS+= ${FOPTS} .cc.so .C.so: .if defined(COPTS) && !empty(COPTS:M*-g*) - ${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + ${COMPILE.cc} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} .else @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} @rm -f ${.TARGET}.o .endif @@ -267,10 +292,10 @@ FFLAGS+= ${FOPTS} .m.so: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*) - ${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + ${COMPILE.m} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} .else @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} @rm -f ${.TARGET}.o .endif @@ -309,7 +334,15 @@ POBJS+=${OBJS:.o=.po} .if ${MKPIC} != "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 +.endif .else SOLIB=lib${LIB}_pic.a _LIBS+=${SOLIB} @@ -345,9 +378,8 @@ __archivebuild: .USE ${RANLIB} ${.TARGET} __archiveinstall: .USE - ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET} - ${RANLIB} -t ${.TARGET} - chmod ${LIBMODE} ${.TARGET} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${UPDATE:D:U-a "${RANLIB} -t"} ${.ALLSRC} ${.TARGET} __archivesymlinkpic: .USE ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} @@ -397,8 +429,12 @@ LLIBS?= -lc llib-l${LIB}.ln: ${LOBJS} @echo building 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} .endif +.endif cleanlib: rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}