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.309 retrieving revision 1.317 diff -u -p -r1.309 -r1.317 --- src/share/mk/bsd.lib.mk 2010/11/08 06:54:52 1.309 +++ src/share/mk/bsd.lib.mk 2011/09/25 11:20:41 1.317 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.309 2010/11/08 06:54:52 lukem Exp $ +# $NetBSD: bsd.lib.mk,v 1.317 2011/09/25 11:20:41 apb Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include @@ -37,7 +37,6 @@ MKPROFILE:= no ##### Basic targets .PHONY: checkver libinstall realinstall: checkver libinstall -clean: cleanlib ##### LIB specific flags. # XXX: This is needed for programs that link with .a libraries @@ -63,16 +62,6 @@ DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so ##### Build and install rules MKDEP_SUFFIXES?= .o .po .pico .go .ln -# Use purely kernel private headers in rump builds -.if !defined(RUMPKERNEL) -.if empty(CPPFLAGS:M-nostdinc) -CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include} -.endif -.if empty(CXXFLAGS:M-nostdinc++) -CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++} -.endif -.endif - .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor @@ -521,12 +510,11 @@ lib${LIB}_g.a:: ${GOBJS} __archivebuild _LIBLDOPTS= .if ${SHLIBDIR} != "/usr/lib" -_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \ - -R${SHLIBDIR} \ - -L${DESTDIR}${SHLIBDIR} +_LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ + -L=${SHLIBDIR} .elif ${SHLIBINSTALLDIR} != "/usr/lib" -_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \ - -L${DESTDIR}${SHLIBINSTALLDIR} +_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ + -L=${SHLIBINSTALLDIR} .endif # gcc -shared now adds -lc automatically. For libraries other than libc and @@ -535,10 +523,14 @@ _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}$ # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not # to add standard libraries, not the linker. .if !defined(LIB) +.if !empty(LIBC_SO) DPLIBC ?= ${DESTDIR}${LIBC_SO} +.endif .else .if ${LIB} != "c" && ${LIB:Mgcc*} == "" +.if !empty(LIBC_SO) DPLIBC ?= ${DESTDIR}${LIBC_SO} +.endif .else LDLIBC ?= -nodefaultlibs .if ${LIB} == "c" @@ -560,18 +552,9 @@ lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOL ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} ${_MKTARGET_BUILD} rm -f lib${LIB}.so.${SHLIB_FULLVERSION} -.if defined(DESTDIR) - ${LIBCC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}${SHLIBDIR}/ \ - -Wl,-x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ - -Wl,--whole-archive ${SOLIB} \ - -Wl,--no-whole-archive ${_LDADD.lib${LIB}} \ - ${_LIBLDOPTS} ${_LDFLAGS.lib${LIB}} \ - -L${_GCC_LIBGCCDIR} -.else ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \ -o ${.TARGET} ${_LIBLDOPTS} \ -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${_LDADD.lib${LIB}} -.endif # 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 @@ -612,15 +595,27 @@ lint: ${LOBJS} ${LINT} ${LINTFLAGS} ${LOBJS} .endif -cleanlib: .PHONY - rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} - rm -f lib${LIB}.a ${STOBJS} - rm -f lib${LIB}_p.a ${POBJS} - rm -f lib${LIB}_g.a ${GOBJS} - rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${_LIB.debug} ${SOBJS} - rm -f ${STOBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp} ${GOBJS:=.tmp} - rm -f llib-l${LIB}.ln ${LOBJS} - +# If the number of entries in CLEANFILES is too large, then the +# commands in bsd.clean.mk encounter errors like "exec(/bin/sh) +# failed (Argument list too long)". Avoid that by splitting the +# files to clean into several lists using different variable names. +# __cleanuse is an internal target in bsd.clean.mk; the way we +# use it here mimics the way it's used by the clean target in +# bsd.clean.mk. +# +clean: libclean1 libclean2 libclean3 libclean4 libclean5 +libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1 +libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2 +libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3 +libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4 +libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5 +CLEANFILES+= a.out [Ee]rrs mklog core *.core +LIBCLEANFILES1+= lib${LIB}.a ${STOBJS} ${STOBJS:=.tmp} +LIBCLEANFILES2+= lib${LIB}_p.a ${POBJS} ${POBJS:=.tmp} +LIBCLEANFILES3+= lib${LIB}_g.a ${GOBJS} ${GOBJS:=.tmp} +LIBCLEANFILES4+= lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${_LIB.debug} +LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp} +LIBCLEANFILES5+= llib-l${LIB}.ln ${LOBJS} .if !target(libinstall) # { # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no @@ -792,5 +787,7 @@ LINKSMODE?= ${LIBMODE} .include .include .include +.include +.include ${TARGETS}: # ensure existence