From 752c57a54ca3c75645f052726222ca9e818c10cf Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Sat, 25 Mar 2017 13:37:31 +0200 Subject: [PATCH] make: update to bmake-20170311 --- bin/make/ChangeLog | 14 +++++++++++++ bin/make/Makefile | 4 ++-- bin/make/PSD.doc/tutorial.ms | 15 +++++++++++-- bin/make/main.c | 13 +++++++++--- bin/make/mk/ChangeLog | 20 ++++++++++++++++++ bin/make/mk/dirdeps.mk | 8 +++---- bin/make/mk/dpadd.mk | 6 +++--- bin/make/mk/install-mk | 4 ++-- bin/make/mk/meta.stage.mk | 50 +++++++++++++++++++++++++++++++------------- bin/make/parse.c | 10 ++++++--- 10 files changed, 111 insertions(+), 33 deletions(-) diff --git a/bin/make/ChangeLog b/bin/make/ChangeLog index 7413bc76ac..d35ec241c9 100644 --- a/bin/make/ChangeLog +++ b/bin/make/ChangeLog @@ -1,3 +1,17 @@ +2017-03-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170311 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it starts with '/'. + +2017-03-01 Simon J. Gerraty + + * 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 * Makefile (_MAKE_VERSION): 20170201 diff --git a/bin/make/Makefile b/bin/make/Makefile index 73fc6e24a8..0e939ee265 100644 --- a/bin/make/Makefile +++ b/bin/make/Makefile @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.80 2017/02/01 18:44:54 sjg Exp $ +# $Id: Makefile,v 1.82 2017/03/12 00:07:18 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170201 +_MAKE_VERSION= 20170311 PROG= make diff --git a/bin/make/PSD.doc/tutorial.ms b/bin/make/PSD.doc/tutorial.ms index d5c8a7d54f..814a09a621 100644 --- a/bin/make/PSD.doc/tutorial.ms +++ b/bin/make/PSD.doc/tutorial.ms @@ -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 diff --git a/bin/make/main.c b/bin/make/main.c index 1ba4a55d2c..128a620c61 100644 --- a/bin/make/main.c +++ b/bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.255 2017/01/31 06:54:23 sjg Exp $ */ +/* $NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.255 2017/01/31 06:54:23 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.255 2017/01/31 06:54:23 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg 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,12 @@ rearg: (void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno)); exit(2); } + if (argvalue[0] == '/' && + 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': diff --git a/bin/make/mk/ChangeLog b/bin/make/mk/ChangeLog index cf19513cf8..ef0bd3793f 100644 --- a/bin/make/mk/ChangeLog +++ b/bin/make/mk/ChangeLog @@ -1,3 +1,23 @@ +2017-03-01 Simon J. Gerraty + + * 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 + + * prog.mk (install_links): depends on realinstall + +2017-02-12 Simon J. Gerraty + + * install-mk (MK_VERSION): 20170212 + + * dpadd.mk: avoid applying :T:R twice to DPLIBS entries + 2017-01-30 Simon J. Gerraty * install-mk (MK_VERSION): 20170130 diff --git a/bin/make/mk/dirdeps.mk b/bin/make/mk/dirdeps.mk index ac3de24585..82b781ac0d 100644 --- a/bin/make/mk/dirdeps.mk +++ b/bin/make/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.85 2017/01/31 08:10:32 sjg Exp $ +# $Id: dirdeps.mk,v 1.87 2017/03/07 01:49:03 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -57,7 +57,7 @@ # distinguish them from others. # # Before each Makefile.depend file is read, we set -# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for +# DEP_RELDIR to be the RELDIR (path relative to SRCTOP) for # its directory, and DEP_MACHINE etc according to the . # represented by the suffix of the corresponding target. # @@ -614,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. diff --git a/bin/make/mk/dpadd.mk b/bin/make/mk/dpadd.mk index c789acfb99..650d61bf9a 100644 --- a/bin/make/mk/dpadd.mk +++ b/bin/make/mk/dpadd.mk @@ -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 diff --git a/bin/make/mk/install-mk b/bin/make/mk/install-mk index 9192507b68..158f74cf6d 100644 --- a/bin/make/mk/install-mk +++ b/bin/make/mk/install-mk @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.136 2017/01/31 07:44:45 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=20170130 +MK_VERSION=20170301 OWNER= GROUP= MODE=444 diff --git a/bin/make/mk/meta.stage.mk b/bin/make/mk/meta.stage.mk index a0f30e3188..223421a51e 100644 --- a/bin/make/mk/meta.stage.mk +++ b/bin/make/mk/meta.stage.mk @@ -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}; StageAs() { \ 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_symlink 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} diff --git a/bin/make/parse.c b/bin/make/parse.c index bbc43bd1a5..e84cae17ff 100644 --- a/bin/make/parse.c +++ b/bin/make/parse.c @@ -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 #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 -- 2.11.4.GIT