Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jun 2015 23:34:05 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r284171 - projects/bmake/share/mk
Message-ID:  <201506082334.t58NY51x043987@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Mon Jun  8 23:34:04 2015
New Revision: 284171
URL: https://svnweb.freebsd.org/changeset/base/284171

Log:
  Latest dirdeps.mk sets DEP_RELDIR for itself.
  
  This helps guard against bugs in manually edited Makefile.depend
  files, and avoids the need to call realpath from the Makefile.depend file.

Modified:
  projects/bmake/share/mk/dirdeps.mk
  projects/bmake/share/mk/gendirdeps.mk

Modified: projects/bmake/share/mk/dirdeps.mk
==============================================================================
--- projects/bmake/share/mk/dirdeps.mk	Mon Jun  8 23:32:27 2015	(r284170)
+++ projects/bmake/share/mk/dirdeps.mk	Mon Jun  8 23:34:04 2015	(r284171)
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.53 2015/05/24 07:08:24 sjg Exp $
+# $Id: dirdeps.mk,v 1.54 2015/06/08 20:55:11 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -588,6 +588,11 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M
 _DEP_TARGET_SPEC := ${d:E}
 # some makefiles may still look at this
 _DEP_MACHINE := ${d:E:C/,.*//}
+# set this "just in case" 
+# we can skip :tA since we computed the path above
+DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,}
+# and reset this
+DIRDEPS =
 .if ${_debug_reldir} && ${_qm} != ${_m}
 .info loading ${_m} for ${d:E}
 .endif
@@ -603,7 +608,9 @@ _DEP_MACHINE := ${d:E:C/,.*//}
 .elif ${.MAKE.LEVEL} > 42
 .error You should have stopped recursing by now.
 .else
-_DEP_RELDIR := ${DEP_RELDIR}
+# we are building something
+DEP_RELDIR := ${RELDIR}
+_DEP_RELDIR := ${RELDIR}
 # pickup local dependencies
 .-include <.depend>
 .endif

Modified: projects/bmake/share/mk/gendirdeps.mk
==============================================================================
--- projects/bmake/share/mk/gendirdeps.mk	Mon Jun  8 23:32:27 2015	(r284170)
+++ projects/bmake/share/mk/gendirdeps.mk	Mon Jun  8 23:34:04 2015	(r284171)
@@ -1,4 +1,4 @@
-# $Id: gendirdeps.mk,v 1.25 2014/03/14 21:28:37 sjg Exp $
+# $Id: gendirdeps.mk,v 1.27 2015/06/08 20:55:11 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -93,6 +93,17 @@ _skip_gendirdeps = egrep -v '^(${SKIP_GE
 _skip_gendirdeps =
 .endif
 
+# Below we will turn _{VAR} into ${VAR} which keeps this simple
+# GENDIRDEPS_FILTER_DIR_VARS is a list of dirs to be substiuted for.
+# GENDIRDEPS_FILTER_VARS is more general.
+# In each case order matters.
+.if !empty(GENDIRDEPS_FILTER_DIR_VARS)
+GENDIRDEPS_FILTER += ${GENDIRDEPS_FILTER_DIR_VARS:@v@S,${$v},_{${v}},@}
+.endif
+.if !empty(GENDIRDEPS_FILTER_VARS)
+GENDIRDEPS_FILTER += ${GENDIRDEPS_FILTER_VARS:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u}
+.endif
+
 # this (*should* be set in meta.sys.mk) 
 # is the script that extracts what we want.
 META2DEPS ?= ${.PARSEDIR}/meta2deps.sh
@@ -300,7 +311,6 @@ CAT_DEPEND ?= .depend
 # to output _{VAR} tokens which we will turn into proper ${VAR} references.
 ${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS}
 	@(echo '# Autogenerated - do NOT edit!'; echo; \
-	echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \
 	echo 'DIRDEPS = \'; \
 	echo '${DIRDEPS:@d@	$d \\${.newline}@}'; echo; \
 	${_include_src_dirdeps} \
@@ -321,7 +331,6 @@ all:	${_DEPENDFILE}
 
 ${_DEPENDFILE}: ${MAKEFILE} ${_this}
 	@(echo '# Autogenerated - do NOT edit!'; echo; \
-	echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \
 	echo 'DIRDEPS = \'; \
 	echo '${DIRDEPS:@d@	$d \\${.newline}@}'; echo; \
 	echo '.include <dirdeps.mk>'; \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506082334.t58NY51x043987>