version 1.318.2.4, 2014/05/22 11:37:53 |
version 1.375, 2018/06/21 11:24:38 |
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. |
.if defined(MKPIE) && (${MKPIE} != "no") |
# Another fix is to provide rcrt0.o like OpenBSD does and |
|
# do relocations for static PIE. |
|
.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) |
CFLAGS+= ${PIE_CFLAGS} |
CFLAGS+= ${PIE_CFLAGS} |
AFLAGS+= ${PIE_AFLAGS} |
AFLAGS+= ${PIE_AFLAGS} |
.endif |
.endif |
Line 64 DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so |
|
Line 66 DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so |
|
.endif # } |
.endif # } |
|
|
##### Build and install rules |
##### Build and install rules |
MKDEP_SUFFIXES?= .o .po .pico .go .ln |
MKDEP_SUFFIXES?= .o .po .pico .go .ln .d |
|
|
.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { |
.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { |
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major |
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major |
Line 147 SHLIB_FULLVERSION=${SHLIB_MAJOR} |
|
Line 149 SHLIB_FULLVERSION=${SHLIB_MAJOR} |
|
PICFLAGS ?= -fPIC |
PICFLAGS ?= -fPIC |
|
|
.if ${MKPICLIB} != "no" |
.if ${MKPICLIB} != "no" |
CSHLIBFLAGS+= ${PICFLAGS} |
CSHLIBFLAGS+= ${PICFLAGS} ${SANITIZERFLAGS} |
.endif |
.endif |
|
|
.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS) |
.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS) |
Line 156 MKSHLIBOBJS= yes |
|
Line 158 MKSHLIBOBJS= yes |
|
MKSHLIBOBJS= no |
MKSHLIBOBJS= no |
.endif |
.endif |
|
|
.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \ |
.if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) || \ |
(defined(CFLAGS) && !empty(CFLAGS:M*-g*)) |
(defined(CFLAGS) && !empty(CFLAGS:M*-g*)) |
# We only add -g to the shared library objects |
# We only add -g to the shared library objects |
# because we don't currently split .a archives. |
# because we don't currently split .a archives. |
|
|
# Platform-independent linker flags for ELF shared libraries |
# Platform-independent linker flags for ELF shared libraries |
SHLIB_SOVERSION= ${SHLIB_MAJOR} |
SHLIB_SOVERSION= ${SHLIB_MAJOR} |
SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION} |
SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION} |
|
SHLIB_SHFLAGS+= ${SANITIZERFLAGS} |
.if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no" |
.if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no" |
SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel |
SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel |
.endif |
.endif |
Line 187 FFLAGS+= ${FOPTS} |
|
Line 190 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 406 _LIB.ln:=llib-l${LIB}.ln |
|
Line 409 _LIB.ln:=llib-l${LIB}.ln |
|
_LIB.so:=${_LIB}.so |
_LIB.so:=${_LIB}.so |
_LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} |
_LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} |
_LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} |
_LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} |
.if ${MKDEBUG} != "no" |
_LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link |
|
.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) |
_LIB.so.debug:=${_LIB.so.full}.debug |
_LIB.so.debug:=${_LIB.so.full}.debug |
.endif |
.endif |
.endif |
.endif |
Line 523 _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YH |
|
Line 527 _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 540 _INSTRANLIB=${empty(PRESERVE):?-a "${RAN |
|
Line 542 _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 555 __archivesymlinkpic: .USE |
|
Line 557 __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 577 _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ |
|
Line 594 _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 |
|
|
LIBCC:= ${CXX} |
LIBCC:= ${CXX} |
. if ${MKLIBCXX} == "yes" |
. if ${MKLIBCXX} == "yes" |
LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib |
LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib |
. elif defined(HAVE_GCC) && ${HAVE_GCC} == 4 |
|
LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../gnu/lib/libstdc++-v3_4 |
|
. else |
. else |
LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3 |
LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3 |
. endif |
. endif |
|
|
_LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} |
_LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} |
_LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} |
_LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} |
|
|
${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \ |
_MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \ |
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} |
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} |
|
|
|
.if defined(_LIB.so.debug) |
|
${_LIB.so.debug}: ${_LIB.so.link} |
|
${_MKTARGET_CREATE} |
|
( ${OBJCOPY} --only-keep-debug \ |
|
${_LIB.so.link} ${_LIB.so.debug} \ |
|
) || (rm -f ${.TARGET}; false) |
|
${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug} |
|
${_MKTARGET_CREATE} |
|
( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ |
|
--add-gnu-debuglink=${_LIB.so.debug} \ |
|
${_LIB.so.link} ${_LIB.so.full}.tmp && \ |
|
mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \ |
|
) || (rm -f ${.TARGET}; false) |
|
${_LIB.so.link}: ${_MAINLIBDEPS} |
|
.else # aka no MKDEBUG |
|
${_LIB.so.full}: ${_MAINLIBDEPS} |
|
.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 |
|
# XXX Also creates dead symlinks until the .full rule runs |
|
# above and creates the main link |
.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ |
.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ |
"${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" |
"${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" |
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp |
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp |
Line 634 ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPL |
|
Line 678 ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPL |
|
.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 defined(_LIB.so.debug) |
|
${_LIB.so.debug}: ${_LIB.so.full} |
|
${_MKTARGET_CREATE} |
|
( ${OBJCOPY} --only-keep-debug ${_LIB.so.full} ${_LIB.so.debug} \ |
|
&& ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ |
|
--add-gnu-debuglink=${_LIB.so.debug} ${_LIB.so.full} \ |
|
) || (rm -f ${.TARGET}; false) |
|
.endif |
|
|
|
.if !empty(LOBJS) # { |
.if !empty(LOBJS) # { |
LLIBS?= -lc |
LLIBS?= -lc |