From owner-svn-src-head@freebsd.org Fri Sep 9 01:09:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70D8FBD2238; Fri, 9 Sep 2016 01:09:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B8929A3; Fri, 9 Sep 2016 01:09:41 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8919f3l015934; Fri, 9 Sep 2016 01:09:41 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8919dQk015918; Fri, 9 Sep 2016 01:09:39 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201609090109.u8919dQk015918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 9 Sep 2016 01:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305633 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 01:09:42 -0000 Author: sjg Date: Fri Sep 9 01:09:39 2016 New Revision: 305633 URL: https://svnweb.freebsd.org/changeset/base/305633 Log: Update to bmake-20170818 This version has some new knobs for dealing with troublesome targets in meta mode. Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 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/install-mk head/contrib/bmake/mk/lib.mk head/contrib/bmake/mk/meta.sys.mk head/contrib/bmake/mk/prog.mk head/contrib/bmake/os.sh head/contrib/bmake/suff.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/ChangeLog Fri Sep 9 01:09:39 2016 (r305633) @@ -1,3 +1,32 @@ +2016-08-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160818 + its a neater number; pick up whitespace fixes to man page. + +2016-08-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160817 + Merge with NetBSD make, pick up + o meta.c: move handling of .MAKE.META.IGNORE_* to meta_ignore() + so we can call it before adding entries to missingFiles. + Thus we do not track files we have been told to ignore. + +2016-08-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160815 + Merge with NetBSD make, pick up + o meta_oodate: apply .MAKE.META.IGNORE_FILTER (if defined) to + pathnames, and skip if the expansion is empty. + Useful for dirdeps.mk when checking DIRDEPS_CACHE. + +2016-08-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160812 + Merge with NetBSD make, pick up + o meta.c: remove all missingFiles entries that match a deleted + dir. + o main.c: set .ERROR_CMD if possible. + 2016-06-06 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160606 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/Makefile Fri Sep 9 01:09:39 2016 (r305633) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $ +# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160606 +_MAKE_VERSION= 20160818 PROG= bmake Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/bmake.1 Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 wiz Exp $ +.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 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 June 2, 2016 +.Dd August 15, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -927,6 +927,9 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -974,7 +977,19 @@ per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/bmake.cat1 Fri Sep 9 01:09:39 2016 (r305633) @@ -604,6 +604,10 @@ VVAARRIIAABBLLEE AASSSSIIGG Provides a list of patterns to match against pathnames. Ignore any that match. + _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R + Provides a list of variable modifiers to apply to each + pathname. Ignore if the expansion is an empty string. + _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -635,9 +639,14 @@ VVAARRIIAABBLLEE AASSSSIIGG becomes `$' per normal evaluation rules. _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R - When bbmmaakkee stops due to an error, it prints its name and - the value of `_._C_U_R_D_I_R' as well as the value of any vari- - ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. + When bbmmaakkee stops due to an error, it sets `_._E_R_R_O_R___T_A_R_G_E_T' + to the name of the target that failed, `_._E_R_R_O_R___C_M_D' to + the commands of the failed target, and in "meta" mode, it + also sets `_._E_R_R_O_R___C_W_D' to the getcwd(3), and + `_._E_R_R_O_R___M_E_T_A___F_I_L_E' to the path of the meta file (if any) + describing the failed target. It then prints its name + and the value of `_._C_U_R_D_I_R' as well as the value of any + variables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. _._n_e_w_l_i_n_e This variable is simply assigned a newline character as its value. This allows expansions using the ::@@ modifier @@ -1489,4 +1498,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 June 2, 2016 NetBSD 5.1 +NetBSD 5.1 August 15, 2016 NetBSD 5.1 Modified: head/contrib/bmake/main.c ============================================================================== --- head/contrib/bmake/main.c Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/main.c Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $ */ +/* $NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.247 2016/06/05 01:39:17 christos Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"; #else #include #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.247 2016/06/05 01:39:17 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -1903,11 +1903,10 @@ cached_realpath(const char *pathname, ch #endif } - rp = Var_Value(pathname, cache, &cp); - if (rp) { + if ((rp = Var_Value(pathname, cache, &cp)) != NULL) { /* a hit */ strlcpy(resolved, rp, MAXPATHLEN); - } else if ((rp = realpath(pathname, resolved))) { + } else if ((rp = realpath(pathname, resolved)) != NULL) { Var_Set(pathname, rp, cache, 0); } free(cp); @@ -1922,6 +1921,14 @@ PrintAddr(void *a, void *b) } +static int +addErrorCMD(void *cmdp, void *gnp) +{ + if (cmdp == NULL) + return 1; /* stop */ + Var_Append(".ERROR_CMD", cmdp, VAR_GLOBAL); + return 0; +} void PrintOnError(GNode *gn, const char *s) @@ -1942,6 +1949,8 @@ PrintOnError(GNode *gn, const char *s) * We can print this even if there is no .ERROR target. */ Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL, 0); + Var_Delete(".ERROR_CMD", VAR_GLOBAL); + Lst_ForEach(gn->commands, addErrorCMD, gn); } strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}", sizeof(tmp) - 1); Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/make.1 Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 wiz Exp $ +.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 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 June 2, 2016 +.Dd August 15, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -938,6 +938,9 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -985,7 +988,19 @@ per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . Modified: head/contrib/bmake/meta.c ============================================================================== --- head/contrib/bmake/meta.c Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/meta.c Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.61 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */ /* * Implement 'meta' mode. @@ -69,6 +69,9 @@ static char *metaIgnorePathsStr; /* stri #ifndef MAKE_META_IGNORE_PATTERNS #define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS" #endif +#ifndef MAKE_META_IGNORE_FILTER +#define MAKE_META_IGNORE_FILTER ".MAKE.META.IGNORE_FILTER" +#endif Boolean useMeta = FALSE; static Boolean useFilemon = FALSE; @@ -79,6 +82,7 @@ static Boolean metaEnv = FALSE; /* don' static Boolean metaVerbose = FALSE; static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */ static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */ +static Boolean metaIgnoreFilter = FALSE; /* do we have more complex filtering? */ static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */ static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */ @@ -645,6 +649,11 @@ meta_mode_init(const char *make_mode) metaIgnorePatterns = TRUE; free(cp); } + cp = NULL; + if (Var_Value(MAKE_META_IGNORE_FILTER, VAR_GLOBAL, &cp)) { + metaIgnoreFilter = TRUE; + free(cp); + } } /* @@ -869,6 +878,7 @@ fgetLine(char **bufp, size_t *szp, int o return 0; } +/* Lst_ForEach wants 1 to stop search */ static int prefix_match(void *p, void *q) { @@ -879,6 +889,32 @@ prefix_match(void *p, void *q) return (0 == strncmp(path, prefix, n)); } +/* + * looking for exact or prefix/ match to + * Lst_Find wants 0 to stop search + */ +static int +path_match(const void *p, const void *q) +{ + const char *prefix = q; + const char *path = p; + size_t n = strlen(prefix); + int rc; + + if ((rc = strncmp(path, prefix, n)) == 0) { + switch (path[n]) { + case '\0': + case '/': + break; + default: + rc = 1; + break; + } + } + return rc; +} + +/* Lst_Find wants 0 to stop search */ static int string_match(const void *p, const void *q) { @@ -889,6 +925,67 @@ string_match(const void *p, const void * } +static int +meta_ignore(GNode *gn, const char *p) +{ + char fname[MAXPATHLEN]; + + if (p == NULL) + return TRUE; + + if (*p == '/') { + cached_realpath(p, fname); /* clean it up */ + if (Lst_ForEach(metaIgnorePaths, prefix_match, fname)) { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring path: %s\n", + p); +#endif + return TRUE; + } + } + + if (metaIgnorePatterns) { + char *pm; + + snprintf(fname, sizeof(fname), + "${%s:@m@${%s:L:M$m}@}", + MAKE_META_IGNORE_PATTERNS, p); + pm = Var_Subst(NULL, fname, gn, VARF_WANTRES); + if (*pm) { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n", + p); +#endif + free(pm); + return TRUE; + } + free(pm); + } + + if (metaIgnoreFilter) { + char *fm; + + /* skip if filter result is empty */ + snprintf(fname, sizeof(fname), + "${%s:L:${%s:ts:}}", + p, MAKE_META_IGNORE_FILTER); + fm = Var_Subst(NULL, fname, gn, VARF_WANTRES); + if (*fm == '\0') { +#ifdef DEBUG_META_MODE + if (DEBUG(META)) + fprintf(debug_file, "meta_oodate: ignoring filtered: %s\n", + p); +#endif + free(fm); + return TRUE; + } + free(fm); + } + return FALSE; +} + /* * When running with 'meta' functionality, a target can be out-of-date * if any of the references in its meta data file is more recent. @@ -1170,12 +1267,19 @@ meta_oodate(GNode *gn, Boolean oodate) /* FALLTHROUGH */ case 'D': /* unlink */ if (*p == '/' && !Lst_IsEmpty(missingFiles)) { - /* remove p from the missingFiles list if present */ - if ((ln = Lst_Find(missingFiles, p, string_match)) != NULL) { - char *tp = Lst_Datum(ln); - Lst_Remove(missingFiles, ln); - free(tp); - ln = NULL; /* we're done with it */ + /* remove any missingFiles entries that match p */ + if ((ln = Lst_Find(missingFiles, p, + path_match)) != NULL) { + LstNode nln; + char *tp; + + do { + nln = Lst_FindFrom(missingFiles, Lst_Succ(ln), + p, path_match); + tp = Lst_Datum(ln); + Lst_Remove(missingFiles, ln); + free(tp); + } while ((ln = nln) != NULL); } } if (buf[0] == 'M') { @@ -1240,8 +1344,10 @@ meta_oodate(GNode *gn, Boolean oodate) if ((link_src != NULL && cached_lstat(p, &fs) < 0) || (link_src == NULL && cached_stat(p, &fs) < 0)) { - if (Lst_Find(missingFiles, p, string_match) == NULL) + if (!meta_ignore(gn, p)) { + if (Lst_Find(missingFiles, p, string_match) == NULL) Lst_AtEnd(missingFiles, bmake_strdup(p)); + } } break; check_link_src: @@ -1259,37 +1365,9 @@ meta_oodate(GNode *gn, Boolean oodate) * be part of the dependencies because * they are _expected_ to change. */ - if (*p == '/') { - cached_realpath(p, fname1); /* clean it up */ - if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) { -#ifdef DEBUG_META_MODE - if (DEBUG(META)) - fprintf(debug_file, "meta_oodate: ignoring path: %s\n", - p); -#endif - break; - } - } - - if (metaIgnorePatterns) { - char *pm; - - snprintf(fname1, sizeof(fname1), - "${%s:@m@${%s:L:M$m}@}", - MAKE_META_IGNORE_PATTERNS, p); - pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES); - if (*pm) { -#ifdef DEBUG_META_MODE - if (DEBUG(META)) - fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n", - p); -#endif - free(pm); - break; - } - free(pm); - } - + if (meta_ignore(gn, p)) + break; + /* * The rest of the record is the file name. * Check if it's not an absolute path. @@ -1547,7 +1625,7 @@ meta_compat_parent(void) while (fgets(buf, sizeof(buf), fp)) { meta_job_output(NULL, buf, ""); printf("%s", buf); - (void)fflush(stdout); + fflush(stdout); } fclose(fp); } Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/ChangeLog Fri Sep 9 01:09:39 2016 (r305633) @@ -1,3 +1,34 @@ +2016-08-15 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160815 + + * dirdeps.mk (.MAKE.META.IGNORE_FILTER): set filter to only + consider Makefile.depend* when checking if DIRDEPS_CACHE is up-to-date. + +2016-08-13 Simon J. Gerraty + + * meta.sys.mk (.MAKE.META.IGNORE_PATHS): + in meta mode we can ignore the mtime of makefiles + +2016-08-02 Simon J. Gerraty + + * install-mk (MK_VERSION): 20160802 + + * lib.mk (libinstall): depends on beforinstall + + * prog.mk (proginstall): depends on beforinstall + patch from Lauri Tirkkonen + + * dirdeps.mk (bootstrap): When bootstrapping; creat + .MAKE.DEPENDFILE_DEFAULT and allow additional filtering via + .MAKE.DEPENDFILE_BOOTSTRAP_SED + + * dirdeps.mk: move some comments to where they make sense. + +2016-07-27 Simon J. Gerraty + + * dirdeps.mk (DIRDEPS_CACHE): no dirname. + 2016-06-02 Simon J. Gerraty * install-mk (MK_VERSION): 20160602 Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/dirdeps.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.67 2016/04/18 21:50:47 sjg Exp $ +# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -116,12 +116,17 @@ _DIRDEP_USE_LEVEL?= 0 .if ${.MAKE.LEVEL} == ${_DIRDEP_USE_LEVEL} # only the first instance is interested in all this -# First off, we want to know what ${MACHINE} to build for. -# This can be complicated if we are using a mixture of ${MACHINE} specific -# and non-specific Makefile.depend* - .if !target(_DIRDEP_USE) +# do some setup we only need once +_CURDIR ?= ${.CURDIR} +_OBJDIR ?= ${.OBJDIR} + +now_utc = ${%s:L:gmtime} +.if !defined(start_utc) +start_utc := ${now_utc} +.endif + .if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != "" # This little trick let's us do # @@ -144,15 +149,6 @@ MK_DIRDEPS_CACHE = no # make sure we get the behavior we expect .MAKE.SAVE_DOLLARS = no -# do some setup we only need once -_CURDIR ?= ${.CURDIR} -_OBJDIR ?= ${.OBJDIR} - -now_utc = ${%s:L:gmtime} -.if !defined(start_utc) -start_utc := ${now_utc} -.endif - # make sure these are empty to start with _DEP_TARGET_SPEC = @@ -223,6 +219,10 @@ N_notmachine := ${.MAKE.DEPENDFILE_PREFE .endif # !target(_DIRDEP_USE) +# First off, we want to know what ${MACHINE} to build for. +# This can be complicated if we are using a mixture of ${MACHINE} specific +# and non-specific Makefile.depend* + # if we were included recursively _DEP_TARGET_SPEC should be valid. .if empty(_DEP_TARGET_SPEC) # we may or may not have included a dependfile yet @@ -385,7 +385,7 @@ BUILD_DIRDEPS ?= yes .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" # this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -397,6 +397,9 @@ M_oneperline = @x@\\${.newline} $$x@ # we do this via sub-make BUILD_DIRDEPS = no +# ignore anything but these +.MAKE.META.IGNORE_FILTER = M*/${.MAKE.DEPENDFILE_PREFIX}* + dirdeps: dirdeps-cached dirdeps-cached: ${DIRDEPS_CACHE} .MAKE @echo "${TRACER}Using ${DIRDEPS_CACHE}" @@ -669,7 +672,10 @@ _DEP_RELDIR := ${RELDIR} make(bootstrap-recurse) || \ make(bootstrap-empty)) -.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T}) +# if we are bootstrapping create the default +_want = ${.CURDIR}/${.MAKE.DEPENDFILE_DEFAULT:T} + +.if exists(${_want}) # stop here ${.TARGETS:Mboot*}: .elif !make(bootstrap-empty) @@ -679,12 +685,19 @@ _src != cd ${.CURDIR} && for m in ${.MAK .error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}Use: bootstrap-empty .endif -_src?= ${.MAKE.DEPENDFILE:T} +_src?= ${.MAKE.DEPENDFILE} + +.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g' # just create Makefile.depend* for this dir bootstrap-this: .NOTMAIN - @echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T} - (cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T}) + @echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \ + echo You need to build ${RELDIR} to correctly populate it. +.if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T} + (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want}) +.else + cp ${.CURDIR}/${_src} ${_want} +.endif # create Makefile.depend* for this dir and its dependencies bootstrap: bootstrap-recurse @@ -704,8 +717,8 @@ bootstrap-recurse: .NOTMAIN .MAKE # create an empty Makefile.depend* to get the ball rolling. bootstrap-empty: .NOTMAIN .NOMETA - @echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \ + @echo Creating empty ${RELDIR}/${_want:T}; \ echo You need to build ${RELDIR} to correctly populate it. - @{ echo DIRDEPS=; echo ".include "; } > ${.CURDIR}/${.MAKE.DEPENDFILE:T} + @{ echo DIRDEPS=; echo ".include "; } > ${_want} .endif Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/install-mk Fri Sep 9 01:09:39 2016 (r305633) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.128 2016/06/03 17:22:32 sjg Exp $ +# $Id: install-mk,v 1.130 2016/08/15 19:28:13 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20160602 +MK_VERSION=20160815 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/lib.mk ============================================================================== --- head/contrib/bmake/mk/lib.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/lib.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.53 2016/03/22 20:45:14 sjg Exp $ +# $Id: lib.mk,v 1.54 2016/08/02 20:52:17 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -564,6 +564,7 @@ libinstall: install: maninstall _SUBDIRUSE maninstall: afterinstall afterinstall: realinstall +libinstall: beforeinstall realinstall: beforeinstall .endif Modified: head/contrib/bmake/mk/meta.sys.mk ============================================================================== --- head/contrib/bmake/mk/meta.sys.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/meta.sys.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: meta.sys.mk,v 1.28 2016/04/05 15:58:37 sjg Exp $ +# $Id: meta.sys.mk,v 1.29 2016/08/13 17:51:45 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -25,6 +25,10 @@ # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:tA} +.if !defined(SYS_MK_DIR) +SYS_MK_DIR := ${_PARSEDIR} +.endif + META_MODE += meta verbose .MAKE.MODE ?= ${META_MODE} @@ -119,6 +123,15 @@ MKDEP_MK = meta.autodep.mk # re-running needlessly META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}} META_NOPHONY= + +# some targets involve old pre-built targets +# ignore mtime of shell +# and mtime of makefiles does not matter in meta mode +.MAKE.META.IGNORE_PATHS += \ + ${MAKEFILE} \ + ${SHELL} \ + ${SYS_MK_DIR} + .if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" .if ${.MAKEFLAGS:Uno:M-k} != "" # make this more obvious Modified: head/contrib/bmake/mk/prog.mk ============================================================================== --- head/contrib/bmake/mk/prog.mk Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/mk/prog.mk Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -# $Id: prog.mk,v 1.26 2016/03/22 20:45:14 sjg Exp $ +# $Id: prog.mk,v 1.27 2016/08/02 20:52:17 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -191,6 +191,7 @@ install_links: maninstall: afterinstall afterinstall: realinstall +proginstall: beforeinstall realinstall: beforeinstall .endif Modified: head/contrib/bmake/os.sh ============================================================================== --- head/contrib/bmake/os.sh Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/os.sh Fri Sep 9 01:09:39 2016 (r305633) @@ -17,7 +17,7 @@ # Simon J. Gerraty # RCSid: -# $Id: os.sh,v 1.50 2015/12/17 17:06:29 sjg Exp $ +# $Id: os.sh,v 1.52 2016/06/17 05:15:14 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -139,7 +139,7 @@ SunOS) case $OS in NetBSD) HOST_ARCH=$MACHINE - SHARE_ARCH=$OS/$HOST + SHARE_ARCH=$OS/$HOST_ARCH ;; OpenBSD) arch=`Which arch /usr/bin:/usr/ucb:$PATH` @@ -208,7 +208,8 @@ TMP_DIRS=${TMP_DIRS:-"/tmp /var/tmp"} MACHINE_ARCH=${MACHINE_ARCH:-$MACHINE} HOST_ARCH=${HOST_ARCH:-$MACHINE_ARCH} # we mount server:/share/arch/$SHARE_ARCH as /usr/local -SHARE_ARCH=${SHARE_ARCH:-$OS/$OSMAJOR.X/$HOST_ARCH} +SHARE_ARCH_DEFAULT=$OS/$OSMAJOR.X/$HOST_ARCH +SHARE_ARCH=${SHARE_ARCH:-$SHARE_ARCH_DEFAULT} LN=${LN:-ln} TR=${TR:-tr} Modified: head/contrib/bmake/suff.c ============================================================================== --- head/contrib/bmake/suff.c Thu Sep 8 23:49:47 2016 (r305632) +++ head/contrib/bmake/suff.c Fri Sep 9 01:09:39 2016 (r305633) @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $ */ +/* $NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $"; +static char rcsid[] = "$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else -__RCSID("$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $"); +__RCSID("$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -766,6 +766,8 @@ Suff_EndTransform(void *gnp, void *dummy { GNode *gn = (GNode *)gnp; + (void)dummy; + if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts)); if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) && @@ -809,7 +811,7 @@ Suff_EndTransform(void *gnp, void *dummy fprintf(debug_file, "transformation %s complete\n", gn->name); } - return(dummy ? 0 : 0); + return 0; } /*- @@ -1215,7 +1217,7 @@ SuffAddSrc(void *sp, void *lsp) #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "1 add %x %x to %x:", targ, s2, ls->l); + fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ls->l); Lst_ForEach(ls->l, PrintAddr, NULL); fprintf(debug_file, "\n"); #endif @@ -1233,7 +1235,7 @@ SuffAddSrc(void *sp, void *lsp) #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "2 add %x %x to %x:", targ, s2, ls->l); + fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ls->l); Lst_ForEach(ls->l, PrintAddr, NULL); fprintf(debug_file, "\n"); #endif @@ -1305,14 +1307,14 @@ SuffRemoveSrc(Lst l) free(s->pref); else { #ifdef DEBUG_SRC - LstNode ln = Lst_Member(s->parent->cp, s); - if (ln != NULL) - Lst_Remove(s->parent->cp, ln); + LstNode ln2 = Lst_Member(s->parent->cp, s); + if (ln2 != NULL) + Lst_Remove(s->parent->cp, ln2); #endif --s->parent->children; } #ifdef DEBUG_SRC - fprintf(debug_file, "free: [l=%x] p=%x %d\n", l, s, s->children); + fprintf(debug_file, "free: [l=%p] p=%p %d\n", l, s, s->children); Lst_Destroy(s->cp, NULL); #endif Lst_Remove(l, ln); @@ -1323,7 +1325,7 @@ SuffRemoveSrc(Lst l) } #ifdef DEBUG_SRC else { - fprintf(debug_file, "keep: [l=%x] p=%x %d: ", l, s, s->children); + fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children); Lst_ForEach(s->cp, PrintAddr, NULL); fprintf(debug_file, "\n"); } @@ -1372,7 +1374,7 @@ SuffFindThem(Lst srcs, Lst slst) */ if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) { #ifdef DEBUG_SRC - fprintf(debug_file, "remove %x from %x\n", s, srcs); + fprintf(debug_file, "remove %p from %p\n", s, srcs); #endif rs = s; break; @@ -1381,7 +1383,7 @@ SuffFindThem(Lst srcs, Lst slst) if ((ptr = Dir_FindFile(s->file, s->suff->searchPath)) != NULL) { rs = s; #ifdef DEBUG_SRC - fprintf(debug_file, "remove %x from %x\n", s, srcs); + fprintf(debug_file, "remove %p from %p\n", s, srcs); #endif free(ptr); break; @@ -1497,7 +1499,7 @@ SuffFindCmds(Src *targ, Lst slst) targ->children += 1; #ifdef DEBUG_SRC ret->cp = Lst_Init(FALSE); - fprintf(debug_file, "3 add %x %x\n", targ, ret); + fprintf(debug_file, "3 add %p %p\n", targ, ret); Lst_AtEnd(targ->cp, ret); #endif Lst_AtEnd(slst, ret); @@ -1616,7 +1618,7 @@ SuffExpandChildren(LstNode cln, GNode *p } free(freeIt); - } else if (*cp == '\\' && *cp != '\0') { + } else if (*cp == '\\' && cp[1] != '\0') { /* * Escaped something -- skip over it */ @@ -2597,8 +2599,10 @@ Suff_End(void) static int SuffPrintName(void *s, void *dummy) { + (void)dummy; + fprintf(debug_file, "%s ", ((Suff *)s)->name); - return (dummy ? 0 : 0); + return 0; } static int @@ -2608,6 +2612,8 @@ SuffPrintSuff(void *sp, void *dummy) int flags; int flag; + (void)dummy; + fprintf(debug_file, "# `%s' [%d] ", s->name, s->refCount); flags = s->flags; @@ -2640,7 +2646,7 @@ SuffPrintSuff(void *sp, void *dummy) fprintf(debug_file, "#\tSearch Path: "); Dir_PrintPath(s->searchPath); fputc('\n', debug_file); - return (dummy ? 0 : 0); + return 0; } static int @@ -2648,12 +2654,14 @@ SuffPrintTrans(void *tp, void *dummy) { GNode *t = (GNode *)tp; + (void)dummy; + fprintf(debug_file, "%-16s: ", t->name); Targ_PrintType(t->type); fputc('\n', debug_file); Lst_ForEach(t->commands, Targ_PrintCmd, NULL); fputc('\n', debug_file); - return(dummy ? 0 : 0); + return 0; } void Modified: head/usr.bin/bmake/Makefile ============================================================================== --- head/usr.bin/bmake/Makefile Thu Sep 8 23:49:47 2016 (r305632) +++ head/usr.bin/bmake/Makefile Fri Sep 9 01:09:39 2016 (r305633) @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $ +# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160606 +_MAKE_VERSION= 20160818 PROG?= ${.CURDIR:T}