mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 00:33:57 +00:00
Use ld -f' (actually
cc -Wl,-f') at `make depend' time to generate
almost perfect dependencies on crt0's and libraries. DPADD and bsd.libnames.mk should go away soon. Use a new _EXTRADEPEND target to implement this and to avoid editing of .depend when .depend isn;t being rebuilt. The afterdepend target doesn't seem to be good for anything and is now unused. Fixed LDDESTDIR for the DESTDIR case when ${SHLIBDIR} != /usr/lib. Added commented-out -nostdlib to LDDESTDIR for the DESTDIR case. The wrong libraries may be used without this; however it breaks linkage to crt0 and libc.
This commit is contained in:
parent
c67b1734f5
commit
663e9677d5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24750
|
@ -1,4 +1,4 @@
|
|||
# $Id$
|
||||
# $Id: bsd.dep.mk,v 1.10 1997/02/22 13:56:08 peter Exp $
|
||||
#
|
||||
# The include file <bsd.dep.mk> handles Makefile dependencies.
|
||||
#
|
||||
|
@ -56,6 +56,9 @@ ${DEPENDFILE}: ${SRCS}
|
|||
${CXXFLAGS:M-nostd*} ${CXXFLAGS:M-[ID]*} \
|
||||
${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}
|
||||
.endif
|
||||
.if target(_EXTRADEPEND)
|
||||
cd ${.CURDIR}; ${MAKE} _EXTRADEPEND
|
||||
.endif
|
||||
|
||||
.else
|
||||
${DEPENDFILE}: _SUBDIR
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
|
||||
# $Id$
|
||||
# $Id: bsd.lib.mk,v 1.50 1997/02/22 13:56:11 peter Exp $
|
||||
#
|
||||
|
||||
.if exists(${.CURDIR}/../Makefile.inc)
|
||||
|
@ -143,7 +143,8 @@ lib${LIB}_p.a:: ${POBJS}
|
|||
.endif
|
||||
|
||||
.if defined(DESTDIR)
|
||||
LDDESTDIR?= -L${DESTDIR}/usr/lib
|
||||
LDDESTDIR?= -L${DESTDIR}${SHLIBDIR} -L${DESTDIR}/usr/lib
|
||||
# LDDESTDIR+= -nostdlib
|
||||
.endif
|
||||
|
||||
.if !defined(NOPIC)
|
||||
|
@ -182,10 +183,16 @@ clean: _SUBDIR
|
|||
.endif
|
||||
|
||||
.if defined(SRCS)
|
||||
afterdepend:
|
||||
@(TMP=_depend$$$$; \
|
||||
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < .depend > $$TMP; \
|
||||
mv $$TMP .depend)
|
||||
_EXTRADEPEND::
|
||||
@TMP=_depend$$$$; \
|
||||
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < ${DEPENDFILE} \
|
||||
> $$TMP; \
|
||||
mv $$TMP ${DEPENDFILE}
|
||||
.endif
|
||||
.if defined(LDADD)
|
||||
_EXTRADEPEND::
|
||||
echo lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: \
|
||||
`ld -Bshareable -x -f ${LDDESTDIR} ${LDADD}` >> ${DEPENDFILE}
|
||||
.endif
|
||||
|
||||
.if !target(install)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
||||
# $Id: bsd.prog.mk,v 1.44 1997/02/22 13:56:13 peter Exp $
|
||||
# $Id: bsd.prog.mk,v 1.45 1997/03/08 19:47:08 bde Exp $
|
||||
|
||||
.if exists(${.CURDIR}/../Makefile.inc)
|
||||
.include "${.CURDIR}/../Makefile.inc"
|
||||
|
@ -22,9 +22,11 @@ LDFLAGS+= -static
|
|||
.endif
|
||||
|
||||
.if defined(DESTDIR)
|
||||
LDDESTDIR+= -L${DESTDIR}/usr/lib
|
||||
LDDESTDIR?= -L${DESTDIR}${SHLIBDIR} -L${DESTDIR}/usr/lib
|
||||
# LDDESTDIR+= -nostdlib
|
||||
.endif
|
||||
|
||||
# XXX obsolescent.
|
||||
.include <bsd.libnames.mk>
|
||||
|
||||
.if defined(PROG)
|
||||
|
@ -35,13 +37,14 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|||
|
||||
.if defined(LDONLY)
|
||||
|
||||
${PROG}: ${LIBCRT0} ${LIBC} ${DPSRCS} ${OBJS} ${DPADD}
|
||||
# XXX is this used? -static in ${LDFLAGS} can't be passed here.
|
||||
${PROG}: ${DPSRCS} ${OBJS}
|
||||
${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDDESTDIR} \
|
||||
${LDADD}
|
||||
|
||||
.else defined(LDONLY)
|
||||
|
||||
${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD}
|
||||
${PROG}: ${DPSRCS} ${OBJS}
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
|
||||
|
||||
.endif
|
||||
|
@ -51,7 +54,7 @@ ${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD}
|
|||
SRCS= ${PROG}.c
|
||||
|
||||
.if 0
|
||||
${PROG}: ${DPSRCS} ${SRCS} ${LIBC} ${DPADD}
|
||||
${PROG}: ${DPSRCS} ${SRCS}
|
||||
${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} \
|
||||
${LDDESTDIR} ${LDADD}
|
||||
|
||||
|
@ -63,7 +66,7 @@ MKDEP= -p
|
|||
# the name of a variable temporary object.
|
||||
# - it's useful to keep objects around for crunching.
|
||||
OBJS= ${PROG}.o
|
||||
${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD}
|
||||
${PROG}: ${DPSRCS} ${OBJS}
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
|
||||
.endif
|
||||
|
||||
|
@ -91,6 +94,12 @@ clean: _SUBDIR
|
|||
.endif
|
||||
.endif
|
||||
|
||||
.if defined(PROG)
|
||||
_EXTRADEPEND:
|
||||
echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \
|
||||
${LDADD}` >> ${DEPENDFILE}
|
||||
.endif
|
||||
|
||||
.if !target(install)
|
||||
.if !target(beforeinstall)
|
||||
beforeinstall:
|
||||
|
|
Loading…
Reference in a new issue