Date: Mon, 6 Mar 2017 23:02:33 +0000 (UTC) From: "Simon J. Gerraty" <sjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314808 - in head: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake Message-ID: <201703062302.v26N2Xt6009979@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sjg Date: Mon Mar 6 23:02:33 2017 New Revision: 314808 URL: https://svnweb.freebsd.org/changeset/base/314808 Log: Merge bmake-20170301 Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/PSD.doc/tutorial.ms head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/dir.c head/contrib/bmake/main.c head/contrib/bmake/make.1 head/contrib/bmake/meta.c head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/dpadd.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/meta.stage.mk head/contrib/bmake/mk/meta2deps.py head/contrib/bmake/mk/prog.mk head/contrib/bmake/mk/subdir.mk head/contrib/bmake/mk/sys.mk head/contrib/bmake/mk/sys.vars.mk head/contrib/bmake/os.sh head/contrib/bmake/parse.c head/contrib/bmake/unit-tests/varmisc.exp head/contrib/bmake/unit-tests/varmisc.mk head/contrib/bmake/var.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/ChangeLog Mon Mar 6 23:02:33 2017 (r314808) @@ -1,3 +1,32 @@ +2017-03-01 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile (_MAKE_VERSION): 20170301 + Merge with NetBSD make, pick up + o main.c: use -C arg as is rather than getcwd() + if they identify the same directory. + o parse.c: ensure loadfile buffer is \n terminated in non-mmap case + +2017-02-01 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile (_MAKE_VERSION): 20170201 + Merge with NetBSD make, pick up + o var.c: allow :_=var and avoid use of special context. + +2017-01-30 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile (_MAKE_VERSION): 20170130 + Merge with NetBSD make, pick up + o var.c: add :range and :_ + o main.c: partially initialize Dir_* before MainParseArgs() + can be called. + If -V, skip Main_ExportMAKEFLAGS() + +2017-01-14 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile (_MAKE_VERSION): 20170114 + Merge with NetBSD make, pick up + o var.c: allow specifying the utc value used by :{gm,local}time + 2016-12-12 Simon J. Gerraty <sjg@bad.crufty.net> * Makefile (_MAKE_VERSION): 20161212 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/Makefile Mon Mar 6 23:02:33 2017 (r314808) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $ +# $Id: Makefile,v 1.81 2017/03/01 17:01:23 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20161212 +_MAKE_VERSION= 20170301 PROG= bmake Modified: head/contrib/bmake/PSD.doc/tutorial.ms ============================================================================== --- head/contrib/bmake/PSD.doc/tutorial.ms Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/PSD.doc/tutorial.ms Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -.\" $NetBSD: tutorial.ms,v 1.12 2014/09/30 21:33:14 christos Exp $ +.\" $NetBSD: tutorial.ms,v 1.13 2017/03/01 13:05:11 kre Exp $ .\" Copyright (c) 1988, 1989, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -117,6 +117,15 @@ .de No .br .ne 0.5i +.ie n \{\ +.nr g3 \w'NOTE ' +.po -\\n(g3u +.br +NOTE +.br +.po +\\n(g3u +.\} +.el \{\ .po -0.5i .br .mk @@ -148,12 +157,14 @@ .rt .ft \\n(g3 .ps \\n(g4 +.\} .. .de Bp .ie !\\n(.$ .IP \(bu 2 .el .IP "\&" 2 .. -.po +.3i +.ie n .po +\w'NOTE 'u +.el .po +.3i .TL PMake \*- A Tutorial .AU Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/bmake.1 Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $ +.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg 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 August 26, 2016 +.Dd February 1, 2017 .Dt BMAKE 1 .Os .Sh NAME @@ -1205,18 +1205,28 @@ safely through recursive invocations of .Nm . .It Cm \&:R Replaces each word in the variable with everything but its suffix. -.It Cm \&:gmtime +.It Cm \&:range[=count] +The value is an integer sequence representing the words of the original +value, or the supplied +.Va count . +.It Cm \&:gmtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr gmtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:hash Compute a 32-bit hash of the value and encode it as hex digits. -.It Cm \&:localtime +.It Cm \&:localtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr localtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:tA Attempt to convert variable to an absolute path using .Xr realpath 3 , @@ -1416,6 +1426,27 @@ For example. .Pp However a single character variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} +.It Cm \&:_[=var] +Save the current variable value in +.Ql $_ +or the named +.Va var +for later reference. +Example usage: +.Bd -literal -offset indent +M_cmpv.units = 1 1000 1000000 +M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ +\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + +.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} + +.Ed +Here +.Ql $_ +is used to save the result of the +.Ql :S +modifier which is later referenced using the index values from +.Ql :range . .It Cm \&:U Ns Ar newval If the variable is undefined .Ar newval Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/bmake.cat1 Mon Mar 6 23:02:33 2017 (r314808) @@ -789,16 +789,20 @@ VVAARRIIAABBLLEE AASSSSIIGG ::RR Replaces each word in the variable with everything but its suffix. - ::ggmmttiimmee - The value is a format string for strftime(3), using the current - gmtime(3). + ::rraannggee[[==ccoouunntt]] + The value is an integer sequence representing the words of the orig- + inal value, or the supplied _c_o_u_n_t. + + ::ggmmttiimmee[[==uuttcc]] + The value is a format string for strftime(3), using gmtime(3). If a + _u_t_c value is not provided or is 0, the current time is used. ::hhaasshh Compute a 32-bit hash of the value and encode it as hex digits. - ::llooccaallttiimmee - The value is a format string for strftime(3), using the current - localtime(3). + ::llooccaallttiimmee[[==uuttcc]] + The value is a format string for strftime(3), using localtime(3). + If a _u_t_c value is not provided or is 0, the current time is used. ::ttAA Attempt to convert variable to an absolute path using realpath(3), if that fails, the value is unchanged. @@ -899,6 +903,19 @@ VVAARRIIAABBLLEE AASSSSIIGG However a single character variable is often more readable: ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} + ::__[[==vvaarr]] + Save the current variable value in `$_' or the named _v_a_r for later + reference. Example usage: + + M_cmpv.units = 1 1000 1000000 + M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \ + \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + + .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} + + Here `$_' is used to save the result of the `:S' modifier which is + later referenced using the index values from `:range'. + ::UU_n_e_w_v_a_l If the variable is undefined _n_e_w_v_a_l is the value. If the variable is defined, the existing value is returned. This is another ODE @@ -1506,4 +1523,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 August 26, 2016 NetBSD 5.1 +NetBSD 7.1_RC1 February 1, 2017 NetBSD 7.1_RC1 Modified: head/contrib/bmake/dir.c ============================================================================== --- head/contrib/bmake/dir.c Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/dir.c Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $"); +__RCSID("$NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -346,11 +346,13 @@ cached_lstat(const char *pathname, void void Dir_Init(const char *cdname) { - dirSearchPath = Lst_Init(FALSE); - openDirectories = Lst_Init(FALSE); - Hash_InitTable(&mtimes, 0); - Hash_InitTable(&lmtimes, 0); - + if (!cdname) { + dirSearchPath = Lst_Init(FALSE); + openDirectories = Lst_Init(FALSE); + Hash_InitTable(&mtimes, 0); + Hash_InitTable(&lmtimes, 0); + return; + } Dir_InitCur(cdname); dotLast = bmake_malloc(sizeof(Path)); Modified: head/contrib/bmake/main.c ============================================================================== --- head/contrib/bmake/main.c Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/main.c Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $ */ +/* $NetBSD: main.c,v 1.257 2017/02/08 17:47:36 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.257 2017/02/08 17:47:36 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.257 2017/02/08 17:47:36 christos Exp $"); #endif #endif /* not lint */ #endif @@ -389,6 +389,7 @@ MainParseArgs(int argc, char **argv) int arginc; char *argvalue; const char *getopt_def; + struct stat sa, sb; char *optscan; Boolean inOption, dashDash = FALSE; char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ @@ -457,6 +458,11 @@ rearg: (void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno)); exit(2); } + if (stat(argvalue, &sa) != -1 && + stat(curdir, &sb) != -1 && + sa.st_ino == sb.st_ino && + sa.st_dev == sb.st_dev) + strncpy(curdir, argvalue, MAXPATHLEN); ignorePWD = TRUE; break; case 'D': @@ -1073,6 +1079,8 @@ main(int argc, char **argv) #ifdef USE_META meta_init(); #endif + Dir_Init(NULL); /* Dir_* safe to call from MainParseArgs */ + /* * First snag any flags out of the MAKE environment variable. * (Note this is *not* MAKEFLAGS since /bin/make uses that and it's @@ -1314,8 +1322,9 @@ main(int argc, char **argv) fprintf(debug_file, "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n", jp_0, jp_1, maxJobs, maxJobTokens, compatMake); - Main_ExportMAKEFLAGS(TRUE); /* initial export */ - + if (!printVars) + Main_ExportMAKEFLAGS(TRUE); /* initial export */ + /* * For compatibility, look at the directories in the VPATH variable * and add them to the search path, if the variable is defined. The @@ -1933,7 +1942,7 @@ PrintAddr(void *a, void *b) static int -addErrorCMD(void *cmdp, void *gnp) +addErrorCMD(void *cmdp, void *gnp MAKE_ATTR_UNUSED) { if (cmdp == NULL) return 1; /* stop */ Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/make.1 Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $ +.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg 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 August 26, 2016 +.Dd February 1, 2017 .Dt MAKE 1 .Os .Sh NAME @@ -1216,18 +1216,28 @@ safely through recursive invocations of .Nm . .It Cm \&:R Replaces each word in the variable with everything but its suffix. -.It Cm \&:gmtime +.It Cm \&:range[=count] +The value is an integer sequence representing the words of the original +value, or the supplied +.Va count . +.It Cm \&:gmtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr gmtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:hash Compute a 32-bit hash of the value and encode it as hex digits. -.It Cm \&:localtime +.It Cm \&:localtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr localtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:tA Attempt to convert variable to an absolute path using .Xr realpath 3 , @@ -1427,6 +1437,27 @@ For example. .Pp However a single character variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} +.It Cm \&:_[=var] +Save the current variable value in +.Ql $_ +or the named +.Va var +for later reference. +Example usage: +.Bd -literal -offset indent +M_cmpv.units = 1 1000 1000000 +M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ +\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + +.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} + +.Ed +Here +.Ql $_ +is used to save the result of the +.Ql :S +modifier which is later referenced using the index values from +.Ql :range . .It Cm \&:U Ns Ar newval If the variable is undefined .Ar newval Modified: head/contrib/bmake/meta.c ============================================================================== --- head/contrib/bmake/meta.c Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/meta.c Mon Mar 6 23:02:33 2017 (r314808) @@ -241,7 +241,7 @@ eat_dots(char *buf, size_t bufsz, int do } static char * -meta_name(struct GNode *gn, char *mname, size_t mnamelen, +meta_name(char *mname, size_t mnamelen, const char *dname, const char *tname, const char *cwd) @@ -396,7 +396,7 @@ printCMD(void *cmdp, void *mfpp) * Do we need/want a .meta file ? */ static Boolean -meta_needed(GNode *gn, const char *dname, const char *tname, +meta_needed(GNode *gn, const char *dname, char *objdir, int verbose) { struct stat fs; @@ -476,7 +476,7 @@ meta_create(BuildMon *pbm, GNode *gn) tname = Var_Value(TARGET, gn, &p[i++]); /* if this succeeds objdir is realpath of dname */ - if (!meta_needed(gn, dname, tname, objdir, TRUE)) + if (!meta_needed(gn, dname, objdir, TRUE)) goto out; dname = objdir; @@ -502,7 +502,7 @@ meta_create(BuildMon *pbm, GNode *gn) /* Don't create meta data. */ goto out; - fname = meta_name(gn, pbm->meta_fname, sizeof(pbm->meta_fname), + fname = meta_name(pbm->meta_fname, sizeof(pbm->meta_fname), dname, tname, objdir); #ifdef DEBUG_META_MODE @@ -1049,7 +1049,7 @@ meta_oodate(GNode *gn, Boolean oodate) tname = Var_Value(TARGET, gn, &pa[i++]); /* if this succeeds fname3 is realpath of dname */ - if (!meta_needed(gn, dname, tname, fname3, FALSE)) + if (!meta_needed(gn, dname, fname3, FALSE)) goto oodate_out; dname = fname3; @@ -1063,7 +1063,7 @@ meta_oodate(GNode *gn, Boolean oodate) */ Make_DoAllVar(gn); - meta_name(gn, fname, sizeof(fname), dname, tname, dname); + meta_name(fname, sizeof(fname), dname, tname, dname); #ifdef DEBUG_META_MODE if (DEBUG(META)) Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/ChangeLog Mon Mar 6 23:02:33 2017 (r314808) @@ -1,3 +1,34 @@ +2017-03-01 Simon J. Gerraty <sjg@bad.crufty.net> + + * install-mk (MK_VERSION): 20170301 + + * dirdeps.mk (_build_all_dirs): update this outside test for empty + DIRDEPS. + + * meta.stage.mk: allow multiple inclusion to the extent it makes + sense. + +2017-02-14 Simon J. Gerraty <sjg@bad.crufty.net> + + * prog.mk (install_links): depends on realinstall + +2017-02-12 Simon J. Gerraty <sjg@bad.crufty.net> + + * install-mk (MK_VERSION): 20170212 + + * dpadd.mk: avoid applying :T:R twice to DPLIBS entries + +2017-01-30 Simon J. Gerraty <sjg@bad.crufty.net> + + * install-mk (MK_VERSION): 20170130 + + * dirdeps.mk: use :range if we can. + + * sys.vars.mk: provide M_cmpv if MAKE_VERSION >= 20170130 + + * meta2deps.py: clean paths without using realpath() where possible. + fix sort_unique. + 2016-12-12 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20161212 Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/dirdeps.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -# $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. @@ -197,7 +197,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 @@ -612,11 +614,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/contrib/bmake/mk/dpadd.mk ============================================================================== --- head/contrib/bmake/mk/dpadd.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/dpadd.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -# $Id: dpadd.mk,v 1.22 2016/05/31 23:30:59 sjg Exp $ +# $Id: dpadd.mk,v 1.23 2017/02/13 16:46:01 sjg Exp $ # # @(#) Copyright (c) 2004, Simon J. Gerraty # @@ -49,11 +49,11 @@ CXXFLAGS_LAST += ${CXXFLAGS_DEBUG_XTRA} # DPLIBS helps us ensure we keep DPADD and LDADD in sync DPLIBS+= ${DPLIBS_LAST} DPADD+= ${DPLIBS:N-*} -.for __lib in ${DPLIBS:T:R} +.for __lib in ${DPLIBS} .if "${_lib:M-*}" != "" LDADD += ${__lib} .else -LDADD += ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}} +LDADD += ${LDADD_${__lib:T:R}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}} .endif .endfor Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/install-mk Mon Mar 6 23:02:33 2017 (r314808) @@ -55,7 +55,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: install-mk,v 1.135 2016/12/12 19:07:42 sjg Exp $ +# $Id: install-mk,v 1.138 2017/03/01 20:26:51 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20161212 +MK_VERSION=20170301 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/meta.stage.mk ============================================================================== --- head/contrib/bmake/mk/meta.stage.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/meta.stage.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,6 +1,6 @@ -# $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. @@ -14,7 +14,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 @@ -127,26 +127,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} @@ -159,6 +150,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) @@ -184,6 +187,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 @@ -192,8 +197,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 @@ -202,8 +210,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 @@ -212,6 +223,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 @@ -231,22 +243,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/contrib/bmake/mk/meta2deps.py ============================================================================== --- head/contrib/bmake/mk/meta2deps.py Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/meta2deps.py Mon Mar 6 23:02:33 2017 (r314808) @@ -37,7 +37,7 @@ We only pay attention to a subset of the """ RCSid: - $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. @@ -103,20 +103,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): @@ -126,6 +142,7 @@ def sort_unique(list, cmp=None, key=None for e in list: if e == le: continue + le = e nl.append(e) return nl @@ -504,6 +521,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: Modified: head/contrib/bmake/mk/prog.mk ============================================================================== --- head/contrib/bmake/mk/prog.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/prog.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -# $Id: prog.mk,v 1.27 2016/08/02 20:52:17 sjg Exp $ +# $Id: prog.mk,v 1.28 2017/02/14 21:26:13 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -191,6 +191,7 @@ install_links: maninstall: afterinstall afterinstall: realinstall +install_links: realinstall proginstall: beforeinstall realinstall: beforeinstall .endif Modified: head/contrib/bmake/mk/subdir.mk ============================================================================== --- head/contrib/bmake/mk/subdir.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/subdir.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -# $Id: subdir.mk,v 1.15 2016/04/05 15:58:37 sjg Exp $ +# $Id: subdir.mk,v 1.16 2017/02/08 22:16:59 sjg Exp $ # skip missing directories... # $NetBSD: bsd.subdir.mk,v 1.11 1996/04/04 02:05:06 jtc Exp $ @@ -45,13 +45,18 @@ _SUBDIRUSE: .USE done ${SUBDIR}:: - @set -e; if test -d ${.CURDIR}/${.TARGET}.${MACHINE}; then \ - _newdir_=${.TARGET}.${MACHINE}; \ + @set -e; _r=${.CURDIR}/; \ + if test -z "${.TARGET:M/*}"; then \ + if test -d ${.CURDIR}/${.TARGET}.${MACHINE}; then \ + _newdir_=${.TARGET}.${MACHINE}; \ + else \ + _newdir_=${.TARGET}; \ + fi; \ else \ - _newdir_=${.TARGET}; \ + _r= _newdir_=${.TARGET}; \ fi; \ ${ECHO_DIR} "===> $${_newdir_}"; \ - cd ${.CURDIR}/$${_newdir_}; \ + cd $${_r}$${_newdir_}; \ ${.MAKE} _THISDIR_="$${_newdir_}" all .endif Modified: head/contrib/bmake/mk/sys.mk ============================================================================== --- head/contrib/bmake/mk/sys.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/sys.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -# $Id: sys.mk,v 1.44 2016/10/01 19:11:55 sjg Exp $ +# $Id: sys.mk,v 1.45 2017/02/05 01:26:13 sjg Exp $ # # @(#) Copyright (c) 2003-2009, Simon J. Gerraty # @@ -71,11 +71,11 @@ SYS_OS_MK := ${_sys_mk} # some options we need to know early OPTIONS_DEFAULT_NO += \ DIRDEPS_BUILD \ - DIRDEPS_CACHE \ - META_MODE + DIRDEPS_CACHE OPTIONS_DEFAULT_DEPENDENT += \ AUTO_OBJ/DIRDEPS_BUILD \ + META_MODE/DIRDEPS_BUILD \ STAGING/DIRDEPS_BUILD \ .-include <options.mk> Modified: head/contrib/bmake/mk/sys.vars.mk ============================================================================== --- head/contrib/bmake/mk/sys.vars.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/mk/sys.vars.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -# $Id: sys.vars.mk,v 1.1 2016/10/01 19:11:55 sjg Exp $ +# $Id: sys.vars.mk,v 1.2 2017/01/31 07:44:45 sjg Exp $ # # @(#) Copyright (c) 2003-2009, Simon J. Gerraty # @@ -67,5 +67,14 @@ M_tA = tA M_tA = C,.*,('cd' & \&\& 'pwd') 2> /dev/null || echo &,:sh .endif +.if ${MAKE_VERSION:U0} >= 20170130 +# M_cmpv allows comparing dotted versions like 3.1.2 +# ${3.1.2:L:${M_cmpv}} -> 3001002 +# we use big jumps to handle 3 digits per dot: +# ${123.456.789:L:${M_cmpv}} -> 123456789 +M_cmpv.units = 1 1000 1000000 +M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh +.endif + # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:${M_tA}} Modified: head/contrib/bmake/os.sh ============================================================================== --- head/contrib/bmake/os.sh Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/os.sh Mon Mar 6 23:02:33 2017 (r314808) @@ -17,7 +17,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: os.sh,v 1.52 2016/06/17 05:15:14 sjg Exp $ +# $Id: os.sh,v 1.53 2017/01/11 20:01:09 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -206,7 +206,13 @@ esac TMP_DIRS=${TMP_DIRS:-"/tmp /var/tmp"} MACHINE_ARCH=${MACHINE_ARCH:-$MACHINE} +case "$MACHINE_ARCH" in +x86*64|amd64) MACHINE32_ARCH=i386;; +*64) MACHINE32_ARCH=`echo $MACHINE_ARCH | sed 's,64,32,'`;; +*) MACHINE32_ARCH=$MACHINE_ARCH;; +esac HOST_ARCH=${HOST_ARCH:-$MACHINE_ARCH} +HOST_ARCH32=${HOST_ARCH32:-$MACHINE32_ARCH} # we mount server:/share/arch/$SHARE_ARCH as /usr/local SHARE_ARCH_DEFAULT=$OS/$OSMAJOR.X/$HOST_ARCH SHARE_ARCH=${SHARE_ARCH:-$SHARE_ARCH_DEFAULT} @@ -215,7 +221,8 @@ TR=${TR:-tr} # Some people like have /share/$HOST_TARGET/bin etc. HOST_TARGET=`echo ${OS}${OSMAJOR}-$HOST_ARCH | tr -d / | toLower` -export HOST_TARGET +HOST_TARGET32=`echo ${OS}${OSMAJOR}-$HOST_ARCH32 | tr -d / | toLower` +export HOST_TARGET HOST_TARGET32 case `echo -n .` in -n*) N=; C="\c";; *) N=-n; C=;; esac Modified: head/contrib/bmake/parse.c ============================================================================== --- head/contrib/bmake/parse.c Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/parse.c Mon Mar 6 23:02:33 2017 (r314808) @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $ */ +/* $NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: parse.c,v 1.217 2016/12/09 22:56:21 sjg Exp $"); +__RCSID("$NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -578,7 +578,11 @@ loadfile(const char *path, int fd) /* truncate malloc region to actual length (maybe not useful) */ if (lf->len > 0) { + /* as for mmap case, ensure trailing \n */ + if (lf->buf[lf->len - 1] != '\n') + lf->len++; lf->buf = bmake_realloc(lf->buf, lf->len); + lf->buf[lf->len - 1] = '\n'; } #ifdef HAVE_MMAP Modified: head/contrib/bmake/unit-tests/varmisc.exp ============================================================================== --- head/contrib/bmake/unit-tests/varmisc.exp Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/unit-tests/varmisc.exp Mon Mar 6 23:02:33 2017 (r314808) @@ -17,4 +17,9 @@ false FALSE do not evaluate or expand :? if discarding is set +year=2016 month=04 day=01 +date=20160401 +Version=123.456.789 == 123456789 +Literal=3.4.5 == 3004005 +We have target specific vars exit status 0 Modified: head/contrib/bmake/unit-tests/varmisc.mk ============================================================================== --- head/contrib/bmake/unit-tests/varmisc.mk Mon Mar 6 22:46:49 2017 (r314807) +++ head/contrib/bmake/unit-tests/varmisc.mk Mon Mar 6 23:02:33 2017 (r314808) @@ -1,8 +1,9 @@ -# $Id: varmisc.mk,v 1.5 2015/10/12 17:10:48 sjg Exp $ +# $Id: varmisc.mk,v 1.9 2017/02/01 18:44:54 sjg Exp $ # # Miscellaneous variable tests. -all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none +all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \ + strftime cmpv unmatched_var_paren: @echo ${foo::=foo-text} @@ -40,3 +41,22 @@ Q_rhs: NQ_none: @echo do not evaluate or expand :? if discarding @echo ${VSET:U${1:L:?${True}:${False}}} + +April1= 1459494000 + +# slightly contorted syntax to use utc via variable +strftime: + @echo ${year=%Y month=%m day=%d:L:gmtime=1459494000} + @echo date=${%Y%m%d:L:${gmtime=${April1}:L}} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703062302.v26N2Xt6009979>