version 1.364, 2016/02/21 03:34:27 |
version 1.374, 2018/06/05 15:37:52 |
Line 42 realinstall: checkver libinstall |
|
Line 42 realinstall: checkver libinstall |
|
# XXX: This is needed for programs that link with .a libraries |
# XXX: This is needed for programs that link with .a libraries |
# Perhaps a more correct solution is to always generate _pic.a |
# Perhaps a more correct solution is to always generate _pic.a |
# files or always have a shared library. |
# files or always have a shared library. |
|
# Another fix is to provide rcrt0.o like OpenBSD does and |
|
# do relocations for static PIE. |
.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) |
.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) |
CFLAGS+= ${PIE_CFLAGS} |
CFLAGS+= ${PIE_CFLAGS} |
AFLAGS+= ${PIE_AFLAGS} |
AFLAGS+= ${PIE_AFLAGS} |
Line 187 FFLAGS+= ${FOPTS} |
|
Line 189 FFLAGS+= ${FOPTS} |
|
.if defined(CTFCONVERT) |
.if defined(CTFCONVERT) |
.if defined(CFLAGS) && !empty(CFLAGS:M*-g*) |
.if defined(CFLAGS) && !empty(CFLAGS:M*-g*) |
CTFFLAGS+= -g |
CTFFLAGS+= -g |
.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 |
.if defined(HAVE_GCC) |
#CFLAGS+= -gdwarf-2 |
#CFLAGS+= -gdwarf-2 |
.endif |
.endif |
.endif |
.endif |
Line 524 _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH |
|
Line 526 _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH |
|
|
|
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug} |
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug} |
|
|
MKARZERO?= ${MKREPRO:Uno} |
|
|
|
.if ${MKARZERO} == "yes" |
.if ${MKARZERO} == "yes" |
_ARFL=crsD |
_ARFL=crsD |
_ARRANFL=sD |
_ARRANFL=sD |
Line 541 _INSTRANLIB=${empty(PRESERVE):?-a "${RAN |
|
Line 541 _INSTRANLIB=${empty(PRESERVE):?-a "${RAN |
|
.if !target(__archivebuild) |
.if !target(__archivebuild) |
__archivebuild: .USE |
__archivebuild: .USE |
${_MKTARGET_BUILD} |
${_MKTARGET_BUILD} |
rm -f ${.TARGET} |
@rm -f ${.TARGET} |
${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` |
${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` |
.endif |
.endif |
|
|
Line 556 __archivesymlinkpic: .USE |
|
Line 556 __archivesymlinkpic: .USE |
|
${_MKTARGET_INSTALL} |
${_MKTARGET_INSTALL} |
${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} |
${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} |
|
|
|
.if !target(__buildstdlib) |
|
__buildstdlib: .USE |
|
@echo building standard ${.TARGET:T:S/.o//:S/lib//} library |
|
@rm -f ${.TARGET} |
|
@${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` |
|
.endif |
|
|
|
.if !target(__buildproflib) |
|
__buildproflib: .USE |
|
@echo building profiled ${.TARGET:T:S/.o//:S/lib//} library |
|
${_MKTARGET_BUILD} |
|
@rm -f ${.TARGET} |
|
@${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT}` |
|
.endif |
|
|
DPSRCS+= ${_YLSRCS} |
DPSRCS+= ${_YLSRCS} |
CLEANFILES+= ${_YLSRCS} |
CLEANFILES+= ${_YLSRCS} |
|
|
Line 578 _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ |
|
Line 593 _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ |
|
_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ |
_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ |
-L=${SHLIBINSTALLDIR} |
-L=${SHLIBINSTALLDIR} |
.endif |
.endif |
|
.if ${MKSTRIPSYM:Uyes} == "yes" |
|
_LIBLDOPTS+= -Wl,-x |
|
.else |
|
_LIBLDOPTS+= -Wl,-X |
|
.endif |
|
|
# gcc -shared now adds -lc automatically. For libraries other than libc and |
# 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 add as a dependency the installed shared libc. For libc and |
Line 628 ${_LIB.so.full}: ${_LIB.so.link} ${_LIB. |
|
Line 648 ${_LIB.so.full}: ${_LIB.so.link} ${_LIB. |
|
${_MKTARGET_CREATE} |
${_MKTARGET_CREATE} |
( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ |
( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ |
--add-gnu-debuglink=${_LIB.so.debug} \ |
--add-gnu-debuglink=${_LIB.so.debug} \ |
${_LIB.so.link} ${_LIB.so.full} \ |
${_LIB.so.link} ${_LIB.so.full}.tmp && \ |
|
mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \ |
) || (rm -f ${.TARGET}; false) |
) || (rm -f ${.TARGET}; false) |
${_LIB.so.link}: ${_MAINLIBDEPS} |
${_LIB.so.link}: ${_MAINLIBDEPS} |
.else # aka no MKDEBUG |
.else # aka no MKDEBUG |
Line 636 ${_LIB.so.full}: ${_MAINLIBDEPS} |
|
Line 657 ${_LIB.so.full}: ${_MAINLIBDEPS} |
|
.endif |
.endif |
${_MKTARGET_BUILD} |
${_MKTARGET_BUILD} |
rm -f ${.TARGET} |
rm -f ${.TARGET} |
${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \ |
${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \ |
${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \ |
${_LDFLAGS.${_LIB}} -o ${.TARGET}.tmp ${_LIBLDOPTS} \ |
-Wl,--whole-archive ${SOLIB} \ |
-Wl,--whole-archive ${SOLIB} \ |
-Wl,--no-whole-archive ${_LDADD.${_LIB}} |
-Wl,--no-whole-archive ${_LDADD.${_LIB}} |
|
.if ${MKSTRIPIDENT} != "no" |
|
${OBJCOPY} -R .ident ${.TARGET}.tmp |
|
.endif |
|
mv -f ${.TARGET}.tmp ${.TARGET} |
# We don't use INSTALL_SYMLINK here because this is just |
# We don't use INSTALL_SYMLINK here because this is just |
# happening inside the build directory/objdir. XXX Why does |
# happening inside the build directory/objdir. XXX Why does |
# this spend so much effort on libraries that aren't live??? XXX |
# this spend so much effort on libraries that aren't live??? XXX |
Line 652 ${_LIB.so.full}: ${_MAINLIBDEPS} |
|
Line 677 ${_LIB.so.full}: ${_MAINLIBDEPS} |
|
.endif |
.endif |
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp |
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp |
mv -f ${_LIB.so}.tmp ${_LIB.so} |
mv -f ${_LIB.so}.tmp ${_LIB.so} |
.if ${MKSTRIPIDENT} != "no" |
|
${OBJCOPY} -R .ident ${.TARGET} |
|
.endif |
|
|
|
.if !empty(LOBJS) # { |
.if !empty(LOBJS) # { |
LLIBS?= -lc |
LLIBS?= -lc |