mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-23 10:06:25 +01:00
A first cut at some rules for building elf shared libs. Of particular
note, using "-Wl,-f" to generate a library objects list doesn't work anymore since the hack to ld hasn't been incorporated into binutils-2.8. (and the -f switch is used for something else already) This is disabled by default, don't panic! :-)
This commit is contained in:
parent
fdaad796ed
commit
8c05a446bf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28945
@ -1,5 +1,5 @@
|
||||
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
|
||||
# $Id: bsd.lib.mk,v 1.59 1997/06/21 15:40:32 jkh Exp $
|
||||
# $Id: bsd.lib.mk,v 1.60 1997/08/05 03:49:48 asami Exp $
|
||||
#
|
||||
|
||||
.if exists(${.CURDIR}/../Makefile.inc)
|
||||
@ -8,8 +8,10 @@
|
||||
|
||||
.if exists(${.CURDIR}/shlib_version)
|
||||
SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
|
||||
.if ${BINFORMAT} == aout
|
||||
SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if defined(DESTDIR)
|
||||
CFLAGS+= -I${DESTDIR}/usr/include
|
||||
@ -113,9 +115,15 @@ _LIBS=lib${LIB}.a
|
||||
.endif
|
||||
|
||||
.if !defined(NOPIC)
|
||||
.if ${BINFORMAT} == aout
|
||||
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
|
||||
_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||
.endif
|
||||
.else
|
||||
.if defined(SHLIB_MAJOR)
|
||||
_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}
|
||||
.endif
|
||||
.endif
|
||||
.if defined(INSTALL_PIC_ARCHIVE)
|
||||
_LIBS+=lib${LIB}_pic.a
|
||||
.endif
|
||||
@ -150,12 +158,23 @@ LDDESTDIRENV?= LIBRARY_PATH=${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib
|
||||
|
||||
.if !defined(NOPIC)
|
||||
SOBJS+= ${OBJS:.o=.so}
|
||||
|
||||
.if ${BINFORMAT} == aout
|
||||
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS}
|
||||
@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
|
||||
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||
@${LDDESTDIRENV} ${CC} -shared -Wl,-x -Wl,-assert -Wl,pure-text \
|
||||
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
`lorder ${SOBJS} | tsort -q` ${LDDESTDIR} ${LDADD}
|
||||
.else
|
||||
lib${LIB}.so.${SHLIB_MAJOR}: ${SOBJS}
|
||||
@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}\)
|
||||
@rm -f lib${LIB}.so.${SHLIB_MAJOR}
|
||||
@${LDDESTDIRENV} ${CC} -shared -Wl,-x \
|
||||
-o lib${LIB}.so.${SHLIB_MAJOR} \
|
||||
-Wl,-soname,lib${LIB}.so.${SHLIB_MAJOR} \
|
||||
`lorder ${SOBJS} | tsort -q` ${LDDESTDIR} ${LDADD}
|
||||
.endif
|
||||
|
||||
lib${LIB}_pic.a:: ${SOBJS}
|
||||
@${ECHO} building special pic ${LIB} library
|
||||
@ -188,9 +207,16 @@ _EXTRADEPEND::
|
||||
.endif
|
||||
.if !defined(NOEXTRADEPEND)
|
||||
_EXTRADEPEND::
|
||||
.if ${BINFORMAT} == aout
|
||||
echo lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: \
|
||||
`${LDDESTDIRENV} ${CC} -shared -Wl,-f ${LDDESTDIR} ${LDADD}` \
|
||||
>> ${DEPENDFILE}
|
||||
.else
|
||||
.if defined(DPADD) && ${DPADD} != ""
|
||||
echo lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: \
|
||||
${DPADD} >> ${DEPENDFILE}
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !target(install)
|
||||
@ -212,12 +238,23 @@ realinstall: beforeinstall
|
||||
.endif
|
||||
.endif
|
||||
.if !defined(NOPIC)
|
||||
.if ${BINFORMAT} == aout
|
||||
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
|
||||
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${INSTALLFLAGS} ${SHLINSTALLFLAGS} \
|
||||
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
${DESTDIR}${SHLIBDIR}
|
||||
.endif
|
||||
.else
|
||||
.if defined(SHLIB_MAJOR)
|
||||
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${INSTALLFLAGS} ${SHLINSTALLFLAGS} \
|
||||
lib${LIB}.so.${SHLIB_MAJOR} \
|
||||
${DESTDIR}${SHLIBDIR}
|
||||
ln ${LN_FLAGS} -sf lib${LIB}.so.${SHLIB_MAJOR} \
|
||||
${DESTDIR}${SHLIBDIR}/lib${LIB}.so
|
||||
.endif
|
||||
.endif
|
||||
.if defined(INSTALL_PIC_ARCHIVE)
|
||||
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
||||
# $Id: bsd.prog.mk,v 1.53 1997/07/31 06:12:04 asami Exp $
|
||||
# $Id: bsd.prog.mk,v 1.54 1997/08/05 03:49:49 asami Exp $
|
||||
|
||||
.if exists(${.CURDIR}/../Makefile.inc)
|
||||
.include "${.CURDIR}/../Makefile.inc"
|
||||
@ -65,8 +65,14 @@ clean: _SUBDIR
|
||||
|
||||
.if defined(PROG) && !defined(NOEXTRADEPEND)
|
||||
_EXTRADEPEND:
|
||||
.if ${BINFORMAT} == aout
|
||||
echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \
|
||||
${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}
|
||||
.else
|
||||
.if defined(DPADD) && ${DPADD} != ""
|
||||
echo ${PROG}: ${DPADD} >> ${DEPENDFILE}
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !target(install)
|
||||
@ -140,5 +146,9 @@ maninstall:
|
||||
all-man:
|
||||
.endif
|
||||
|
||||
.if ${BINFORMAT} != aout
|
||||
.include <bsd.libnames.mk>
|
||||
.endif
|
||||
|
||||
.include <bsd.dep.mk>
|
||||
.include <bsd.obj.mk>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94
|
||||
# $Id: sys.mk,v 1.22 1997/02/22 13:56:15 peter Exp $
|
||||
# $Id: sys.mk,v 1.23 1997/04/13 06:44:25 jkh Exp $
|
||||
|
||||
unix ?= We run FreeBSD, not UNIX.
|
||||
|
||||
@ -98,6 +98,9 @@ YFLAGS ?= -d
|
||||
GTAGSFLAGS= -se
|
||||
HTAGSFLAGS=
|
||||
|
||||
# Binary file format
|
||||
BINFORMAT?= aout
|
||||
|
||||
.if defined(%POSIX)
|
||||
# Posix 1003.2 mandated rules
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user