diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog index f46e95de9a03..e1d6f10c3414 100644 --- a/contrib/bmake/ChangeLog +++ b/contrib/bmake/ChangeLog @@ -1,3 +1,9 @@ +2015-06-06 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150606 + Merge with NetBSD make, pick up + o make.1: document .OBJDIR target + 2015-05-05 Simon J. Gerraty * Makefile (MAKE_VERSION): 20150505 diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile index 803997a575e3..e5427a877f20 100644 --- a/contrib/bmake/Makefile +++ b/contrib/bmake/Makefile @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.38 2015/05/05 21:58:05 sjg Exp $ +# $Id: Makefile,v 1.39 2015/06/07 15:54:37 sjg Exp $ # Base version on src date -MAKE_VERSION= 20150505 +MAKE_VERSION= 20150606 PROG= bmake diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1 index 702d392cc794..39d28c4e1ee3 100644 --- a/contrib/bmake/bmake.1 +++ b/contrib/bmake/bmake.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.247 2015/04/10 08:43:32 wiz Exp $ +.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd April 9, 2015 +.Dd June 4, 2015 .Dt MAKE 1 .Os .Sh NAME @@ -993,14 +993,15 @@ This is especially useful with .Ql Ev MAKEOBJDIR . .Pp .Ql Va .OBJDIR -may be modified in the makefile as a global variable. +may be modified in the makefile via the special target +.Ql Ic .OBJDIR . In all cases, .Nm will .Xr chdir 2 -to +to the specified directory if it exists, and set .Ql Va .OBJDIR -and set +and .Ql Ev PWD to that directory before executing any targets. . @@ -2001,6 +2002,15 @@ Disable parallel mode. Synonym for .Ic .NOTPARALLEL , for compatibility with other pmake variants. +.It Ic .OBJDIR +The source is a new value for +.Ql Va .OBJDIR . +If it exists, +.Nm +will +.Xr chdir 2 +to it and update the value of +.Ql Va .OBJDIR . .It Ic .ORDER The named targets are made in sequence. This ordering does not add targets to the list of targets to be made. diff --git a/contrib/bmake/bmake.cat1 b/contrib/bmake/bmake.cat1 index 5c62c1ba8e4c..4d43e2de00c9 100644 --- a/contrib/bmake/bmake.cat1 +++ b/contrib/bmake/bmake.cat1 @@ -647,10 +647,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS may be used. This is especially useful with `MAKEOBJDIR'. - `_._O_B_J_D_I_R' may be modified in the makefile as a global - variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' - and set `PWD' to that directory before executing any tar- - gets. + `_._O_B_J_D_I_R' may be modified in the makefile via the special + target `..OOBBJJDDIIRR'. In all cases, bbmmaakkee will chdir(2) to + the specified directory if it exists, and set `_._O_B_J_D_I_R' + and `PWD' to that directory before executing any targets. _._P_A_R_S_E_D_I_R A path to the directory of the current `_M_a_k_e_f_i_l_e' being parsed. @@ -1271,6 +1271,9 @@ SSPPEECCIIAALL TTAARRGGEETTSS Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake variants. + ..OOBBJJDDIIRR The source is a new value for `_._O_B_J_D_I_R'. If it exists, bbmmaakkee + will chdir(2) to it and update the value of `_._O_B_J_D_I_R'. + ..OORRDDEERR The named targets are made in sequence. This ordering does not add targets to the list of targets to be made. Since the depen- dents of a target do not get built until the target itself could @@ -1449,4 +1452,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 April 9, 2015 NetBSD 5.1 +NetBSD 5.1 June 4, 2015 NetBSD 5.1 diff --git a/contrib/bmake/make.1 b/contrib/bmake/make.1 index 3acc02ad7dfd..38bba31b39df 100644 --- a/contrib/bmake/make.1 +++ b/contrib/bmake/make.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.247 2015/04/10 08:43:32 wiz Exp $ +.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd April 9, 2015 +.Dd June 4, 2015 .Dt MAKE 1 .Os .Sh NAME @@ -1004,14 +1004,15 @@ This is especially useful with .Ql Ev MAKEOBJDIR . .Pp .Ql Va .OBJDIR -may be modified in the makefile as a global variable. +may be modified in the makefile via the special target +.Ql Ic .OBJDIR . In all cases, .Nm will .Xr chdir 2 -to +to the specified directory if it exists, and set .Ql Va .OBJDIR -and set +and .Ql Ev PWD to that directory before executing any targets. . @@ -2012,6 +2013,15 @@ Disable parallel mode. Synonym for .Ic .NOTPARALLEL , for compatibility with other pmake variants. +.It Ic .OBJDIR +The source is a new value for +.Ql Va .OBJDIR . +If it exists, +.Nm +will +.Xr chdir 2 +to it and update the value of +.Ql Va .OBJDIR . .It Ic .ORDER The named targets are made in sequence. This ordering does not add targets to the list of targets to be made. diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog index 9b4059e10674..85c8ae1715b2 100644 --- a/contrib/bmake/mk/ChangeLog +++ b/contrib/bmake/mk/ChangeLog @@ -1,3 +1,29 @@ +2015-06-06 Simon J. Gerraty + + * install-mk (MK_VERSION): 20150606 + + * dirdeps.mk: don't rely on manually maintained Makefile.depend + to set DEP_RELDIR and reset DIRDEPS. + By setting DEP_RELDIR ourselves we can skip :tA + + * gendirdeps.mk: skip setting DEP_RELDIR. + +2015-05-24 Simon J. Gerraty + + * dirdeps.mk: avoid wildcards like make(bootstrap*) + +2015-05-20 Simon J. Gerraty + + * install-mk (MK_VERSION): 20150520 + + * dirdeps.mk: when we are building dirdeps cache file we *want* + meta_oodate to look at all the Makefile.depend files, so + set .MAKE.DEPENDFILE to something that won't match. + + * meta.stage.mk: for STAGE_AS_* basename of file may not be unique + so first use absolute path as key. + Also skip staging at level 0. + 2015-04-30 Simon J. Gerraty * install-mk (MK_VERSION): 20150430 diff --git a/contrib/bmake/mk/dirdeps.mk b/contrib/bmake/mk/dirdeps.mk index 4186346336dc..4aa101fbd8d0 100644 --- a/contrib/bmake/mk/dirdeps.mk +++ b/contrib/bmake/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.51 2015/05/06 06:07:30 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. @@ -383,6 +383,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP DIRDEPS="${DIRDEPS}" \ MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ + .MAKE.DEPENDFILE=.none \ 3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \ mv ${.TARGET}.new ${.TARGET} @@ -587,6 +588,11 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}} _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 @@ -602,13 +608,15 @@ _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 # bootstrapping new dependencies made easy? -.if make(bootstrap*) && !target(bootstrap) +.if (make(bootstrap) || make(bootstrap-recurse)) && !target(bootstrap) .if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) # stop here diff --git a/contrib/bmake/mk/gendirdeps.mk b/contrib/bmake/mk/gendirdeps.mk index 28e1f21652ad..614a20e3d451 100644 --- a/contrib/bmake/mk/gendirdeps.mk +++ b/contrib/bmake/mk/gendirdeps.mk @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.26 2014/09/05 04:40:52 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. @@ -311,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} \ @@ -332,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 '; \ diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk index 598cf393d9db..05facd549ee9 100644 --- a/contrib/bmake/mk/install-mk +++ b/contrib/bmake/mk/install-mk @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.110 2015/05/01 06:37:49 sjg Exp $ +# $Id: install-mk,v 1.112 2015/06/08 20:55:11 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20150430 +MK_VERSION=20150606 OWNER= GROUP= MODE=444 diff --git a/contrib/bmake/mk/meta.stage.mk b/contrib/bmake/mk/meta.stage.mk index cd951136fb72..588f50e98204 100644 --- a/contrib/bmake/mk/meta.stage.mk +++ b/contrib/bmake/mk/meta.stage.mk @@ -1,4 +1,4 @@ -# $Id: meta.stage.mk,v 1.34 2014/11/20 22:40:08 sjg Exp $ +# $Id: meta.stage.mk,v 1.35 2015/05/20 06:40:33 sjg Exp $ # # @(#) Copyright (c) 2011, Simon J. Gerraty # @@ -218,7 +218,7 @@ STAGE_AS.$s ?= ${.ALLSRC:N.dirdep} 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:T}:U${f:T}}@} + @${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 $@ .endfor @@ -238,7 +238,9 @@ staging: # generally we want staging to wait until everything else is done STAGING_WAIT ?= .WAIT +.if ${.MAKE.LEVEL} > 0 all: ${STAGING_WAIT} staging +.endif .if exists(${.PARSEDIR}/stage-install.sh) && !defined(STAGE_INSTALL) # this will run install(1) and then followup with .dirdep files. diff --git a/contrib/bmake/mk/meta.sys.mk b/contrib/bmake/mk/meta.sys.mk index bcafd5593212..1f7ac49dae07 100644 --- a/contrib/bmake/mk/meta.sys.mk +++ b/contrib/bmake/mk/meta.sys.mk @@ -1,4 +1,4 @@ -# $Id: meta.sys.mk,v 1.20 2014/08/04 05:12:27 sjg Exp $ +# $Id: meta.sys.mk,v 1.21 2015/06/01 22:43:49 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -108,11 +108,16 @@ _metaError: .NOMETA .NOTMAIN .if ${.MAKE.MODE:Mmeta*} != "" MKDEP_MK = meta.autodep.mk -# if we think we are updating dependencies, -# then filemon had better be present -.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) +.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" +.if ${.MAKEFLAGS:Uno:M-k} != "" +# make this more obvious +.warning Setting UPDATE_DEPENDFILE=NO due to -k +UPDATE_DEPENDFILE= NO +.export UPDATE_DEPENDFILE +.elif !exists(/dev/filemon) .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. .endif +.endif .if ${.MAKE.LEVEL} == 0 # make sure dirdeps target exists and do it first diff --git a/contrib/bmake/mk/mkopt.sh b/contrib/bmake/mk/mkopt.sh index 38b624ef1d24..c3a39c508ffc 100755 --- a/contrib/bmake/mk/mkopt.sh +++ b/contrib/bmake/mk/mkopt.sh @@ -1,5 +1,5 @@ : -# $Id: mkopt.sh,v 1.8 2014/11/15 07:07:18 sjg Exp $ +# $Id: mkopt.sh,v 1.10 2015/06/07 17:29:08 sjg Exp $ # # @(#) Copyright (c) 2014, Simon J. Gerraty # @@ -19,9 +19,10 @@ # no need to be included more than once _MKOPT_SH=: +_MKOPT_PREFIX=${_MKOPT_PREFIX:-MK_} # -# _mk_opt OPT default +# _mk_opt default OPT # # Set MK_$OPT # @@ -35,7 +36,7 @@ _MKOPT_SH=: # _mk_opt() { _d=$1 - _mo=MK_$2 _wo=WITHOUT_$2 _wi=WITH_$2 + _mo=${_MKOPT_PREFIX}$2 _wo=WITHOUT_$2 _wi=WITH_$2 eval "_mov=\$$_mo _wov=\$$_wo _wiv=\$$_wi" case "$_wiv" in @@ -63,15 +64,23 @@ _mk_opts() { _d=no for _o in "$@" do - case "$_o" in + case "$_o" in + */*) # option is dirname default comes from basename + eval "_d=\$${_MKOPT_PREFIX}${_o#*/}" + _o=${_o%/*} + ;; yes|no) _d=$_o; continue;; esac _mk_opt $_d $_o done } +# handle either options.mk style OPTIONS_DEFAULT_* +# or FreeBSD's new bsd.mkopt.mk style __DEFAULT_*_OPTIONS _mk_opts_defaults() { - _mk_opts no $__DEFAULT_NO_OPTIONS yes $__DEFAULT_YES_OPTIONS + _mk_opts no $OPTIONS_DEFAULT_NO $__DEFAULT_NO_OPTIONS \ + yes $OPTIONS_DEFAULT_YES $__DEFAULT_YES_OPTIONS \ + $OPTIONS_DEFAULT_DEPENDENT $__DEFAULT_DEPENDENT_OPTIONS } case "/$0" in diff --git a/contrib/bmake/targ.c b/contrib/bmake/targ.c index 527206ec90c0..5db5477ca546 100644 --- a/contrib/bmake/targ.c +++ b/contrib/bmake/targ.c @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.59 2014/09/07 20:55:34 joerg Exp $ */ +/* $NetBSD: targ.c,v 1.60 2015/05/25 09:01:06 manu Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: targ.c,v 1.59 2014/09/07 20:55:34 joerg Exp $"; +static char rcsid[] = "$NetBSD: targ.c,v 1.60 2015/05/25 09:01:06 manu Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: targ.c,v 1.59 2014/09/07 20:55:34 joerg Exp $"); +__RCSID("$NetBSD: targ.c,v 1.60 2015/05/25 09:01:06 manu Exp $"); #endif #endif /* not lint */ #endif diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile index 4abb45feb211..4f83731294ca 100644 --- a/usr.bin/bmake/Makefile +++ b/usr.bin/bmake/Makefile @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.38 2015/05/05 21:58:05 sjg Exp $ +# $Id: Makefile,v 1.39 2015/06/07 15:54:37 sjg Exp $ # Base version on src date -MAKE_VERSION= 20150505 +MAKE_VERSION= 20150606 PROG?= ${.CURDIR:T}