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 /share/mk/bsd.prog.mk | |
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.
Diffstat (limited to 'share/mk/bsd.prog.mk')
-rw-r--r-- | share/mk/bsd.prog.mk | 21 |
1 files changed, 15 insertions, 6 deletions
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: |