diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 9b357035be20..ccca375da32c 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -9,8 +9,8 @@ .include -.if defined(MAKEOBJDIRPREFIX) && ${.OBJDIR:M${MAKEOBJDIRPREFIX}/*} != "" -ROOTOBJDIR= ${.OBJDIR:S/${.CURDIR}//}${SRCTOP} +.if ${.OBJDIR:S,${.CURDIR},,} != ${.OBJDIR} +ROOTOBJDIR= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP} .elif defined(OBJTOP) && ${.OBJDIR:M${OBJTOP}*} != "" ROOTOBJDIR= ${OBJTOP} .endif