| version 1.273, 2008/01/09 11:26:14 |
version 1.273.4.1, 2008/06/02 13:21:43 |
|
|
| # Pull in <bsd.sys.mk> here so we can override its .c.o rule |
# Pull in <bsd.sys.mk> here so we can override its .c.o rule |
| .include <bsd.sys.mk> |
.include <bsd.sys.mk> |
| |
|
| |
LIBISPRIVATE?= no |
| |
|
| |
.if ${LIBISPRIVATE} != "no" |
| |
MKDEBUGLIB:= no |
| |
MKLINT:= no |
| |
MKPIC:= no |
| |
MKPROFILE:= no |
| |
.endif |
| |
|
| ##### Basic targets |
##### Basic targets |
| .PHONY: checkver libinstall |
.PHONY: checkver libinstall |
| realinstall: checkver libinstall |
realinstall: checkver libinstall |
| Line 333 OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g} |
|
| Line 342 OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g} |
|
| |
|
| STOBJS+=${OBJS} |
STOBJS+=${OBJS} |
| |
|
| .if ${MKPRIVATELIB} != "no" |
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} |
| |
|
| |
.if ${LIBISPRIVATE} != "no" |
| # No installation is required |
# No installation is required |
| libinstall:: |
libinstall:: |
| .else # ${MKPRIVATELIB} == "no" # { |
.else # ${LIBISPRIVATE} == "no" # { |
| |
|
| .if ${MKDEBUGLIB} != "no" |
.if ${MKDEBUGLIB} != "no" |
| _LIBS+=lib${LIB}_g.a |
_LIBS+=lib${LIB}_g.a |
| Line 371 _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION} |
|
| Line 382 _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION} |
|
| .endif |
.endif |
| .endif # } |
.endif # } |
| |
|
| LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} |
.if ${MKLINT} != "no" && !empty(LOBJS) |
| .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS) |
|
| _LIBS+=llib-l${LIB}.ln |
_LIBS+=llib-l${LIB}.ln |
| .endif |
.endif |
| |
|
| .endif # ${MKPRIVATELIB} == "no" # } |
.endif # ${LIBISPRIVATE} == "no" # } |
| |
|
| ALLOBJS= |
ALLOBJS= |
| .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ |
.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ |
|
|
| ALLOBJS+=${STOBJS} |
ALLOBJS+=${STOBJS} |
| .endif |
.endif |
| ALLOBJS+=${POBJS} ${SOBJS} |
ALLOBJS+=${POBJS} ${SOBJS} |
| .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS) |
.if ${MKLINT} != "no" && !empty(LOBJS) |
| ALLOBJS+=${LOBJS} |
ALLOBJS+=${LOBJS} |
| .endif |
.endif |
| .else # !defined(LIB) # } { |
.else # !defined(LIB) # } { |
| Line 441 _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}$ |
|
| Line 451 _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}$ |
|
| -L${DESTDIR}${SHLIBINSTALLDIR} |
-L${DESTDIR}${SHLIBINSTALLDIR} |
| .endif |
.endif |
| |
|
| lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \ |
# gcc -shared now adds -lc automatically. For libraries other than libc and |
| |
# libgcc* we add as a dependency the installed shared libc. For libc and |
| |
# libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that |
| |
# -Xl,-nostdlib is not enough because we want to tell the compiler-driver not |
| |
# to add standard libraries, not the linker. |
| |
.if !defined(LIB) |
| |
DPLIBC ?= ${DESTDIR}${LIBC_SO} |
| |
.else |
| |
.if ${LIB} != "c" && ${LIB:Mgcc*} == "" |
| |
DPLIBC ?= ${DESTDIR}${LIBC_SO} |
| |
.else |
| |
LDLIBC ?= -nodefaultlibs |
| |
.if ${LIB} == "c" |
| |
LDADD+= -lgcc_pic |
| |
.endif |
| |
.endif |
| |
.endif |
| |
|
| |
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \ |
| ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} |
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} |
| ${_MKTARGET_BUILD} |
${_MKTARGET_BUILD} |
| rm -f lib${LIB}.so.${SHLIB_FULLVERSION} |
rm -f lib${LIB}.so.${SHLIB_FULLVERSION} |
| .if defined(DESTDIR) |
.if defined(DESTDIR) |
| ${CC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \ |
${CC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \ |
| ${_LIBLDOPTS} \ |
${_LIBLDOPTS} \ |
| -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \ |
-Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \ |
| -Wl,--whole-archive ${SOLIB} \ |
-Wl,--whole-archive ${SOLIB} \ |
| -Wl,--no-whole-archive ${LDADD} \ |
-Wl,--no-whole-archive ${LDADD} \ |
| -L${_GCC_LIBGCCDIR} |
-L${_GCC_LIBGCCDIR} |
| .else |
.else |
| ${CC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \ |
${CC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} \ |
| ${_LIBLDOPTS} \ |
-o ${.TARGET} ${_LIBLDOPTS} \ |
| -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD} |
-Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD} |
| .endif |
.endif |
| .if ${OBJECT_FMT} == "ELF" |
.if ${OBJECT_FMT} == "ELF" |
| Line 479 llib-l${LIB}.ln: ${LOBJS} |
|
| Line 507 llib-l${LIB}.ln: ${LOBJS} |
|
| .endif |
.endif |
| .endif # } |
.endif # } |
| |
|
| |
lint: ${LOBJS} |
| |
.if defined(LOBJS) && !empty(LOBJS) |
| |
${LINT} ${LINTFLAGS} ${LOBJS} |
| |
.endif |
| |
|
| cleanlib: .PHONY |
cleanlib: .PHONY |
| rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} |
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} |
| rm -f lib${LIB}.a ${STOBJS} |
rm -f lib${LIB}.a ${STOBJS} |
| Line 617 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SH |
|
| Line 650 ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SH |
|
| .endif |
.endif |
| .endif |
.endif |
| |
|
| .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS) |
.if ${MKLINT} != "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 |
| |
|