diff options
author | bde <bde@FreeBSD.org> | 1997-04-09 16:10:27 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-04-09 16:10:27 +0000 |
commit | b531e6bb86952d3985923b1181488c61fd5f03cc (patch) | |
tree | 83968417cf50d710239768ef7bb6ef4882a59793 | |
parent | f9744710975755477aadbb88db162e4d0bca1982 (diff) | |
download | FreeBSD-src-b531e6bb86952d3985923b1181488c61fd5f03cc.zip FreeBSD-src-b531e6bb86952d3985923b1181488c61fd5f03cc.tar.gz |
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.
-rw-r--r-- | share/mk/bsd.dep.mk | 5 | ||||
-rw-r--r-- | share/mk/bsd.lib.mk | 19 | ||||
-rw-r--r-- | share/mk/bsd.prog.mk | 21 |
3 files changed, 32 insertions, 13 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 20dac47..90abc88 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -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 diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 0a23ef0..66245fb 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -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) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 9f5ddfc..e855cd7 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -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: |