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.148 retrieving revision 1.159.4.1 diff -u -p -r1.148 -r1.159.4.1 --- src/share/mk/bsd.lib.mk 1999/02/12 01:10:07 1.148 +++ src/share/mk/bsd.lib.mk 1999/12/27 18:31:11 1.159.4.1 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.148 1999/02/12 01:10:07 lukem Exp $ +# $NetBSD: bsd.lib.mk,v 1.159.4.1 1999/12/27 18:31:11 wrstuden Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .if !target(__initialized__) @@ -8,6 +8,7 @@ __initialized__: .endif .include .include +.include .MAIN: all .endif @@ -15,16 +16,17 @@ __initialized__: realinstall: checkver libinstall clean cleandir distclean: cleanlib -.if exists(${.CURDIR}/shlib_version) -SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major -SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor +.if exists(${SHLIB_VERSION_FILE}) +SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major +SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor # Check for higher installed library versions. .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \ exists(${BSDSRCDIR}/lib/checkver) checkver: @(cd ${.CURDIR} && \ - ${BSDSRCDIR}/lib/checkver -d ${DESTDIR}${LIBDIR} ${LIB}) + ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ + -d ${DESTDIR}${LIBDIR} ${LIB}) .else checkver: .endif @@ -64,21 +66,24 @@ CPICFLAGS ?= -fpic -DPIC CPPPICFLAGS?= -DPIC CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} APICFLAGS ?= -.elif ${MACHINE_ARCH} == "mips" +.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" # mips-specific shared library flags -# On mips, all libs need to be compiled with ABIcalls, not just sharedlibs. -CPICFLAGS?= -APICFLAGS?= -#CPICFLAGS?= -fpic -DPIC -#APICFLAGS?= -DPIC - -# so turn shlib PIC flags on for ${CPP}, ${CC}, and ${AS} as follows: -AINC+=-DPIC -DABICALLS -COPTS+= -fPIC ${AINC} +# On mips, all libs are compiled with ABIcalls, not just sharedlibs. +MKPICLIB= no + +# so turn shlib PIC flags on for ${AS}. +AINC+=-DABICALLS AFLAGS+= -fPIC AS+= -KPIC +.elif ${MACHINE_ARCH} == "sparc" && ${OBJECT_FMT} == "ELF" + +CPICFLAGS ?= -fpic -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS ?= -KPIC + .else # Platform-independent flags for NetBSD a.out shared libraries (and PowerPC) @@ -93,6 +98,8 @@ APICFLAGS?= -k .endif +MKPICLIB?= yes + # Platform-independent linker flags for ELF shared libraries .if ${OBJECT_FMT} == "ELF" SHLIB_SOVERSION=${SHLIB_MAJOR} @@ -104,61 +111,97 @@ SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crte CFLAGS+= ${COPTS} .c.o: +.if defined(COPTS) && !empty(COPTS:M*-g*) + ${COMPILE.c} ${.IMPSRC} +.else @echo ${COMPILE.c:Q} ${.IMPSRC} @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .c.po: +.if defined(COPTS) && !empty(COPTS:M*-g*) + ${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET} +.else @echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET} @${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o @${LD} -X -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .c.so: +.if defined(COPTS) && !empty(COPTS:M*-g*) + ${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} +.else @echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} @${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .c.ln: ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} .cc.o .C.o: +.if defined(COPTS) && !empty(COPTS:M*-g*) + ${COMPILE.cc} ${.IMPSRC} +.else @echo ${COMPILE.cc:Q} ${.IMPSRC} @${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .cc.po .C.po: +.if defined(COPTS) && !empty(COPTS:M*-g*) + ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET} +.else @echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET} @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o @${LD} -X -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .cc.so .C.so: +.if defined(COPTS) && !empty(COPTS:M*-g*) + ${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} +.else @echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} @${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .m.o: +.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*) + ${COMPILE.m} ${.IMPSRC} +.else @echo ${COMPILE.m:Q} ${.IMPSRC} @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .m.po: +.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*) + ${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET} +.else @echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET} @${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o @${LD} -X -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .m.so: +.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*) + ${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} +.else @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} @${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.endif .S.o .s.o: @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} @@ -185,12 +228,21 @@ _LIBS=lib${LIB}.a _LIBS= .endif -.if ${MKPROFILE} != "no" && ${MKLINKLIB} != "no" +OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g} + +.if ${MKPROFILE} != "no" _LIBS+=lib${LIB}_p.a +POBJS+=${OBJS:.o=.po} .endif .if ${MKPIC} != "no" -_LIBS+=lib${LIB}_pic.a +.if ${MKPICLIB} == "no" +SOLIB=lib${LIB}.a +.else +SOLIB=lib${LIB}_pic.a +_LIBS+=${SOLIB} +SOBJS+=${OBJS:.o=.so} +.endif .if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} .endif @@ -198,9 +250,12 @@ _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHL .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" _LIBS+=llib-l${LIB}.ln +LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} .endif -all: ${SRCS} ${_LIBS} +ALLOBJS=${OBJS} ${POBJS} ${SOBJS} ${LOBJS} + +all: ${SRCS} ${ALLOBJS:O} ${_LIBS} __archivebuild: .USE @rm -f ${.TARGET} @@ -208,8 +263,8 @@ __archivebuild: .USE ${RANLIB} ${.TARGET} __archiveinstall: .USE - ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} \ - -m 600 ${.ALLSRC} ${.TARGET} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \ + -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET} ${RANLIB} -t ${.TARGET} chmod ${LIBMODE} ${.TARGET} @@ -223,22 +278,29 @@ OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} lib${LIB}.a:: ${OBJS} __archivebuild @echo building standard ${LIB} library -POBJS+= ${OBJS:.o=.po} lib${LIB}_p.a:: ${POBJS} __archivebuild @echo building profiled ${LIB} library -SOBJS+= ${OBJS:.o=.so} lib${LIB}_pic.a:: ${SOBJS} __archivebuild @echo building shared object ${LIB} library -lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD} \ +lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOLIB} ${DPADD} \ ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\) @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} +.if defined(DESTDIR) + $(LD) -nostdlib -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ + ${SHLIB_LDSTARTFILE} \ + --whole-archive ${SOLIB} \ + -L${DESTDIR}${LIBDIR} -R${LIBDIR} \ + --no-whole-archive ${LDADD} \ + ${SHLIB_LDENDFILE} +.else $(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ ${SHLIB_LDSTARTFILE} \ - --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \ + --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \ ${SHLIB_LDENDFILE} +.endif .if ${OBJECT_FMT} == "ELF" rm -f lib${LIB}.so.${SHLIB_MAJOR} ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ @@ -248,7 +310,6 @@ lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINO lib${LIB}.so .endif -LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} LLIBS?= -lc llib-l${LIB}.ln: ${LOBJS} @echo building llib-l${LIB}.ln @@ -279,7 +340,7 @@ libinstall:: ${DESTDIR}${LIBDIR}/lib${LI .if !defined(UPDATE) .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a .endif -.if !defined(BUILD) +.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a) ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE .endif @@ -287,12 +348,12 @@ ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall .endif -.if ${MKPROFILE} != "no" && ${MKLINKLIB} != "no" +.if ${MKPROFILE} != "no" libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a .if !defined(UPDATE) .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a .endif -.if !defined(BUILD) +.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a) ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE .endif @@ -300,32 +361,37 @@ ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall .endif -.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" && ${MKLINKLIB} != "no" +.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" +.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a .if !defined(UPDATE) .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a .endif -.if !defined(BUILD) +.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a) ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE .endif - -.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a +.if ${MKPICLIB} == "no" +${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: + rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a + ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a +.else ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall .endif +.endif .if ${MKPIC} != "no" && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} .if !defined(UPDATE) .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} .endif -.if !defined(BUILD) +.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}) ${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} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} \ - -m ${LIBMODE} ${.ALLSRC} ${.TARGET} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \ + -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET} .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR) /sbin/ldconfig -m ${LIBDIR} .endif @@ -346,14 +412,14 @@ libinstall:: ${DESTDIR}${LINTLIBDIR}/lli .if !defined(UPDATE) .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln .endif -.if !defined(BUILD) +.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln) ${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} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} \ - -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \ + -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR} .endif .endif