Fixed `make objlink' (and `make obj' in the (non-default) OBJLINK case).

Running them twice usually destroyed the target binary.  E.g., the
second `make objlink' in `make objlink; make; make objlink' replaced
the `cat' binary by a symlink cat@ -> /usr/obj/usr/src/bin/cat.

`ln -fs' is unusable when the target might be a symlink that resolves
to a directory.  Then -f applies to a file in the directory and not
to the symlink.  This seems to be the standard (and sometimes useful)
behaviour.
This commit is contained in:
Bruce Evans 1996-09-05 17:53:13 +00:00
parent 5b963fa12e
commit 833e666181
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $Id: bsd.obj.mk,v 1.6 1996/07/12 06:01:55 pst Exp $ # $Id: bsd.obj.mk,v 1.7 1996/07/14 11:09:12 peter Exp $
# #
# The include file <bsd.obj.mk> handles creating 'obj' directory # The include file <bsd.obj.mk> handles creating 'obj' directory
# and cleaning up object files, log files etc. # and cleaning up object files, log files etc.
@ -55,7 +55,8 @@ obj: _SUBDIR
${ECHO} "Unable to create ${.TARGETOBJDIR}."; \ ${ECHO} "Unable to create ${.TARGETOBJDIR}."; \
exit 1; \ exit 1; \
fi; \ fi; \
ln -fs ${.TARGETOBJDIR} ${.CURDIR}/obj; \ rm -f ${.CURDIR}/obj; \
ln -s ${.TARGETOBJDIR} ${.CURDIR}/obj; \
${ECHO} "${.CURDIR} -> ${.TARGETOBJDIR}"; \ ${ECHO} "${.CURDIR} -> ${.TARGETOBJDIR}"; \
fi fi
.endif .endif
@ -65,7 +66,8 @@ obj: _SUBDIR
.if !target(objlink) .if !target(objlink)
objlink: _SUBDIR objlink: _SUBDIR
@if test -d ${.TARGETOBJDIR}; then \ @if test -d ${.TARGETOBJDIR}; then \
ln -fs ${.TARGETOBJDIR} ${.CURDIR}/obj; \ rm -f ${.CURDIR}/obj; \
ln -s ${.TARGETOBJDIR} ${.CURDIR}/obj; \
else \ else \
echo "No ${.TARGETOBJDIR} to link to - do a make obj."; \ echo "No ${.TARGETOBJDIR} to link to - do a make obj."; \
fi fi