From 9e4e7aed095e0254c4d2bdad8c47bd3e883b31f8 Mon Sep 17 00:00:00 2001 From: markj Date: Thu, 1 May 2014 03:18:11 +0000 Subject: [PATCH] MFC r262733: Use a full path to the target for make rules which create symlinks @, machine and ${MACHINE_CPUARCH}. Otherwise the presence of a file named "x86" or "x86.c" in the make path can cause problems. git-svn-id: svn://svn.freebsd.org/base/stable/10@265169 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/conf/kmod.mk | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index bd058789b..0d688ef9a 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -238,7 +238,7 @@ beforedepend: ${_ILINKS} # causes all the modules to be rebuilt when the directory pointed to changes. .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) -${OBJS}: ${_link} +${OBJS}: ${.OBJDIR}/${_link} .endif .endfor @@ -252,18 +252,23 @@ SYSDIR= ${_dir} .error "can't find kernel source tree" .endif -${_ILINKS}: - @case ${.TARGET} in \ +.for _link in ${_ILINKS} +.PHONY: ${_link} +${_link}: ${.OBJDIR}/${_link} + +${.OBJDIR}/${_link}: + @case ${.TARGET:T} in \ machine) \ path=${SYSDIR}/${MACHINE}/include ;; \ @) \ path=${SYSDIR} ;; \ *) \ - path=${SYSDIR}/${.TARGET}/include ;; \ + path=${SYSDIR}/${.TARGET:T}/include ;; \ esac ; \ path=`(cd $$path && /bin/pwd)` ; \ - ${ECHO} ${.TARGET} "->" $$path ; \ - ln -sf $$path ${.TARGET} + ${ECHO} ${.TARGET:T} "->" $$path ; \ + ln -sf $$path ${.TARGET:T} +.endfor CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} -- 2.45.0