Ensure .OBJDIR has known value

If for any reason we cannot set .OBJDIR==_objdir as desired
use .CURDIR so that at least the classic
.if ${.OBJDIR} != ${.CURDIR}
works and dangerous misstakes can be avoided.

Reviewed by: bdrewery
This commit is contained in:
Simon J. Gerraty 2017-11-04 21:02:26 +00:00
parent 1f66baa5eb
commit 5abdb50e57
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325404

View file

@ -61,11 +61,17 @@ __objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \
.endif
# This causes make to use the specified directory as .OBJDIR
.OBJDIR: ${__objdir}
.if ${.OBJDIR:tA} != ${__objdir:tA} && ${__objdir_made:Uno:M${__objdir}/*} != ""
.if ${.OBJDIR:tA} != ${__objdir:tA}
# we did not get what we want - do we care?
.if ${__objdir_made:Uno:M${__objdir}/*} != ""
# watch out for __objdir being relative path
.if !(${__objdir:M/*} == "" && ${.OBJDIR:tA} == ${${.CURDIR}/${__objdir}:L:tA})
.error could not use ${__objdir}: .OBJDIR=${.OBJDIR}
.endif
.endif
# apparently we can live with it
# make sure we know what we have
.OBJDIR: ${.CURDIR}
.endif
.endif
.endif