Import bmake-20170711

This commit is contained in:
Simon J. Gerraty 2017-07-15 21:19:27 +00:00
commit 8695518c44
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321036
20 changed files with 382 additions and 207 deletions

View File

@ -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> 2017-05-10 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170510 * Makefile (_MAKE_VERSION): 20170510

View File

@ -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 # Base version on src date
_MAKE_VERSION= 20170510 _MAKE_VERSION= 20170711
PROG= bmake PROG= bmake

View File

@ -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 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd February 1, 2017 .Dd June 22, 2017
.Dt BMAKE 1 .Dt BMAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -48,6 +48,7 @@
.Op Fl m Ar directory .Op Fl m Ar directory
.Op Fl T Ar file .Op Fl T Ar file
.Op Fl V Ar variable .Op Fl V Ar variable
.Op Fl v Ar variable
.Op Ar variable=value .Op Ar variable=value
.Op Ar target ... .Op Ar target ...
.Sh DESCRIPTION .Sh DESCRIPTION
@ -206,7 +207,9 @@ Print debugging information about target list maintenance.
.It Ar V .It Ar V
Force the Force the
.Fl V .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 .It Ar v
Print debugging information about variable assignment. Print debugging information about variable assignment.
.It Ar x .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 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. or update its modification time to make it appear up-to-date.
.It Fl V Ar variable .It Fl V Ar variable
Print Print the value of
.Nm Ns 's .Ar variable .
idea of the value of
.Ar variable ,
in the global context.
Do not build any targets. Do not build any targets.
Multiple instances of this option may be specified; Multiple instances of this option may be specified;
the variables will be printed one per line, the variables will be printed one per line,
with a blank line for each null or undefined variable. 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 If
.Ar variable .Ar variable
contains a contains a
.Ql \&$ .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 .It Fl W
Treat any warnings during makefile parsing as errors. Treat any warnings during makefile parsing as errors.
.It Fl w .It Fl w
@ -657,7 +679,7 @@ The seven local variables are as follows:
.Bl -tag -width ".ARCHIVE" -offset indent .Bl -tag -width ".ARCHIVE" -offset indent
.It Va .ALLSRC .It Va .ALLSRC
The list of all sources for this target; also known as The list of all sources for this target; also known as
.Ql Va \&\*[Gt] . .Ql Va \&> .
.It Va .ARCHIVE .It Va .ARCHIVE
The name of the archive file; also known as The name of the archive file; also known as
.Ql Va \&! . .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 target is to be transformed (the
.Dq implied .Dq implied
source); also known as source); also known as
.Ql Va \&\*[Lt] . .Ql Va \&< .
It is not defined in explicit rules. It is not defined in explicit rules.
.It Va .MEMBER .It Va .MEMBER
The name of the archive member; also known as The name of the archive member; also known as
@ -691,9 +713,9 @@ in archive member rules.
.El .El
.Pp .Pp
The shorter forms The shorter forms
.Ql ( Va \*[Gt] , .Ql ( Va > ,
.Ql Va \&! , .Ql Va \&! ,
.Ql Va \*[Lt] , .Ql Va < ,
.Ql Va % , .Ql Va % ,
.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 A boolean that controls the default behavior of the
.Fl V .Fl V
option. 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 .It Va .MAKE.EXPORTED
The list of variables exported by The list of variables exported by
.Nm . .Nm .
@ -1287,7 +1313,7 @@ it is anchored at the end of each word.
Inside Inside
.Ar new_string , .Ar new_string ,
an ampersand an ampersand
.Pq Ql \*[Am] .Pq Ql &
is replaced by is replaced by
.Ar old_string .Ar old_string
(without any (without any
@ -1751,7 +1777,7 @@ may be any one of the following:
.Bl -tag -width "Cm XX" .Bl -tag -width "Cm XX"
.It Cm \&|\&| .It Cm \&|\&|
Logical OR. Logical OR.
.It Cm \&\*[Am]\*[Am] .It Cm \&&&
Logical Logical
.Tn AND ; .Tn AND ;
of higher precedence than of higher precedence than
@ -1768,7 +1794,7 @@ The boolean operator
may be used to logically negate an entire may be used to logically negate an entire
conditional. conditional.
It is of higher precedence than It is of higher precedence than
.Ql Ic \&\*[Am]\*[Am] . .Ql Ic \&&& .
.Pp .Pp
The value of The value of
.Ar expression .Ar expression

View File

@ -6,8 +6,8 @@ NNAAMMEE
SSYYNNOOPPSSIISS 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] 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] [--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] [--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]
[_t_a_r_g_e_t _._._.] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.]
DDEESSCCRRIIPPTTIIOONN DDEESSCCRRIIPPTTIIOONN
bbmmaakkee is a program designed to simplify the maintenance of other pro- 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- _t Print debugging information about target list mainte-
nance. 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. _v Print debugging information about variable assignment.
@ -209,12 +211,25 @@ DDEESSCCRRIIPPTTIIOONN
to-date. to-date.
--VV _v_a_r_i_a_b_l_e --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- Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple
text. Do not build any targets. Multiple instances of this instances of this option may be specified; the variables will be
option may be specified; the variables will be printed one per printed one per line, with a blank line for each null or unde-
line, with a blank line for each null or undefined variable. If fined variable. The value printed is extracted from the global
_v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before context after all makefiles have been read. By default, the raw
printing. 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. --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 _._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 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. _._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. 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

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -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. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -77,8 +77,8 @@
* Header for users of the buf library. * Header for users of the buf library.
*/ */
#ifndef _BUF_H #ifndef MAKE_BUF_H
#define _BUF_H #define MAKE_BUF_H
typedef char Byte; typedef char Byte;
@ -116,4 +116,4 @@ void Buf_Init(Buffer *, int);
Byte *Buf_Destroy(Buffer *, Boolean); Byte *Buf_Destroy(Buffer *, Boolean);
Byte *Buf_DestroyCompact(Buffer *); Byte *Buf_DestroyCompact(Buffer *);
#endif /* _BUF_H */ #endif /* MAKE_BUF_H */

View File

@ -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. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -75,8 +75,8 @@
/* dir.h -- /* dir.h --
*/ */
#ifndef _DIR #ifndef MAKE_DIR_H
#define _DIR #define MAKE_DIR_H
typedef struct Path { typedef struct Path {
char *name; /* Name of directory */ char *name; /* Name of directory */
@ -105,4 +105,4 @@ void Dir_PrintPath(Lst);
void Dir_Destroy(void *); void Dir_Destroy(void *);
void * Dir_CopyDir(void *); void * Dir_CopyDir(void *);
#endif /* _DIR */ #endif /* MAKE_DIR_H */

View File

@ -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. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -78,8 +78,8 @@
* which maintains hash tables. * which maintains hash tables.
*/ */
#ifndef _HASH #ifndef _HASH_H
#define _HASH #define _HASH_H
/* /*
* The following defines one entry in the hash table. * 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_EnumFirst(Hash_Table *, Hash_Search *);
Hash_Entry *Hash_EnumNext(Hash_Search *); Hash_Entry *Hash_EnumNext(Hash_Search *);
#endif /* _HASH */ #endif /* _HASH_H */

View File

@ -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 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/ */
#ifndef MAKE_NATIVE #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 #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else #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
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -159,7 +159,9 @@ Boolean deleteOnError; /* .DELETE_ON_ERROR: set */
static Boolean noBuiltins; /* -r flag */ static Boolean noBuiltins; /* -r flag */
static Lst makefiles; /* ordered list of makefiles to read */ 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 */ static Lst variables; /* list of variables to print */
int maxJobs; /* -j argument */ int maxJobs; /* -j argument */
static int maxJobTokens; /* -j argument */ static int maxJobTokens; /* -j argument */
@ -421,7 +423,7 @@ MainParseArgs(int argc, char **argv)
Boolean inOption, dashDash = FALSE; Boolean inOption, dashDash = FALSE;
char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ 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 */ /* Can't actually use getopt(3) because rescanning is not portable */
getopt_def = OPTFLAGS; getopt_def = OPTFLAGS;
@ -546,8 +548,9 @@ MainParseArgs(int argc, char **argv)
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
break; break;
case 'V': case 'V':
case 'v':
if (argvalue == NULL) goto noarg; if (argvalue == NULL) goto noarg;
printVars = TRUE; printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
(void)Lst_AtEnd(variables, argvalue); (void)Lst_AtEnd(variables, argvalue);
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL); Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
@ -877,6 +880,89 @@ MakeMode(const char *mode)
free(mp); 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 -- * main --
* The main function, for obvious reasons. Initializes variables * The main function, for obvious reasons. Initializes variables
@ -897,8 +983,7 @@ MakeMode(const char *mode)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
Lst targs; /* target nodes to create -- passed to Make_Init */ Boolean outOfDate; /* FALSE if all targets up to date */
Boolean outOfDate = FALSE; /* FALSE if all targets up to date */
struct stat sb, sa; struct stat sb, sa;
char *p1, *path; char *p1, *path;
char mdpath[MAXPATHLEN]; char mdpath[MAXPATHLEN];
@ -1027,7 +1112,7 @@ main(int argc, char **argv)
create = Lst_Init(FALSE); create = Lst_Init(FALSE);
makefiles = Lst_Init(FALSE); makefiles = Lst_Init(FALSE);
printVars = FALSE; printVars = 0;
debugVflag = FALSE; debugVflag = FALSE;
variables = Lst_Init(FALSE); variables = Lst_Init(FALSE);
beSilent = FALSE; /* Print commands as executed */ 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 */ /* print the values of any variables requested by the user */
if (printVars) { if (printVars) {
LstNode ln; doPrintVars();
Boolean expandVars; outOfDate = FALSE;
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);
}
} else { } else {
/* outOfDate = runTargets();
* 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);
}
} }
#ifdef CLEANUP #ifdef CLEANUP
Lst_Destroy(targs, NULL);
Lst_Destroy(variables, NULL); Lst_Destroy(variables, NULL);
Lst_Destroy(makefiles, NULL); Lst_Destroy(makefiles, NULL);
Lst_Destroy(create, (FreeProc *)free); Lst_Destroy(create, (FreeProc *)free);
@ -1931,7 +1956,8 @@ usage(void)
"usage: %s [-BeikNnqrstWwX] \n\ "usage: %s [-BeikNnqrstWwX] \n\
[-C directory] [-D variable] [-d flags] [-f makefile]\n\ [-C directory] [-D variable] [-d flags] [-f makefile]\n\
[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\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); exit(2);
} }

View File

@ -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 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd February 1, 2017 .Dd June 22, 2017
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -48,6 +48,7 @@
.Op Fl m Ar directory .Op Fl m Ar directory
.Op Fl T Ar file .Op Fl T Ar file
.Op Fl V Ar variable .Op Fl V Ar variable
.Op Fl v Ar variable
.Op Ar variable=value .Op Ar variable=value
.Op Ar target ... .Op Ar target ...
.Sh DESCRIPTION .Sh DESCRIPTION
@ -206,7 +207,9 @@ Print debugging information about target list maintenance.
.It Ar V .It Ar V
Force the Force the
.Fl V .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 .It Ar v
Print debugging information about variable assignment. Print debugging information about variable assignment.
.It Ar x .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 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. or update its modification time to make it appear up-to-date.
.It Fl V Ar variable .It Fl V Ar variable
Print Print the value of
.Nm Ns 's .Ar variable .
idea of the value of
.Ar variable ,
in the global context.
Do not build any targets. Do not build any targets.
Multiple instances of this option may be specified; Multiple instances of this option may be specified;
the variables will be printed one per line, the variables will be printed one per line,
with a blank line for each null or undefined variable. 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 If
.Ar variable .Ar variable
contains a contains a
.Ql \&$ .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 .It Fl W
Treat any warnings during makefile parsing as errors. Treat any warnings during makefile parsing as errors.
.It Fl w .It Fl w
@ -657,7 +679,7 @@ The seven local variables are as follows:
.Bl -tag -width ".ARCHIVE" -offset indent .Bl -tag -width ".ARCHIVE" -offset indent
.It Va .ALLSRC .It Va .ALLSRC
The list of all sources for this target; also known as The list of all sources for this target; also known as
.Ql Va \&\*[Gt] . .Ql Va \&> .
.It Va .ARCHIVE .It Va .ARCHIVE
The name of the archive file; also known as The name of the archive file; also known as
.Ql Va \&! . .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 target is to be transformed (the
.Dq implied .Dq implied
source); also known as source); also known as
.Ql Va \&\*[Lt] . .Ql Va \&< .
It is not defined in explicit rules. It is not defined in explicit rules.
.It Va .MEMBER .It Va .MEMBER
The name of the archive member; also known as The name of the archive member; also known as
@ -691,9 +713,9 @@ in archive member rules.
.El .El
.Pp .Pp
The shorter forms The shorter forms
.Ql ( Va \*[Gt] , .Ql ( Va > ,
.Ql Va \&! , .Ql Va \&! ,
.Ql Va \*[Lt] , .Ql Va < ,
.Ql Va % , .Ql Va % ,
.Ql Va \&? , .Ql Va \&? ,
.Ql Va * , .Ql Va * ,
@ -787,6 +809,10 @@ from which generated dependencies are read.
A boolean that controls the default behavior of the A boolean that controls the default behavior of the
.Fl V .Fl V
option. 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 .It Va .MAKE.EXPORTED
The list of variables exported by The list of variables exported by
.Nm . .Nm .
@ -1298,7 +1324,7 @@ it is anchored at the end of each word.
Inside Inside
.Ar new_string , .Ar new_string ,
an ampersand an ampersand
.Pq Ql \*[Am] .Pq Ql &
is replaced by is replaced by
.Ar old_string .Ar old_string
(without any (without any
@ -1762,7 +1788,7 @@ may be any one of the following:
.Bl -tag -width "Cm XX" .Bl -tag -width "Cm XX"
.It Cm \&|\&| .It Cm \&|\&|
Logical OR. Logical OR.
.It Cm \&\*[Am]\*[Am] .It Cm \&&&
Logical Logical
.Tn AND ; .Tn AND ;
of higher precedence than of higher precedence than
@ -1779,7 +1805,7 @@ The boolean operator
may be used to logically negate an entire may be used to logically negate an entire
conditional. conditional.
It is of higher precedence than It is of higher precedence than
.Ql Ic \&\*[Am]\*[Am] . .Ql Ic \&&& .
.Pp .Pp
The value of The value of
.Ar expression .Ar expression

View File

@ -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. * Implement 'meta' mode.
@ -727,7 +727,7 @@ meta_job_error(Job *job, GNode *gn, int flags, int status)
pbm = &Mybm; pbm = &Mybm;
} }
if (pbm->mfp != NULL) { if (pbm->mfp != NULL) {
fprintf(pbm->mfp, "*** Error code %d%s\n", fprintf(pbm->mfp, "\n*** Error code %d%s\n",
status, status,
(flags & JOB_IGNERR) ? (flags & JOB_IGNERR) ?
"(ignored)" : ""); "(ignored)" : "");
@ -782,13 +782,13 @@ int
meta_cmd_finish(void *pbmp) meta_cmd_finish(void *pbmp)
{ {
int error = 0; int error = 0;
#ifdef USE_FILEMON
BuildMon *pbm = pbmp; BuildMon *pbm = pbmp;
int x; int x;
if (!pbm) if (!pbm)
pbm = &Mybm; pbm = &Mybm;
#ifdef USE_FILEMON
if (pbm->filemon_fd >= 0) { if (pbm->filemon_fd >= 0) {
if (close(pbm->filemon_fd) < 0) if (close(pbm->filemon_fd) < 0)
error = errno; error = errno;
@ -796,8 +796,9 @@ meta_cmd_finish(void *pbmp)
if (error == 0 && x != 0) if (error == 0 && x != 0)
error = x; error = x;
pbm->filemon_fd = pbm->mon_fd = -1; pbm->filemon_fd = pbm->mon_fd = -1;
} } else
#endif #endif
fprintf(pbm->mfp, "\n"); /* ensure end with newline */
return error; return error;
} }
@ -861,6 +862,8 @@ fgetLine(char **bufp, size_t *szp, int o, FILE *fp)
newsz = ROUNDUP((fs.st_size / 2), BUFSIZ); newsz = ROUNDUP((fs.st_size / 2), BUFSIZ);
if (newsz <= bufsz) if (newsz <= bufsz)
newsz = ROUNDUP(fs.st_size, BUFSIZ); newsz = ROUNDUP(fs.st_size, BUFSIZ);
if (newsz <= bufsz)
return x; /* truncated */
if (DEBUG(META)) if (DEBUG(META))
fprintf(debug_file, "growing buffer %u -> %u\n", fprintf(debug_file, "growing buffer %u -> %u\n",
(unsigned)bufsz, (unsigned)newsz); (unsigned)bufsz, (unsigned)newsz);
@ -948,10 +951,10 @@ meta_ignore(GNode *gn, const char *p)
if (metaIgnorePatterns) { if (metaIgnorePatterns) {
char *pm; char *pm;
snprintf(fname, sizeof(fname), Var_Set(".p.", p, gn, 0);
"${%s:@m@${%s:L:M$m}@}", pm = Var_Subst(NULL,
MAKE_META_IGNORE_PATTERNS, p); "${" MAKE_META_IGNORE_PATTERNS ":@m@${.p.:M$m}@}",
pm = Var_Subst(NULL, fname, gn, VARF_WANTRES); gn, VARF_WANTRES);
if (*pm) { if (*pm) {
#ifdef DEBUG_META_MODE #ifdef DEBUG_META_MODE
if (DEBUG(META)) if (DEBUG(META))

View File

@ -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> 2017-05-08 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170505 * install-mk (MK_VERSION): 20170505

View File

@ -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. # Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved. # All rights reserved.
@ -636,6 +636,11 @@ _build_all_dirs := ${_build_all_dirs:O:u}
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \ x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo
x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} 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 .else
# this makes it all happen # this makes it all happen
dirdeps: ${_build_all_dirs} dirdeps: ${_build_all_dirs}
@ -646,6 +651,11 @@ ${_build_all_dirs}: _DIRDEP_USE
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs} .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
.endif .endif
.if !empty(DEP_EXPORT_VARS)
.export ${DEP_EXPORT_VARS}
DEP_EXPORT_VARS=
.endif
# this builds the dependency graph # this builds the dependency graph
.for m in ${_machines} .for m in ${_machines}
# it would be nice to do :N${.TARGET} # it would be nice to do :N${.TARGET}

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net> # Simon J. Gerraty <sjg@crufty.net>
# RCSid: # 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 # @(#) Copyright (c) 1994 Simon J. Gerraty
# #
@ -70,7 +70,7 @@
# sjg@crufty.net # sjg@crufty.net
# #
MK_VERSION=20170505 MK_VERSION=20170630
OWNER= OWNER=
GROUP= GROUP=
MODE=444 MODE=444

View File

@ -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}__) .if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__: __${.PARSEFILE}__:
@ -268,8 +268,7 @@ ${CXX_SUFFIXES:%=%.o}:
${COMPILE.cc} ${.IMPSRC} ${COMPILE.cc} ${.IMPSRC}
.S.o .s.o: .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} == "") .if (${LD_X} == "")
.c.po: .c.po:
@ -282,21 +281,18 @@ ${CXX_SUFFIXES:%=%.po}:
${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
.else .else
.c.po: .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} @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o @rm -f ${.TARGET}.o
${CXX_SUFFIXES:%=%.po}: ${CXX_SUFFIXES:%=%.po}:
@echo ${COMPILE.cc} ${CXX_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET} ${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o
@${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o ${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o @rm -f ${.TARGET}.o
.S${PICO} .s${PICO}: .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
@${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o @rm -f ${.TARGET}.o
.endif .endif
@ -312,21 +308,18 @@ ${CXX_SUFFIXES:%=%${PICO}}:
.else .else
.c${PICO}: .c${PICO}:
@echo ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
@${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o @rm -f ${.TARGET}.o
${CXX_SUFFIXES:%=%${PICO}}: ${CXX_SUFFIXES:%=%${PICO}}:
@echo ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o
@${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o @rm -f ${.TARGET}.o
.S.po .s.po: .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
@${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o ${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o @rm -f ${.TARGET}.o
.endif .endif
@ -418,7 +411,7 @@ lib${LIB}.${LD_so}:: lib${LIB}.a
.else # MK_LIBTOOL=yes .else # MK_LIBTOOL=yes
lib${LIB}.a:: ${OBJS} lib${LIB}.a:: ${OBJS}
@echo building standard ${LIB} library @${META_NOECHO} building standard ${LIB} library
@rm -f ${.TARGET} @rm -f ${.TARGET}
@${AR} ${AR_cq} ${.TARGET} ${LD_objs} @${AR} ${AR_cq} ${.TARGET} ${LD_objs}
${RANLIB} ${.TARGET} ${RANLIB} ${.TARGET}
@ -426,7 +419,7 @@ lib${LIB}.a:: ${OBJS}
POBJS+= ${OBJS:.o=.po} POBJS+= ${OBJS:.o=.po}
.NOPATH: ${POBJS} .NOPATH: ${POBJS}
lib${LIB}_p.a:: ${POBJS} lib${LIB}_p.a:: ${POBJS}
@echo building profiled ${LIB} library @${META_NOECHO} building profiled ${LIB} library
@rm -f ${.TARGET} @rm -f ${.TARGET}
@${AR} ${AR_cq} ${.TARGET} ${LD_pobjs} @${AR} ${AR_cq} ${.TARGET} ${LD_pobjs}
${RANLIB} ${.TARGET} ${RANLIB} ${.TARGET}
@ -434,7 +427,7 @@ lib${LIB}_p.a:: ${POBJS}
SOBJS+= ${OBJS:.o=${PICO}} SOBJS+= ${OBJS:.o=${PICO}}
.NOPATH: ${SOBJS} .NOPATH: ${SOBJS}
lib${LIB}_pic.a:: ${SOBJS} lib${LIB}_pic.a:: ${SOBJS}
@echo building shared object ${LIB} library @${META_NOECHO} building shared object ${LIB} library
@rm -f ${.TARGET} @rm -f ${.TARGET}
@${AR} ${AR_cq} ${.TARGET} ${LD_sobjs} @${AR} ${AR_cq} ${.TARGET} ${LD_sobjs}
${RANLIB} ${.TARGET} ${RANLIB} ${.TARGET}
@ -444,7 +437,7 @@ lib${LIB}_pic.a:: ${SOBJS}
# bound to be non-portable... # bound to be non-portable...
# this is known to work for NetBSD 1.6 and FreeBSD 4.2 # this is known to work for NetBSD 1.6 and FreeBSD 4.2
lib${LIB}.${LD_so}: ${SOLIB} ${DPADD} 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} @rm -f ${.TARGET}
.if ${TARGET_OSNAME} == "NetBSD" || ${TARGET_OSNAME} == "FreeBSD" .if ${TARGET_OSNAME} == "NetBSD" || ${TARGET_OSNAME} == "FreeBSD"
.if ${OBJECT_FMT} == "ELF" .if ${OBJECT_FMT} == "ELF"
@ -468,7 +461,7 @@ LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.NOPATH: ${LOBJS} .NOPATH: ${LOBJS}
LLIBS?= -lc LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS} llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln @${META_NOECHO} building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln @rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${LOBJS} ${LLIBS} @${LINT} -C${LIB} ${LOBJS} ${LLIBS}
@ -508,10 +501,8 @@ LIB_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP}
.include <links.mk> .include <links.mk>
.if !target(realinstall) && !empty(LIB) .if !target(libinstall) && !empty(LIB)
realinstall: libinstall realinstall: libinstall
.endif
.if !target(libinstall)
libinstall: libinstall:
[ -d ${DESTDIR}/${LIBDIR} ] || \ [ -d ${DESTDIR}/${LIBDIR} ] || \
${INSTALL} -d ${LIB_INSTALL_OWN} -m 775 ${DESTDIR}${LIBDIR} ${INSTALL} -d ${LIB_INSTALL_OWN} -m 775 ${DESTDIR}${LIBDIR}

View File

@ -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 # @(#) 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}} @${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_includes: stage_incs
stage_incs: .dirdep stage_incs: .dirdep
@${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_INCSDIR:${STAGE_DIR_FILTER}} ${STAGE_INCS} @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_INCSDIR:${STAGE_DIR_FILTER}} ${STAGE_INCS}
@touch $@ @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_libs: .dirdep
@${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${STAGE_LIBS} @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${STAGE_LIBS}
.if !defined(NO_SHLIB_LINKS) .if !defined(NO_SHLIB_LINKS)
@ -152,18 +172,7 @@ stage_libs: .dirdep
.endif .endif
.endif .endif
@touch $@ @touch $@
.endif # first time
.if !empty(STAGE_INCSDIR)
STAGE_TARGETS += stage_incs
STAGE_INCS ?= ${.ALLSRC:N.dirdep:Nstage_*}
.endif .endif
.if !empty(STAGE_LIBDIR)
STAGE_TARGETS += stage_libs
STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*}
.endif .endif
.if !empty(STAGE_DIR) .if !empty(STAGE_DIR)
@ -174,8 +183,6 @@ STAGE_SYMLINKS_DIR._default = ${STAGE_SYMLINKS_DIR:U${STAGE_OBJTOP}}
STAGE_FILES._default = ${STAGE_FILES} STAGE_FILES._default = ${STAGE_FILES}
STAGE_LINKS._default = ${STAGE_LINKS} STAGE_LINKS._default = ${STAGE_LINKS}
STAGE_SYMLINKS._default = ${STAGE_SYMLINKS} STAGE_SYMLINKS._default = ${STAGE_SYMLINKS}
STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*}
STAGE_SYMLINKS ?= ${.ALLSRC:T:N.dirdep:Nstage_*}
.endif .endif
.if !empty(STAGE_SETS) .if !empty(STAGE_SETS)
@ -183,24 +190,31 @@ CLEANFILES += ${STAGE_SETS:@s@stage*$s@}
# some makefiles need to populate multiple directories # some makefiles need to populate multiple directories
.for s in ${STAGE_SETS:O:u} .for s in ${STAGE_SETS:O:u}
STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} .if !empty(STAGE_FILES.$s)
STAGE_SYMLINKS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} stage_files.$s: ${STAGE_FILES.$s}
STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP} .endif
STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP} .if target(stage_files.$s) || target(stage_files${s:S,^,.,:N._default})
STAGE_TARGETS += stage_files STAGE_TARGETS += stage_files
STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
.if !target(.stage_files.$s) .if !target(.stage_files.$s)
.stage_files.$s: .stage_files.$s:
.if $s != "_default" .if $s != "_default"
stage_files: stage_files.$s stage_files: stage_files.$s
stage_files.$s: .dirdep stage_files.$s: .dirdep
.else .else
STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*}
stage_files: .dirdep stage_files: .dirdep
.endif .endif
@${STAGE_FILE_SCRIPT}; StageFiles ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_FILES.$s} @${STAGE_FILE_SCRIPT}; StageFiles ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_FILES.$s}
@touch $@ @touch $@
.endif .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 STAGE_TARGETS += stage_links
.if !target(.stage_links.$s) .if !target(.stage_links.$s)
.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} @${STAGE_LINKS_SCRIPT}; StageLinks ${STAGE_LINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_LINKS.$s}
@touch $@ @touch $@
.endif .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 STAGE_TARGETS += stage_symlinks
.if !target(.stage_symlinks.$s) .if !target(.stage_symlinks.$s)
.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} @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_SYMLINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_SYMLINKS.$s}
@touch $@ @touch $@
.endif .endif
.endif
.endfor .endfor
.endif .endif
@ -233,8 +254,6 @@ stage_symlinks: .dirdep
.if !empty(STAGE_AS_SETS) .if !empty(STAGE_AS_SETS)
CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@} 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 # sometimes things need to be renamed as they are staged
# each ${file} will be staged as ${STAGE_AS_${file:T}} # each ${file} will be staged as ${STAGE_AS_${file:T}}
# one could achieve the same with SYMLINKS # 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 # it is the same as using stage_as and stage_symlinks but ensures
# both operations happen together # both operations happen together
.for s in ${STAGE_AS_SETS:O:u} .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.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
.if !target(.stage_as.$s) .if !target(.stage_as.$s)
.stage_as.$s: .stage_as.$s:
stage_as: 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}}}@} @${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 $@ @touch $@
.endif .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) .if !target(.stage_as_and_symlink.$s)
.stage_as_and_symlink.$s: .stage_as_and_symlink.$s:
stage_as_and_symlink: 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@} @${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 $@ @touch $@
.endif .endif
.endif
.endfor .endfor
.endif .endif
@ -304,6 +334,9 @@ beforeinstall: .dirdep
.NOPATH: ${STAGE_FILES} .NOPATH: ${STAGE_FILES}
.if !empty(STAGE_TARGETS) .if !empty(STAGE_TARGETS)
# for backwards compat make sure they exist
${STAGE_TARGETS}:
.NOPATH: ${CLEANFILES} .NOPATH: ${CLEANFILES}
MK_STALE_STAGED?= no MK_STALE_STAGED?= no

View File

@ -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 # @(#) Copyright (c) 2010, Simon J. Gerraty
@ -120,6 +120,7 @@ MKDEP_MK = meta.autodep.mk
# re-running needlessly # re-running needlessly
META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}} META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}}
META_NOPHONY= META_NOPHONY=
META_NOECHO= :
# some targets involve old pre-built targets # some targets involve old pre-built targets
# ignore mtime of shell # ignore mtime of shell
@ -163,5 +164,6 @@ BUILD_AT_LEVEL0 ?= no
META_COOKIE_TOUCH= META_COOKIE_TOUCH=
# some targets need to be .PHONY in non-meta mode # some targets need to be .PHONY in non-meta mode
META_NOPHONY= .PHONY META_NOPHONY= .PHONY
META_NOECHO= echo
.endif .endif
.endif .endif

