Import bmake-20160604
Performace improvements for meta mode.
This commit is contained in:
parent
0366f1b527
commit
b63d9399ea
@ -1,3 +1,26 @@
|
||||
2016-06-04 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20160604
|
||||
Merge with NetBSD make, pick up
|
||||
o meta.c: missing filemon data is only relevant if we read a
|
||||
meta file.
|
||||
Also do not return oodate for a missing metafile if gn->path
|
||||
points to .CURDIR
|
||||
|
||||
2016-06-02 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20160602
|
||||
Merge with NetBSD make, pick up
|
||||
o cached_realpath(): avoid hitting filesystem more than necessary.
|
||||
o meta.c: refactor need_meta decision, add knobs for
|
||||
missing meta file and filemon data wrt out-of-datedness.
|
||||
|
||||
2016-05-28 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20160528
|
||||
|
||||
* boot-strap, make-bootstrap.sh.in: Makefile now uses _MAKE_VERSION
|
||||
|
||||
2016-05-12 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20160512
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $Id: Makefile,v 1.63 2016/05/12 20:34:46 sjg Exp $
|
||||
# $Id: Makefile,v 1.66 2016/06/04 22:21:15 sjg Exp $
|
||||
|
||||
# Base version on src date
|
||||
_MAKE_VERSION= 20160512
|
||||
_MAKE_VERSION= 20160604
|
||||
|
||||
PROG= bmake
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $
|
||||
.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 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 May 10, 2016
|
||||
.Dd June 2, 2016
|
||||
.Dt MAKE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -846,7 +846,7 @@ Can affect the mode that
|
||||
.Nm
|
||||
runs in.
|
||||
It can contain a number of keywords:
|
||||
.Bl -hang -width ignore-cmd
|
||||
.Bl -hang -width missing-filemon=bf.
|
||||
.It Pa compat
|
||||
Like
|
||||
.Fl B ,
|
||||
@ -870,6 +870,17 @@ will not create .meta files in
|
||||
This can be overridden by setting
|
||||
.Va bf
|
||||
to a value which represents True.
|
||||
.It Pa missing-meta= Ar bf
|
||||
If
|
||||
.Va bf
|
||||
is True, then a missing .meta file makes the target out-of-date.
|
||||
.It Pa missing-filemon= Ar bf
|
||||
If
|
||||
.Va bf
|
||||
is True, then missing filemon data makes the target out-of-date.
|
||||
.It Pa nofilemon
|
||||
Do not use
|
||||
.Xr filemon 4 .
|
||||
.It Pa env
|
||||
For debugging, it can be useful to include the environment
|
||||
in the .meta file.
|
||||
|
@ -531,37 +531,51 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
||||
mode that bbmmaakkee runs in. It can contain a number of key-
|
||||
words:
|
||||
|
||||
_c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" mode.
|
||||
_c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat"
|
||||
mode.
|
||||
|
||||
_m_e_t_a Puts bbmmaakkee into "meta" mode, where meta files
|
||||
are created for each target to capture the
|
||||
command run, the output generated and if
|
||||
filemon(4) is available, the system calls
|
||||
which are of interest to bbmmaakkee. The captured
|
||||
output can be very useful when diagnosing
|
||||
errors.
|
||||
_m_e_t_a Puts bbmmaakkee into "meta" mode, where
|
||||
meta files are created for each tar-
|
||||
get to capture the command run, the
|
||||
output generated and if filemon(4)
|
||||
is available, the system calls which
|
||||
are of interest to bbmmaakkee. The cap-
|
||||
tured output can be very useful when
|
||||
diagnosing errors.
|
||||
|
||||
_c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta files
|
||||
in `_._C_U_R_D_I_R'. This can be overridden by set-
|
||||
ting _b_f to a value which represents True.
|
||||
_c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta
|
||||
files in `_._C_U_R_D_I_R'. This can be
|
||||
overridden by setting _b_f to a value
|
||||
which represents True.
|
||||
|
||||
_e_n_v For debugging, it can be useful to include
|
||||
the environment in the .meta file.
|
||||
_m_i_s_s_i_n_g_-_m_e_t_a_= _b_f If _b_f is True, then a missing .meta
|
||||
file makes the target out-of-date.
|
||||
|
||||
_v_e_r_b_o_s_e If in "meta" mode, print a clue about the
|
||||
target being built. This is useful if the
|
||||
build is otherwise running silently. The
|
||||
message printed the value of:
|
||||
_._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X.
|
||||
_m_i_s_s_i_n_g_-_f_i_l_e_m_o_n_= _b_f If _b_f is True, then missing filemon
|
||||
data makes the target out-of-date.
|
||||
|
||||
_i_g_n_o_r_e_-_c_m_d Some makefiles have commands which are simply
|
||||
not stable. This keyword causes them to be
|
||||
ignored for determining whether a target is
|
||||
out of date in "meta" mode. See also
|
||||
..NNOOMMEETTAA__CCMMPP.
|
||||
_n_o_f_i_l_e_m_o_n Do not use filemon(4).
|
||||
|
||||
_s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is created,
|
||||
mark the target ..SSIILLEENNTT.
|
||||
_e_n_v For debugging, it can be useful to
|
||||
include the environment in the .meta
|
||||
file.
|
||||
|
||||
_v_e_r_b_o_s_e If in "meta" mode, print a clue
|
||||
about the target being built. This
|
||||
is useful if the build is otherwise
|
||||
running silently. The message
|
||||
printed the value of:
|
||||
_._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X.
|
||||
|
||||
_i_g_n_o_r_e_-_c_m_d Some makefiles have commands which
|
||||
are simply not stable. This keyword
|
||||
causes them to be ignored for deter-
|
||||
mining whether a target is out of
|
||||
date in "meta" mode. See also
|
||||
..NNOOMMEETTAA__CCMMPP.
|
||||
|
||||
_s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is
|
||||
created, mark the target ..SSIILLEENNTT.
|
||||
|
||||
_._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K
|
||||
In "meta" mode, provides a list of prefixes which match
|
||||
@ -1475,4 +1489,4 @@ BBUUGGSS
|
||||
|
||||
There is no way of escaping a space character in a filename.
|
||||
|
||||
NetBSD 5.1 May 10, 2016 NetBSD 5.1
|
||||
NetBSD 5.1 June 2, 2016 NetBSD 5.1
|
||||
|
@ -111,7 +111,7 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: boot-strap,v 1.48 2015/10/25 05:20:48 sjg Exp $
|
||||
# $Id: boot-strap,v 1.49 2016/05/29 00:09:14 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2001 Simon J. Gerraty
|
||||
#
|
||||
@ -451,7 +451,7 @@ op_all() {
|
||||
op_install
|
||||
else
|
||||
op_test
|
||||
MAKE_VERSION=`sed -n '/^MAKE_VERSION/ { s,.*= *,,;p; }' $srcdir/Makefile`
|
||||
MAKE_VERSION=`sed -n '/^_MAKE_VERSION/ { s,.*= *,,;p; }' $srcdir/Makefile`
|
||||
echo You can install by running:
|
||||
echo
|
||||
echo $0 $cmd_args op=install
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.245 2016/06/03 01:21:59 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.245 2016/06/03 01:21:59 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#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.244 2016/04/05 04:25:43 sjg Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.245 2016/06/03 01:21:59 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -1014,7 +1014,7 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* A relative path, canonicalize it.
|
||||
*/
|
||||
p1 = realpath(argv[0], mdpath);
|
||||
p1 = cached_realpath(argv[0], mdpath);
|
||||
if (!p1 || *p1 != '/' || stat(p1, &sb) < 0) {
|
||||
p1 = argv[0]; /* realpath failed */
|
||||
}
|
||||
@ -1884,6 +1884,40 @@ usage(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* realpath(3) can get expensive, cache results...
|
||||
*/
|
||||
char *
|
||||
cached_realpath(const char *pathname, char *resolved)
|
||||
{
|
||||
static GNode *cache;
|
||||
char *rp, *cp;
|
||||
|
||||
if (!pathname || !pathname[0])
|
||||
return NULL;
|
||||
|
||||
if (!cache) {
|
||||
cache = Targ_NewGN("Realpath");
|
||||
#ifndef DEBUG_REALPATH_CACHE
|
||||
cache->flags = INTERNAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
rp = Var_Value(pathname, cache, &cp);
|
||||
if (rp) {
|
||||
/* a hit */
|
||||
if (resolved)
|
||||
strlcpy(resolved, rp, MAXPATHLEN);
|
||||
else
|
||||
resolved = bmake_strdup(rp);
|
||||
} else {
|
||||
if ((rp = realpath(pathname, resolved))) {
|
||||
Var_Set(pathname, rp, cache, 0);
|
||||
}
|
||||
}
|
||||
return rp ? resolved : NULL;
|
||||
}
|
||||
|
||||
int
|
||||
PrintAddr(void *a, void *b)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ esac
|
||||
CC="@CC@"
|
||||
CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
|
||||
|
||||
MAKE_VERSION=`sed -n '/^MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile`
|
||||
MAKE_VERSION=`sed -n '/^_MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile`
|
||||
|
||||
MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
|
||||
-D@force_machine@MACHINE=\"@machine@\" -DMACHINE_ARCH=\"@machine_arch@\" \
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $
|
||||
.\" $NetBSD: make.1,v 1.259 2016/06/03 07:07:37 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 May 10, 2016
|
||||
.Dd June 2, 2016
|
||||
.Dt MAKE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -857,7 +857,7 @@ Can affect the mode that
|
||||
.Nm
|
||||
runs in.
|
||||
It can contain a number of keywords:
|
||||
.Bl -hang -width ignore-cmd
|
||||
.Bl -hang -width missing-filemon=bf.
|
||||
.It Pa compat
|
||||
Like
|
||||
.Fl B ,
|
||||
@ -881,6 +881,17 @@ will not create .meta files in
|
||||
This can be overridden by setting
|
||||
.Va bf
|
||||
to a value which represents True.
|
||||
.It Pa missing-meta= Ar bf
|
||||
If
|
||||
.Va bf
|
||||
is True, then a missing .meta file makes the target out-of-date.
|
||||
.It Pa missing-filemon= Ar bf
|
||||
If
|
||||
.Va bf
|
||||
is True, then missing filemon data makes the target out-of-date.
|
||||
.It Pa nofilemon
|
||||
Do not use
|
||||
.Xr filemon 4 .
|
||||
.It Pa env
|
||||
For debugging, it can be useful to include the environment
|
||||
in the .meta file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make.h,v 1.98 2016/02/18 18:29:14 christos Exp $ */
|
||||
/* $NetBSD: make.h,v 1.99 2016/06/03 01:21:59 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -199,6 +199,7 @@ typedef struct GNode {
|
||||
#define DONE_ALLSRC 0x40 /* We do it once only */
|
||||
#define CYCLE 0x1000 /* Used by MakePrintStatus */
|
||||
#define DONECYCLE 0x2000 /* Used by MakePrintStatus */
|
||||
#define INTERNAL 0x4000 /* Internal use only */
|
||||
enum enum_made {
|
||||
UNMADE, DEFERRED, REQUESTED, BEINGMADE,
|
||||
MADE, UPTODATE, ERROR, ABORTED
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: meta.c,v 1.57 2016/05/12 20:28:34 sjg Exp $ */
|
||||
/* $NetBSD: meta.c,v 1.60 2016/06/04 22:17:14 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Implement 'meta' mode.
|
||||
@ -73,6 +73,8 @@ static char *metaIgnorePathsStr; /* string storage for the list */
|
||||
Boolean useMeta = FALSE;
|
||||
static Boolean useFilemon = FALSE;
|
||||
static Boolean writeMeta = FALSE;
|
||||
static Boolean metaMissing = FALSE; /* oodate if missing */
|
||||
static Boolean filemonMissing = FALSE; /* oodate if missing */
|
||||
static Boolean metaEnv = FALSE; /* don't save env unless asked */
|
||||
static Boolean metaVerbose = FALSE;
|
||||
static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */
|
||||
@ -237,24 +239,13 @@ eat_dots(char *buf, size_t bufsz, int dots)
|
||||
static char *
|
||||
meta_name(struct GNode *gn, char *mname, size_t mnamelen,
|
||||
const char *dname,
|
||||
const char *tname)
|
||||
const char *tname,
|
||||
const char *cwd)
|
||||
{
|
||||
char buf[MAXPATHLEN];
|
||||
char cwd[MAXPATHLEN];
|
||||
char *rp;
|
||||
char *cp;
|
||||
char *tp;
|
||||
char *p[4]; /* >= number of possible uses */
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (!dname)
|
||||
dname = Var_Value(".OBJDIR", gn, &p[i++]);
|
||||
if (!tname)
|
||||
tname = Var_Value(TARGET, gn, &p[i++]);
|
||||
|
||||
if (realpath(dname, cwd))
|
||||
dname = cwd;
|
||||
|
||||
/*
|
||||
* Weed out relative paths from the target file name.
|
||||
@ -264,7 +255,7 @@ meta_name(struct GNode *gn, char *mname, size_t mnamelen,
|
||||
* basename as given to us.
|
||||
*/
|
||||
if ((cp = strrchr(tname, '/'))) {
|
||||
if (realpath(tname, buf)) {
|
||||
if (cached_realpath(tname, buf)) {
|
||||
if ((rp = strrchr(buf, '/'))) {
|
||||
rp++;
|
||||
cp++;
|
||||
@ -309,9 +300,6 @@ meta_name(struct GNode *gn, char *mname, size_t mnamelen,
|
||||
}
|
||||
}
|
||||
free(tp);
|
||||
for (i--; i >= 0; i--) {
|
||||
free(p[i]);
|
||||
}
|
||||
return (mname);
|
||||
}
|
||||
|
||||
@ -391,14 +379,78 @@ printCMD(void *cmdp, void *mfpp)
|
||||
*/
|
||||
#define SKIP_META_TYPE(_type) do { \
|
||||
if ((gn->type & __CONCAT(OP_, _type))) { \
|
||||
if (DEBUG(META)) { \
|
||||
if (verbose) { \
|
||||
fprintf(debug_file, "Skipping meta for %s: .%s\n", \
|
||||
gn->name, __STRING(_type)); \
|
||||
} \
|
||||
return (NULL); \
|
||||
return FALSE; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Do we need/want a .meta file ?
|
||||
*/
|
||||
static Boolean
|
||||
meta_needed(GNode *gn, const char *dname, const char *tname,
|
||||
char *objdir, int verbose)
|
||||
{
|
||||
struct stat fs;
|
||||
|
||||
if (verbose)
|
||||
verbose = DEBUG(META);
|
||||
|
||||
/* This may be a phony node which we don't want meta data for... */
|
||||
/* Skip .meta for .BEGIN, .END, .ERROR etc as well. */
|
||||
/* Or it may be explicitly flagged as .NOMETA */
|
||||
SKIP_META_TYPE(NOMETA);
|
||||
/* Unless it is explicitly flagged as .META */
|
||||
if (!(gn->type & OP_META)) {
|
||||
SKIP_META_TYPE(PHONY);
|
||||
SKIP_META_TYPE(SPECIAL);
|
||||
SKIP_META_TYPE(MAKE);
|
||||
}
|
||||
|
||||
/* Check if there are no commands to execute. */
|
||||
if (Lst_IsEmpty(gn->commands)) {
|
||||
if (verbose)
|
||||
fprintf(debug_file, "Skipping meta for %s: no commands\n",
|
||||
gn->name);
|
||||
return FALSE;
|
||||
}
|
||||
if ((gn->type & (OP_META|OP_SUBMAKE)) == OP_SUBMAKE) {
|
||||
/* OP_SUBMAKE is a bit too aggressive */
|
||||
if (Lst_ForEach(gn->commands, is_submake, gn)) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "Skipping meta for %s: .SUBMAKE\n",
|
||||
gn->name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* The object directory may not exist. Check it.. */
|
||||
if (stat(dname, &fs) != 0) {
|
||||
if (verbose)
|
||||
fprintf(debug_file, "Skipping meta for %s: no .OBJDIR\n",
|
||||
gn->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* make sure these are canonical */
|
||||
if (cached_realpath(dname, objdir))
|
||||
dname = objdir;
|
||||
|
||||
/* If we aren't in the object directory, don't create a meta file. */
|
||||
if (!metaCurdirOk && strcmp(curdir, dname) == 0) {
|
||||
if (verbose)
|
||||
fprintf(debug_file, "Skipping meta for %s: .OBJDIR == .CURDIR\n",
|
||||
gn->name);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static FILE *
|
||||
meta_create(BuildMon *pbm, GNode *gn)
|
||||
{
|
||||
@ -412,62 +464,17 @@ meta_create(BuildMon *pbm, GNode *gn)
|
||||
const char *cp;
|
||||
char *p[4]; /* >= possible uses */
|
||||
int i;
|
||||
struct stat fs;
|
||||
|
||||
|
||||
/* This may be a phony node which we don't want meta data for... */
|
||||
/* Skip .meta for .BEGIN, .END, .ERROR etc as well. */
|
||||
/* Or it may be explicitly flagged as .NOMETA */
|
||||
SKIP_META_TYPE(NOMETA);
|
||||
/* Unless it is explicitly flagged as .META */
|
||||
if (!(gn->type & OP_META)) {
|
||||
SKIP_META_TYPE(PHONY);
|
||||
SKIP_META_TYPE(SPECIAL);
|
||||
SKIP_META_TYPE(MAKE);
|
||||
}
|
||||
|
||||
mf.fp = NULL;
|
||||
|
||||
i = 0;
|
||||
|
||||
|
||||
dname = Var_Value(".OBJDIR", gn, &p[i++]);
|
||||
tname = Var_Value(TARGET, gn, &p[i++]);
|
||||
|
||||
/* The object directory may not exist. Check it.. */
|
||||
if (stat(dname, &fs) != 0) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "Skipping meta for %s: no .OBJDIR\n",
|
||||
gn->name);
|
||||
goto out;
|
||||
}
|
||||
/* Check if there are no commands to execute. */
|
||||
if (Lst_IsEmpty(gn->commands)) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "Skipping meta for %s: no commands\n",
|
||||
gn->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* make sure these are canonical */
|
||||
if (realpath(dname, objdir))
|
||||
dname = objdir;
|
||||
|
||||
/* If we aren't in the object directory, don't create a meta file. */
|
||||
if (!metaCurdirOk && strcmp(curdir, dname) == 0) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "Skipping meta for %s: .OBJDIR == .CURDIR\n",
|
||||
gn->name);
|
||||
/* if this succeeds objdir is realpath of dname */
|
||||
if (!meta_needed(gn, dname, tname, objdir, TRUE))
|
||||
goto out;
|
||||
}
|
||||
if (!(gn->type & OP_META)) {
|
||||
/* We do not generate .meta files for sub-makes */
|
||||
if (Lst_ForEach(gn->commands, is_submake, gn)) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "Skipping meta for %s: .MAKE\n",
|
||||
gn->name);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
dname = objdir;
|
||||
|
||||
if (metaVerbose) {
|
||||
char *mp;
|
||||
@ -492,7 +499,7 @@ meta_create(BuildMon *pbm, GNode *gn)
|
||||
goto out;
|
||||
|
||||
fname = meta_name(gn, pbm->meta_fname, sizeof(pbm->meta_fname),
|
||||
dname, tname);
|
||||
dname, tname, objdir);
|
||||
|
||||
#ifdef DEBUG_META_MODE
|
||||
if (DEBUG(META))
|
||||
@ -561,6 +568,10 @@ meta_init(void)
|
||||
}
|
||||
|
||||
|
||||
#define get_mode_bf(bf, token) \
|
||||
if ((cp = strstr(make_mode, token))) \
|
||||
bf = boolValue(&cp[sizeof(token) - 1])
|
||||
|
||||
/*
|
||||
* Initialization we need after reading makefiles.
|
||||
*/
|
||||
@ -583,17 +594,13 @@ meta_mode_init(const char *make_mode)
|
||||
writeMeta = FALSE;
|
||||
if (strstr(make_mode, "nofilemon"))
|
||||
useFilemon = FALSE;
|
||||
if ((cp = strstr(make_mode, "curdirok="))) {
|
||||
metaCurdirOk = boolValue(&cp[9]);
|
||||
}
|
||||
if ((cp = strstr(make_mode, "silent="))) {
|
||||
metaSilent = boolValue(&cp[7]);
|
||||
}
|
||||
if (strstr(make_mode, "ignore-cmd"))
|
||||
metaIgnoreCMDs = TRUE;
|
||||
/* for backwards compatability */
|
||||
Var_Set(".MAKE.META_CREATED", "${.MAKE.META.CREATED}", VAR_GLOBAL, 0);
|
||||
Var_Set(".MAKE.META_FILES", "${.MAKE.META.FILES}", VAR_GLOBAL, 0);
|
||||
if (useFilemon)
|
||||
get_mode_bf(filemonMissing, "missing-filemon=");
|
||||
get_mode_bf(metaCurdirOk, "curdirok=");
|
||||
get_mode_bf(metaMissing, "missing-meta=");
|
||||
get_mode_bf(metaSilent, "silent=");
|
||||
}
|
||||
if (metaVerbose && !Var_Exists(MAKE_META_PREFIX, VAR_GLOBAL)) {
|
||||
/*
|
||||
@ -921,6 +928,8 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
char fname1[MAXPATHLEN];
|
||||
char fname2[MAXPATHLEN];
|
||||
char fname3[MAXPATHLEN];
|
||||
const char *dname;
|
||||
const char *tname;
|
||||
char *p;
|
||||
char *cp;
|
||||
char *link_src;
|
||||
@ -930,10 +939,23 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
FILE *fp;
|
||||
Boolean needOODATE = FALSE;
|
||||
Lst missingFiles;
|
||||
|
||||
char *pa[4]; /* >= possible uses */
|
||||
int i;
|
||||
int have_filemon = FALSE;
|
||||
|
||||
if (oodate)
|
||||
return oodate; /* we're done */
|
||||
|
||||
i = 0;
|
||||
|
||||
dname = Var_Value(".OBJDIR", gn, &pa[i++]);
|
||||
tname = Var_Value(TARGET, gn, &pa[i++]);
|
||||
|
||||
/* if this succeeds fname3 is realpath of dname */
|
||||
if (!meta_needed(gn, dname, tname, fname3, FALSE))
|
||||
goto oodate_out;
|
||||
dname = fname3;
|
||||
|
||||
missingFiles = Lst_Init(FALSE);
|
||||
|
||||
/*
|
||||
@ -944,7 +966,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
*/
|
||||
Make_DoAllVar(gn);
|
||||
|
||||
meta_name(gn, fname, sizeof(fname), NULL, NULL);
|
||||
meta_name(gn, fname, sizeof(fname), dname, tname, dname);
|
||||
|
||||
#ifdef DEBUG_META_MODE
|
||||
if (DEBUG(META))
|
||||
@ -957,7 +979,6 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
int lineno = 0;
|
||||
int lastpid = 0;
|
||||
int pid;
|
||||
int f = 0;
|
||||
int x;
|
||||
LstNode ln;
|
||||
struct stat fs;
|
||||
@ -996,13 +1017,13 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
link_src = NULL;
|
||||
move_target = NULL;
|
||||
/* Find the start of the build monitor section. */
|
||||
if (!f) {
|
||||
if (!have_filemon) {
|
||||
if (strncmp(buf, "-- filemon", 10) == 0) {
|
||||
f = 1;
|
||||
have_filemon = TRUE;
|
||||
continue;
|
||||
}
|
||||
if (strncmp(buf, "# buildmon", 10) == 0) {
|
||||
f = 1;
|
||||
have_filemon = TRUE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1014,7 +1035,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
fprintf(debug_file, "%s: %d: %s\n", fname, lineno, buf);
|
||||
#endif
|
||||
strsep(&p, " ");
|
||||
if (f) {
|
||||
if (have_filemon) {
|
||||
/*
|
||||
* We are in the 'filemon' output section.
|
||||
* Each record from filemon follows the general form:
|
||||
@ -1239,7 +1260,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
* they are _expected_ to change.
|
||||
*/
|
||||
if (*p == '/') {
|
||||
realpath(p, fname1); /* clean it up */
|
||||
cached_realpath(p, fname1); /* clean it up */
|
||||
if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) {
|
||||
#ifdef DEBUG_META_MODE
|
||||
if (DEBUG(META))
|
||||
@ -1324,7 +1345,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
oodate = TRUE;
|
||||
} else if (S_ISDIR(fs.st_mode)) {
|
||||
/* Update the latest directory. */
|
||||
realpath(p, latestdir);
|
||||
cached_realpath(p, latestdir);
|
||||
}
|
||||
} else if (errno == ENOENT && *p == '/' &&
|
||||
strncmp(p, cwd, cwdlen) != 0) {
|
||||
@ -1434,12 +1455,27 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
fname, (char *)Lst_Datum(Lst_First(missingFiles)));
|
||||
oodate = TRUE;
|
||||
}
|
||||
} else {
|
||||
if ((gn->type & OP_META)) {
|
||||
if (!oodate && !have_filemon && filemonMissing) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "%s: required but missing\n", fname);
|
||||
fprintf(debug_file, "%s: missing filemon data\n", fname);
|
||||
oodate = TRUE;
|
||||
}
|
||||
} else {
|
||||
if (writeMeta && metaMissing) {
|
||||
cp = NULL;
|
||||
|
||||
/* if target is in .CURDIR we do not need a meta file */
|
||||
if (gn->path && (cp = strrchr(gn->path, '/')) && cp > gn->path) {
|
||||
if (strncmp(curdir, gn->path, (cp - gn->path)) != 0) {
|
||||
cp = NULL; /* not in .CURDIR */
|
||||
}
|
||||
}
|
||||
if (!cp) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "%s: required but missing\n", fname);
|
||||
oodate = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Lst_Destroy(missingFiles, (FreeProc *)free);
|
||||
@ -1454,6 +1490,11 @@ meta_oodate(GNode *gn, Boolean oodate)
|
||||
Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn, 0);
|
||||
free(cp);
|
||||
}
|
||||
|
||||
oodate_out:
|
||||
for (i--; i >= 0; i--) {
|
||||
free(pa[i]);
|
||||
}
|
||||
return oodate;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
2016-06-02 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20160602
|
||||
* meta.autodep.mk: when passing META_FILES to gendirdeps.mk
|
||||
do not apply :T to META_XTRAS
|
||||
patch from Bryan Drewery at FreeBSD.org.
|
||||
|
||||
2016-05-30 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20160530
|
||||
* meta.stage.mk: we assume ${CLEANFILES} gets .NOPATH
|
||||
make it so.
|
||||
|
||||
2016-05-12 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20160512
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: dpadd.mk,v 1.21 2016/05/18 20:54:55 sjg Exp $
|
||||
# $Id: dpadd.mk,v 1.22 2016/05/31 23:30:59 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2004, Simon J. Gerraty
|
||||
#
|
||||
@ -100,7 +100,7 @@ __dpadd_libs := ${DPADD:M*/lib*}
|
||||
|
||||
# Order -L's to search ours first.
|
||||
# Avoids picking up old versions already installed.
|
||||
__dpadd_libdirs := ${__dpadd_libs}:R:H:S/^/-L/g:O:u:N-L}
|
||||
__dpadd_libdirs := ${__dpadd_libs:R:H:S/^/-L/g:O:u:N-L}
|
||||
LDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*}
|
||||
LDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*:N-L${HOST_LIBDIR:U/usr/lib}}
|
||||
.if defined(HOST_LIBDIR) && ${HOST_LIBDIR} != "/usr/lib"
|
||||
|
@ -55,7 +55,7 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: install-mk,v 1.126 2016/05/18 20:54:55 sjg Exp $
|
||||
# $Id: install-mk,v 1.128 2016/06/03 17:22:32 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1994 Simon J. Gerraty
|
||||
#
|
||||
@ -70,7 +70,7 @@
|
||||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
MK_VERSION=20160512
|
||||
MK_VERSION=20160602
|
||||
OWNER=
|
||||
GROUP=
|
||||
MODE=444
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: meta.autodep.mk,v 1.44 2016/04/07 17:00:38 sjg Exp $
|
||||
# $Id: meta.autodep.mk,v 1.45 2016/06/03 17:22:32 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||
@ -266,7 +266,7 @@ ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.MET
|
||||
DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \
|
||||
MAKESYSPATH=${_makesyspath} \
|
||||
${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE} \
|
||||
META_FILES='${META_XTRAS:T:O:u} ${META_FILES:T:O:u:${META_FILE_FILTER:ts:}}')
|
||||
META_FILES='${META_XTRAS:O:u} ${META_FILES:T:O:u:${META_FILE_FILTER:ts:}}')
|
||||
@test -s $@ && touch $@; :
|
||||
.endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: meta.stage.mk,v 1.44 2016/03/16 18:21:23 sjg Exp $
|
||||
# $Id: meta.stage.mk,v 1.45 2016/05/26 03:59:09 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2011, Simon J. Gerraty
|
||||
#
|
||||
@ -270,6 +270,8 @@ beforeinstall: .dirdep
|
||||
.NOPATH: ${STAGE_FILES}
|
||||
|
||||
.if !empty(STAGE_TARGETS)
|
||||
.NOPATH: ${CLEANFILES}
|
||||
|
||||
MK_STALE_STAGED?= no
|
||||
.if ${MK_STALE_STAGED} == "yes"
|
||||
all: stale_staged
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nonints.h,v 1.72 2016/02/18 20:25:08 sjg Exp $ */
|
||||
/* $NetBSD: nonints.h,v 1.73 2016/06/03 01:21:59 sjg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -122,6 +122,7 @@ void execError(const char *, const char *);
|
||||
char *getTmpdir(void);
|
||||
Boolean s2Boolean(const char *, Boolean);
|
||||
Boolean getBoolean(const char *, Boolean);
|
||||
char *cached_realpath(const char *, char *);
|
||||
|
||||
/* parse.c */
|
||||
void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.207 2016/03/11 15:12:39 matthias Exp $ */
|
||||
/* $NetBSD: var.c,v 1.208 2016/06/03 01:21:59 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.207 2016/03/11 15:12:39 matthias Exp $";
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.208 2016/06/03 01:21:59 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.207 2016/03/11 15:12:39 matthias Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.208 2016/06/03 01:21:59 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -530,7 +530,7 @@ VarAdd(const char *name, const char *val, GNode *ctxt)
|
||||
h = Hash_CreateEntry(&ctxt->context, name, NULL);
|
||||
Hash_SetValue(h, v);
|
||||
v->name = h->name;
|
||||
if (DEBUG(VAR)) {
|
||||
if (DEBUG(VAR) && (ctxt->flags & INTERNAL) == 0) {
|
||||
fprintf(debug_file, "%s:%s = %s\n", ctxt->name, name, val);
|
||||
}
|
||||
}
|
||||
@ -1950,7 +1950,7 @@ VarRealpath(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
Buf_AddByte(buf, vpstate->varSpace);
|
||||
}
|
||||
addSpace = TRUE;
|
||||
rp = realpath(word, rbuf);
|
||||
rp = cached_realpath(word, rbuf);
|
||||
if (rp && *rp == '/' && stat(rp, &st) == 0)
|
||||
word = rp;
|
||||
|
||||
|
@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
|
||||
CLEANDIRS+= FreeBSD
|
||||
CLEANFILES+= bootstrap
|
||||
|
||||
# $Id: Makefile,v 1.63 2016/05/12 20:34:46 sjg Exp $
|
||||
# $Id: Makefile,v 1.66 2016/06/04 22:21:15 sjg Exp $
|
||||
|
||||
# Base version on src date
|
||||
_MAKE_VERSION= 20160512
|
||||
_MAKE_VERSION= 20160604
|
||||
|
||||
PROG?= ${.CURDIR:T}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user