aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile4
-rw-r--r--bmake.158
-rw-r--r--bmake.cat140
-rw-r--r--buf.h8
-rw-r--r--dir.h8
-rw-r--r--hash.h8
-rw-r--r--main.c172
-rw-r--r--make.158
-rw-r--r--meta.c19
-rw-r--r--mk/ChangeLog19
-rw-r--r--mk/dirdeps.mk12
-rw-r--r--mk/install-mk4
-rw-r--r--mk/lib.mk47
-rw-r--r--mk/meta.stage.mk79
-rw-r--r--mk/meta.sys.mk4
-rwxr-xr-xmk/meta2deps.py15
-rw-r--r--mk/own.mk9
-rw-r--r--sprite.h8
19 files changed, 380 insertions, 205 deletions
diff --git a/ChangeLog b/ChangeLog
index 37d3e6e32ba9..424cfe20cd8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-07-11 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * Makefile (_MAKE_VERSION): 20170711
+ forgot to update after merge on 20170708 ;-)
+ o main.c: refactor to reduce size of main function.
+ add -v option to always fully expand values.
+ o meta.c: ensure command output in meta file has ending newline
+ even when filemon not being used.
+ When matching ${.MAKE.META.IGNORE_PATTERNS} do not use
+ pathname via ':L' since any ':' in pathname breaks that.
+ Instead set a '${.p.}' to pathname in the target context and
+ use that.
+
2017-05-10 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170510
diff --git a/Makefile b/Makefile
index 1ded36d5170b..8cfe8b488f9f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-# $Id: Makefile,v 1.92 2017/05/10 22:29:04 sjg Exp $
+# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $
# Base version on src date
-_MAKE_VERSION= 20170510
+_MAKE_VERSION= 20170711
PROG= bmake
diff --git a/bmake.1 b/bmake.1
index 3bad1e7316a0..03747459a967 100644
--- a/bmake.1
+++ b/bmake.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $
+.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34: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 February 1, 2017
+.Dd June 22, 2017
.Dt BMAKE 1
.Os
.Sh NAME
@@ -48,6 +48,7 @@
.Op Fl m Ar directory
.Op Fl T Ar file
.Op Fl V Ar variable
+.Op Fl v Ar variable
.Op Ar variable=value
.Op Ar target ...
.Sh DESCRIPTION
@@ -206,7 +207,9 @@ Print debugging information about target list maintenance.
.It Ar V
Force the
.Fl V
-option to print raw values of variables.
+option to print raw values of variables, overriding the default behavior
+set via
+.Va .MAKE.EXPAND_VARIABLES .
.It Ar v
Print debugging information about variable assignment.
.It Ar x
@@ -334,20 +337,39 @@ for each job started and completed.
Rather than re-building a target as specified in the makefile, create it
or update its modification time to make it appear up-to-date.
.It Fl V Ar variable
-Print
-.Nm Ns 's
-idea of the value of
-.Ar variable ,
-in the global context.
+Print the value of
+.Ar variable .
Do not build any targets.
Multiple instances of this option may be specified;
the variables will be printed one per line,
with a blank line for each null or undefined variable.
+The value printed is extracted from the global context after all
+makefiles have been read.
+By default, the raw variable contents (which may
+include additional unexpanded variable references) are shown.
If
.Ar variable
contains a
.Ql \&$
-then the value will be expanded before printing.
+then the value will be recursively expanded to its complete resultant
+text before printing.
+The expanded value will also be printed if
+.Va .MAKE.EXPAND_VARIABLES
+is set to true and
+the
+.Fl dV
+option has not been used to override it.
+Note that loop-local and target-local variables, as well as values
+taken temporarily by global variables during makefile processing, are
+not accessible via this option.
+The
+.Fl dv
+debug mode can be used to see these at the cost of generating
+substantial extraneous output.
+.It Fl v Ar variable
+Like
+.Fl V
+but the variable is always expanded to its complete value.
.It Fl W
Treat any warnings during makefile parsing as errors.
.It Fl w
@@ -657,7 +679,7 @@ The seven local variables are as follows:
.Bl -tag -width ".ARCHIVE" -offset indent
.It Va .ALLSRC
The list of all sources for this target; also known as
-.Ql Va \&\*[Gt] .
+.Ql Va \&> .
.It Va .ARCHIVE
The name of the archive file; also known as
.Ql Va \&! .
@@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the source from which the
target is to be transformed (the
.Dq implied
source); also known as
-.Ql Va \&\*[Lt] .
+.Ql Va \&< .
It is not defined in explicit rules.
.It Va .MEMBER
The name of the archive member; also known as
@@ -691,9 +713,9 @@ in archive member rules.
.El
.Pp
The shorter forms
-.Ql ( Va \*[Gt] ,
+.Ql ( Va > ,
.Ql Va \&! ,
-.Ql Va \*[Lt] ,
+.Ql Va < ,
.Ql Va % ,
.Ql Va \&? ,
.Ql Va * ,
@@ -776,6 +798,10 @@ from which generated dependencies are read.
A boolean that controls the default behavior of the
.Fl V
option.
+If true, variable values printed with
+.Fl V
+are fully expanded; if false, the raw variable contents (which may
+include additional unexpanded variable references) are shown.
.It Va .MAKE.EXPORTED
The list of variables exported by
.Nm .
@@ -1287,7 +1313,7 @@ it is anchored at the end of each word.
Inside
.Ar new_string ,
an ampersand
-.Pq Ql \*[Am]
+.Pq Ql &
is replaced by
.Ar old_string
(without any
@@ -1751,7 +1777,7 @@ may be any one of the following:
.Bl -tag -width "Cm XX"
.It Cm \&|\&|
Logical OR.
-.It Cm \&\*[Am]\*[Am]
+.It Cm \&&&
Logical
.Tn AND ;
of higher precedence than
@@ -1768,7 +1794,7 @@ The boolean operator
may be used to logically negate an entire
conditional.
It is of higher precedence than
-.Ql Ic \&\*[Am]\*[Am] .
+.Ql Ic \&&& .
.Pp
The value of
.Ar expression
diff --git a/bmake.cat1 b/bmake.cat1
index bd98e5b3b245..1b6294219f00 100644
--- a/bmake.cat1
+++ b/bmake.cat1
@@ -6,8 +6,8 @@ NNAAMMEE
SSYYNNOOPPSSIISS
bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s]
[--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s]
- [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e]
- [_t_a_r_g_e_t _._._.]
+ [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e]
+ [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.]
DDEESSCCRRIIPPTTIIOONN
bbmmaakkee is a program designed to simplify the maintenance of other pro-
@@ -118,7 +118,9 @@ DDEESSCCRRIIPPTTIIOONN
_t Print debugging information about target list mainte-
nance.
- _V Force the --VV option to print raw values of variables.
+ _V Force the --VV option to print raw values of variables,
+ overriding the default behavior set via
+ _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S.
_v Print debugging information about variable assignment.
@@ -209,12 +211,25 @@ DDEESSCCRRIIPPTTIIOONN
to-date.
--VV _v_a_r_i_a_b_l_e
- Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con-
- text. Do not build any targets. Multiple instances of this
- option may be specified; the variables will be printed one per
- line, with a blank line for each null or undefined variable. If
- _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before
- printing.
+ Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple
+ instances of this option may be specified; the variables will be
+ printed one per line, with a blank line for each null or unde-
+ fined variable. The value printed is extracted from the global
+ context after all makefiles have been read. By default, the raw
+ variable contents (which may include additional unexpanded vari-
+ able references) are shown. If _v_a_r_i_a_b_l_e contains a `$' then the
+ value will be recursively expanded to its complete resultant text
+ before printing. The expanded value will also be printed if
+ _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not
+ been used to override it. Note that loop-local and target-local
+ variables, as well as values taken temporarily by global vari-
+ ables during makefile processing, are not accessible via this
+ option. The --ddvv debug mode can be used to see these at the cost
+ of generating substantial extraneous output.
+
+ --vv _v_a_r_i_a_b_l_e
+ Like --VV but the variable is always expanded to its complete
+ value.
--WW Treat any warnings during makefile parsing as errors.
@@ -488,7 +503,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
_._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S
A boolean that controls the default behavior of the --VV
- option.
+ option. If true, variable values printed with --VV are
+ fully expanded; if false, the raw variable contents
+ (which may include additional unexpanded variable refer-
+ ences) are shown.
_._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee.
@@ -1523,4 +1541,4 @@ BBUUGGSS
There is no way of escaping a space character in a filename.
-NetBSD 7.1_RC1 February 1, 2017 NetBSD 7.1_RC1
+NetBSD 7.1_RC1 June 22, 2017 NetBSD 7.1_RC1
diff --git a/buf.h b/buf.h
index 25be67d79afb..7bd2d2b7940b 100644
--- a/buf.h
+++ b/buf.h
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.h,v 1.17 2012/04/24 20:26:58 sjg Exp $ */
+/* $NetBSD: buf.h,v 1.19 2017/05/31 22:02:06 maya Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -77,8 +77,8 @@
* Header for users of the buf library.
*/
-#ifndef _BUF_H
-#define _BUF_H
+#ifndef MAKE_BUF_H
+#define MAKE_BUF_H
typedef char Byte;
@@ -116,4 +116,4 @@ void Buf_Init(Buffer *, int);
Byte *Buf_Destroy(Buffer *, Boolean);
Byte *Buf_DestroyCompact(Buffer *);
-#endif /* _BUF_H */
+#endif /* MAKE_BUF_H */
diff --git a/dir.h b/dir.h
index aa004504a5bc..52ab35e2fd25 100644
--- a/dir.h
+++ b/dir.h
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.h,v 1.15 2012/04/07 18:29:08 christos Exp $ */
+/* $NetBSD: dir.h,v 1.18 2017/05/31 22:02:06 maya Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -75,8 +75,8 @@
/* dir.h --
*/
-#ifndef _DIR
-#define _DIR
+#ifndef MAKE_DIR_H
+#define MAKE_DIR_H
typedef struct Path {
char *name; /* Name of directory */
@@ -105,4 +105,4 @@ void Dir_PrintPath(Lst);
void Dir_Destroy(void *);
void * Dir_CopyDir(void *);
-#endif /* _DIR */
+#endif /* MAKE_DIR_H */
diff --git a/hash.h b/hash.h
index 0e3d22dc317e..8ab6ffd4f556 100644
--- a/hash.h
+++ b/hash.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hash.h,v 1.11 2016/06/07 00:40:00 sjg Exp $ */
+/* $NetBSD: hash.h,v 1.12 2017/05/31 21:07:03 maya Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -78,8 +78,8 @@
* which maintains hash tables.
*/
-#ifndef _HASH
-#define _HASH
+#ifndef _HASH_H
+#define _HASH_H
/*
* The following defines one entry in the hash table.
@@ -146,4 +146,4 @@ void Hash_DeleteEntry(Hash_Table *, Hash_Entry *);
Hash_Entry *Hash_EnumFirst(Hash_Table *, Hash_Search *);
Hash_Entry *Hash_EnumNext(Hash_Search *);
-#endif /* _HASH */
+#endif /* _HASH_H */
diff --git a/main.c b/main.c
index 9c52fd210d88..cca44c5b4648 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $ */
+/* $NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos 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.265 2017/05/10 22:26:14 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -159,7 +159,9 @@ Boolean deleteOnError; /* .DELETE_ON_ERROR: set */
static Boolean noBuiltins; /* -r flag */
static Lst makefiles; /* ordered list of makefiles to read */
-static Boolean printVars; /* print value of one or more vars */
+static int printVars; /* -[vV] argument */
+#define COMPAT_VARS 1
+#define EXPAND_VARS 2
static Lst variables; /* list of variables to print */
int maxJobs; /* -j argument */
static int maxJobTokens; /* -j argument */
@@ -421,7 +423,7 @@ MainParseArgs(int argc, char **argv)
Boolean inOption, dashDash = FALSE;
char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */
-#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstw"
+#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstv:w"
/* Can't actually use getopt(3) because rescanning is not portable */
getopt_def = OPTFLAGS;
@@ -546,8 +548,9 @@ rearg:
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
break;
case 'V':
+ case 'v':
if (argvalue == NULL) goto noarg;
- printVars = TRUE;
+ printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
(void)Lst_AtEnd(variables, argvalue);
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
@@ -877,6 +880,89 @@ MakeMode(const char *mode)
free(mp);
}
+static void
+doPrintVars(void)
+{
+ LstNode ln;
+ Boolean expandVars;
+
+ if (printVars == EXPAND_VARS)
+ expandVars = TRUE;
+ else if (debugVflag)
+ expandVars = FALSE;
+ else
+ expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
+
+ for (ln = Lst_First(variables); ln != NULL;
+ ln = Lst_Succ(ln)) {
+ char *var = (char *)Lst_Datum(ln);
+ char *value;
+ char *p1;
+
+ if (strchr(var, '$')) {
+ value = p1 = Var_Subst(NULL, var, VAR_GLOBAL,
+ VARF_WANTRES);
+ } else if (expandVars) {
+ char tmp[128];
+ int len = snprintf(tmp, sizeof(tmp), "${%s}", var);
+
+ if (len >= (int)sizeof(tmp))
+ Fatal("%s: variable name too big: %s",
+ progname, var);
+ value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
+ VARF_WANTRES);
+ } else {
+ value = Var_Value(var, VAR_GLOBAL, &p1);
+ }
+ printf("%s\n", value ? value : "");
+ free(p1);
+ }
+}
+
+static Boolean
+runTargets(void)
+{
+ Lst targs; /* target nodes to create -- passed to Make_Init */
+ Boolean outOfDate; /* FALSE if all targets up to date */
+
+ /*
+ * Have now read the entire graph and need to make a list of
+ * targets to create. If none was given on the command line,
+ * we consult the parsing module to find the main target(s)
+ * to create.
+ */
+ if (Lst_IsEmpty(create))
+ targs = Parse_MainName();
+ else
+ targs = Targ_FindList(create, TARG_CREATE);
+
+ if (!compatMake) {
+ /*
+ * Initialize job module before traversing the graph
+ * now that any .BEGIN and .END targets have been read.
+ * This is done only if the -q flag wasn't given
+ * (to prevent the .BEGIN from being executed should
+ * it exist).
+ */
+ if (!queryFlag) {
+ Job_Init();
+ jobsRunning = TRUE;
+ }
+
+ /* Traverse the graph, checking on all the targets */
+ outOfDate = Make_Run(targs);
+ } else {
+ /*
+ * Compat_Init will take care of creating all the
+ * targets as well as initializing the module.
+ */
+ Compat_Run(targs);
+ outOfDate = FALSE;
+ }
+ Lst_Destroy(targs, NULL);
+ return outOfDate;
+}
+
/*-
* main --
* The main function, for obvious reasons. Initializes variables
@@ -897,8 +983,7 @@ MakeMode(const char *mode)
int
main(int argc, char **argv)
{
- Lst targs; /* target nodes to create -- passed to Make_Init */
- Boolean outOfDate = FALSE; /* FALSE if all targets up to date */
+ Boolean outOfDate; /* FALSE if all targets up to date */
struct stat sb, sa;
char *p1, *path;
char mdpath[MAXPATHLEN];
@@ -1027,7 +1112,7 @@ main(int argc, char **argv)
create = Lst_Init(FALSE);
makefiles = Lst_Init(FALSE);
- printVars = FALSE;
+ printVars = 0;
debugVflag = FALSE;
variables = Lst_Init(FALSE);
beSilent = FALSE; /* Print commands as executed */
@@ -1406,73 +1491,13 @@ main(int argc, char **argv)
/* print the values of any variables requested by the user */
if (printVars) {
- LstNode ln;
- Boolean expandVars;
-
- if (debugVflag)
- expandVars = FALSE;
- else
- expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
- for (ln = Lst_First(variables); ln != NULL;
- ln = Lst_Succ(ln)) {
- char *var = (char *)Lst_Datum(ln);
- char *value;
-
- if (strchr(var, '$')) {
- value = p1 = Var_Subst(NULL, var, VAR_GLOBAL,
- VARF_WANTRES);
- } else if (expandVars) {
- char tmp[128];
-
- if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp)))
- Fatal("%s: variable name too big: %s",
- progname, var);
- value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
- VARF_WANTRES);
- } else {
- value = Var_Value(var, VAR_GLOBAL, &p1);
- }
- printf("%s\n", value ? value : "");
- free(p1);
- }
+ doPrintVars();
+ outOfDate = FALSE;
} else {
- /*
- * Have now read the entire graph and need to make a list of
- * targets to create. If none was given on the command line,
- * we consult the parsing module to find the main target(s)
- * to create.
- */
- if (Lst_IsEmpty(create))
- targs = Parse_MainName();
- else
- targs = Targ_FindList(create, TARG_CREATE);
-
- if (!compatMake) {
- /*
- * Initialize job module before traversing the graph
- * now that any .BEGIN and .END targets have been read.
- * This is done only if the -q flag wasn't given
- * (to prevent the .BEGIN from being executed should
- * it exist).
- */
- if (!queryFlag) {
- Job_Init();
- jobsRunning = TRUE;
- }
-
- /* Traverse the graph, checking on all the targets */
- outOfDate = Make_Run(targs);
- } else {
- /*
- * Compat_Init will take care of creating all the
- * targets as well as initializing the module.
- */
- Compat_Run(targs);
- }
+ outOfDate = runTargets();
}
#ifdef CLEANUP
- Lst_Destroy(targs, NULL);
Lst_Destroy(variables, NULL);
Lst_Destroy(makefiles, NULL);
Lst_Destroy(create, (FreeProc *)free);
@@ -1931,7 +1956,8 @@ usage(void)
"usage: %s [-BeikNnqrstWwX] \n\
[-C directory] [-D variable] [-d flags] [-f makefile]\n\
[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n\
- [-V variable] [variable=value] [target ...]\n", progname);
+ [-V variable] [-v variable] [variable=value] [target ...]\n",
+ progname);
exit(2);
}
diff --git a/make.1 b/make.1
index a461909e87ee..8da5f679e6f2 100644
--- a/make.1
+++ b/make.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $
+.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34: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 February 1, 2017
+.Dd June 22, 2017
.Dt MAKE 1
.Os
.Sh NAME
@@ -48,6 +48,7 @@
.Op Fl m Ar directory
.Op Fl T Ar file
.Op Fl V Ar variable
+.Op Fl v Ar variable
.Op Ar variable=value
.Op Ar target ...
.Sh DESCRIPTION
@@ -206,7 +207,9 @@ Print debugging information about target list maintenance.
.It Ar V
Force the
.Fl V
-option to print raw values of variables.
+option to print raw values of variables, overriding the default behavior
+set via
+.Va .MAKE.EXPAND_VARIABLES .
.It Ar v
Print debugging information about variable assignment.
.It Ar x
@@ -334,20 +337,39 @@ for each job started and completed.
Rather than re-building a target as specified in the makefile, create it
or update its modification time to make it appear up-to-date.
.It Fl V Ar variable
-Print
-.Nm Ns 's
-idea of the value of
-.Ar variable ,
-in the global context.
+Print the value of
+.Ar variable .
Do not build any targets.
Multiple instances of this option may be specified;
the variables will be printed one per line,
with a blank line for each null or undefined variable.
+The value printed is extracted from the global context after all
+makefiles have been read.
+By default, the raw variable contents (which may
+include additional unexpanded variable references) are shown.
If
.Ar variable
contains a
.Ql \&$
-then the value will be expanded before printing.
+then the value will be recursively expanded to its complete resultant
+text before printing.
+The expanded value will also be printed if
+.Va .MAKE.EXPAND_VARIABLES
+is set to true and
+the
+.Fl dV
+option has not been used to override it.
+Note that loop-local and target-local variables, as well as values
+taken temporarily by global variables during makefile processing, are
+not accessible via this option.
+The
+.Fl dv
+debug mode can be used to see these at the cost of generating
+substantial extraneous output.
+.It Fl v Ar variable
+Like
+.Fl V
+but the variable is always expanded to its complete value.
.It Fl W
Treat any warnings during makefile parsing as errors.
.It Fl w
@@ -657,7 +679,7 @@ The seven local variables are as follows:
.Bl -tag -width ".ARCHIVE" -offset indent
.It Va .ALLSRC
The list of all sources for this target; also known as
-.Ql Va \&\*[Gt] .
+.Ql Va \&> .
.It Va .ARCHIVE
The name of the archive file; also known as
.Ql Va \&! .
@@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the source from which the
target is to be transformed (the
.Dq implied
source); also known as
-.Ql Va \&\*[Lt] .
+.Ql Va \&< .
It is not defined in explicit rules.
.It Va .MEMBER
The name of the archive member; also known as
@@ -691,9 +713,9 @@ in archive member rules.
.El
.Pp
The shorter forms
-.Ql ( Va \*[Gt] ,
+.Ql ( Va > ,
.Ql Va \&! ,
-.Ql Va \*[Lt] ,
+.Ql Va < ,
.Ql Va % ,
.Ql Va \&? ,
.Ql Va * ,
@@ -776,6 +798,10 @@ from which generated dependencies are read.
A boolean that controls the default behavior of the
.Fl V
option.
+If true, variable values printed with
+.Fl V
+are fully expanded; if false, the raw variable contents (which may
+include additional unexpanded variable references) are shown.
.It Va .MAKE.EXPORTED
The list of variables exported by
.Nm .
@@ -1287,7 +1313,7 @@ it is anchored at the end of each word.
Inside
.Ar new_string ,
an ampersand
-.Pq Ql \*[Am]
+.Pq Ql &
is replaced by
.Ar old_string
(without any
@@ -1751,7 +1777,7 @@ may be any one of the following:
.Bl -tag -width "Cm XX"
.It Cm \&|\&|
Logical OR.
-.It Cm \&\*[Am]\*[Am]
+.It Cm \&&&
Logical
.Tn AND ;
of higher precedence than
@@ -1768,7 +1794,7 @@ The boolean operator
may be used to logically negate an entire
conditional.
It is of higher precedence than
-.Ql Ic \&\*[Am]\*[Am] .
+.Ql Ic \&&& .
.Pp
The value of
.Ar expression
diff --git a/meta.c b/meta.c
index 33c2dd8d5e3d..b8ddfb0b5e1b 100644
--- a/meta.c
+++ b/meta.c
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.68 2017/07/09 04:54:00 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -727,7 +727,7 @@ meta_job_error(Job *job, GNode *gn, int flags, int status)
pbm = &Mybm;
}
if (pbm->mfp != NULL) {
- fprintf(pbm->mfp, "*** Error code %d%s\n",
+ fprintf(pbm->mfp, "\n*** Error code %d%s\n",
status,
(flags & JOB_IGNERR) ?
"(ignored)" : "");
@@ -782,13 +782,13 @@ int
meta_cmd_finish(void *pbmp)
{
int error = 0;
-#ifdef USE_FILEMON
BuildMon *pbm = pbmp;
int x;
if (!pbm)
pbm = &Mybm;
+#ifdef USE_FILEMON
if (pbm->filemon_fd >= 0) {
if (close(pbm->filemon_fd) < 0)
error = errno;
@@ -796,8 +796,9 @@ meta_cmd_finish(void *pbmp)
if (error == 0 && x != 0)
error = x;
pbm->filemon_fd = pbm->mon_fd = -1;
- }
+ } else
#endif
+ fprintf(pbm->mfp, "\n"); /* ensure end with newline */
return error;
}
@@ -861,6 +862,8 @@ fgetLine(char **bufp, size_t *szp, int o, FILE *fp)
newsz = ROUNDUP((fs.st_size / 2), BUFSIZ);
if (newsz <= bufsz)
newsz = ROUNDUP(fs.st_size, BUFSIZ);
+ if (newsz <= bufsz)
+ return x; /* truncated */
if (DEBUG(META))
fprintf(debug_file, "growing buffer %u -> %u\n",
(unsigned)bufsz, (unsigned)newsz);
@@ -948,10 +951,10 @@ meta_ignore(GNode *gn, const char *p)
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);
+ Var_Set(".p.", p, gn, 0);
+ pm = Var_Subst(NULL,
+ "${" MAKE_META_IGNORE_PATTERNS ":@m@${.p.:M$m}@}",
+ gn, VARF_WANTRES);
if (*pm) {
#ifdef DEBUG_META_MODE
if (DEBUG(META))
diff --git a/mk/ChangeLog b/mk/ChangeLog
index 8e42c8cbed50..179d191e9008 100644
--- a/mk/ChangeLog
+++ b/mk/ChangeLog
@@ -1,3 +1,22 @@
+2017-06-30 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * install-mk (MK_VERSION): 20170630
+
+ * meta.stage.mk: avoid triggering stage_* targets with nothing to do.
+
+2017-05-23 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * meta2deps.py: take special care of '..'
+
+2017-05-15 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * install-mk (MK_VERSION): 20170515
+
+ * dirdeps.mk (DEP_EXPORT_VARS): on rare occasions it is
+ useful/necessary for a Makefile.depend file to export some knobs.
+ This is complicated when we are doing DIRDEPS_CACHE, so we will
+ handle export of any variables listed in DEP_EXPORT_VARS.
+
2017-05-08 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170505
diff --git a/mk/dirdeps.mk b/mk/dirdeps.mk
index a0a40e586a06..1ae0fbb635ab 100644
--- a/mk/dirdeps.mk
+++ b/mk/dirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.88 2017/04/24 20:34:59 sjg Exp $
+# $Id: dirdeps.mk,v 1.89 2017/05/17 17:41:47 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@@ -636,6 +636,11 @@ _build_all_dirs := ${_build_all_dirs:O:u}
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo
x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} echo; } >&3; echo
+.if !empty(DEP_EXPORT_VARS)
+# Discouraged, but there are always exceptions.
+# Handle it here rather than explain how.
+x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo
+.endif
.else
# this makes it all happen
dirdeps: ${_build_all_dirs}
@@ -646,6 +651,11 @@ ${_build_all_dirs}: _DIRDEP_USE
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
.endif
+.if !empty(DEP_EXPORT_VARS)
+.export ${DEP_EXPORT_VARS}
+DEP_EXPORT_VARS=
+.endif
+
# this builds the dependency graph
.for m in ${_machines}
# it would be nice to do :N${.TARGET}
diff --git a/mk/install-mk b/mk/install-mk
index 50da97cbe61d..0950b109a276 100644
--- a/mk/install-mk
+++ b/mk/install-mk
@@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: install-mk,v 1.145 2017/05/09 04:05:32 sjg Exp $
+# $Id: install-mk,v 1.148 2017/06/30 23:46:15 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@@ -70,7 +70,7 @@
# sjg@crufty.net
#
-MK_VERSION=20170505
+MK_VERSION=20170630
OWNER=
GROUP=
MODE=444
diff --git a/mk/lib.mk b/mk/lib.mk
index 0cc1466f2fc5..de21e3249076 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -1,4 +1,4 @@
-# $Id: lib.mk,v 1.61 2017/05/06 17:30:09 sjg Exp $
+# $Id: lib.mk,v 1.62 2017/06/11 03:24:04 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -268,8 +268,7 @@ ${CXX_SUFFIXES:%=%.o}:
${COMPILE.cc} ${.IMPSRC}
.S.o .s.o:
- @echo ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
- @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
+ ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
.if (${LD_X} == "")
.c.po:
@@ -282,21 +281,18 @@ ${CXX_SUFFIXES:%=%.po}:
${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
.else
.c.po:
- @echo ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}.o
+ ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
${CXX_SUFFIXES:%=%.po}:
- @echo ${COMPILE.cc} ${CXX_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o
- @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
+ ${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o
+ ${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S${PICO} .s${PICO}:
- @echo ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
- @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
+ ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
+ ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
@@ -312,21 +308,18 @@ ${CXX_SUFFIXES:%=%${PICO}}:
.else
.c${PICO}:
- @echo ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
- @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
+ ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
+ ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
${CXX_SUFFIXES:%=%${PICO}}:
- @echo ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
- @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
+ ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
+ ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
- @echo ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
- @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
+ ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
+ ${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
@@ -418,7 +411,7 @@ lib${LIB}.${LD_so}:: lib${LIB}.a
.else # MK_LIBTOOL=yes
lib${LIB}.a:: ${OBJS}
- @echo building standard ${LIB} library
+ @${META_NOECHO} building standard ${LIB} library
@rm -f ${.TARGET}
@${AR} ${AR_cq} ${.TARGET} ${LD_objs}
${RANLIB} ${.TARGET}
@@ -426,7 +419,7 @@ lib${LIB}.a:: ${OBJS}
POBJS+= ${OBJS:.o=.po}
.NOPATH: ${POBJS}
lib${LIB}_p.a:: ${POBJS}
- @echo building profiled ${LIB} library
+ @${META_NOECHO} building profiled ${LIB} library
@rm -f ${.TARGET}
@${AR} ${AR_cq} ${.TARGET} ${LD_pobjs}
${RANLIB} ${.TARGET}
@@ -434,7 +427,7 @@ lib${LIB}_p.a:: ${POBJS}
SOBJS+= ${OBJS:.o=${PICO}}
.NOPATH: ${SOBJS}
lib${LIB}_pic.a:: ${SOBJS}
- @echo building shared object ${LIB} library
+ @${META_NOECHO} building shared object ${LIB} library
@rm -f ${.TARGET}
@${AR} ${AR_cq} ${.TARGET} ${LD_sobjs}
${RANLIB} ${.TARGET}
@@ -444,7 +437,7 @@ lib${LIB}_pic.a:: ${SOBJS}
# bound to be non-portable...
# this is known to work for NetBSD 1.6 and FreeBSD 4.2
lib${LIB}.${LD_so}: ${SOLIB} ${DPADD}
- @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
+ @${META_NOECHO} building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f ${.TARGET}
.if ${TARGET_OSNAME} == "NetBSD" || ${TARGET_OSNAME} == "FreeBSD"
.if ${OBJECT_FMT} == "ELF"
@@ -468,7 +461,7 @@ LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.NOPATH: ${LOBJS}
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
- @echo building llib-l${LIB}.ln
+ @${META_NOECHO} building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${LOBJS} ${LLIBS}
@@ -508,10 +501,8 @@ LIB_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP}
.include <links.mk>
-.if !target(realinstall) && !empty(LIB)
+.if !target(libinstall) && !empty(LIB)
realinstall: libinstall
-.endif
-.if !target(libinstall)
libinstall:
[ -d ${DESTDIR}/${LIBDIR} ] || \
${INSTALL} -d ${LIB_INSTALL_OWN} -m 775 ${DESTDIR}${LIBDIR}
diff --git a/mk/meta.stage.mk b/mk/meta.stage.mk
index 7383aadec564..03906a8d7507 100644
--- a/mk/meta.stage.mk
+++ b/mk/meta.stage.mk
@@ -1,4 +1,4 @@
-# $Id: meta.stage.mk,v 1.49 2017/04/01 02:10:34 sjg Exp $
+# $Id: meta.stage.mk,v 1.54 2017/07/06 23:20:33 sjg Exp $
#
# @(#) Copyright (c) 2011-2017, Simon J. Gerraty
#
@@ -136,11 +136,31 @@ _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}}
+.endif # first time
+
+
+.if !empty(STAGE_INCSDIR)
+.if !empty(STAGE_INCS)
+stage_incs: ${STAGE_INCS}
+.endif
+.if target(stage_incs) || !empty(.ALLTARGETS:Mstage_includes)
+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
+.endif
+
+.if !empty(STAGE_LIBDIR)
+.if !empty(STAGE_LIBS)
+stage_libs: ${STAGE_LIBS}
+.endif
+.if target(stage_libs)
+STAGE_TARGETS += stage_libs
+STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*}
stage_libs: .dirdep
@${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${STAGE_LIBS}
.if !defined(NO_SHLIB_LINKS)
@@ -152,18 +172,7 @@ 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)
@@ -174,8 +183,6 @@ STAGE_SYMLINKS_DIR._default = ${STAGE_SYMLINKS_DIR:U${STAGE_OBJTOP}}
STAGE_FILES._default = ${STAGE_FILES}
STAGE_LINKS._default = ${STAGE_LINKS}
STAGE_SYMLINKS._default = ${STAGE_SYMLINKS}
-STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*}
-STAGE_SYMLINKS ?= ${.ALLSRC:T:N.dirdep:Nstage_*}
.endif
.if !empty(STAGE_SETS)
@@ -183,24 +190,31 @@ CLEANFILES += ${STAGE_SETS:@s@stage*$s@}
# some makefiles need to populate multiple directories
.for s in ${STAGE_SETS:O:u}
-STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
-STAGE_SYMLINKS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
-STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP}
-STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP}
-
+.if !empty(STAGE_FILES.$s)
+stage_files.$s: ${STAGE_FILES.$s}
+.endif
+.if target(stage_files.$s) || target(stage_files${s:S,^,.,:N._default})
STAGE_TARGETS += stage_files
+STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
.if !target(.stage_files.$s)
.stage_files.$s:
.if $s != "_default"
stage_files: stage_files.$s
stage_files.$s: .dirdep
.else
+STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*}
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
+.endif
+.if !empty(STAGE_LINKS.$s)
+stage_links.$s:
+.endif
+.if target(stage_links.$s) || target(stage_links${s:S,^,.,:N._default})
+STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP}
STAGE_TARGETS += stage_links
.if !target(.stage_links.$s)
.stage_links.$s:
@@ -213,7 +227,13 @@ stage_links: .dirdep
@${STAGE_LINKS_SCRIPT}; StageLinks ${STAGE_LINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_LINKS.$s}
@touch $@
.endif
+.endif
+.if !empty(STAGE_SYMLINKS.$s)
+stage_symlinks.$s:
+.endif
+.if target(stage_symlinks.$s) || target(stage_symlinks${s:S,^,.,:N._default})
+STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP}
STAGE_TARGETS += stage_symlinks
.if !target(.stage_symlinks.$s)
.stage_symlinks.$s:
@@ -226,6 +246,7 @@ stage_symlinks: .dirdep
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_SYMLINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_SYMLINKS.$s}
@touch $@
.endif
+.endif
.endfor
.endif
@@ -233,8 +254,6 @@ stage_symlinks: .dirdep
.if !empty(STAGE_AS_SETS)
CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@}
-STAGE_TARGETS += stage_as stage_as_and_symlink
-
# sometimes things need to be renamed as they are staged
# each ${file} will be staged as ${STAGE_AS_${file:T}}
# one could achieve the same with SYMLINKS
@@ -242,9 +261,12 @@ STAGE_TARGETS += stage_as stage_as_and_symlink
# it is the same as using stage_as and stage_symlinks but ensures
# both operations happen together
.for s in ${STAGE_AS_SETS:O:u}
+.if !empty(STAGE_AS.$s)
+stage_as.$s: ${STAGE_AS.$s}
+.endif
+.if target(stage_as.$s)
+STAGE_TARGETS += stage_as
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
@@ -252,7 +274,14 @@ 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
+.endif
+.if !empty(STAGE_AS_AND_SYMLINK.$s)
+stage_as_and_symlink.$s: ${STAGE_AS_AND_SYMLINK.$s}
+.endif
+.if target(stage_as_and_symlink.$s)
+STAGE_TARGETS += stage_as_and_symlink
+STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
.if !target(.stage_as_and_symlink.$s)
.stage_as_and_symlink.$s:
stage_as_and_symlink: stage_as_and_symlink.$s
@@ -261,6 +290,7 @@ stage_as_and_symlink.$s: .dirdep
@${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
+.endif
.endfor
.endif
@@ -304,6 +334,9 @@ beforeinstall: .dirdep
.NOPATH: ${STAGE_FILES}
.if !empty(STAGE_TARGETS)
+# for backwards compat make sure they exist
+${STAGE_TARGETS}:
+
.NOPATH: ${CLEANFILES}
MK_STALE_STAGED?= no
diff --git a/mk/meta.sys.mk b/mk/meta.sys.mk
index 747d85e4cd50..4dbdd7919baf 100644
--- a/mk/meta.sys.mk
+++ b/mk/meta.sys.mk
@@ -1,4 +1,4 @@
-# $Id: meta.sys.mk,v 1.31 2016/09/10 00:44:46 sjg Exp $
+# $Id: meta.sys.mk,v 1.32 2017/06/11 03:24:04 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@@ -120,6 +120,7 @@ MKDEP_MK = meta.autodep.mk
# re-running needlessly
META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}}
META_NOPHONY=
+META_NOECHO= :
# some targets involve old pre-built targets
# ignore mtime of shell
@@ -163,5 +164,6 @@ BUILD_AT_LEVEL0 ?= no
META_COOKIE_TOUCH=
# some targets need to be .PHONY in non-meta mode
META_NOPHONY= .PHONY
+META_NOECHO= echo
.endif
.endif
diff --git a/mk/meta2deps.py b/mk/meta2deps.py
index 22eef5fa749a..4b007d138e23 100755
--- a/mk/meta2deps.py
+++ b/mk/meta2deps.py
@@ -37,7 +37,7 @@ We only pay attention to a subset of the information in the
"""
RCSid:
- $Id: meta2deps.py,v 1.26 2017/05/09 04:04:16 sjg Exp $
+ $Id: meta2deps.py,v 1.27 2017/05/24 00:04:04 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@@ -90,6 +90,12 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
for d in [last_dir, cwd]:
if not d:
continue
+ if path == '..':
+ dw = d.split('/')
+ p = '/'.join(dw[:-1])
+ if not p:
+ p = '/'
+ return p
p = '/'.join([d,path])
if debug > 2:
print("looking for:", p, end=' ', file=debug_out)
@@ -115,8 +121,11 @@ def cleanpath(path):
if not d or d == '.':
continue
if d == '..':
- p.pop()
- continue
+ try:
+ p.pop()
+ continue
+ except:
+ break
p.append(d)
return r + '/'.join(p)
diff --git a/mk/own.mk b/mk/own.mk
index 1d087ac4dbc1..713d1ad0745b 100644
--- a/mk/own.mk
+++ b/mk/own.mk
@@ -1,4 +1,4 @@
-# $Id: own.mk,v 1.35 2017/05/03 18:09:44 sjg Exp $
+# $Id: own.mk,v 1.36 2017/07/08 21:58:46 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -7,7 +7,7 @@ __${.PARSEFILE}__:
.include "init.mk"
.endif
-.ifndef NOMAKECONF
+.if !defined(NOMAKECONF) && !defined(NO_MAKECONF)
MAKECONF?= /etc/mk.conf
.-include "${MAKECONF}"
.endif
@@ -35,7 +35,7 @@ libprefix?= /usr
.endif
# FreeBSD at least does not set this
-MACHINE_ARCH?=${MACHINE}
+MACHINE_ARCH?= ${MACHINE}
# we need to make sure these are defined too in case sys.mk fails to.
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
@@ -129,12 +129,11 @@ _uid!= id -u
USERGRP!= id -g
.export USERGRP
.endif
-.for x in BIN CONF DOC INC INFO FILES KMOD LIB MAN NLS SHARE
+.for x in BIN CONF DOC INC INFO FILES KMOD LIB MAN NLS PROG SHARE
$xOWN= ${USER}
$xGRP= ${USERGRP}
$x_INSTALL_OWN=
.endfor
-PROG_INSTALL_OWN=
.endif
.endif
diff --git a/sprite.h b/sprite.h
index 6ec4fe2e4d09..cdcffd99abed 100644
--- a/sprite.h
+++ b/sprite.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sprite.h,v 1.11 2009/01/23 21:26:30 dsl Exp $ */
+/* $NetBSD: sprite.h,v 1.14 2017/05/31 22:02:06 maya Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -78,8 +78,8 @@
* Common constants and type declarations for Sprite.
*/
-#ifndef _SPRITE
-#define _SPRITE
+#ifndef MAKE_SPRITE_H
+#define MAKE_SPRITE_H
/*
@@ -113,4 +113,4 @@ typedef int ReturnStatus;
#define SUCCESS 0x00000000
#define FAILURE 0x00000001
-#endif /* _SPRITE */
+#endif /* MAKE_SPRITE_H */