svn commit: r314809 - head/share/mk
Simon J. Gerraty
sjg at FreeBSD.org
Mon Mar 6 23:13:27 UTC 2017
Author: sjg
Date: Mon Mar 6 23:13:25 2017
New Revision: 314809
URL: https://svnweb.freebsd.org/changeset/base/314809
Log:
Update dirdeps/meta bits from latest bmake.
Modified:
head/share/mk/dirdeps.mk
head/share/mk/meta.stage.mk
head/share/mk/meta2deps.py
Modified: head/share/mk/dirdeps.mk
==============================================================================
--- head/share/mk/dirdeps.mk Mon Mar 6 23:02:33 2017 (r314808)
+++ head/share/mk/dirdeps.mk Mon Mar 6 23:13:25 2017 (r314809)
@@ -1,5 +1,5 @@
# $FreeBSD$
-# $Id: dirdeps.mk,v 1.84 2016/11/27 02:44:34 sjg Exp $
+# $Id: dirdeps.mk,v 1.86 2017/03/01 20:26:51 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@@ -58,7 +58,7 @@
# distinguish them from others.
#
# Before each Makefile.depend file is read, we set
-# DEP_RELDIR to be the RELDIR (path relative to SRCTOP) for
+# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for
# its directory, and DEP_MACHINE etc according to the .<target_spec>
# represented by the suffix of the corresponding target.
#
@@ -198,7 +198,9 @@ DEP_$v ?= ${$v}
# we compute below are fully qualified wrt DEP_TARGET_SPEC.
# The makefiles may only partially specify (eg. MACHINE only),
# so we need to construct a set of modifiers to fill in the gaps.
-.if ${TARGET_SPEC_VARS:[#]} > 10
+.if ${MAKE_VERSION} >= 20170130
+_tspec_x := ${TARGET_SPEC_VARS:range}
+.elif ${TARGET_SPEC_VARS:[#]} > 10
# seriously? better have jot(1) or equivalent to produce suitable sequence
_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh}
.else
@@ -613,11 +615,11 @@ _build_dirs += \
# qualify everything now
_build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u}
+.endif # empty DIRDEPS
+
_build_all_dirs += ${_build_dirs}
_build_all_dirs := ${_build_all_dirs:O:u}
-.endif # empty DIRDEPS
-
# Normally if doing make -V something,
# we do not want to waste time chasing DIRDEPS
# but if we want to count the number of Makefile.depend* read, we do.
Modified: head/share/mk/meta.stage.mk
==============================================================================
--- head/share/mk/meta.stage.mk Mon Mar 6 23:02:33 2017 (r314808)
+++ head/share/mk/meta.stage.mk Mon Mar 6 23:13:25 2017 (r314809)
@@ -1,7 +1,7 @@
# $FreeBSD$
-# $Id: meta.stage.mk,v 1.47 2016/12/07 23:07:49 sjg Exp $
+# $Id: meta.stage.mk,v 1.48 2017/03/01 22:48:07 sjg Exp $
#
-# @(#) Copyright (c) 2011, Simon J. Gerraty
+# @(#) Copyright (c) 2011-2017, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -15,7 +15,7 @@
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+# the guard target is defined later
.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} != ""
# this is generally safer anyway
@@ -128,26 +128,17 @@ STAGE_AS_SCRIPT = ${STAGE_DIRDEP_SCRIPT}
done; :; }
# this is simple, a list of the "staged" files depends on this,
-_STAGE_BASENAME_USE: .USE ${.TARGET:T}
+_STAGE_BASENAME_USE: .USE .dirdep ${.TARGET:T}
@${STAGE_FILE_SCRIPT}; StageFiles ${.TARGET:H:${STAGE_DIR_FILTER}} ${.TARGET:T}
-_STAGE_AS_BASENAME_USE: .USE ${.TARGET:T}
+_STAGE_AS_BASENAME_USE: .USE .dirdep ${.TARGET:T}
@${STAGE_AS_SCRIPT}; StageAs ${.TARGET:H:${STAGE_DIR_FILTER}} ${.TARGET:T} ${STAGE_AS_${.TARGET:T}:U${.TARGET:T}}
-.if !empty(STAGE_INCSDIR)
-STAGE_TARGETS += stage_incs
-STAGE_INCS ?= ${.ALLSRC:N.dirdep:Nstage_*}
stage_includes: stage_incs
stage_incs: .dirdep
@${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_INCSDIR:${STAGE_DIR_FILTER}} ${STAGE_INCS}
@touch $@
-.endif
-
-.if !empty(STAGE_LIBDIR)
-STAGE_TARGETS += stage_libs
-
-STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*}
stage_libs: .dirdep
@${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${STAGE_LIBS}
@@ -160,6 +151,18 @@ stage_libs: .dirdep
.endif
.endif
@touch $@
+
+.endif # first time
+
+
+.if !empty(STAGE_INCSDIR)
+STAGE_TARGETS += stage_incs
+STAGE_INCS ?= ${.ALLSRC:N.dirdep:Nstage_*}
+.endif
+
+.if !empty(STAGE_LIBDIR)
+STAGE_TARGETS += stage_libs
+STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*}
.endif
.if !empty(STAGE_DIR)
@@ -185,6 +188,8 @@ STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP}
STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP}
STAGE_TARGETS += stage_files
+.if !target(.stage_files.$s)
+.stage_files.$s:
.if $s != "_default"
stage_files: stage_files.$s
stage_files.$s: .dirdep
@@ -193,8 +198,11 @@ stage_files: .dirdep
.endif
@${STAGE_FILE_SCRIPT}; StageFiles ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_FILES.$s}
@touch $@
+.endif
STAGE_TARGETS += stage_links
+.if !target(.stage_links.$s)
+.stage_links.$s:
.if $s != "_default"
stage_links: stage_links.$s
stage_links.$s: .dirdep
@@ -203,8 +211,11 @@ stage_links: .dirdep
.endif
@${STAGE_LINKS_SCRIPT}; StageLinks ${STAGE_LINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_LINKS.$s}
@touch $@
+.endif
STAGE_TARGETS += stage_symlinks
+.if !target(.stage_symlinks.$s)
+.stage_symlinks.$s:
.if $s != "_default"
stage_symlinks: stage_symlinks.$s
stage_symlinks.$s: .dirdep
@@ -213,6 +224,7 @@ stage_symlinks: .dirdep
.endif
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_SYMLINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_SYMLINKS.$s}
@touch $@
+.endif
.endfor
.endif
@@ -232,22 +244,32 @@ STAGE_TARGETS += stage_as stage_as_and_s
STAGE_AS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
+.if !target(.stage_as.$s)
+.stage_as.$s:
stage_as: stage_as.$s
stage_as.$s: .dirdep
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
@touch $@
+.endif
+.if !target(.stage_as_and_symlink.$s)
+.stage_as_and_symlink.$s:
stage_as_and_symlink: stage_as_and_symlink.$s
stage_as_and_symlink.$s: .dirdep
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} $f@}
@touch $@
+.endif
.endfor
.endif
CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes
+# this lot also only makes sense the first time...
+.if !target(__${.PARSEFILE}__)
+__${.PARSEFILE}__:
+
# stage_*links usually needs to follow any others.
# for non-jobs mode the order here matters
staging: ${STAGE_TARGETS:N*_links} ${STAGE_TARGETS:M*_links}
Modified: head/share/mk/meta2deps.py
==============================================================================
--- head/share/mk/meta2deps.py Mon Mar 6 23:02:33 2017 (r314808)
+++ head/share/mk/meta2deps.py Mon Mar 6 23:13:25 2017 (r314809)
@@ -38,7 +38,7 @@ We only pay attention to a subset of the
"""
RCSid:
$FreeBSD$
- $Id: meta2deps.py,v 1.22 2016/12/12 19:07:42 sjg Exp $
+ $Id: meta2deps.py,v 1.24 2017/02/08 22:17:10 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@@ -104,20 +104,36 @@ def resolve(path, cwd, last_dir=None, de
return p
return None
+def cleanpath(path):
+ """cleanup path without using realpath(3)"""
+ if path.startswith('/'):
+ r = '/'
+ else:
+ r = ''
+ p = []
+ w = path.split('/')
+ for d in w:
+ if not d or d == '.':
+ continue
+ if d == '..':
+ p.pop()
+ continue
+ p.append(d)
+
+ return r + '/'.join(p)
+
def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
"""
Return an absolute path, resolving via cwd or last_dir if needed.
- this gets called a lot, so we try to avoid calling realpath
- until we know we have something.
+ this gets called a lot, so we try to avoid calling realpath.
"""
rpath = resolve(path, cwd, last_dir, debug, debug_out)
if rpath:
path = rpath
if (path.find('/') < 0 or
path.find('./') > 0 or
- path.endswith('/..') or
- os.path.islink(path)):
- return os.path.realpath(path)
+ path.endswith('/..')):
+ path = cleanpath(path)
return path
def sort_unique(list, cmp=None, key=None, reverse=False):
@@ -127,6 +143,7 @@ def sort_unique(list, cmp=None, key=None
for e in list:
if e == le:
continue
+ le = e
nl.append(e)
return nl
@@ -505,6 +522,8 @@ class MetaFile:
dir = abspath(dir, cwd, self.last_dir, self.debug, self.debug_out)
if rdir == dir or rdir.find('./') > 0:
rdir = None
+ if os.path.islink(dir):
+ rdir = os.path.realpath(dir)
# now put path back together
path = '/'.join([dir,base])
if self.debug > 1:
More information about the svn-src-head
mailing list