View File

@ -37,7 +37,7 @@
""" """
RCSid: 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. Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved. 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]: for d in [last_dir, cwd]:
if not d: if not d:
continue continue
if path == '..':
dw = d.split('/')
p = '/'.join(dw[:-1])
if not p:
p = '/'
return p
p = '/'.join([d,path]) p = '/'.join([d,path])
if debug > 2: if debug > 2:
print("looking for:", p, end=' ', file=debug_out) print("looking for:", p, end=' ', file=debug_out)
@ -115,8 +121,11 @@ def cleanpath(path):
if not d or d == '.': if not d or d == '.':
continue continue
if d == '..': if d == '..':
p.pop() try:
continue p.pop()
continue
except:
break
p.append(d) p.append(d)
return r + '/'.join(p) return r + '/'.join(p)

View File

@ -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}__) .if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__: __${.PARSEFILE}__:
@ -7,7 +7,7 @@ __${.PARSEFILE}__:
.include "init.mk" .include "init.mk"
.endif .endif
.ifndef NOMAKECONF .if !defined(NOMAKECONF) && !defined(NO_MAKECONF)
MAKECONF?= /etc/mk.conf MAKECONF?= /etc/mk.conf
.-include "${MAKECONF}" .-include "${MAKECONF}"
.endif .endif
@ -35,7 +35,7 @@ libprefix?= /usr
.endif .endif
# FreeBSD at least does not set this # 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. # we need to make sure these are defined too in case sys.mk fails to.
COMPILE.s?= ${CC} ${AFLAGS} -c COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS} LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
@ -129,12 +129,11 @@ _uid!= id -u
USERGRP!= id -g USERGRP!= id -g
.export USERGRP .export USERGRP
.endif .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} $xOWN= ${USER}
$xGRP= ${USERGRP} $xGRP= ${USERGRP}
$x_INSTALL_OWN= $x_INSTALL_OWN=
.endfor .endfor
PROG_INSTALL_OWN=
.endif .endif
.endif .endif

View File

@ -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 * Copyright (c) 1988, 1989, 1990, 1993
@ -78,8 +78,8 @@
* Common constants and type declarations for Sprite. * Common constants and type declarations for Sprite.
*/ */
#ifndef _SPRITE #ifndef MAKE_SPRITE_H
#define _SPRITE #define MAKE_SPRITE_H
/* /*
@ -113,4 +113,4 @@ typedef int ReturnStatus;
#define SUCCESS 0x00000000 #define SUCCESS 0x00000000
#define FAILURE 0x00000001 #define FAILURE 0x00000001
#endif /* _SPRITE */ #endif /* MAKE_SPRITE_H */

View File

@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
CLEANDIRS+= FreeBSD CLEANDIRS+= FreeBSD
CLEANFILES+= bootstrap CLEANFILES+= bootstrap
# $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 # Base version on src date
_MAKE_VERSION= 20170510 _MAKE_VERSION= 20170711
PROG?= ${.CURDIR:T} PROG?= ${.CURDIR:T}