Merge bmake-20160307
This commit is contained in:
@@ -1,3 +1,41 @@
|
|||||||
|
2016-03-07 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* Makefile (MAKE_VERSION): 20160307
|
||||||
|
Merge with NetBSD make, pick up
|
||||||
|
o var.c: fix :ts\nnn to be octal by default.
|
||||||
|
o meta.c: meta_finish() to cleanup memory.
|
||||||
|
|
||||||
|
2016-02-26 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* Makefile (MAKE_VERSION): 20160226
|
||||||
|
Merge with NetBSD make, pick up
|
||||||
|
o meta.c: allow meta file for makeDepend if makefiles want it.
|
||||||
|
|
||||||
|
2016-02-19 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* var.c: default .MAKE.SAVE_DOLLARS to FALSE
|
||||||
|
for backwards compatability.
|
||||||
|
|
||||||
|
* Makefile (MAKE_VERSION): 20160220
|
||||||
|
Merge with NetBSD make, pick up
|
||||||
|
o var.c: add knob to control handling of '$$' in :=
|
||||||
|
|
||||||
|
2016-02-18 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* Makefile (MAKE_VERSION): 20160218
|
||||||
|
Merge with NetBSD make, pick up
|
||||||
|
o var.c: add .export-literal allows us to fix sys.clean-env.mk
|
||||||
|
post the changes to Var_Subst.
|
||||||
|
Var_Subst now takes flags, and does not consume '$$' in :=
|
||||||
|
|
||||||
|
2016-02-17 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* Makefile (MAKE_VERSION): 20160217
|
||||||
|
Merge with NetBSD make, pick up
|
||||||
|
o var.c: preserve '$$' in :=
|
||||||
|
o parse.c: add .dinclude for handling included
|
||||||
|
makefile like .depend
|
||||||
|
|
||||||
2015-12-20 Simon J. Gerraty <sjg@bad.crufty.net>
|
2015-12-20 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
* Makefile (MAKE_VERSION): 20151220
|
* Makefile (MAKE_VERSION): 20151220
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# $Id: Makefile,v 1.49 2015/12/20 22:54:40 sjg Exp $
|
# $Id: Makefile,v 1.55 2016/03/07 22:02:47 sjg Exp $
|
||||||
|
|
||||||
# Base version on src date
|
# Base version on src date
|
||||||
MAKE_VERSION= 20151220
|
MAKE_VERSION= 20160307
|
||||||
|
|
||||||
PROG= bmake
|
PROG= bmake
|
||||||
|
|
||||||
|
|||||||
+23
-25
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $ */
|
/* $NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $";
|
static char rcsid[] = "$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
|
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $");
|
__RCSID("$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -136,7 +136,6 @@ __RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $");
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <ctype.h>
|
|
||||||
#ifdef HAVE_AR_H
|
#ifdef HAVE_AR_H
|
||||||
#include <ar.h>
|
#include <ar.h>
|
||||||
#else
|
#else
|
||||||
@@ -156,7 +155,6 @@ struct ar_hdr {
|
|||||||
#if defined(HAVE_RANLIB_H) && !(defined(__ELF__) || defined(NO_RANLIB))
|
#if defined(HAVE_RANLIB_H) && !(defined(__ELF__) || defined(NO_RANLIB))
|
||||||
#include <ranlib.h>
|
#include <ranlib.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_UTIME_H
|
#ifdef HAVE_UTIME_H
|
||||||
@@ -254,8 +252,7 @@ ArchFree(void *ap)
|
|||||||
free(Hash_GetValue(entry));
|
free(Hash_GetValue(entry));
|
||||||
|
|
||||||
free(a->name);
|
free(a->name);
|
||||||
if (a->fnametab)
|
free(a->fnametab);
|
||||||
free(a->fnametab);
|
|
||||||
Hash_DeleteTable(&a->members);
|
Hash_DeleteTable(&a->members);
|
||||||
free(a);
|
free(a);
|
||||||
}
|
}
|
||||||
@@ -310,9 +307,10 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
|||||||
void *freeIt;
|
void *freeIt;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt);
|
result = Var_Parse(cp, ctxt, VARF_UNDEFERR|VARF_WANTRES,
|
||||||
if (freeIt)
|
&length, &freeIt);
|
||||||
free(freeIt);
|
free(freeIt);
|
||||||
|
|
||||||
if (result == var_Error) {
|
if (result == var_Error) {
|
||||||
return(FAILURE);
|
return(FAILURE);
|
||||||
} else {
|
} else {
|
||||||
@@ -325,7 +323,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
|||||||
|
|
||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
if (subLibName) {
|
if (subLibName) {
|
||||||
libName = Var_Subst(NULL, libName, ctxt, TRUE, TRUE);
|
libName = Var_Subst(NULL, libName, ctxt, VARF_UNDEFERR|VARF_WANTRES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -351,9 +349,10 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
|||||||
void *freeIt;
|
void *freeIt;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt);
|
result = Var_Parse(cp, ctxt, VARF_UNDEFERR|VARF_WANTRES,
|
||||||
if (freeIt)
|
&length, &freeIt);
|
||||||
free(freeIt);
|
free(freeIt);
|
||||||
|
|
||||||
if (result == var_Error) {
|
if (result == var_Error) {
|
||||||
return(FAILURE);
|
return(FAILURE);
|
||||||
} else {
|
} else {
|
||||||
@@ -404,7 +403,8 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
|||||||
char *oldMemName = memName;
|
char *oldMemName = memName;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
memName = Var_Subst(NULL, memName, ctxt, TRUE, TRUE);
|
memName = Var_Subst(NULL, memName, ctxt,
|
||||||
|
VARF_UNDEFERR|VARF_WANTRES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now form an archive spec and recurse to deal with nested
|
* Now form an archive spec and recurse to deal with nested
|
||||||
@@ -759,8 +759,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
|||||||
badarch:
|
badarch:
|
||||||
fclose(arch);
|
fclose(arch);
|
||||||
Hash_DeleteTable(&ar->members);
|
Hash_DeleteTable(&ar->members);
|
||||||
if (ar->fnametab)
|
free(ar->fnametab);
|
||||||
free(ar->fnametab);
|
|
||||||
free(ar);
|
free(ar);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1045,10 +1044,10 @@ Arch_Touch(GNode *gn)
|
|||||||
arch = ArchFindMember(Var_Value(ARCHIVE, gn, &p1),
|
arch = ArchFindMember(Var_Value(ARCHIVE, gn, &p1),
|
||||||
Var_Value(MEMBER, gn, &p2),
|
Var_Value(MEMBER, gn, &p2),
|
||||||
&arh, "r+");
|
&arh, "r+");
|
||||||
if (p1)
|
|
||||||
free(p1);
|
free(p1);
|
||||||
if (p2)
|
free(p2);
|
||||||
free(p2);
|
|
||||||
snprintf(arh.AR_DATE, sizeof(arh.AR_DATE), "%-12ld", (long) now);
|
snprintf(arh.AR_DATE, sizeof(arh.AR_DATE), "%-12ld", (long) now);
|
||||||
|
|
||||||
if (arch != NULL) {
|
if (arch != NULL) {
|
||||||
@@ -1127,10 +1126,9 @@ Arch_MTime(GNode *gn)
|
|||||||
arhPtr = ArchStatMember(Var_Value(ARCHIVE, gn, &p1),
|
arhPtr = ArchStatMember(Var_Value(ARCHIVE, gn, &p1),
|
||||||
Var_Value(MEMBER, gn, &p2),
|
Var_Value(MEMBER, gn, &p2),
|
||||||
TRUE);
|
TRUE);
|
||||||
if (p1)
|
|
||||||
free(p1);
|
free(p1);
|
||||||
if (p2)
|
free(p2);
|
||||||
free(p2);
|
|
||||||
|
|
||||||
if (arhPtr != NULL) {
|
if (arhPtr != NULL) {
|
||||||
modTime = (time_t)strtol(arhPtr->AR_DATE, NULL, 10);
|
modTime = (time_t)strtol(arhPtr->AR_DATE, NULL, 10);
|
||||||
|
|||||||
+36
-11
@@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $
|
.\" $NetBSD: make.1,v 1.254 2016/02/20 01:43:28 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 June 4, 2015
|
.Dd February 19, 2016
|
||||||
.Dt MAKE 1
|
.Dt MAKE 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -293,7 +293,7 @@ then
|
|||||||
will search for the specified file or directory named in the remaining part
|
will search for the specified file or directory named in the remaining part
|
||||||
of the argument string.
|
of the argument string.
|
||||||
The search starts with the current directory of
|
The search starts with the current directory of
|
||||||
the Makefile and then works upward towards the root of the filesystem.
|
the Makefile and then works upward towards the root of the file system.
|
||||||
If the search is successful, then the resulting directory replaces the
|
If the search is successful, then the resulting directory replaces the
|
||||||
.Qq \&.../
|
.Qq \&.../
|
||||||
specification in the
|
specification in the
|
||||||
@@ -868,7 +868,7 @@ This can be overridden by setting
|
|||||||
.Va bf
|
.Va bf
|
||||||
to a value which represents True.
|
to a value which represents True.
|
||||||
.It Pa env
|
.It Pa env
|
||||||
For debugging, it can be useful to inlcude the environment
|
For debugging, it can be useful to include the environment
|
||||||
in the .meta file.
|
in the .meta file.
|
||||||
.It Pa verbose
|
.It Pa verbose
|
||||||
If in "meta" mode, print a clue about the target being built.
|
If in "meta" mode, print a clue about the target being built.
|
||||||
@@ -918,7 +918,7 @@ The default value is:
|
|||||||
This variable is used to record the names of variables assigned to
|
This variable is used to record the names of variables assigned to
|
||||||
on the command line, so that they may be exported as part of
|
on the command line, so that they may be exported as part of
|
||||||
.Ql Ev MAKEFLAGS .
|
.Ql Ev MAKEFLAGS .
|
||||||
This behaviour can be disabled by assigning an empty value to
|
This behavior can be disabled by assigning an empty value to
|
||||||
.Ql Va .MAKEOVERRIDES
|
.Ql Va .MAKEOVERRIDES
|
||||||
within a makefile.
|
within a makefile.
|
||||||
Extra variables can be exported from a makefile
|
Extra variables can be exported from a makefile
|
||||||
@@ -941,6 +941,19 @@ The process-id of
|
|||||||
.It Va .MAKE.PPID
|
.It Va .MAKE.PPID
|
||||||
The parent process-id of
|
The parent process-id of
|
||||||
.Nm .
|
.Nm .
|
||||||
|
.It Va .MAKE.SAVE_DOLLARS
|
||||||
|
value should be a boolean that controls whether
|
||||||
|
.Ql $$
|
||||||
|
are preserved when doing
|
||||||
|
.Ql :=
|
||||||
|
assignments.
|
||||||
|
The default is false, for backwards compatibility.
|
||||||
|
Set to true for compatability with other makes.
|
||||||
|
If set to false,
|
||||||
|
.Ql $$
|
||||||
|
becomes
|
||||||
|
.Ql $
|
||||||
|
per normal evaluation rules.
|
||||||
.It Va MAKE_PRINT_VAR_ON_ERROR
|
.It Va MAKE_PRINT_VAR_ON_ERROR
|
||||||
When
|
When
|
||||||
.Nm
|
.Nm
|
||||||
@@ -1044,7 +1057,7 @@ sets
|
|||||||
to the value of
|
to the value of
|
||||||
.Ql Ev PWD
|
.Ql Ev PWD
|
||||||
instead.
|
instead.
|
||||||
This behaviour is disabled if
|
This behavior is disabled if
|
||||||
.Ql Ev MAKEOBJDIRPREFIX
|
.Ql Ev MAKEOBJDIRPREFIX
|
||||||
is set or
|
is set or
|
||||||
.Ql Ev MAKEOBJDIR
|
.Ql Ev MAKEOBJDIR
|
||||||
@@ -1114,7 +1127,7 @@ The wildcard characters may be escaped with a backslash
|
|||||||
As a consequence of the way values are split into words, matched,
|
As a consequence of the way values are split into words, matched,
|
||||||
and then joined, a construct like
|
and then joined, a construct like
|
||||||
.Dl ${VAR:M*}
|
.Dl ${VAR:M*}
|
||||||
will normalise the inter-word spacing, removing all leading and
|
will normalize the inter-word spacing, removing all leading and
|
||||||
trailing space, and converting multiple consecutive spaces
|
trailing space, and converting multiple consecutive spaces
|
||||||
to single spaces.
|
to single spaces.
|
||||||
.
|
.
|
||||||
@@ -1134,7 +1147,7 @@ Randomize words in variable.
|
|||||||
The results will be different each time you are referring to the
|
The results will be different each time you are referring to the
|
||||||
modified variable; use the assignment with expansion
|
modified variable; use the assignment with expansion
|
||||||
.Pq Ql Cm \&:=
|
.Pq Ql Cm \&:=
|
||||||
to prevent such behaviour.
|
to prevent such behavior.
|
||||||
For example,
|
For example,
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
LIST= uno due tre quattro
|
LIST= uno due tre quattro
|
||||||
@@ -1166,7 +1179,7 @@ The value is a format string for
|
|||||||
using the current
|
using the current
|
||||||
.Xr gmtime 3 .
|
.Xr gmtime 3 .
|
||||||
.It Cm \&:hash
|
.It Cm \&:hash
|
||||||
Compute a 32bit hash of the value and encode it as hex digits.
|
Compute a 32-bit hash of the value and encode it as hex digits.
|
||||||
.It Cm \&:localtime
|
.It Cm \&:localtime
|
||||||
The value is a format string for
|
The value is a format string for
|
||||||
.Xr strftime 3 ,
|
.Xr strftime 3 ,
|
||||||
@@ -1444,7 +1457,7 @@ value is divided into words.
|
|||||||
.Pp
|
.Pp
|
||||||
Ordinarily, a value is treated as a sequence of words
|
Ordinarily, a value is treated as a sequence of words
|
||||||
delimited by white space.
|
delimited by white space.
|
||||||
Some modifiers suppress this behaviour,
|
Some modifiers suppress this behavior,
|
||||||
causing a value to be treated as a single word
|
causing a value to be treated as a single word
|
||||||
(possibly containing embedded white space).
|
(possibly containing embedded white space).
|
||||||
An empty value, or a value that consists entirely of white-space,
|
An empty value, or a value that consists entirely of white-space,
|
||||||
@@ -1530,12 +1543,20 @@ For compatibility with other versions of
|
|||||||
.Nm
|
.Nm
|
||||||
.Ql include file ...
|
.Ql include file ...
|
||||||
is also accepted.
|
is also accepted.
|
||||||
|
.Pp
|
||||||
If the include statement is written as
|
If the include statement is written as
|
||||||
.Cm .-include
|
.Cm .-include
|
||||||
or as
|
or as
|
||||||
.Cm .sinclude
|
.Cm .sinclude
|
||||||
then errors locating and/or opening include files are ignored.
|
then errors locating and/or opening include files are ignored.
|
||||||
.Pp
|
.Pp
|
||||||
|
If the include statement is written as
|
||||||
|
.Cm .dinclude
|
||||||
|
not only are errors locating and/or opening include files ignored,
|
||||||
|
but stale dependencies within the included file will be ignored
|
||||||
|
just like
|
||||||
|
.Va .MAKE.DEPENDFILE .
|
||||||
|
.Pp
|
||||||
Conditional expressions are also preceded by a single dot as the first
|
Conditional expressions are also preceded by a single dot as the first
|
||||||
character of a line.
|
character of a line.
|
||||||
The possible conditionals are as follows:
|
The possible conditionals are as follows:
|
||||||
@@ -1571,6 +1592,10 @@ This allows exporting a value to the environment which is different from that
|
|||||||
used by
|
used by
|
||||||
.Nm
|
.Nm
|
||||||
internally.
|
internally.
|
||||||
|
.It Ic .export-literal Ar variable ...
|
||||||
|
The same as
|
||||||
|
.Ql .export-env ,
|
||||||
|
except that variables in the value are not expanded.
|
||||||
.It Ic .info Ar message
|
.It Ic .info Ar message
|
||||||
The message is printed along with the name of the makefile and line number.
|
The message is printed along with the name of the makefile and line number.
|
||||||
.It Ic .undef Ar variable
|
.It Ic .undef Ar variable
|
||||||
@@ -2068,7 +2093,7 @@ The sources are a set of
|
|||||||
pairs.
|
pairs.
|
||||||
.Bl -tag -width hasErrCtls
|
.Bl -tag -width hasErrCtls
|
||||||
.It Ar name
|
.It Ar name
|
||||||
This is the minimal specification, used to select one of the builtin
|
This is the minimal specification, used to select one of the built-in
|
||||||
shell specs;
|
shell specs;
|
||||||
.Ar sh ,
|
.Ar sh ,
|
||||||
.Ar ksh ,
|
.Ar ksh ,
|
||||||
|
|||||||
+39
-22
@@ -178,11 +178,11 @@ DDEESSCCRRIIPPTTIIOONN
|
|||||||
then bbmmaakkee will search for the specified file or directory named
|
then bbmmaakkee will search for the specified file or directory named
|
||||||
in the remaining part of the argument string. The search starts
|
in the remaining part of the argument string. The search starts
|
||||||
with the current directory of the Makefile and then works upward
|
with the current directory of the Makefile and then works upward
|
||||||
towards the root of the filesystem. If the search is successful,
|
towards the root of the file system. If the search is success-
|
||||||
then the resulting directory replaces the ".../" specification in
|
ful, then the resulting directory replaces the ".../" specifica-
|
||||||
the --mm argument. If used, this feature allows bbmmaakkee to easily
|
tion in the --mm argument. If used, this feature allows bbmmaakkee to
|
||||||
search in the current source tree for customized sys.mk files
|
easily search in the current source tree for customized sys.mk
|
||||||
(e.g., by using ".../mk/sys.mk" as an argument).
|
files (e.g., by using ".../mk/sys.mk" as an argument).
|
||||||
|
|
||||||
--nn Display the commands that would have been executed, but do not
|
--nn Display the commands that would have been executed, but do not
|
||||||
actually execute them unless the target depends on the .MAKE spe-
|
actually execute them unless the target depends on the .MAKE spe-
|
||||||
@@ -543,7 +543,7 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
in `_._C_U_R_D_I_R'. This can be overridden by set-
|
in `_._C_U_R_D_I_R'. This can be overridden by set-
|
||||||
ting _b_f to a value which represents True.
|
ting _b_f to a value which represents True.
|
||||||
|
|
||||||
_e_n_v For debugging, it can be useful to inlcude
|
_e_n_v For debugging, it can be useful to include
|
||||||
the environment in the .meta file.
|
the environment in the .meta file.
|
||||||
|
|
||||||
_v_e_r_b_o_s_e If in "meta" mode, print a clue about the
|
_v_e_r_b_o_s_e If in "meta" mode, print a clue about the
|
||||||
@@ -591,7 +591,7 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
|
|
||||||
_._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables
|
_._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables
|
||||||
assigned to on the command line, so that they may be
|
assigned to on the command line, so that they may be
|
||||||
exported as part of `MAKEFLAGS'. This behaviour can be
|
exported as part of `MAKEFLAGS'. This behavior can be
|
||||||
disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'
|
disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'
|
||||||
within a makefile. Extra variables can be exported from
|
within a makefile. Extra variables can be exported from
|
||||||
a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'.
|
a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'.
|
||||||
@@ -607,6 +607,13 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
|
|
||||||
_._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee.
|
_._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee.
|
||||||
|
|
||||||
|
_._M_A_K_E_._S_A_V_E___D_O_L_L_A_R_S
|
||||||
|
value should be a boolean that controls whether `$$' are
|
||||||
|
preserved when doing `:=' assignments. The default is
|
||||||
|
false, for backwards compatibility. Set to true for com-
|
||||||
|
patability with other makes. If set to false, `$$'
|
||||||
|
becomes `$' per normal evaluation rules.
|
||||||
|
|
||||||
_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R
|
_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R
|
||||||
When bbmmaakkee stops due to an error, it prints its name and
|
When bbmmaakkee stops due to an error, it prints its name and
|
||||||
the value of `_._C_U_R_D_I_R' as well as the value of any vari-
|
the value of `_._C_U_R_D_I_R' as well as the value of any vari-
|
||||||
@@ -670,7 +677,7 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
sets `_._C_U_R_D_I_R' to the canonical path given by getcwd(3).
|
sets `_._C_U_R_D_I_R' to the canonical path given by getcwd(3).
|
||||||
However, if the environment variable `PWD' is set and
|
However, if the environment variable `PWD' is set and
|
||||||
gives a path to the current directory, then bbmmaakkee sets
|
gives a path to the current directory, then bbmmaakkee sets
|
||||||
`_._C_U_R_D_I_R' to the value of `PWD' instead. This behaviour
|
`_._C_U_R_D_I_R' to the value of `PWD' instead. This behavior
|
||||||
is disabled if `MAKEOBJDIRPREFIX' is set or `MAKEOBJDIR'
|
is disabled if `MAKEOBJDIRPREFIX' is set or `MAKEOBJDIR'
|
||||||
contains a variable transform. `PWD' is set to the value
|
contains a variable transform. `PWD' is set to the value
|
||||||
of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes.
|
of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes.
|
||||||
@@ -717,7 +724,7 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
of the way values are split into words, matched, and then joined, a
|
of the way values are split into words, matched, and then joined, a
|
||||||
construct like
|
construct like
|
||||||
${VAR:M*}
|
${VAR:M*}
|
||||||
will normalise the inter-word spacing, removing all leading and
|
will normalize the inter-word spacing, removing all leading and
|
||||||
trailing space, and converting multiple consecutive spaces to single
|
trailing space, and converting multiple consecutive spaces to single
|
||||||
spaces.
|
spaces.
|
||||||
|
|
||||||
@@ -730,7 +737,7 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
|
|
||||||
::OOxx Randomize words in variable. The results will be different each
|
::OOxx Randomize words in variable. The results will be different each
|
||||||
time you are referring to the modified variable; use the assignment
|
time you are referring to the modified variable; use the assignment
|
||||||
with expansion (`::==') to prevent such behaviour. For example,
|
with expansion (`::==') to prevent such behavior. For example,
|
||||||
|
|
||||||
LIST= uno due tre quattro
|
LIST= uno due tre quattro
|
||||||
RANDOM_LIST= ${LIST:Ox}
|
RANDOM_LIST= ${LIST:Ox}
|
||||||
@@ -758,7 +765,7 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
gmtime(3).
|
gmtime(3).
|
||||||
|
|
||||||
::hhaasshh
|
::hhaasshh
|
||||||
Compute a 32bit hash of the value and encode it as hex digits.
|
Compute a 32-bit hash of the value and encode it as hex digits.
|
||||||
|
|
||||||
::llooccaallttiimmee
|
::llooccaallttiimmee
|
||||||
The value is a format string for strftime(3), using the current
|
The value is a format string for strftime(3), using the current
|
||||||
@@ -914,13 +921,13 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
|
|||||||
tions related to the way in which the value is divided into words.
|
tions related to the way in which the value is divided into words.
|
||||||
|
|
||||||
Ordinarily, a value is treated as a sequence of words delimited by
|
Ordinarily, a value is treated as a sequence of words delimited by
|
||||||
white space. Some modifiers suppress this behaviour, causing a
|
white space. Some modifiers suppress this behavior, causing a value
|
||||||
value to be treated as a single word (possibly containing embedded
|
to be treated as a single word (possibly containing embedded white
|
||||||
white space). An empty value, or a value that consists entirely of
|
space). An empty value, or a value that consists entirely of white-
|
||||||
white-space, is treated as a single word. For the purposes of the
|
space, is treated as a single word. For the purposes of the `::[[]]'
|
||||||
`::[[]]' modifier, the words are indexed both forwards using positive
|
modifier, the words are indexed both forwards using positive inte-
|
||||||
integers (where index 1 represents the first word), and backwards
|
gers (where index 1 represents the first word), and backwards using
|
||||||
using negative integers (where index -1 represents the last word).
|
negative integers (where index -1 represents the last word).
|
||||||
|
|
||||||
The _r_a_n_g_e is subjected to variable expansion, and the expanded
|
The _r_a_n_g_e is subjected to variable expansion, and the expanded
|
||||||
result is then interpreted as follows:
|
result is then interpreted as follows:
|
||||||
@@ -957,8 +964,14 @@ IINNCCLLUUDDEE SSTTAATTEEMMEENNTTSS,, CCOONNDDIITTIIOO
|
|||||||
used, the including makefile's directory and any directories specified
|
used, the including makefile's directory and any directories specified
|
||||||
using the --II option are searched before the system makefile directory.
|
using the --II option are searched before the system makefile directory.
|
||||||
For compatibility with other versions of bbmmaakkee `include file ...' is also
|
For compatibility with other versions of bbmmaakkee `include file ...' is also
|
||||||
accepted. If the include statement is written as ..--iinncclluuddee or as
|
accepted.
|
||||||
..ssiinncclluuddee then errors locating and/or opening include files are ignored.
|
|
||||||
|
If the include statement is written as ..--iinncclluuddee or as ..ssiinncclluuddee then
|
||||||
|
errors locating and/or opening include files are ignored.
|
||||||
|
|
||||||
|
If the include statement is written as ..ddiinncclluuddee not only are errors
|
||||||
|
locating and/or opening include files ignored, but stale dependencies
|
||||||
|
within the included file will be ignored just like _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E.
|
||||||
|
|
||||||
Conditional expressions are also preceded by a single dot as the first
|
Conditional expressions are also preceded by a single dot as the first
|
||||||
character of a line. The possible conditionals are as follows:
|
character of a line. The possible conditionals are as follows:
|
||||||
@@ -982,6 +995,10 @@ IINNCCLLUUDDEE SSTTAATTEEMMEENNTTSS,, CCOONNDDIITTIIOO
|
|||||||
to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the environ-
|
to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the environ-
|
||||||
ment which is different from that used by bbmmaakkee internally.
|
ment which is different from that used by bbmmaakkee internally.
|
||||||
|
|
||||||
|
..eexxppoorrtt--lliitteerraall _v_a_r_i_a_b_l_e _._._.
|
||||||
|
The same as `.export-env', except that variables in the value are
|
||||||
|
not expanded.
|
||||||
|
|
||||||
..iinnffoo _m_e_s_s_a_g_e
|
..iinnffoo _m_e_s_s_a_g_e
|
||||||
The message is printed along with the name of the makefile and
|
The message is printed along with the name of the makefile and
|
||||||
line number.
|
line number.
|
||||||
@@ -1307,7 +1324,7 @@ SSPPEECCIIAALL TTAARRGGEETTSS
|
|||||||
sources are a set of _f_i_e_l_d_=_v_a_l_u_e pairs.
|
sources are a set of _f_i_e_l_d_=_v_a_l_u_e pairs.
|
||||||
|
|
||||||
_n_a_m_e This is the minimal specification, used to select
|
_n_a_m_e This is the minimal specification, used to select
|
||||||
one of the builtin shell specs; _s_h, _k_s_h, and _c_s_h.
|
one of the built-in shell specs; _s_h, _k_s_h, and _c_s_h.
|
||||||
|
|
||||||
_p_a_t_h Specifies the path to the shell.
|
_p_a_t_h Specifies the path to the shell.
|
||||||
|
|
||||||
@@ -1452,4 +1469,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 5.1 June 4, 2015 NetBSD 5.1
|
NetBSD 5.1 February 19, 2016 NetBSD 5.1
|
||||||
|
|||||||
+12
-14
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: compat.c,v 1.101 2015/10/11 04:51:24 sjg Exp $ */
|
/* $NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos 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.
|
||||||
@@ -70,14 +70,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: compat.c,v 1.101 2015/10/11 04:51:24 sjg Exp $";
|
static char rcsid[] = "$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: compat.c,v 1.101 2015/10/11 04:51:24 sjg Exp $");
|
__RCSID("$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -146,8 +146,8 @@ CompatInterrupt(int signo)
|
|||||||
if (!noExecute && eunlink(file) != -1) {
|
if (!noExecute && eunlink(file) != -1) {
|
||||||
Error("*** %s removed", file);
|
Error("*** %s removed", file);
|
||||||
}
|
}
|
||||||
if (p1)
|
|
||||||
free(p1);
|
free(p1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run .INTERRUPT only if hit with interrupt signal
|
* Run .INTERRUPT only if hit with interrupt signal
|
||||||
@@ -213,7 +213,7 @@ CompatRunCommand(void *cmdp, void *gnp)
|
|||||||
doIt = FALSE;
|
doIt = FALSE;
|
||||||
|
|
||||||
cmdNode = Lst_Member(gn->commands, cmd);
|
cmdNode = Lst_Member(gn->commands, cmd);
|
||||||
cmdStart = Var_Subst(NULL, cmd, gn, FALSE, TRUE);
|
cmdStart = Var_Subst(NULL, cmd, gn, VARF_WANTRES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* brk_string will return an argv with a NULL in av[0], thus causing
|
* brk_string will return an argv with a NULL in av[0], thus causing
|
||||||
@@ -374,10 +374,10 @@ CompatRunCommand(void *cmdp, void *gnp)
|
|||||||
execError("exec", av[0]);
|
execError("exec", av[0]);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
if (mav)
|
|
||||||
free(mav);
|
free(mav);
|
||||||
if (bp)
|
free(bp);
|
||||||
free(bp);
|
|
||||||
Lst_Replace(cmdNode, NULL);
|
Lst_Replace(cmdNode, NULL);
|
||||||
|
|
||||||
#ifdef USE_META
|
#ifdef USE_META
|
||||||
@@ -516,8 +516,7 @@ Compat_Make(void *gnp, void *pgnp)
|
|||||||
if (Lst_Member(gn->iParents, pgn) != NULL) {
|
if (Lst_Member(gn->iParents, pgn) != NULL) {
|
||||||
char *p1;
|
char *p1;
|
||||||
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
|
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -620,8 +619,7 @@ Compat_Make(void *gnp, void *pgnp)
|
|||||||
if (Lst_Member(gn->iParents, pgn) != NULL) {
|
if (Lst_Member(gn->iParents, pgn) != NULL) {
|
||||||
char *p1;
|
char *p1;
|
||||||
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
|
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
}
|
}
|
||||||
switch(gn->made) {
|
switch(gn->made) {
|
||||||
case BEINGMADE:
|
case BEINGMADE:
|
||||||
|
|||||||
+17
-21
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $ */
|
/* $NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos 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.
|
||||||
@@ -70,14 +70,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $";
|
static char rcsid[] = "$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
|
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $");
|
__RCSID("$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -289,10 +289,10 @@ CondGetArg(char **linePtr, char **argPtr, const char *func)
|
|||||||
int len;
|
int len;
|
||||||
void *freeIt;
|
void *freeIt;
|
||||||
|
|
||||||
cp2 = Var_Parse(cp, VAR_CMD, TRUE, TRUE, &len, &freeIt);
|
cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES,
|
||||||
|
&len, &freeIt);
|
||||||
Buf_AddBytes(&buf, strlen(cp2), cp2);
|
Buf_AddBytes(&buf, strlen(cp2), cp2);
|
||||||
if (freeIt)
|
free(freeIt);
|
||||||
free(freeIt);
|
|
||||||
cp += len;
|
cp += len;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -346,8 +346,8 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
|
|||||||
} else {
|
} else {
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
if (p1)
|
|
||||||
free(p1);
|
free(p1);
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,8 +574,9 @@ CondGetString(Boolean doEval, Boolean *quoted, void **freeIt, Boolean strictLHS)
|
|||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
/* if we are in quotes, then an undefined variable is ok */
|
/* if we are in quotes, then an undefined variable is ok */
|
||||||
str = Var_Parse(condExpr, VAR_CMD, (qt ? 0 : doEval),
|
str = Var_Parse(condExpr, VAR_CMD,
|
||||||
TRUE, &len, freeIt);
|
((!qt && doEval) ? VARF_UNDEFERR : 0) |
|
||||||
|
VARF_WANTRES, &len, freeIt);
|
||||||
if (str == var_Error) {
|
if (str == var_Error) {
|
||||||
if (*freeIt) {
|
if (*freeIt) {
|
||||||
free(*freeIt);
|
free(*freeIt);
|
||||||
@@ -805,10 +806,8 @@ compare_expression(Boolean doEval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (lhsFree)
|
free(lhsFree);
|
||||||
free(lhsFree);
|
free(rhsFree);
|
||||||
if (rhsFree)
|
|
||||||
free(rhsFree);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +826,7 @@ get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
|
|||||||
/* We do all the work here and return the result as the length */
|
/* We do all the work here and return the result as the length */
|
||||||
*argPtr = NULL;
|
*argPtr = NULL;
|
||||||
|
|
||||||
val = Var_Parse(cp - 1, VAR_CMD, FALSE, TRUE, &length, &freeIt);
|
val = Var_Parse(cp - 1, VAR_CMD, VARF_WANTRES, &length, &freeIt);
|
||||||
/*
|
/*
|
||||||
* Advance *linePtr to beyond the closing ). Note that
|
* Advance *linePtr to beyond the closing ). Note that
|
||||||
* we subtract one because 'length' is calculated from 'cp - 1'.
|
* we subtract one because 'length' is calculated from 'cp - 1'.
|
||||||
@@ -848,8 +847,7 @@ get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
|
|||||||
* true/false here.
|
* true/false here.
|
||||||
*/
|
*/
|
||||||
length = *val ? 2 : 1;
|
length = *val ? 2 : 1;
|
||||||
if (freeIt)
|
free(freeIt);
|
||||||
free(freeIt);
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,8 +898,7 @@ compare_function(Boolean doEval)
|
|||||||
}
|
}
|
||||||
/* Evaluate the argument using the required function. */
|
/* Evaluate the argument using the required function. */
|
||||||
t = !doEval || fn_def->fn_proc(arglen, arg);
|
t = !doEval || fn_def->fn_proc(arglen, arg);
|
||||||
if (arg)
|
free(arg);
|
||||||
free(arg);
|
|
||||||
condExpr = cp;
|
condExpr = cp;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@@ -933,8 +930,7 @@ compare_function(Boolean doEval)
|
|||||||
* be empty - even if it contained a variable expansion.
|
* be empty - even if it contained a variable expansion.
|
||||||
*/
|
*/
|
||||||
t = !doEval || if_info->defProc(arglen, arg) != if_info->doNot;
|
t = !doEval || if_info->defProc(arglen, arg) != if_info->doNot;
|
||||||
if (arg)
|
free(arg);
|
||||||
free(arg);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+57
-32
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: dirname.c,v 1.11 2009/11/24 13:34:20 tnozaki Exp $ */
|
/* $NetBSD: dirname.c,v 1.13 2014/07/16 10:52:26 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||||
@@ -35,7 +35,10 @@
|
|||||||
#ifndef HAVE_DIRNAME
|
#ifndef HAVE_DIRNAME
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#ifdef HAVE_LIBGEN_H
|
||||||
|
#include <libgen.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_LIMITS_H
|
#ifdef HAVE_LIMITS_H
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -45,51 +48,73 @@
|
|||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
# define PATH_MAX 1024
|
# define PATH_MAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MIN
|
||||||
|
# define MIN(a, b) ((a < b) ? a : b)
|
||||||
|
#endif
|
||||||
|
|
||||||
char *
|
|
||||||
dirname(char *path)
|
static size_t
|
||||||
|
xdirname_r(const char *path, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
static char result[PATH_MAX];
|
const char *endp;
|
||||||
const char *lastp;
|
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If `path' is a null pointer or points to an empty string,
|
* If `path' is a null pointer or points to an empty string,
|
||||||
* return a pointer to the string ".".
|
* return a pointer to the string ".".
|
||||||
*/
|
*/
|
||||||
if ((path == NULL) || (*path == '\0'))
|
if (path == NULL || *path == '\0') {
|
||||||
goto singledot;
|
path = ".";
|
||||||
|
len = 1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Strip trailing slashes, if any. */
|
/* Strip trailing slashes, if any. */
|
||||||
lastp = path + strlen(path) - 1;
|
endp = path + strlen(path) - 1;
|
||||||
while (lastp != path && *lastp == '/')
|
while (endp != path && *endp == '/')
|
||||||
lastp--;
|
endp--;
|
||||||
|
|
||||||
/* Terminate path at the last occurence of '/'. */
|
/* Find the start of the dir */
|
||||||
do {
|
while (endp > path && *endp != '/')
|
||||||
if (*lastp == '/') {
|
endp--;
|
||||||
/* Strip trailing slashes, if any. */
|
|
||||||
while (lastp != path && *lastp == '/')
|
|
||||||
lastp--;
|
|
||||||
|
|
||||||
/* ...and copy the result into the result buffer. */
|
if (endp == path) {
|
||||||
len = (lastp - path) + 1 /* last char */;
|
path = *endp == '/' ? "/" : ".";
|
||||||
if (len > (PATH_MAX - 1))
|
len = 1;
|
||||||
len = PATH_MAX - 1;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(result, path, len);
|
do
|
||||||
result[len] = '\0';
|
endp--;
|
||||||
|
while (endp > path && *endp == '/');
|
||||||
|
|
||||||
return (result);
|
len = endp - path + 1;
|
||||||
}
|
out:
|
||||||
} while (--lastp >= path);
|
if (buf != NULL && buflen != 0) {
|
||||||
|
buflen = MIN(len, buflen - 1);
|
||||||
|
memcpy(buf, path, buflen);
|
||||||
|
buf[buflen] = '\0';
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
/* No /'s found, return a pointer to the string ".". */
|
char *
|
||||||
singledot:
|
dirname(char *path)
|
||||||
result[0] = '.';
|
{
|
||||||
result[1] = '\0';
|
static char result[PATH_MAX];
|
||||||
|
(void)xdirname_r(path, result, sizeof(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return (result);
|
#ifdef MAIN
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf("%s\n", dirname(argv[1]));
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: for.c,v 1.50 2015/10/11 04:51:24 sjg Exp $ */
|
/* $NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1992, The Regents of the University of California.
|
* Copyright (c) 1992, The Regents of the University of California.
|
||||||
@@ -30,14 +30,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: for.c,v 1.50 2015/10/11 04:51:24 sjg Exp $";
|
static char rcsid[] = "$NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: for.c,v 1.50 2015/10/11 04:51:24 sjg Exp $");
|
__RCSID("$NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -216,7 +216,7 @@ For_Eval(char *line)
|
|||||||
* We can't do the escapes here - because we don't know whether
|
* We can't do the escapes here - because we don't know whether
|
||||||
* we are substuting into ${...} or $(...).
|
* we are substuting into ${...} or $(...).
|
||||||
*/
|
*/
|
||||||
sub = Var_Subst(NULL, ptr, VAR_GLOBAL, FALSE, TRUE);
|
sub = Var_Subst(NULL, ptr, VAR_GLOBAL, VARF_WANTRES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Split into words allowing for quoted strings.
|
* Split into words allowing for quoted strings.
|
||||||
|
|||||||
+49
-40
@@ -1,3 +1,5 @@
|
|||||||
|
/* $NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1987, 1993, 1994
|
* Copyright (c) 1987, 1993, 1994
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
@@ -10,11 +12,7 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. Neither the name of the University nor the names of its contributors
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -35,11 +33,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#if !defined(HAVE_GETOPT) || defined(WANT_GETOPT_LONG) || defined(BROKEN_GETOPT)
|
#if !defined(HAVE_GETOPT) || defined(WANT_GETOPT_LONG) || defined(BROKEN_GETOPT)
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
|
||||||
/* static char sccsid[] = "from: @(#)getopt.c 8.2 (Berkeley) 4/2/94"; */
|
|
||||||
static char *rcsid = "$Id: getopt.c,v 1.3 1999/01/08 02:14:18 sjg Exp $";
|
|
||||||
#endif /* LIBC_SCCS and not lint */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -61,13 +55,10 @@ char *optarg; /* argument associated with option */
|
|||||||
* Parse argc/argv argument vector.
|
* Parse argc/argv argument vector.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
getopt(nargc, nargv, ostr)
|
getopt(int nargc, char * const nargv[], const char *ostr)
|
||||||
int nargc;
|
|
||||||
char * const *nargv;
|
|
||||||
const char *ostr;
|
|
||||||
{
|
{
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
static char *place = EMSG; /* option letter processing */
|
static const char *place = EMSG; /* option letter processing */
|
||||||
char *oli; /* option letter list index */
|
char *oli; /* option letter list index */
|
||||||
|
|
||||||
#ifndef BSD4_4
|
#ifndef BSD4_4
|
||||||
@@ -79,43 +70,63 @@ getopt(nargc, nargv, ostr)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (optreset || !*place) { /* update scanning pointer */
|
if (optreset || *place == 0) { /* update scanning pointer */
|
||||||
optreset = 0;
|
optreset = 0;
|
||||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
place = nargv[optind];
|
||||||
|
if (optind >= nargc || *place++ != '-') {
|
||||||
|
/* Argument is absent or is not an option */
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (place[1] && *++place == '-' /* found "--" */
|
optopt = *place++;
|
||||||
&& !place[1]) { /* and not "--foo" */
|
if (optopt == '-' && *place == 0) {
|
||||||
|
/* "--" => end of options */
|
||||||
++optind;
|
++optind;
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} /* option letter okay? */
|
if (optopt == 0) {
|
||||||
if ((optopt = (int)*place++) == (int)':' ||
|
/* Solitary '-', treat as a '-' option
|
||||||
!(oli = strchr(ostr, optopt))) {
|
if the program (eg su) is looking for it. */
|
||||||
/*
|
place = EMSG;
|
||||||
* if the user didn't specify '-' as an option,
|
if (strchr(ostr, '-') == NULL)
|
||||||
* assume it means -1.
|
return -1;
|
||||||
*/
|
optopt = '-';
|
||||||
if (optopt == (int)'-')
|
}
|
||||||
return (-1);
|
} else
|
||||||
if (!*place)
|
optopt = *place++;
|
||||||
|
|
||||||
|
/* See if option letter is one the caller wanted... */
|
||||||
|
if (optopt == ':' || (oli = strchr(ostr, optopt)) == NULL) {
|
||||||
|
if (*place == 0)
|
||||||
++optind;
|
++optind;
|
||||||
if (opterr && *ostr != ':')
|
if (opterr && *ostr != ':')
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"%s: illegal option -- %c\n", __progname, optopt);
|
"%s: unknown option -- %c\n", __progname, optopt);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
if (*++oli != ':') { /* don't need argument */
|
|
||||||
|
/* Does this option need an argument? */
|
||||||
|
if (oli[1] != ':') {
|
||||||
|
/* don't need argument */
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
if (!*place)
|
if (*place == 0)
|
||||||
++optind;
|
++optind;
|
||||||
}
|
} else {
|
||||||
else { /* need an argument */
|
/* Option-argument is either the rest of this argument or the
|
||||||
if (*place) /* no white space */
|
entire next argument. */
|
||||||
optarg = place;
|
if (*place)
|
||||||
else if (nargc <= ++optind) { /* no arg */
|
optarg = __UNCONST(place);
|
||||||
|
else if (oli[2] == ':')
|
||||||
|
/*
|
||||||
|
* GNU Extension, for optional arguments if the rest of
|
||||||
|
* the argument is empty, we return NULL
|
||||||
|
*/
|
||||||
|
optarg = NULL;
|
||||||
|
else if (nargc > ++optind)
|
||||||
|
optarg = nargv[optind];
|
||||||
|
else {
|
||||||
|
/* option-argument absent */
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
if (*ostr == ':')
|
if (*ostr == ':')
|
||||||
return (BADARG);
|
return (BADARG);
|
||||||
@@ -125,12 +136,10 @@ getopt(nargc, nargv, ostr)
|
|||||||
__progname, optopt);
|
__progname, optopt);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
else /* white space */
|
|
||||||
optarg = nargv[optind];
|
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
++optind;
|
++optind;
|
||||||
}
|
}
|
||||||
return (optopt); /* dump back option letter */
|
return (optopt); /* return option letter */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAIN
|
#ifdef MAIN
|
||||||
|
|||||||
+15
-20
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $ */
|
/* $NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos 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.
|
||||||
@@ -70,14 +70,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $";
|
static char rcsid[] = "$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $");
|
__RCSID("$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -144,7 +144,6 @@ __RCSID("$NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $");
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#if !defined(USE_SELECT) && defined(HAVE_POLL_H)
|
#if !defined(USE_SELECT) && defined(HAVE_POLL_H)
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#else
|
#else
|
||||||
@@ -441,8 +440,8 @@ JobCreatePipe(Job *job, int minfd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set close-on-exec flag for both */
|
/* Set close-on-exec flag for both */
|
||||||
(void)fcntl(job->jobPipe[0], F_SETFD, 1);
|
(void)fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC);
|
||||||
(void)fcntl(job->jobPipe[1], F_SETFD, 1);
|
(void)fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We mark the input side of the pipe non-blocking; we poll(2) the
|
* We mark the input side of the pipe non-blocking; we poll(2) the
|
||||||
@@ -731,7 +730,7 @@ JobPrintCommand(void *cmdp, void *jobp)
|
|||||||
|
|
||||||
numCommands += 1;
|
numCommands += 1;
|
||||||
|
|
||||||
cmdStart = cmd = Var_Subst(NULL, cmd, job->node, FALSE, TRUE);
|
cmdStart = cmd = Var_Subst(NULL, cmd, job->node, VARF_WANTRES);
|
||||||
|
|
||||||
cmdTemplate = "%s\n";
|
cmdTemplate = "%s\n";
|
||||||
|
|
||||||
@@ -882,8 +881,7 @@ JobPrintCommand(void *cmdp, void *jobp)
|
|||||||
|
|
||||||
DBPRINTF(cmdTemplate, cmd);
|
DBPRINTF(cmdTemplate, cmd);
|
||||||
free(cmdStart);
|
free(cmdStart);
|
||||||
if (escCmd)
|
free(escCmd);
|
||||||
free(escCmd);
|
|
||||||
if (errOff) {
|
if (errOff) {
|
||||||
/*
|
/*
|
||||||
* If echoing is already off, there's no point in issuing the
|
* If echoing is already off, there's no point in issuing the
|
||||||
@@ -919,7 +917,7 @@ JobPrintCommand(void *cmdp, void *jobp)
|
|||||||
static int
|
static int
|
||||||
JobSaveCommand(void *cmd, void *gn)
|
JobSaveCommand(void *cmd, void *gn)
|
||||||
{
|
{
|
||||||
cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, FALSE, TRUE);
|
cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, VARF_WANTRES);
|
||||||
(void)Lst_AtEnd(postCommands->commands, cmd);
|
(void)Lst_AtEnd(postCommands->commands, cmd);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -1250,8 +1248,7 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
|
|||||||
*/
|
*/
|
||||||
Make_HandleUse(DEFAULT, gn);
|
Make_HandleUse(DEFAULT, gn);
|
||||||
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn, 0);
|
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn, 0);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
} else if (Dir_MTime(gn, 0) == 0 && (gn->type & OP_SPECIAL) == 0) {
|
} else if (Dir_MTime(gn, 0) == 0 && (gn->type & OP_SPECIAL) == 0) {
|
||||||
/*
|
/*
|
||||||
* The node wasn't the target of an operator we have no .DEFAULT
|
* The node wasn't the target of an operator we have no .DEFAULT
|
||||||
@@ -1615,7 +1612,7 @@ JobStart(GNode *gn, int flags)
|
|||||||
if (job->cmdFILE == NULL) {
|
if (job->cmdFILE == NULL) {
|
||||||
Punt("Could not fdopen %s", tfile);
|
Punt("Could not fdopen %s", tfile);
|
||||||
}
|
}
|
||||||
(void)fcntl(FILENO(job->cmdFILE), F_SETFD, 1);
|
(void)fcntl(FILENO(job->cmdFILE), F_SETFD, FD_CLOEXEC);
|
||||||
/*
|
/*
|
||||||
* Send the commands to the command file, flush all its buffers then
|
* Send the commands to the command file, flush all its buffers then
|
||||||
* rewind and remove the thing.
|
* rewind and remove the thing.
|
||||||
@@ -2212,7 +2209,7 @@ Job_SetPrefix(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
targPrefix = Var_Subst(NULL, "${" MAKE_JOB_PREFIX "}",
|
targPrefix = Var_Subst(NULL, "${" MAKE_JOB_PREFIX "}",
|
||||||
VAR_GLOBAL, FALSE, TRUE);
|
VAR_GLOBAL, VARF_WANTRES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
@@ -2425,8 +2422,7 @@ Job_ParseShell(char *line)
|
|||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shellArgv)
|
free(UNCONST(shellArgv));
|
||||||
free(UNCONST(shellArgv));
|
|
||||||
|
|
||||||
memset(&newShell, 0, sizeof(newShell));
|
memset(&newShell, 0, sizeof(newShell));
|
||||||
|
|
||||||
@@ -2674,8 +2670,7 @@ void
|
|||||||
Job_End(void)
|
Job_End(void)
|
||||||
{
|
{
|
||||||
#ifdef CLEANUP
|
#ifdef CLEANUP
|
||||||
if (shellArgv)
|
free(shellArgv);
|
||||||
free(shellArgv);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2880,8 +2875,8 @@ Job_ServerStart(int max_tokens, int jp_0, int jp_1)
|
|||||||
/* Pipe passed in from parent */
|
/* Pipe passed in from parent */
|
||||||
tokenWaitJob.inPipe = jp_0;
|
tokenWaitJob.inPipe = jp_0;
|
||||||
tokenWaitJob.outPipe = jp_1;
|
tokenWaitJob.outPipe = jp_1;
|
||||||
(void)fcntl(jp_0, F_SETFD, 1);
|
(void)fcntl(jp_0, F_SETFD, FD_CLOEXEC);
|
||||||
(void)fcntl(jp_1, F_SETFD, 1);
|
(void)fcntl(jp_1, F_SETFD, FD_CLOEXEC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+64
-50
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $ */
|
/* $NetBSD: main.c,v 1.242 2016/03/07 21:45:43 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.235 2015/10/25 05:24:44 sjg Exp $";
|
static char rcsid[] = "$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 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.235 2015/10/25 05:24:44 sjg Exp $");
|
__RCSID("$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -125,7 +125,6 @@ __RCSID("$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $");
|
|||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -696,8 +695,7 @@ Main_ParseArgLine(const char *line)
|
|||||||
#endif
|
#endif
|
||||||
buf = bmake_malloc(len = strlen(line) + strlen(argv0) + 2);
|
buf = bmake_malloc(len = strlen(line) + strlen(argv0) + 2);
|
||||||
(void)snprintf(buf, len, "%s %s", argv0, line);
|
(void)snprintf(buf, len, "%s %s", argv0, line);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
|
|
||||||
argv = brk_string(buf, &argc, TRUE, &args);
|
argv = brk_string(buf, &argc, TRUE, &args);
|
||||||
if (argv == NULL) {
|
if (argv == NULL) {
|
||||||
@@ -723,7 +721,7 @@ Main_SetObjdir(const char *path)
|
|||||||
/* expand variable substitutions */
|
/* expand variable substitutions */
|
||||||
if (strchr(path, '$') != 0) {
|
if (strchr(path, '$') != 0) {
|
||||||
snprintf(buf, MAXPATHLEN, "%s", path);
|
snprintf(buf, MAXPATHLEN, "%s", path);
|
||||||
path = p = Var_Subst(NULL, buf, VAR_GLOBAL, FALSE, TRUE);
|
path = p = Var_Subst(NULL, buf, VAR_GLOBAL, VARF_WANTRES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path[0] != '/') {
|
if (path[0] != '/') {
|
||||||
@@ -747,8 +745,7 @@ Main_SetObjdir(const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p)
|
free(p);
|
||||||
free(p);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,7 +804,7 @@ MakeMode(const char *mode)
|
|||||||
|
|
||||||
if (!mode)
|
if (!mode)
|
||||||
mode = mp = Var_Subst(NULL, "${" MAKE_MODE ":tl}",
|
mode = mp = Var_Subst(NULL, "${" MAKE_MODE ":tl}",
|
||||||
VAR_GLOBAL, FALSE, TRUE);
|
VAR_GLOBAL, VARF_WANTRES);
|
||||||
|
|
||||||
if (mode && *mode) {
|
if (mode && *mode) {
|
||||||
if (strstr(mode, "compat")) {
|
if (strstr(mode, "compat")) {
|
||||||
@@ -819,8 +816,8 @@ MakeMode(const char *mode)
|
|||||||
meta_mode_init(mode);
|
meta_mode_init(mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (mp)
|
|
||||||
free(mp);
|
free(mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
@@ -1253,7 +1250,7 @@ main(int argc, char **argv)
|
|||||||
(char *)Lst_Datum(ln));
|
(char *)Lst_Datum(ln));
|
||||||
} else {
|
} else {
|
||||||
p1 = Var_Subst(NULL, "${" MAKEFILE_PREFERENCE "}",
|
p1 = Var_Subst(NULL, "${" MAKEFILE_PREFERENCE "}",
|
||||||
VAR_CMD, FALSE, TRUE);
|
VAR_CMD, VARF_WANTRES);
|
||||||
if (p1) {
|
if (p1) {
|
||||||
(void)str2Lst_Append(makefiles, p1, NULL);
|
(void)str2Lst_Append(makefiles, p1, NULL);
|
||||||
(void)Lst_Find(makefiles, NULL, ReadMakefile);
|
(void)Lst_Find(makefiles, NULL, ReadMakefile);
|
||||||
@@ -1264,7 +1261,7 @@ main(int argc, char **argv)
|
|||||||
/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
|
/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
|
||||||
if (!noBuiltins || !printVars) {
|
if (!noBuiltins || !printVars) {
|
||||||
makeDependfile = Var_Subst(NULL, "${.MAKE.DEPENDFILE:T}",
|
makeDependfile = Var_Subst(NULL, "${.MAKE.DEPENDFILE:T}",
|
||||||
VAR_CMD, FALSE, TRUE);
|
VAR_CMD, VARF_WANTRES);
|
||||||
doing_depend = TRUE;
|
doing_depend = TRUE;
|
||||||
(void)ReadMakefile(makeDependfile, NULL);
|
(void)ReadMakefile(makeDependfile, NULL);
|
||||||
doing_depend = FALSE;
|
doing_depend = FALSE;
|
||||||
@@ -1276,8 +1273,7 @@ main(int argc, char **argv)
|
|||||||
MakeMode(NULL);
|
MakeMode(NULL);
|
||||||
|
|
||||||
Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
|
Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
|
|
||||||
if (!compatMake)
|
if (!compatMake)
|
||||||
Job_ServerStart(maxJobTokens, jp_0, jp_1);
|
Job_ServerStart(maxJobTokens, jp_0, jp_1);
|
||||||
@@ -1302,7 +1298,7 @@ main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
static char VPATH[] = "${VPATH}";
|
static char VPATH[] = "${VPATH}";
|
||||||
|
|
||||||
vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE, TRUE);
|
vpath = Var_Subst(NULL, VPATH, VAR_CMD, VARF_WANTRES);
|
||||||
path = vpath;
|
path = vpath;
|
||||||
do {
|
do {
|
||||||
/* skip to end of directory */
|
/* skip to end of directory */
|
||||||
@@ -1350,7 +1346,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (strchr(var, '$')) {
|
if (strchr(var, '$')) {
|
||||||
value = p1 = Var_Subst(NULL, var, VAR_GLOBAL,
|
value = p1 = Var_Subst(NULL, var, VAR_GLOBAL,
|
||||||
FALSE, TRUE);
|
VARF_WANTRES);
|
||||||
} else if (expandVars) {
|
} else if (expandVars) {
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
|
|
||||||
@@ -1358,13 +1354,12 @@ main(int argc, char **argv)
|
|||||||
Fatal("%s: variable name too big: %s",
|
Fatal("%s: variable name too big: %s",
|
||||||
progname, var);
|
progname, var);
|
||||||
value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
|
value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
|
||||||
FALSE, TRUE);
|
VARF_WANTRES);
|
||||||
} else {
|
} else {
|
||||||
value = Var_Value(var, VAR_GLOBAL, &p1);
|
value = Var_Value(var, VAR_GLOBAL, &p1);
|
||||||
}
|
}
|
||||||
printf("%s\n", value ? value : "");
|
printf("%s\n", value ? value : "");
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@@ -1420,6 +1415,9 @@ main(int argc, char **argv)
|
|||||||
if (enterFlag)
|
if (enterFlag)
|
||||||
printf("%s: Leaving directory `%s'\n", progname, curdir);
|
printf("%s: Leaving directory `%s'\n", progname, curdir);
|
||||||
|
|
||||||
|
#ifdef USE_META
|
||||||
|
meta_finish();
|
||||||
|
#endif
|
||||||
Suff_End();
|
Suff_End();
|
||||||
Targ_End();
|
Targ_End();
|
||||||
Arch_End();
|
Arch_End();
|
||||||
@@ -1488,8 +1486,7 @@ ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
|
|||||||
name = Dir_FindFile(fname,
|
name = Dir_FindFile(fname,
|
||||||
Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
|
Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
|
||||||
if (!name || (fd = open(name, O_RDONLY)) == -1) {
|
if (!name || (fd = open(name, O_RDONLY)) == -1) {
|
||||||
if (name)
|
free(name);
|
||||||
free(name);
|
|
||||||
free(path);
|
free(path);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@@ -1896,7 +1893,7 @@ PrintOnError(GNode *gn, const char *s)
|
|||||||
}
|
}
|
||||||
strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
|
strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
|
||||||
sizeof(tmp) - 1);
|
sizeof(tmp) - 1);
|
||||||
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
|
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
|
||||||
if (cp) {
|
if (cp) {
|
||||||
if (*cp)
|
if (*cp)
|
||||||
printf("%s", cp);
|
printf("%s", cp);
|
||||||
@@ -1927,7 +1924,7 @@ Main_ExportMAKEFLAGS(Boolean first)
|
|||||||
|
|
||||||
strncpy(tmp, "${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}",
|
strncpy(tmp, "${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}",
|
||||||
sizeof(tmp));
|
sizeof(tmp));
|
||||||
s = Var_Subst(NULL, tmp, VAR_CMD, FALSE, TRUE);
|
s = Var_Subst(NULL, tmp, VAR_CMD, VARF_WANTRES);
|
||||||
if (s && *s) {
|
if (s && *s) {
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
setenv("MAKEFLAGS", s, 1);
|
setenv("MAKEFLAGS", s, 1);
|
||||||
@@ -1950,7 +1947,7 @@ getTmpdir(void)
|
|||||||
* Ensure it ends with /.
|
* Ensure it ends with /.
|
||||||
*/
|
*/
|
||||||
tmpdir = Var_Subst(NULL, "${TMPDIR:tA:U" _PATH_TMP "}/", VAR_GLOBAL,
|
tmpdir = Var_Subst(NULL, "${TMPDIR:tA:U" _PATH_TMP "}/", VAR_GLOBAL,
|
||||||
FALSE, TRUE);
|
VARF_WANTRES);
|
||||||
if (stat(tmpdir, &st) < 0 || !S_ISDIR(st.st_mode)) {
|
if (stat(tmpdir, &st) < 0 || !S_ISDIR(st.st_mode)) {
|
||||||
free(tmpdir);
|
free(tmpdir);
|
||||||
tmpdir = bmake_strdup(_PATH_TMP);
|
tmpdir = bmake_strdup(_PATH_TMP);
|
||||||
@@ -1990,6 +1987,44 @@ mkTempFile(const char *pattern, char **fnamep)
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a string representation of a boolean.
|
||||||
|
* Anything that looks like "No", "False", "Off", "0" etc,
|
||||||
|
* is FALSE, otherwise TRUE.
|
||||||
|
*/
|
||||||
|
Boolean
|
||||||
|
s2Boolean(const char *s, Boolean bf)
|
||||||
|
{
|
||||||
|
if (s) {
|
||||||
|
switch(*s) {
|
||||||
|
case '\0': /* not set - the default wins */
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
case 'F':
|
||||||
|
case 'f':
|
||||||
|
case 'N':
|
||||||
|
case 'n':
|
||||||
|
bf = FALSE;
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
case 'o':
|
||||||
|
switch (s[1]) {
|
||||||
|
case 'F':
|
||||||
|
case 'f':
|
||||||
|
bf = FALSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bf = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bf = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (bf);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a Boolean based on setting of a knob.
|
* Return a Boolean based on setting of a knob.
|
||||||
@@ -2004,32 +2039,11 @@ getBoolean(const char *name, Boolean bf)
|
|||||||
char tmp[64];
|
char tmp[64];
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if (snprintf(tmp, sizeof(tmp), "${%s:tl}", name) < (int)(sizeof(tmp))) {
|
if (snprintf(tmp, sizeof(tmp), "${%s:U:tl}", name) < (int)(sizeof(tmp))) {
|
||||||
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
|
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
|
||||||
|
|
||||||
if (cp) {
|
if (cp) {
|
||||||
switch(*cp) {
|
bf = s2Boolean(cp, bf);
|
||||||
case '\0': /* not set - the default wins */
|
|
||||||
break;
|
|
||||||
case '0':
|
|
||||||
case 'f':
|
|
||||||
case 'n':
|
|
||||||
bf = FALSE;
|
|
||||||
break;
|
|
||||||
case 'o':
|
|
||||||
switch (cp[1]) {
|
|
||||||
case 'f':
|
|
||||||
bf = FALSE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bf = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bf = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
free(cp);
|
free(cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-11
@@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $
|
.\" $NetBSD: make.1,v 1.254 2016/02/20 01:43:28 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 June 4, 2015
|
.Dd February 19, 2016
|
||||||
.Dt MAKE 1
|
.Dt MAKE 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -293,7 +293,7 @@ then
|
|||||||
will search for the specified file or directory named in the remaining part
|
will search for the specified file or directory named in the remaining part
|
||||||
of the argument string.
|
of the argument string.
|
||||||
The search starts with the current directory of
|
The search starts with the current directory of
|
||||||
the Makefile and then works upward towards the root of the filesystem.
|
the Makefile and then works upward towards the root of the file system.
|
||||||
If the search is successful, then the resulting directory replaces the
|
If the search is successful, then the resulting directory replaces the
|
||||||
.Qq \&.../
|
.Qq \&.../
|
||||||
specification in the
|
specification in the
|
||||||
@@ -879,7 +879,7 @@ This can be overridden by setting
|
|||||||
.Va bf
|
.Va bf
|
||||||
to a value which represents True.
|
to a value which represents True.
|
||||||
.It Pa env
|
.It Pa env
|
||||||
For debugging, it can be useful to inlcude the environment
|
For debugging, it can be useful to include the environment
|
||||||
in the .meta file.
|
in the .meta file.
|
||||||
.It Pa verbose
|
.It Pa verbose
|
||||||
If in "meta" mode, print a clue about the target being built.
|
If in "meta" mode, print a clue about the target being built.
|
||||||
@@ -929,7 +929,7 @@ The default value is:
|
|||||||
This variable is used to record the names of variables assigned to
|
This variable is used to record the names of variables assigned to
|
||||||
on the command line, so that they may be exported as part of
|
on the command line, so that they may be exported as part of
|
||||||
.Ql Ev MAKEFLAGS .
|
.Ql Ev MAKEFLAGS .
|
||||||
This behaviour can be disabled by assigning an empty value to
|
This behavior can be disabled by assigning an empty value to
|
||||||
.Ql Va .MAKEOVERRIDES
|
.Ql Va .MAKEOVERRIDES
|
||||||
within a makefile.
|
within a makefile.
|
||||||
Extra variables can be exported from a makefile
|
Extra variables can be exported from a makefile
|
||||||
@@ -952,6 +952,19 @@ The process-id of
|
|||||||
.It Va .MAKE.PPID
|
.It Va .MAKE.PPID
|
||||||
The parent process-id of
|
The parent process-id of
|
||||||
.Nm .
|
.Nm .
|
||||||
|
.It Va .MAKE.SAVE_DOLLARS
|
||||||
|
value should be a boolean that controls whether
|
||||||
|
.Ql $$
|
||||||
|
are preserved when doing
|
||||||
|
.Ql :=
|
||||||
|
assignments.
|
||||||
|
The default is false, for backwards compatibility.
|
||||||
|
Set to true for compatability with other makes.
|
||||||
|
If set to false,
|
||||||
|
.Ql $$
|
||||||
|
becomes
|
||||||
|
.Ql $
|
||||||
|
per normal evaluation rules.
|
||||||
.It Va MAKE_PRINT_VAR_ON_ERROR
|
.It Va MAKE_PRINT_VAR_ON_ERROR
|
||||||
When
|
When
|
||||||
.Nm
|
.Nm
|
||||||
@@ -1055,7 +1068,7 @@ sets
|
|||||||
to the value of
|
to the value of
|
||||||
.Ql Ev PWD
|
.Ql Ev PWD
|
||||||
instead.
|
instead.
|
||||||
This behaviour is disabled if
|
This behavior is disabled if
|
||||||
.Ql Ev MAKEOBJDIRPREFIX
|
.Ql Ev MAKEOBJDIRPREFIX
|
||||||
is set or
|
is set or
|
||||||
.Ql Ev MAKEOBJDIR
|
.Ql Ev MAKEOBJDIR
|
||||||
@@ -1125,7 +1138,7 @@ The wildcard characters may be escaped with a backslash
|
|||||||
As a consequence of the way values are split into words, matched,
|
As a consequence of the way values are split into words, matched,
|
||||||
and then joined, a construct like
|
and then joined, a construct like
|
||||||
.Dl ${VAR:M*}
|
.Dl ${VAR:M*}
|
||||||
will normalise the inter-word spacing, removing all leading and
|
will normalize the inter-word spacing, removing all leading and
|
||||||
trailing space, and converting multiple consecutive spaces
|
trailing space, and converting multiple consecutive spaces
|
||||||
to single spaces.
|
to single spaces.
|
||||||
.
|
.
|
||||||
@@ -1145,7 +1158,7 @@ Randomize words in variable.
|
|||||||
The results will be different each time you are referring to the
|
The results will be different each time you are referring to the
|
||||||
modified variable; use the assignment with expansion
|
modified variable; use the assignment with expansion
|
||||||
.Pq Ql Cm \&:=
|
.Pq Ql Cm \&:=
|
||||||
to prevent such behaviour.
|
to prevent such behavior.
|
||||||
For example,
|
For example,
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
LIST= uno due tre quattro
|
LIST= uno due tre quattro
|
||||||
@@ -1177,7 +1190,7 @@ The value is a format string for
|
|||||||
using the current
|
using the current
|
||||||
.Xr gmtime 3 .
|
.Xr gmtime 3 .
|
||||||
.It Cm \&:hash
|
.It Cm \&:hash
|
||||||
Compute a 32bit hash of the value and encode it as hex digits.
|
Compute a 32-bit hash of the value and encode it as hex digits.
|
||||||
.It Cm \&:localtime
|
.It Cm \&:localtime
|
||||||
The value is a format string for
|
The value is a format string for
|
||||||
.Xr strftime 3 ,
|
.Xr strftime 3 ,
|
||||||
@@ -1455,7 +1468,7 @@ value is divided into words.
|
|||||||
.Pp
|
.Pp
|
||||||
Ordinarily, a value is treated as a sequence of words
|
Ordinarily, a value is treated as a sequence of words
|
||||||
delimited by white space.
|
delimited by white space.
|
||||||
Some modifiers suppress this behaviour,
|
Some modifiers suppress this behavior,
|
||||||
causing a value to be treated as a single word
|
causing a value to be treated as a single word
|
||||||
(possibly containing embedded white space).
|
(possibly containing embedded white space).
|
||||||
An empty value, or a value that consists entirely of white-space,
|
An empty value, or a value that consists entirely of white-space,
|
||||||
@@ -1541,12 +1554,20 @@ For compatibility with other versions of
|
|||||||
.Nm
|
.Nm
|
||||||
.Ql include file ...
|
.Ql include file ...
|
||||||
is also accepted.
|
is also accepted.
|
||||||
|
.Pp
|
||||||
If the include statement is written as
|
If the include statement is written as
|
||||||
.Cm .-include
|
.Cm .-include
|
||||||
or as
|
or as
|
||||||
.Cm .sinclude
|
.Cm .sinclude
|
||||||
then errors locating and/or opening include files are ignored.
|
then errors locating and/or opening include files are ignored.
|
||||||
.Pp
|
.Pp
|
||||||
|
If the include statement is written as
|
||||||
|
.Cm .dinclude
|
||||||
|
not only are errors locating and/or opening include files ignored,
|
||||||
|
but stale dependencies within the included file will be ignored
|
||||||
|
just like
|
||||||
|
.Va .MAKE.DEPENDFILE .
|
||||||
|
.Pp
|
||||||
Conditional expressions are also preceded by a single dot as the first
|
Conditional expressions are also preceded by a single dot as the first
|
||||||
character of a line.
|
character of a line.
|
||||||
The possible conditionals are as follows:
|
The possible conditionals are as follows:
|
||||||
@@ -1582,6 +1603,10 @@ This allows exporting a value to the environment which is different from that
|
|||||||
used by
|
used by
|
||||||
.Nm
|
.Nm
|
||||||
internally.
|
internally.
|
||||||
|
.It Ic .export-literal Ar variable ...
|
||||||
|
The same as
|
||||||
|
.Ql .export-env ,
|
||||||
|
except that variables in the value are not expanded.
|
||||||
.It Ic .info Ar message
|
.It Ic .info Ar message
|
||||||
The message is printed along with the name of the makefile and line number.
|
The message is printed along with the name of the makefile and line number.
|
||||||
.It Ic .undef Ar variable
|
.It Ic .undef Ar variable
|
||||||
@@ -2079,7 +2104,7 @@ The sources are a set of
|
|||||||
pairs.
|
pairs.
|
||||||
.Bl -tag -width hasErrCtls
|
.Bl -tag -width hasErrCtls
|
||||||
.It Ar name
|
.It Ar name
|
||||||
This is the minimal specification, used to select one of the builtin
|
This is the minimal specification, used to select one of the built-in
|
||||||
shell specs;
|
shell specs;
|
||||||
.Ar sh ,
|
.Ar sh ,
|
||||||
.Ar ksh ,
|
.Ar ksh ,
|
||||||
|
|||||||
+10
-16
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: make.c,v 1.92 2015/10/11 04:51:24 sjg Exp $ */
|
/* $NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: make.c,v 1.92 2015/10/11 04:51:24 sjg Exp $";
|
static char rcsid[] = "$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: make.c,v 1.92 2015/10/11 04:51:24 sjg Exp $");
|
__RCSID("$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -482,10 +482,9 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
|
|||||||
if (gn->uname == NULL) {
|
if (gn->uname == NULL) {
|
||||||
gn->uname = gn->name;
|
gn->uname = gn->name;
|
||||||
} else {
|
} else {
|
||||||
if (gn->name)
|
free(gn->name);
|
||||||
free(gn->name);
|
|
||||||
}
|
}
|
||||||
gn->name = Var_Subst(NULL, gn->uname, pgn, FALSE, TRUE);
|
gn->name = Var_Subst(NULL, gn->uname, pgn, VARF_WANTRES);
|
||||||
if (gn->name && gn->uname && strcmp(gn->name, gn->uname) != 0) {
|
if (gn->name && gn->uname && strcmp(gn->name, gn->uname) != 0) {
|
||||||
/* See if we have a target for this node. */
|
/* See if we have a target for this node. */
|
||||||
tgn = Targ_FindNode(gn->name, TARG_NOCREATE);
|
tgn = Targ_FindNode(gn->name, TARG_NOCREATE);
|
||||||
@@ -692,8 +691,7 @@ Make_Update(GNode *cgn)
|
|||||||
checked++;
|
checked++;
|
||||||
|
|
||||||
cname = Var_Value(TARGET, cgn, &p1);
|
cname = Var_Value(TARGET, cgn, &p1);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
|
|
||||||
if (DEBUG(MAKE))
|
if (DEBUG(MAKE))
|
||||||
fprintf(debug_file, "Make_Update: %s%s\n", cgn->name, cgn->cohort_num);
|
fprintf(debug_file, "Make_Update: %s%s\n", cgn->name, cgn->cohort_num);
|
||||||
@@ -838,8 +836,7 @@ Make_Update(GNode *cgn)
|
|||||||
Var_Set(PREFIX, cpref, pgn, 0);
|
Var_Set(PREFIX, cpref, pgn, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
Lst_Close(cgn->iParents);
|
Lst_Close(cgn->iParents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -907,8 +904,7 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
|
|||||||
}
|
}
|
||||||
if (allsrc != NULL)
|
if (allsrc != NULL)
|
||||||
Var_Append(ALLSRC, allsrc, pgn);
|
Var_Append(ALLSRC, allsrc, pgn);
|
||||||
if (p2)
|
free(p2);
|
||||||
free(p2);
|
|
||||||
if (pgn->type & OP_JOIN) {
|
if (pgn->type & OP_JOIN) {
|
||||||
if (cgn->made == MADE) {
|
if (cgn->made == MADE) {
|
||||||
Var_Append(OODATE, child, pgn);
|
Var_Append(OODATE, child, pgn);
|
||||||
@@ -934,8 +930,7 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
|
|||||||
*/
|
*/
|
||||||
Var_Append(OODATE, child, pgn);
|
Var_Append(OODATE, child, pgn);
|
||||||
}
|
}
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -981,8 +976,7 @@ Make_DoAllVar(GNode *gn)
|
|||||||
if (gn->type & OP_JOIN) {
|
if (gn->type & OP_JOIN) {
|
||||||
char *p1;
|
char *p1;
|
||||||
Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn, 0);
|
Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn, 0);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
}
|
}
|
||||||
gn->flags |= DONE_ALLSRC;
|
gn->flags |= DONE_ALLSRC;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: make.h,v 1.96 2015/09/21 21:50:16 pooka Exp $ */
|
/* $NetBSD: make.h,v 1.98 2016/02/18 18:29:14 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -88,6 +88,7 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
@@ -98,6 +99,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#ifndef FD_CLOEXEC
|
||||||
|
#define FD_CLOEXEC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define MAKE_GNUC_PREREQ(x, y) \
|
#define MAKE_GNUC_PREREQ(x, y) \
|
||||||
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
|
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
|
||||||
@@ -501,6 +506,10 @@ Boolean Main_SetObjdir(const char *);
|
|||||||
int mkTempFile(const char *, char **);
|
int mkTempFile(const char *, char **);
|
||||||
int str2Lst_Append(Lst, char *, const char *);
|
int str2Lst_Append(Lst, char *, const char *);
|
||||||
|
|
||||||
|
#define VARF_UNDEFERR 1
|
||||||
|
#define VARF_WANTRES 2
|
||||||
|
#define VARF_ASSIGN 4
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define UNCONST(ptr) ({ \
|
#define UNCONST(ptr) ({ \
|
||||||
union __unconst { \
|
union __unconst { \
|
||||||
|
|||||||
+42
-40
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: meta.c,v 1.41 2015/11/30 23:37:56 sjg Exp $ */
|
/* $NetBSD: meta.c,v 1.53 2016/03/07 21:45:43 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implement 'meta' mode.
|
* Implement 'meta' mode.
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* --sjg
|
* --sjg
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2010, Juniper Networks, Inc.
|
* Copyright (c) 2009-2016, Juniper Networks, Inc.
|
||||||
* Portions Copyright (c) 2009, John Birrell.
|
* Portions Copyright (c) 2009, John Birrell.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -37,7 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#ifdef HAVE_LIBGEN_H
|
#ifdef HAVE_LIBGEN_H
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#elif !defined(HAVE_DIRNAME)
|
#elif !defined(HAVE_DIRNAME)
|
||||||
@@ -60,7 +59,9 @@ char * dirname(char *);
|
|||||||
|
|
||||||
static BuildMon Mybm; /* for compat */
|
static BuildMon Mybm; /* for compat */
|
||||||
static Lst metaBailiwick; /* our scope of control */
|
static Lst metaBailiwick; /* our scope of control */
|
||||||
|
static char *metaBailiwickStr; /* string storage for the list */
|
||||||
static Lst metaIgnorePaths; /* paths we deliberately ignore */
|
static Lst metaIgnorePaths; /* paths we deliberately ignore */
|
||||||
|
static char *metaIgnorePathsStr; /* string storage for the list */
|
||||||
|
|
||||||
#ifndef MAKE_META_IGNORE_PATHS
|
#ifndef MAKE_META_IGNORE_PATHS
|
||||||
#define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
|
#define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
|
||||||
@@ -148,8 +149,8 @@ filemon_open(BuildMon *pbm)
|
|||||||
err(1, "Could not set filemon file descriptor!");
|
err(1, "Could not set filemon file descriptor!");
|
||||||
}
|
}
|
||||||
/* we don't need these once we exec */
|
/* we don't need these once we exec */
|
||||||
(void)fcntl(pbm->mon_fd, F_SETFD, 1);
|
(void)fcntl(pbm->mon_fd, F_SETFD, FD_CLOEXEC);
|
||||||
(void)fcntl(pbm->filemon_fd, F_SETFD, 1);
|
(void)fcntl(pbm->filemon_fd, F_SETFD, FD_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -300,8 +301,7 @@ meta_name(struct GNode *gn, char *mname, size_t mnamelen,
|
|||||||
}
|
}
|
||||||
free(tp);
|
free(tp);
|
||||||
for (i--; i >= 0; i--) {
|
for (i--; i >= 0; i--) {
|
||||||
if (p[i])
|
free(p[i]);
|
||||||
free(p[i]);
|
|
||||||
}
|
}
|
||||||
return (mname);
|
return (mname);
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ is_submake(void *cmdp, void *gnp)
|
|||||||
}
|
}
|
||||||
cp = strchr(cmd, '$');
|
cp = strchr(cmd, '$');
|
||||||
if ((cp)) {
|
if ((cp)) {
|
||||||
mp = Var_Subst(NULL, cmd, gn, FALSE, TRUE);
|
mp = Var_Subst(NULL, cmd, gn, VARF_WANTRES);
|
||||||
cmd = mp;
|
cmd = mp;
|
||||||
}
|
}
|
||||||
cp2 = strstr(cmd, p_make);
|
cp2 = strstr(cmd, p_make);
|
||||||
@@ -353,8 +353,7 @@ is_submake(void *cmdp, void *gnp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mp)
|
free(mp);
|
||||||
free(mp);
|
|
||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,11 +370,10 @@ printCMD(void *cmdp, void *mfpp)
|
|||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
|
|
||||||
if (strchr(cmd, '$')) {
|
if (strchr(cmd, '$')) {
|
||||||
cmd = cp = Var_Subst(NULL, cmd, mfp->gn, FALSE, TRUE);
|
cmd = cp = Var_Subst(NULL, cmd, mfp->gn, VARF_WANTRES);
|
||||||
}
|
}
|
||||||
fprintf(mfp->fp, "CMD %s\n", cmd);
|
fprintf(mfp->fp, "CMD %s\n", cmd);
|
||||||
if (cp)
|
free(cp);
|
||||||
free(cp);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,7 +464,7 @@ meta_create(BuildMon *pbm, GNode *gn)
|
|||||||
char *mp;
|
char *mp;
|
||||||
|
|
||||||
/* Describe the target we are building */
|
/* Describe the target we are building */
|
||||||
mp = Var_Subst(NULL, "${" MAKE_META_PREFIX "}", gn, FALSE, TRUE);
|
mp = Var_Subst(NULL, "${" MAKE_META_PREFIX "}", gn, VARF_WANTRES);
|
||||||
if (*mp)
|
if (*mp)
|
||||||
fprintf(stdout, "%s\n", mp);
|
fprintf(stdout, "%s\n", mp);
|
||||||
free(mp);
|
free(mp);
|
||||||
@@ -480,9 +478,6 @@ meta_create(BuildMon *pbm, GNode *gn)
|
|||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if (strcmp(cp, makeDependfile) == 0)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (!writeMeta)
|
if (!writeMeta)
|
||||||
/* Don't create meta data. */
|
/* Don't create meta data. */
|
||||||
goto out;
|
goto out;
|
||||||
@@ -524,8 +519,7 @@ meta_create(BuildMon *pbm, GNode *gn)
|
|||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
for (i--; i >= 0; i--) {
|
for (i--; i >= 0; i--) {
|
||||||
if (p[i])
|
free(p[i]);
|
||||||
free(p[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (mf.fp);
|
return (mf.fp);
|
||||||
@@ -609,10 +603,10 @@ meta_mode_init(const char *make_mode)
|
|||||||
* We consider ourselves master of all within ${.MAKE.META.BAILIWICK}
|
* We consider ourselves master of all within ${.MAKE.META.BAILIWICK}
|
||||||
*/
|
*/
|
||||||
metaBailiwick = Lst_Init(FALSE);
|
metaBailiwick = Lst_Init(FALSE);
|
||||||
cp = Var_Subst(NULL, "${.MAKE.META.BAILIWICK:O:u:tA}", VAR_GLOBAL,
|
metaBailiwickStr = Var_Subst(NULL, "${.MAKE.META.BAILIWICK:O:u:tA}",
|
||||||
FALSE, TRUE);
|
VAR_GLOBAL, VARF_WANTRES);
|
||||||
if (cp) {
|
if (metaBailiwickStr) {
|
||||||
str2Lst_Append(metaBailiwick, cp, NULL);
|
str2Lst_Append(metaBailiwick, metaBailiwickStr, NULL);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
|
* We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
|
||||||
@@ -620,11 +614,11 @@ meta_mode_init(const char *make_mode)
|
|||||||
metaIgnorePaths = Lst_Init(FALSE);
|
metaIgnorePaths = Lst_Init(FALSE);
|
||||||
Var_Append(MAKE_META_IGNORE_PATHS,
|
Var_Append(MAKE_META_IGNORE_PATHS,
|
||||||
"/dev /etc /proc /tmp /var/run /var/tmp ${TMPDIR}", VAR_GLOBAL);
|
"/dev /etc /proc /tmp /var/run /var/tmp ${TMPDIR}", VAR_GLOBAL);
|
||||||
cp = Var_Subst(NULL,
|
metaIgnorePathsStr = Var_Subst(NULL,
|
||||||
"${" MAKE_META_IGNORE_PATHS ":O:u:tA}", VAR_GLOBAL,
|
"${" MAKE_META_IGNORE_PATHS ":O:u:tA}", VAR_GLOBAL,
|
||||||
FALSE, TRUE);
|
VARF_WANTRES);
|
||||||
if (cp) {
|
if (metaIgnorePathsStr) {
|
||||||
str2Lst_Append(metaIgnorePaths, cp, NULL);
|
str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,9 +687,9 @@ meta_job_error(Job *job, GNode *gn, int flags, int status)
|
|||||||
|
|
||||||
if (job != NULL) {
|
if (job != NULL) {
|
||||||
pbm = &job->bm;
|
pbm = &job->bm;
|
||||||
} else {
|
|
||||||
if (!gn)
|
if (!gn)
|
||||||
gn = job->node;
|
gn = job->node;
|
||||||
|
} else {
|
||||||
pbm = &Mybm;
|
pbm = &Mybm;
|
||||||
}
|
}
|
||||||
if (pbm->mfp != NULL) {
|
if (pbm->mfp != NULL) {
|
||||||
@@ -709,7 +703,7 @@ meta_job_error(Job *job, GNode *gn, int flags, int status)
|
|||||||
}
|
}
|
||||||
getcwd(cwd, sizeof(cwd));
|
getcwd(cwd, sizeof(cwd));
|
||||||
Var_Set(".ERROR_CWD", cwd, VAR_GLOBAL, 0);
|
Var_Set(".ERROR_CWD", cwd, VAR_GLOBAL, 0);
|
||||||
if (pbm && pbm->meta_fname[0]) {
|
if (pbm->meta_fname[0]) {
|
||||||
Var_Set(".ERROR_META_FILE", pbm->meta_fname, VAR_GLOBAL, 0);
|
Var_Set(".ERROR_META_FILE", pbm->meta_fname, VAR_GLOBAL, 0);
|
||||||
}
|
}
|
||||||
meta_job_finish(job);
|
meta_job_finish(job);
|
||||||
@@ -734,7 +728,7 @@ meta_job_output(Job *job, char *cp, const char *nl)
|
|||||||
char *cp2;
|
char *cp2;
|
||||||
|
|
||||||
meta_prefix = Var_Subst(NULL, "${" MAKE_META_PREFIX "}",
|
meta_prefix = Var_Subst(NULL, "${" MAKE_META_PREFIX "}",
|
||||||
VAR_GLOBAL, FALSE, TRUE);
|
VAR_GLOBAL, VARF_WANTRES);
|
||||||
if ((cp2 = strchr(meta_prefix, '$')))
|
if ((cp2 = strchr(meta_prefix, '$')))
|
||||||
meta_prefix_len = cp2 - meta_prefix;
|
meta_prefix_len = cp2 - meta_prefix;
|
||||||
else
|
else
|
||||||
@@ -785,6 +779,15 @@ meta_job_finish(Job *job)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_finish(void)
|
||||||
|
{
|
||||||
|
Lst_Destroy(metaBailiwick, NULL);
|
||||||
|
free(metaBailiwickStr);
|
||||||
|
Lst_Destroy(metaIgnorePaths, NULL);
|
||||||
|
free(metaIgnorePathsStr);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch a full line from fp - growing bufp if needed
|
* Fetch a full line from fp - growing bufp if needed
|
||||||
* Return length in bufp.
|
* Return length in bufp.
|
||||||
@@ -1035,14 +1038,12 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||||||
ldir = Var_Value(ldir_vname, VAR_GLOBAL, &tp);
|
ldir = Var_Value(ldir_vname, VAR_GLOBAL, &tp);
|
||||||
if (ldir) {
|
if (ldir) {
|
||||||
strlcpy(latestdir, ldir, sizeof(latestdir));
|
strlcpy(latestdir, ldir, sizeof(latestdir));
|
||||||
if (tp)
|
free(tp);
|
||||||
free(tp);
|
|
||||||
}
|
}
|
||||||
ldir = Var_Value(lcwd_vname, VAR_GLOBAL, &tp);
|
ldir = Var_Value(lcwd_vname, VAR_GLOBAL, &tp);
|
||||||
if (ldir) {
|
if (ldir) {
|
||||||
strlcpy(lcwd, ldir, sizeof(lcwd));
|
strlcpy(lcwd, ldir, sizeof(lcwd));
|
||||||
if (tp)
|
free(tp);
|
||||||
free(tp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Skip past the pid. */
|
/* Skip past the pid. */
|
||||||
@@ -1320,7 +1321,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||||||
if (DEBUG(META))
|
if (DEBUG(META))
|
||||||
fprintf(debug_file, "%s: %d: cannot compare command using .OODATE\n", fname, lineno);
|
fprintf(debug_file, "%s: %d: cannot compare command using .OODATE\n", fname, lineno);
|
||||||
}
|
}
|
||||||
cmd = Var_Subst(NULL, cmd, gn, TRUE, TRUE);
|
cmd = Var_Subst(NULL, cmd, gn, VARF_WANTRES|VARF_UNDEFERR);
|
||||||
|
|
||||||
if ((cp = strchr(cmd, '\n'))) {
|
if ((cp = strchr(cmd, '\n'))) {
|
||||||
int n;
|
int n;
|
||||||
@@ -1382,7 +1383,6 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||||||
fprintf(debug_file, "%s: missing files: %s...\n",
|
fprintf(debug_file, "%s: missing files: %s...\n",
|
||||||
fname, (char *)Lst_Datum(Lst_First(missingFiles)));
|
fname, (char *)Lst_Datum(Lst_First(missingFiles)));
|
||||||
oodate = TRUE;
|
oodate = TRUE;
|
||||||
Lst_Destroy(missingFiles, (FreeProc *)free);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((gn->type & OP_META)) {
|
if ((gn->type & OP_META)) {
|
||||||
@@ -1391,6 +1391,9 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||||||
oodate = TRUE;
|
oodate = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Lst_Destroy(missingFiles, (FreeProc *)free);
|
||||||
|
|
||||||
if (oodate && needOODATE) {
|
if (oodate && needOODATE) {
|
||||||
/*
|
/*
|
||||||
* Target uses .OODATE which is empty; or we wouldn't be here.
|
* Target uses .OODATE which is empty; or we wouldn't be here.
|
||||||
@@ -1399,8 +1402,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||||||
*/
|
*/
|
||||||
Var_Delete(OODATE, gn);
|
Var_Delete(OODATE, gn);
|
||||||
Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn, 0);
|
Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn, 0);
|
||||||
if (cp)
|
free(cp);
|
||||||
free(cp);
|
|
||||||
}
|
}
|
||||||
return oodate;
|
return oodate;
|
||||||
}
|
}
|
||||||
@@ -1427,8 +1429,8 @@ meta_compat_start(void)
|
|||||||
if (pipe(childPipe) < 0)
|
if (pipe(childPipe) < 0)
|
||||||
Punt("Cannot create pipe: %s", strerror(errno));
|
Punt("Cannot create pipe: %s", strerror(errno));
|
||||||
/* Set close-on-exec flag for both */
|
/* Set close-on-exec flag for both */
|
||||||
(void)fcntl(childPipe[0], F_SETFD, 1);
|
(void)fcntl(childPipe[0], F_SETFD, FD_CLOEXEC);
|
||||||
(void)fcntl(childPipe[1], F_SETFD, 1);
|
(void)fcntl(childPipe[1], F_SETFD, FD_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: meta.h,v 1.3 2013/03/23 05:31:29 sjg Exp $ */
|
/* $NetBSD: meta.h,v 1.4 2016/03/07 21:45:43 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Things needed for 'meta' mode.
|
* Things needed for 'meta' mode.
|
||||||
@@ -42,6 +42,7 @@ extern Boolean useMeta;
|
|||||||
|
|
||||||
struct Job; /* not defined yet */
|
struct Job; /* not defined yet */
|
||||||
void meta_init(void);
|
void meta_init(void);
|
||||||
|
void meta_finish(void);
|
||||||
void meta_mode_init(const char *);
|
void meta_mode_init(const char *);
|
||||||
void meta_job_start(struct Job *, GNode *);
|
void meta_job_start(struct Job *, GNode *);
|
||||||
void meta_job_child(struct Job *);
|
void meta_job_child(struct Job *);
|
||||||
|
|||||||
@@ -1,3 +1,42 @@
|
|||||||
|
2016-03-02 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* meta2deps.sh: don't ignore subdirs.
|
||||||
|
patch from Bryan Drewery
|
||||||
|
|
||||||
|
2016-02-26 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* install-mk (MK_VERSION): 20160226
|
||||||
|
|
||||||
|
* gendirdeps.mk: mark _DEPENDFILE .NOMETA
|
||||||
|
|
||||||
|
2016-02-20 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* dirdeps.mk: we shouldn't normally include .depend but if we do
|
||||||
|
use .dinclude if we can.
|
||||||
|
|
||||||
|
2016-02-18 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* install-mk (MK_VERSION): 20160218
|
||||||
|
* sys.clean-env.mk: with recent change to Var_Subst()
|
||||||
|
we cannot use the '$$' trick, but .export-literal does the job
|
||||||
|
we need.
|
||||||
|
* auto.dep.mk: make use .dinclude if we can.
|
||||||
|
|
||||||
|
|
||||||
|
2016-02-05 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* dirdeps.mk:
|
||||||
|
Add _build_all_dirs such that local.dirdeps.mk can
|
||||||
|
add fully qualified dirs to it.
|
||||||
|
These will be built normally but the current
|
||||||
|
DEP_RELDIR will not depend on then (to avoid cycles).
|
||||||
|
This makes it easy to hook things like unit-tests into build.
|
||||||
|
|
||||||
|
|
||||||
|
2016-01-21 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
|
* dirdeps.mk: add bootstrap-empty
|
||||||
|
|
||||||
2015-12-12 Simon J. Gerraty <sjg@bad.crufty.net>
|
2015-12-12 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||||
|
|
||||||
* install-mk (MK_VERSION): 20151212
|
* install-mk (MK_VERSION): 20151212
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# RCSid:
|
# RCSid:
|
||||||
# $Id: auto.dep.mk,v 1.3 2014/08/04 05:19:10 sjg Exp $
|
# $Id: auto.dep.mk,v 1.4 2016/02/18 21:16:39 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -45,6 +45,7 @@ CXXFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
|
|||||||
|
|
||||||
CLEANFILES += .depend ${.MAKE.DEPENDFILE} *.d
|
CLEANFILES += .depend ${.MAKE.DEPENDFILE} *.d
|
||||||
|
|
||||||
|
.if ${MAKE_VERSION} < 20160218
|
||||||
# skip generating dependfile for misc targets
|
# skip generating dependfile for misc targets
|
||||||
.if ${.TARGETS:Uall:M*all} != ""
|
.if ${.TARGETS:Uall:M*all} != ""
|
||||||
.END: ${.MAKE.DEPENDFILE}
|
.END: ${.MAKE.DEPENDFILE}
|
||||||
@@ -60,5 +61,14 @@ ${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
|
|||||||
-@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \
|
-@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \
|
||||||
echo ".-include \"$$f\""; \
|
echo ".-include \"$$f\""; \
|
||||||
done > $@
|
done > $@
|
||||||
|
.else
|
||||||
|
# we have .dinclude
|
||||||
|
.if empty(_SKIP_BUILD)
|
||||||
|
_all_objs = ${OBJS} ${POBJS} ${SOBJS}
|
||||||
|
.for d in ${_all_objs:M*o:T:O:u:%=%.d}
|
||||||
|
.dinclude "$d"
|
||||||
|
.endfor
|
||||||
|
.endif
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
.endif
|
||||||
|
|||||||
+48
-16
@@ -1,4 +1,4 @@
|
|||||||
# $Id: dirdeps.mk,v 1.55 2015/10/20 22:04:53 sjg Exp $
|
# $Id: dirdeps.mk,v 1.59 2016/02/26 23:32:29 sjg Exp $
|
||||||
|
|
||||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@@ -121,6 +121,9 @@ _DIRDEP_USE_LEVEL?= 0
|
|||||||
# and non-specific Makefile.depend*
|
# and non-specific Makefile.depend*
|
||||||
|
|
||||||
.if !target(_DIRDEP_USE)
|
.if !target(_DIRDEP_USE)
|
||||||
|
# make sure we get the behavior we expect
|
||||||
|
.MAKE.SAVE_DOLLARS = no
|
||||||
|
|
||||||
# do some setup we only need once
|
# do some setup we only need once
|
||||||
_CURDIR ?= ${.CURDIR}
|
_CURDIR ?= ${.CURDIR}
|
||||||
_OBJDIR ?= ${.OBJDIR}
|
_OBJDIR ?= ${.OBJDIR}
|
||||||
@@ -256,11 +259,8 @@ DEP_RELDIR := ${DIRDEPS:R:[1]}
|
|||||||
MK_DIRDEPS_CACHE = no
|
MK_DIRDEPS_CACHE = no
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# reset each time through
|
||||||
# pickup customizations
|
_build_all_dirs =
|
||||||
# as below you can use !target(_DIRDEP_USE) to protect things
|
|
||||||
# which should only be done once.
|
|
||||||
.-include "local.dirdeps.mk"
|
|
||||||
|
|
||||||
# the first time we are included the _DIRDEP_USE target will not be defined
|
# the first time we are included the _DIRDEP_USE target will not be defined
|
||||||
# we can use this as a clue to do initialization and other one time things.
|
# we can use this as a clue to do initialization and other one time things.
|
||||||
@@ -280,6 +280,14 @@ DEBUG_DIRDEPS ?= no
|
|||||||
# remember the initial value of DEP_RELDIR - we test for it below.
|
# remember the initial value of DEP_RELDIR - we test for it below.
|
||||||
_DEP_RELDIR := ${DEP_RELDIR}
|
_DEP_RELDIR := ${DEP_RELDIR}
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# pickup customizations
|
||||||
|
# as below you can use !target(_DIRDEP_USE) to protect things
|
||||||
|
# which should only be done once.
|
||||||
|
.-include "local.dirdeps.mk"
|
||||||
|
|
||||||
|
.if !target(_DIRDEP_USE)
|
||||||
# things we skip for host tools
|
# things we skip for host tools
|
||||||
SKIP_HOSTDIR ?=
|
SKIP_HOSTDIR ?=
|
||||||
|
|
||||||
@@ -399,6 +407,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
|
|||||||
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
|
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
|
||||||
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
|
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
|
||||||
.MAKE.DEPENDFILE=.none \
|
.MAKE.DEPENDFILE=.none \
|
||||||
|
${.MAKEFLAGS:tW:S,-D ,-D,g:tw:M*WITH*} \
|
||||||
3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \
|
3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \
|
||||||
mv ${.TARGET}.new ${.TARGET}
|
mv ${.TARGET}.new ${.TARGET}
|
||||||
|
|
||||||
@@ -479,7 +488,11 @@ _build_dirs += ${_machines:@m@${_CURDIR}.$m@}
|
|||||||
_build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
_build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
||||||
.if ${DEP_TARGET_SPEC} == ${TARGET_SPEC}
|
.if ${DEP_TARGET_SPEC} == ${TARGET_SPEC}
|
||||||
# pickup local dependencies now
|
# pickup local dependencies now
|
||||||
|
.if ${MAKE_VERSION} < 20160220
|
||||||
.-include <.depend>
|
.-include <.depend>
|
||||||
|
.else
|
||||||
|
.dinclude <.depend>
|
||||||
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
@@ -531,22 +544,25 @@ _build_dirs += \
|
|||||||
# qualify everything now
|
# qualify everything now
|
||||||
_build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u}
|
_build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u}
|
||||||
|
|
||||||
|
_build_all_dirs += ${_build_dirs}
|
||||||
|
_build_all_dirs := ${_build_all_dirs:O:u}
|
||||||
|
|
||||||
.endif # empty DIRDEPS
|
.endif # empty DIRDEPS
|
||||||
|
|
||||||
# Normally if doing make -V something,
|
# Normally if doing make -V something,
|
||||||
# we do not want to waste time chasing DIRDEPS
|
# we do not want to waste time chasing DIRDEPS
|
||||||
# but if we want to count the number of Makefile.depend* read, we do.
|
# but if we want to count the number of Makefile.depend* read, we do.
|
||||||
.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
|
.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
|
||||||
.if !empty(_build_dirs)
|
.if !empty(_build_all_dirs)
|
||||||
.if ${BUILD_DIRDEPS_CACHE} == "yes"
|
.if ${BUILD_DIRDEPS_CACHE} == "yes"
|
||||||
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
|
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
|
||||||
echo 'dirdeps: ${_build_dirs:${M_oneperline}}'; echo; } >&3; echo
|
echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo
|
||||||
x!= { ${_build_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
|
||||||
.else
|
.else
|
||||||
# this makes it all happen
|
# this makes it all happen
|
||||||
dirdeps: ${_build_dirs}
|
dirdeps: ${_build_all_dirs}
|
||||||
.endif
|
.endif
|
||||||
${_build_dirs}: _DIRDEP_USE
|
${_build_all_dirs}: _DIRDEP_USE
|
||||||
|
|
||||||
.if ${_debug_reldir}
|
.if ${_debug_reldir}
|
||||||
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
|
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
|
||||||
@@ -580,14 +596,14 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
# Now find more dependencies - and recurse.
|
# Now find more dependencies - and recurse.
|
||||||
.for d in ${_build_dirs}
|
.for d in ${_build_all_dirs}
|
||||||
.if ${_DIRDEP_CHECKED:M$d} == ""
|
.if ${_DIRDEP_CHECKED:M$d} == ""
|
||||||
# once only
|
# once only
|
||||||
_DIRDEP_CHECKED += $d
|
_DIRDEP_CHECKED += $d
|
||||||
.if ${_debug_search}
|
.if ${_debug_search}
|
||||||
.info checking $d
|
.info checking $d
|
||||||
.endif
|
.endif
|
||||||
# Note: _build_dirs is fully qualifed so d:R is always the directory
|
# Note: _build_all_dirs is fully qualifed so d:R is always the directory
|
||||||
.if exists(${d:R})
|
.if exists(${d:R})
|
||||||
# Warning: there is an assumption here that MACHINE is always
|
# Warning: there is an assumption here that MACHINE is always
|
||||||
# the first entry in TARGET_SPEC_VARS.
|
# the first entry in TARGET_SPEC_VARS.
|
||||||
@@ -627,28 +643,37 @@ DIRDEPS =
|
|||||||
DEP_RELDIR := ${RELDIR}
|
DEP_RELDIR := ${RELDIR}
|
||||||
_DEP_RELDIR := ${RELDIR}
|
_DEP_RELDIR := ${RELDIR}
|
||||||
# pickup local dependencies
|
# pickup local dependencies
|
||||||
|
.if ${MAKE_VERSION} < 20160220
|
||||||
.-include <.depend>
|
.-include <.depend>
|
||||||
|
.else
|
||||||
|
.dinclude <.depend>
|
||||||
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# bootstrapping new dependencies made easy?
|
# bootstrapping new dependencies made easy?
|
||||||
.if (make(bootstrap) || make(bootstrap-recurse)) && !target(bootstrap)
|
.if !target(bootstrap) && (make(bootstrap) || \
|
||||||
|
make(bootstrap-this) || \
|
||||||
|
make(bootstrap-recurse) || \
|
||||||
|
make(bootstrap-empty))
|
||||||
|
|
||||||
.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T})
|
.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T})
|
||||||
# stop here
|
# stop here
|
||||||
${.TARGETS:Mboot*}:
|
${.TARGETS:Mboot*}:
|
||||||
.else
|
.elif !make(bootstrap-empty)
|
||||||
# find a Makefile.depend to use as _src
|
# find a Makefile.depend to use as _src
|
||||||
_src != cd ${.CURDIR} && for m in ${.MAKE.DEPENDFILE_PREFERENCE:T:S,${MACHINE},*,}; do test -s $$m || continue; echo $$m; break; done; echo
|
_src != cd ${.CURDIR} && for m in ${.MAKE.DEPENDFILE_PREFERENCE:T:S,${MACHINE},*,}; do test -s $$m || continue; echo $$m; break; done; echo
|
||||||
.if empty(_src)
|
.if empty(_src)
|
||||||
.error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}
|
.error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}Use: bootstrap-empty
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
_src?= ${.MAKE.DEPENDFILE:T}
|
_src?= ${.MAKE.DEPENDFILE:T}
|
||||||
|
|
||||||
|
# just create Makefile.depend* for this dir
|
||||||
bootstrap-this: .NOTMAIN
|
bootstrap-this: .NOTMAIN
|
||||||
@echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T}
|
@echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T}
|
||||||
(cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T})
|
(cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T})
|
||||||
|
|
||||||
|
# create Makefile.depend* for this dir and its dependencies
|
||||||
bootstrap: bootstrap-recurse
|
bootstrap: bootstrap-recurse
|
||||||
bootstrap-recurse: bootstrap-this
|
bootstrap-recurse: bootstrap-this
|
||||||
|
|
||||||
@@ -663,4 +688,11 @@ bootstrap-recurse: .NOTMAIN .MAKE
|
|||||||
done
|
done
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# create an empty Makefile.depend* to get the ball rolling.
|
||||||
|
bootstrap-empty: .NOTMAIN .NOMETA
|
||||||
|
@echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \
|
||||||
|
echo You need to build ${RELDIR} to correctly populate it.
|
||||||
|
@{ echo DIRDEPS=; echo ".include <dirdeps.mk>"; } > ${.CURDIR}/${.MAKE.DEPENDFILE:T}
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: gendirdeps.mk,v 1.29 2015/10/03 05:00:46 sjg Exp $
|
# $Id: gendirdeps.mk,v 1.30 2016/02/27 00:20:39 sjg Exp $
|
||||||
|
|
||||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@@ -309,7 +309,7 @@ CAT_DEPEND ?= .depend
|
|||||||
# .depend may contain things we don't want.
|
# .depend may contain things we don't want.
|
||||||
# The sed command at the end of the stream, allows for the filters
|
# The sed command at the end of the stream, allows for the filters
|
||||||
# to output _{VAR} tokens which we will turn into proper ${VAR} references.
|
# to output _{VAR} tokens which we will turn into proper ${VAR} references.
|
||||||
${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS}
|
${_DEPENDFILE}: .NOMETA ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS}
|
||||||
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
||||||
echo 'DIRDEPS = \'; \
|
echo 'DIRDEPS = \'; \
|
||||||
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
||||||
@@ -329,7 +329,7 @@ DIRDEPS := ${SUBDIR:S,^,${RELDIR}/,:O:u}
|
|||||||
|
|
||||||
all: ${_DEPENDFILE}
|
all: ${_DEPENDFILE}
|
||||||
|
|
||||||
${_DEPENDFILE}: ${MAKEFILE} ${_this}
|
${_DEPENDFILE}: .NOMETA ${MAKEFILE} ${_this}
|
||||||
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
||||||
echo 'DIRDEPS = \'; \
|
echo 'DIRDEPS = \'; \
|
||||||
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
# Simon J. Gerraty <sjg@crufty.net>
|
# Simon J. Gerraty <sjg@crufty.net>
|
||||||
|
|
||||||
# RCSid:
|
# RCSid:
|
||||||
# $Id: install-mk,v 1.118 2015/12/16 01:57:06 sjg Exp $
|
# $Id: install-mk,v 1.121 2016/02/27 00:23:02 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=20151212
|
MK_VERSION=20160226
|
||||||
OWNER=
|
OWNER=
|
||||||
GROUP=
|
GROUP=
|
||||||
MODE=444
|
MODE=444
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: meta.autodep.mk,v 1.39 2015/12/07 04:35:32 sjg Exp $
|
# $Id: meta.autodep.mk,v 1.40 2016/02/22 22:44:58 sjg Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||||
@@ -86,7 +86,7 @@ WANT_UPDATE_DEPENDFILE ?= yes
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${WANT_UPDATE_DEPENDFILE:Uno:tl} != "no"
|
.if ${WANT_UPDATE_DEPENDFILE:Uno:tl} != "no"
|
||||||
.if ${.MAKE.MODE:Mmeta*} == "" || ${.MAKE.MODE:M*read*} != ""
|
.if ${.MAKE.MODE:Uno:Mmeta*} == "" || ${.MAKE.MODE:Uno:M*read*} != ""
|
||||||
UPDATE_DEPENDFILE = no
|
UPDATE_DEPENDFILE = no
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: meta.stage.mk,v 1.41 2015/11/13 17:34:04 sjg Exp $
|
# $Id: meta.stage.mk,v 1.43 2016/02/24 18:46:32 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2011, Simon J. Gerraty
|
# @(#) Copyright (c) 2011, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -26,7 +26,7 @@ _dirdep = ${RELDIR}
|
|||||||
CLEANFILES+= .dirdep
|
CLEANFILES+= .dirdep
|
||||||
|
|
||||||
# this allows us to trace dependencies back to their src dir
|
# this allows us to trace dependencies back to their src dir
|
||||||
.dirdep:
|
.dirdep: .NOPATH
|
||||||
@echo '${_dirdep}' > $@
|
@echo '${_dirdep}' > $@
|
||||||
|
|
||||||
.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == ""
|
.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == ""
|
||||||
@@ -241,7 +241,7 @@ CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes
|
|||||||
# for non-jobs mode the order here matters
|
# for non-jobs mode the order here matters
|
||||||
staging: ${STAGE_TARGETS:N*_links} ${STAGE_TARGETS:M*_links}
|
staging: ${STAGE_TARGETS:N*_links} ${STAGE_TARGETS:M*_links}
|
||||||
|
|
||||||
.if ${.MAKE.JOBS:U0} > 0 && ${STAGE_TARGETS:M*_links} != ""
|
.if ${.MAKE.JOBS:U0} > 0 && ${STAGE_TARGETS:U:M*_links} != ""
|
||||||
# the above isn't sufficient
|
# the above isn't sufficient
|
||||||
.for t in ${STAGE_TARGETS:N*links:O:u}
|
.for t in ${STAGE_TARGETS:N*links:O:u}
|
||||||
.ORDER: $t stage_links
|
.ORDER: $t stage_links
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: meta.sys.mk,v 1.26 2015/11/14 21:16:13 sjg Exp $
|
# $Id: meta.sys.mk,v 1.27 2016/02/22 22:44:58 sjg Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||||
@@ -102,7 +102,7 @@ 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
|
||||||
# Are we, after all, in meta mode?
|
# Are we, after all, in meta mode?
|
||||||
.if ${.MAKE.MODE:Mmeta*} != ""
|
.if ${.MAKE.MODE:Uno:Mmeta*} != ""
|
||||||
MKDEP_MK = meta.autodep.mk
|
MKDEP_MK = meta.autodep.mk
|
||||||
|
|
||||||
.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
|
.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# RCSid:
|
# RCSid:
|
||||||
# $Id: meta2deps.sh,v 1.9 2015/04/03 18:23:25 sjg Exp $
|
# $Id: meta2deps.sh,v 1.10 2016/03/02 18:53:36 sjg Exp $
|
||||||
|
|
||||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@@ -309,7 +309,7 @@ meta2deps() {
|
|||||||
*) seen=$dir;;
|
*) seen=$dir;;
|
||||||
esac
|
esac
|
||||||
case "$dir" in
|
case "$dir" in
|
||||||
${CURDIR:-.}|${CURDIR:-.}/*|"") continue;;
|
${CURDIR:-.}|"") continue;;
|
||||||
$src_re)
|
$src_re)
|
||||||
# avoid repeating ourselves...
|
# avoid repeating ourselves...
|
||||||
case "$DPDEPS,$seensrc," in
|
case "$DPDEPS,$seensrc," in
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: sys.clean-env.mk,v 1.20 2012/11/12 06:56:04 sjg Exp $
|
# $Id: sys.clean-env.mk,v 1.21 2016/02/18 21:16:40 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -94,6 +94,7 @@ _tricky_env_vars = MAKEOBJDIR OBJTOP
|
|||||||
# MAKEOBJDIR='${.CURDIR:S,${SRCTOP},${OBJTOP},}'
|
# MAKEOBJDIR='${.CURDIR:S,${SRCTOP},${OBJTOP},}'
|
||||||
_srctop := ${SRCTOP:U${SB_SRC:U${SB}/src}}
|
_srctop := ${SRCTOP:U${SB_SRC:U${SB}/src}}
|
||||||
_objroot := ${OBJROOT:U${SB_OBJROOT:U${SB}/${SB_OBJPREFIX}}}
|
_objroot := ${OBJROOT:U${SB_OBJROOT:U${SB}/${SB_OBJPREFIX}}}
|
||||||
|
.if ${MAKE_VERSION} < 20160218
|
||||||
_objtop := ${OBJTOP:U${_objroot}${MACHINE}}
|
_objtop := ${OBJTOP:U${_objroot}${MACHINE}}
|
||||||
# Take care of ${MACHINE}
|
# Take care of ${MACHINE}
|
||||||
.if ${MACHINE} == "host" || ${OBJTOP} == ${HOST_OBJTOP:Uno}
|
.if ${MACHINE} == "host" || ${OBJTOP} == ${HOST_OBJTOP:Uno}
|
||||||
@@ -113,7 +114,17 @@ MAKEOBJDIR = $${.CURDIR:S,${_srctop},$${OBJTOP},}
|
|||||||
.for v in ${_tricky_env_vars}
|
.for v in ${_tricky_env_vars}
|
||||||
$v := ${$v}
|
$v := ${$v}
|
||||||
.endfor
|
.endfor
|
||||||
|
.else
|
||||||
|
# we cannot use the '$$' trick, anymore
|
||||||
|
# but we can export a literal (unexpanded) value
|
||||||
|
SRCTOP := ${_srctop}
|
||||||
|
OBJROOT := ${_objroot}
|
||||||
|
OBJTOP = ${OBJROOT}${MACHINE}
|
||||||
|
MAKEOBJDIR = ${.CURDIR:S,${SRCTOP},${OBJTOP},}
|
||||||
|
.export-literal SRCTOP OBJROOT ${_tricky_env_vars}
|
||||||
|
.endif
|
||||||
#.info ${_tricky_env_vars:@v@${.newline}$v=${$v}@}
|
#.info ${_tricky_env_vars:@v@${.newline}$v=${$v}@}
|
||||||
|
#showenv:
|
||||||
|
# @env | egrep 'OBJ|SRC'
|
||||||
.endif # MAKEOBJDIR
|
.endif # MAKEOBJDIR
|
||||||
.endif # level 0
|
.endif # level 0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: sys.dependfile.mk,v 1.6 2014/08/02 18:02:06 sjg Exp $
|
# $Id: sys.dependfile.mk,v 1.7 2016/02/20 01:57:39 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -49,7 +49,9 @@ _e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}
|
|||||||
# If any already exist, we should follow suit.
|
# If any already exist, we should follow suit.
|
||||||
_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
|
_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
|
||||||
# MACHINE must be the last entry in _aml ;-)
|
# MACHINE must be the last entry in _aml ;-)
|
||||||
|
_m := ${MACHINE}
|
||||||
_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
|
_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
|
||||||
|
MACHINE := ${_m}
|
||||||
.if !empty(_e)
|
.if !empty(_e)
|
||||||
.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
|
.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# RCSid:
|
# RCSid:
|
||||||
# $Id: warnings.mk,v 1.8 2014/04/02 19:20:23 sjg Exp $
|
# $Id: warnings.mk,v 1.9 2016/02/20 02:00:58 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2002, Simon J. Gerraty
|
# @(#) Copyright (c) 2002, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
.ifndef _w_cflags
|
.ifndef _w_cflags
|
||||||
|
# make sure we get the behavior we expect
|
||||||
|
.MAKE.SAVE_DOLLARS = no
|
||||||
|
|
||||||
# Any number of warnings sets can be added.
|
# Any number of warnings sets can be added.
|
||||||
.-include "warnings-sets.mk"
|
.-include "warnings-sets.mk"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: nonints.h,v 1.69 2015/10/11 04:51:24 sjg Exp $ */
|
/* $NetBSD: nonints.h,v 1.72 2016/02/18 20:25:08 sjg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -120,6 +120,7 @@ void Finish(int) MAKE_ATTR_DEAD;
|
|||||||
int eunlink(const char *);
|
int eunlink(const char *);
|
||||||
void execError(const char *, const char *);
|
void execError(const char *, const char *);
|
||||||
char *getTmpdir(void);
|
char *getTmpdir(void);
|
||||||
|
Boolean s2Boolean(const char *, Boolean);
|
||||||
Boolean getBoolean(const char *, Boolean);
|
Boolean getBoolean(const char *, Boolean);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
@@ -184,8 +185,8 @@ void Var_Set(const char *, const char *, GNode *, int);
|
|||||||
void Var_Append(const char *, const char *, GNode *);
|
void Var_Append(const char *, const char *, GNode *);
|
||||||
Boolean Var_Exists(const char *, GNode *);
|
Boolean Var_Exists(const char *, GNode *);
|
||||||
char *Var_Value(const char *, GNode *, char **);
|
char *Var_Value(const char *, GNode *, char **);
|
||||||
char *Var_Parse(const char *, GNode *, Boolean, Boolean, int *, void **);
|
char *Var_Parse(const char *, GNode *, int, int *, void **);
|
||||||
char *Var_Subst(const char *, const char *, GNode *, Boolean, Boolean);
|
char *Var_Subst(const char *, const char *, GNode *, int);
|
||||||
char *Var_GetTail(const char *);
|
char *Var_GetTail(const char *);
|
||||||
char *Var_GetHead(const char *);
|
char *Var_GetHead(const char *);
|
||||||
void Var_Init(void);
|
void Var_Init(void);
|
||||||
|
|||||||
+24
-22
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $ */
|
/* $NetBSD: parse.c,v 1.212 2016/02/19 06:19:06 sjg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $";
|
static char rcsid[] = "$NetBSD: parse.c,v 1.212 2016/02/19 06:19:06 sjg Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $");
|
__RCSID("$NetBSD: parse.c,v 1.212 2016/02/19 06:19:06 sjg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -128,7 +128,6 @@ __RCSID("$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $");
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -161,6 +160,7 @@ typedef struct IFile {
|
|||||||
int lineno; /* current line number in file */
|
int lineno; /* current line number in file */
|
||||||
int first_lineno; /* line number of start of text */
|
int first_lineno; /* line number of start of text */
|
||||||
int cond_depth; /* 'if' nesting when file opened */
|
int cond_depth; /* 'if' nesting when file opened */
|
||||||
|
Boolean depending; /* state of doing_depend on EOF */
|
||||||
char *P_str; /* point to base of string buffer */
|
char *P_str; /* point to base of string buffer */
|
||||||
char *P_ptr; /* point to next char of string buffer */
|
char *P_ptr; /* point to next char of string buffer */
|
||||||
char *P_end; /* point to the end of string buffer */
|
char *P_end; /* point to the end of string buffer */
|
||||||
@@ -816,7 +816,7 @@ ParseMessage(char *line)
|
|||||||
while (isspace((u_char)*line))
|
while (isspace((u_char)*line))
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
line = Var_Subst(NULL, line, VAR_CMD, FALSE, TRUE);
|
line = Var_Subst(NULL, line, VAR_CMD, VARF_WANTRES);
|
||||||
Parse_Error(mtype, "%s", line);
|
Parse_Error(mtype, "%s", line);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
@@ -1233,9 +1233,9 @@ ParseDoDependency(char *line)
|
|||||||
int length;
|
int length;
|
||||||
void *freeIt;
|
void *freeIt;
|
||||||
|
|
||||||
(void)Var_Parse(cp, VAR_CMD, TRUE, TRUE, &length, &freeIt);
|
(void)Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES,
|
||||||
if (freeIt)
|
&length, &freeIt);
|
||||||
free(freeIt);
|
free(freeIt);
|
||||||
cp += length-1;
|
cp += length-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1948,7 +1948,7 @@ Parse_DoVar(char *line, GNode *ctxt)
|
|||||||
if (!Var_Exists(line, ctxt))
|
if (!Var_Exists(line, ctxt))
|
||||||
Var_Set(line, "", ctxt, 0);
|
Var_Set(line, "", ctxt, 0);
|
||||||
|
|
||||||
cp = Var_Subst(NULL, cp, ctxt, FALSE, TRUE);
|
cp = Var_Subst(NULL, cp, ctxt, VARF_WANTRES|VARF_ASSIGN);
|
||||||
oldVars = oldOldVars;
|
oldVars = oldOldVars;
|
||||||
freeCp = TRUE;
|
freeCp = TRUE;
|
||||||
|
|
||||||
@@ -1963,7 +1963,7 @@ Parse_DoVar(char *line, GNode *ctxt)
|
|||||||
* expansion on the whole thing. The resulting string will need
|
* expansion on the whole thing. The resulting string will need
|
||||||
* freeing when we're done, so set freeCmd to TRUE.
|
* freeing when we're done, so set freeCmd to TRUE.
|
||||||
*/
|
*/
|
||||||
cp = Var_Subst(NULL, cp, VAR_CMD, TRUE, TRUE);
|
cp = Var_Subst(NULL, cp, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES);
|
||||||
freeCp = TRUE;
|
freeCp = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2155,7 +2155,7 @@ Parse_AddIncludeDir(char *dir)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Parse_include_file(char *file, Boolean isSystem, int silent)
|
Parse_include_file(char *file, Boolean isSystem, Boolean depinc, int silent)
|
||||||
{
|
{
|
||||||
struct loadedfile *lf;
|
struct loadedfile *lf;
|
||||||
char *fullname; /* full pathname of file */
|
char *fullname; /* full pathname of file */
|
||||||
@@ -2255,6 +2255,8 @@ Parse_include_file(char *file, Boolean isSystem, int silent)
|
|||||||
/* Start reading from this file next */
|
/* Start reading from this file next */
|
||||||
Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
|
Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
|
||||||
curFile->lf = lf;
|
curFile->lf = lf;
|
||||||
|
if (depinc)
|
||||||
|
doing_depend = depinc; /* only turn it on */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2302,9 +2304,9 @@ ParseDoInclude(char *line)
|
|||||||
* Substitute for any variables in the file name before trying to
|
* Substitute for any variables in the file name before trying to
|
||||||
* find the thing.
|
* find the thing.
|
||||||
*/
|
*/
|
||||||
file = Var_Subst(NULL, file, VAR_CMD, FALSE, TRUE);
|
file = Var_Subst(NULL, file, VAR_CMD, VARF_WANTRES);
|
||||||
|
|
||||||
Parse_include_file(file, endc == '>', silent);
|
Parse_include_file(file, endc == '>', (*line == 'd'), silent);
|
||||||
free(file);
|
free(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2339,10 +2341,8 @@ ParseSetIncludedFile(void)
|
|||||||
fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
|
fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
|
||||||
"${.INCLUDEDFROMFILE} = `%s'\n", __func__, pd, pf);
|
"${.INCLUDEDFROMFILE} = `%s'\n", __func__, pd, pf);
|
||||||
|
|
||||||
if (fp)
|
free(fp);
|
||||||
free(fp);
|
free(dp);
|
||||||
if (dp)
|
|
||||||
free(dp);
|
|
||||||
}
|
}
|
||||||
/*-
|
/*-
|
||||||
*---------------------------------------------------------------------
|
*---------------------------------------------------------------------
|
||||||
@@ -2472,6 +2472,7 @@ Parse_SetInput(const char *name, int line, int fd,
|
|||||||
curFile->nextbuf = nextbuf;
|
curFile->nextbuf = nextbuf;
|
||||||
curFile->nextbuf_arg = arg;
|
curFile->nextbuf_arg = arg;
|
||||||
curFile->lf = NULL;
|
curFile->lf = NULL;
|
||||||
|
curFile->depending = doing_depend; /* restore this on EOF */
|
||||||
|
|
||||||
assert(nextbuf != NULL);
|
assert(nextbuf != NULL);
|
||||||
|
|
||||||
@@ -2532,7 +2533,7 @@ ParseTraditionalInclude(char *line)
|
|||||||
* Substitute for any variables in the file name before trying to
|
* Substitute for any variables in the file name before trying to
|
||||||
* find the thing.
|
* find the thing.
|
||||||
*/
|
*/
|
||||||
all_files = Var_Subst(NULL, file, VAR_CMD, FALSE, TRUE);
|
all_files = Var_Subst(NULL, file, VAR_CMD, VARF_WANTRES);
|
||||||
|
|
||||||
if (*file == '\0') {
|
if (*file == '\0') {
|
||||||
Parse_Error(PARSE_FATAL,
|
Parse_Error(PARSE_FATAL,
|
||||||
@@ -2550,7 +2551,7 @@ ParseTraditionalInclude(char *line)
|
|||||||
else
|
else
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|
||||||
Parse_include_file(file, FALSE, silent);
|
Parse_include_file(file, FALSE, FALSE, silent);
|
||||||
}
|
}
|
||||||
free(all_files);
|
free(all_files);
|
||||||
}
|
}
|
||||||
@@ -2600,7 +2601,7 @@ ParseGmakeExport(char *line)
|
|||||||
/*
|
/*
|
||||||
* Expand the value before putting it in the environment.
|
* Expand the value before putting it in the environment.
|
||||||
*/
|
*/
|
||||||
value = Var_Subst(NULL, value, VAR_CMD, FALSE, TRUE);
|
value = Var_Subst(NULL, value, VAR_CMD, VARF_WANTRES);
|
||||||
setenv(variable, value, 1);
|
setenv(variable, value, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2628,6 +2629,7 @@ ParseEOF(void)
|
|||||||
|
|
||||||
assert(curFile->nextbuf != NULL);
|
assert(curFile->nextbuf != NULL);
|
||||||
|
|
||||||
|
doing_depend = curFile->depending; /* restore this */
|
||||||
/* get next input buffer, if any */
|
/* get next input buffer, if any */
|
||||||
ptr = curFile->nextbuf(curFile->nextbuf_arg, &len);
|
ptr = curFile->nextbuf(curFile->nextbuf_arg, &len);
|
||||||
curFile->P_ptr = ptr;
|
curFile->P_ptr = ptr;
|
||||||
@@ -2990,7 +2992,7 @@ Parse_File(const char *name, int fd)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strncmp(cp, "include", 7) == 0 ||
|
if (strncmp(cp, "include", 7) == 0 ||
|
||||||
((cp[0] == 's' || cp[0] == '-') &&
|
((cp[0] == 'd' || cp[0] == 's' || cp[0] == '-') &&
|
||||||
strncmp(&cp[1], "include", 7) == 0)) {
|
strncmp(&cp[1], "include", 7) == 0)) {
|
||||||
ParseDoInclude(cp);
|
ParseDoInclude(cp);
|
||||||
continue;
|
continue;
|
||||||
@@ -3149,7 +3151,7 @@ Parse_File(const char *name, int fd)
|
|||||||
* variables expanded before being parsed. Tell the variable
|
* variables expanded before being parsed. Tell the variable
|
||||||
* module to complain if some variable is undefined...
|
* module to complain if some variable is undefined...
|
||||||
*/
|
*/
|
||||||
line = Var_Subst(NULL, line, VAR_CMD, TRUE, TRUE);
|
line = Var_Subst(NULL, line, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need a non-circular list for the target nodes
|
* Need a non-circular list for the target nodes
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: suff.c,v 1.75 2015/12/20 22:44:10 sjg Exp $ */
|
/* $NetBSD: suff.c,v 1.78 2016/02/18 18:29:14 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: suff.c,v 1.75 2015/12/20 22:44:10 sjg Exp $";
|
static char rcsid[] = "$NetBSD: suff.c,v 1.78 2016/02/18 18:29:14 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: suff.c,v 1.75 2015/12/20 22:44:10 sjg Exp $");
|
__RCSID("$NetBSD: suff.c,v 1.78 2016/02/18 18:29:14 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -1556,7 +1556,7 @@ SuffExpandChildren(LstNode cln, GNode *pgn)
|
|||||||
if (DEBUG(SUFF)) {
|
if (DEBUG(SUFF)) {
|
||||||
fprintf(debug_file, "Expanding \"%s\"...", cgn->name);
|
fprintf(debug_file, "Expanding \"%s\"...", cgn->name);
|
||||||
}
|
}
|
||||||
cp = Var_Subst(NULL, cgn->name, pgn, TRUE, TRUE);
|
cp = Var_Subst(NULL, cgn->name, pgn, VARF_UNDEFERR|VARF_WANTRES);
|
||||||
|
|
||||||
if (cp != NULL) {
|
if (cp != NULL) {
|
||||||
Lst members = Lst_Init(FALSE);
|
Lst members = Lst_Init(FALSE);
|
||||||
@@ -1609,13 +1609,13 @@ SuffExpandChildren(LstNode cln, GNode *pgn)
|
|||||||
int len;
|
int len;
|
||||||
void *freeIt;
|
void *freeIt;
|
||||||
|
|
||||||
junk = Var_Parse(cp, pgn, TRUE, TRUE, &len, &freeIt);
|
junk = Var_Parse(cp, pgn, VARF_UNDEFERR|VARF_WANTRES,
|
||||||
|
&len, &freeIt);
|
||||||
if (junk != var_Error) {
|
if (junk != var_Error) {
|
||||||
cp += len - 1;
|
cp += len - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeIt)
|
free(freeIt);
|
||||||
free(freeIt);
|
|
||||||
} else if (*cp == '\\' && *cp != '\0') {
|
} else if (*cp == '\\' && *cp != '\0') {
|
||||||
/*
|
/*
|
||||||
* Escaped something -- skip over it
|
* Escaped something -- skip over it
|
||||||
@@ -1933,8 +1933,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
|
|||||||
for (i = (sizeof(copy)/sizeof(copy[0]))-1; i >= 0; i--) {
|
for (i = (sizeof(copy)/sizeof(copy[0]))-1; i >= 0; i--) {
|
||||||
char *p1;
|
char *p1;
|
||||||
Var_Set(copy[i], Var_Value(copy[i], mem, &p1), gn, 0);
|
Var_Set(copy[i], Var_Value(copy[i], mem, &p1), gn, 0);
|
||||||
if (p1)
|
free(p1);
|
||||||
free(p1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: targ.c,v 1.60 2015/05/25 09:01:06 manu Exp $ */
|
/* $NetBSD: targ.c,v 1.61 2016/01/17 17:45:21 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: targ.c,v 1.60 2015/05/25 09:01:06 manu Exp $";
|
static char rcsid[] = "$NetBSD: targ.c,v 1.61 2016/01/17 17:45:21 christos Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: targ.c,v 1.60 2015/05/25 09:01:06 manu Exp $");
|
__RCSID("$NetBSD: targ.c,v 1.61 2016/01/17 17:45:21 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -292,10 +292,8 @@ TargFreeGN(void *gnp)
|
|||||||
|
|
||||||
|
|
||||||
free(gn->name);
|
free(gn->name);
|
||||||
if (gn->uname)
|
free(gn->uname);
|
||||||
free(gn->uname);
|
free(gn->path);
|
||||||
if (gn->path)
|
|
||||||
free(gn->path);
|
|
||||||
/* gn->fname points to name allocated when file was opened, don't free */
|
/* gn->fname points to name allocated when file was opened, don't free */
|
||||||
|
|
||||||
Lst_Destroy(gn->iParents, NULL);
|
Lst_Destroy(gn->iParents, NULL);
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ make:
|
|||||||
UT_TEST=export-env.mk
|
UT_TEST=export-env.mk
|
||||||
UT_ENV=not-exported
|
UT_ENV=not-exported
|
||||||
UT_EXP=not-exported
|
UT_EXP=not-exported
|
||||||
|
UT_LIT=literal export-env.mk
|
||||||
env:
|
env:
|
||||||
UT_TEST=export-env.mk
|
UT_TEST=export-env.mk
|
||||||
UT_ENV=exported
|
UT_ENV=exported
|
||||||
UT_EXP=exported
|
UT_EXP=exported
|
||||||
|
UT_LIT=literal ${UT_TEST}
|
||||||
exit status 0
|
exit status 0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: export-env.mk,v 1.1.1.1 2014/08/30 18:57:18 sjg Exp $
|
# $Id: export-env.mk,v 1.1.1.2 2016/02/18 20:35:24 sjg Exp $
|
||||||
|
|
||||||
# our normal .export, subsequent changes affect the environment
|
# our normal .export, subsequent changes affect the environment
|
||||||
UT_TEST=this
|
UT_TEST=this
|
||||||
@@ -15,9 +15,12 @@ UT_EXP=before-export
|
|||||||
export UT_EXP=exported
|
export UT_EXP=exported
|
||||||
UT_EXP=not-exported
|
UT_EXP=not-exported
|
||||||
|
|
||||||
|
UT_LIT= literal ${UT_TEST}
|
||||||
|
.export-literal UT_LIT
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo make:; ${UT_TEST UT_ENV UT_EXP:L:@v@echo $v=${$v};@}
|
@echo make:; ${UT_TEST UT_ENV UT_EXP UT_LIT:L:@v@echo $v=${$v};@}
|
||||||
@echo env:; ${UT_TEST UT_ENV UT_EXP:L:@v@echo $v=$${$v};@}
|
@echo env:; ${UT_TEST UT_ENV UT_EXP UT_LIT:L:@v@echo $v=$${$v};@}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,16 @@ THREE
|
|||||||
FOUR
|
FOUR
|
||||||
FIVE
|
FIVE
|
||||||
SIX"
|
SIX"
|
||||||
|
LIST:ts/xa:tu="ONE
|
||||||
|
TWO
|
||||||
|
THREE
|
||||||
|
FOUR
|
||||||
|
FIVE
|
||||||
|
SIX"
|
||||||
make: Bad modifier `:tx' for LIST
|
make: Bad modifier `:tx' for LIST
|
||||||
LIST:tx="}"
|
LIST:tx="}"
|
||||||
make: Bad modifier `:ts\x' for LIST
|
make: Bad modifier `:ts\X' for LIST
|
||||||
LIST:ts/x:tu="\x:tu}"
|
LIST:ts/x:tu="\X:tu}"
|
||||||
FU_mod-ts="a/b/cool"
|
FU_mod-ts="a/b/cool"
|
||||||
FU_mod-ts:ts:T="cool" == cool?
|
FU_mod-ts:ts:T="cool" == cool?
|
||||||
B.${AAA:ts}="Baaa" == Baaa?
|
B.${AAA:ts}="Baaa" == Baaa?
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ mod-ts:
|
|||||||
@${PRINT} 'LIST:ts/n="${LIST:ts\n}"'
|
@${PRINT} 'LIST:ts/n="${LIST:ts\n}"'
|
||||||
@${PRINT} 'LIST:ts/t="${LIST:ts\t}"'
|
@${PRINT} 'LIST:ts/t="${LIST:ts\t}"'
|
||||||
@${PRINT} 'LIST:ts/012:tu="${LIST:ts\012:tu}"'
|
@${PRINT} 'LIST:ts/012:tu="${LIST:ts\012:tu}"'
|
||||||
|
@${PRINT} 'LIST:ts/xa:tu="${LIST:ts\xa:tu}"'
|
||||||
@${PRINT} 'LIST:tx="${LIST:tx}"'
|
@${PRINT} 'LIST:tx="${LIST:tx}"'
|
||||||
@${PRINT} 'LIST:ts/x:tu="${LIST:ts\x:tu}"'
|
@${PRINT} 'LIST:ts/x:tu="${LIST:ts\X:tu}"'
|
||||||
@${PRINT} 'FU_$@="${FU_${@:ts}:ts}"'
|
@${PRINT} 'FU_$@="${FU_${@:ts}:ts}"'
|
||||||
@${PRINT} 'FU_$@:ts:T="${FU_${@:ts}:ts:T}" == cool?'
|
@${PRINT} 'FU_$@:ts:T="${FU_${@:ts}:ts:T}" == cool?'
|
||||||
@${PRINT} 'B.$${AAA:ts}="${B.${AAA:ts}}" == Baaa?'
|
@${PRINT} 'B.$${AAA:ts}="${B.${AAA:ts}}" == Baaa?'
|
||||||
|
|||||||
+131
-91
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $ */
|
/* $NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $";
|
static char rcsid[] = "$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $");
|
__RCSID("$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@@ -154,12 +154,22 @@ char **savedEnv = NULL;
|
|||||||
char var_Error[] = "";
|
char var_Error[] = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Similar to var_Error, but returned when the 'errnum' flag for Var_Parse is
|
* Similar to var_Error, but returned when the 'VARF_UNDEFERR' flag for
|
||||||
* set false. Why not just use a constant? Well, gcc likes to condense
|
* Var_Parse is not set. Why not just use a constant? Well, gcc likes
|
||||||
* identical string instances...
|
* to condense identical string instances...
|
||||||
*/
|
*/
|
||||||
static char varNoError[] = "";
|
static char varNoError[] = "";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Traditionally we consume $$ during := like any other expansion.
|
||||||
|
* Other make's do not.
|
||||||
|
* This knob allows controlling the behavior.
|
||||||
|
* FALSE for old behavior.
|
||||||
|
* TRUE for new compatible.
|
||||||
|
*/
|
||||||
|
#define SAVE_DOLLARS ".MAKE.SAVE_DOLLARS"
|
||||||
|
static Boolean save_dollars = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internally, variables are contained in four different contexts.
|
* Internally, variables are contained in four different contexts.
|
||||||
* 1) the environment. They may not be changed. If an environment
|
* 1) the environment. They may not be changed. If an environment
|
||||||
@@ -216,7 +226,11 @@ static int var_exportedVars = VAR_EXPORTED_NONE;
|
|||||||
* We pass this to Var_Export when doing the initial export
|
* We pass this to Var_Export when doing the initial export
|
||||||
* or after updating an exported var.
|
* or after updating an exported var.
|
||||||
*/
|
*/
|
||||||
#define VAR_EXPORT_PARENT 1
|
#define VAR_EXPORT_PARENT 1
|
||||||
|
/*
|
||||||
|
* We pass this to Var_Export1 to tell it to leave the value alone.
|
||||||
|
*/
|
||||||
|
#define VAR_EXPORT_LITERAL 2
|
||||||
|
|
||||||
/* Var*Pattern flags */
|
/* Var*Pattern flags */
|
||||||
#define VAR_SUB_GLOBAL 0x01 /* Apply substitution globally */
|
#define VAR_SUB_GLOBAL 0x01 /* Apply substitution globally */
|
||||||
@@ -541,7 +555,7 @@ Var_Delete(const char *name, GNode *ctxt)
|
|||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if (strchr(name, '$')) {
|
if (strchr(name, '$')) {
|
||||||
cp = Var_Subst(NULL, name, VAR_GLOBAL, FALSE, TRUE);
|
cp = Var_Subst(NULL, name, VAR_GLOBAL, VARF_WANTRES);
|
||||||
} else {
|
} else {
|
||||||
cp = (char *)name;
|
cp = (char *)name;
|
||||||
}
|
}
|
||||||
@@ -580,12 +594,13 @@ Var_Delete(const char *name, GNode *ctxt)
|
|||||||
* We only manipulate flags of vars if 'parent' is set.
|
* We only manipulate flags of vars if 'parent' is set.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
Var_Export1(const char *name, int parent)
|
Var_Export1(const char *name, int flags)
|
||||||
{
|
{
|
||||||
char tmp[BUFSIZ];
|
char tmp[BUFSIZ];
|
||||||
Var *v;
|
Var *v;
|
||||||
char *val = NULL;
|
char *val = NULL;
|
||||||
int n;
|
int n;
|
||||||
|
int parent = (flags & VAR_EXPORT_PARENT);
|
||||||
|
|
||||||
if (*name == '.')
|
if (*name == '.')
|
||||||
return 0; /* skip internals */
|
return 0; /* skip internals */
|
||||||
@@ -613,7 +628,7 @@ Var_Export1(const char *name, int parent)
|
|||||||
return 0; /* nothing to do */
|
return 0; /* nothing to do */
|
||||||
}
|
}
|
||||||
val = Buf_GetAll(&v->val, NULL);
|
val = Buf_GetAll(&v->val, NULL);
|
||||||
if (strchr(val, '$')) {
|
if ((flags & VAR_EXPORT_LITERAL) == 0 && strchr(val, '$')) {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
/*
|
/*
|
||||||
* Flag this as something we need to re-export.
|
* Flag this as something we need to re-export.
|
||||||
@@ -632,7 +647,7 @@ Var_Export1(const char *name, int parent)
|
|||||||
}
|
}
|
||||||
n = snprintf(tmp, sizeof(tmp), "${%s}", name);
|
n = snprintf(tmp, sizeof(tmp), "${%s}", name);
|
||||||
if (n < (int)sizeof(tmp)) {
|
if (n < (int)sizeof(tmp)) {
|
||||||
val = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
|
val = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
|
||||||
setenv(name, val, 1);
|
setenv(name, val, 1);
|
||||||
free(val);
|
free(val);
|
||||||
}
|
}
|
||||||
@@ -700,7 +715,7 @@ Var_ExportVars(void)
|
|||||||
int ac;
|
int ac;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
val = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
|
val = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
|
||||||
if (*val) {
|
if (*val) {
|
||||||
av = brk_string(val, &ac, FALSE, &as);
|
av = brk_string(val, &ac, FALSE, &as);
|
||||||
for (i = 0; i < ac; i++) {
|
for (i = 0; i < ac; i++) {
|
||||||
@@ -725,7 +740,7 @@ Var_Export(char *str, int isExport)
|
|||||||
char *val;
|
char *val;
|
||||||
char **av;
|
char **av;
|
||||||
char *as;
|
char *as;
|
||||||
int track;
|
int flags;
|
||||||
int ac;
|
int ac;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -734,13 +749,16 @@ Var_Export(char *str, int isExport)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
if (strncmp(str, "-env", 4) == 0) {
|
if (strncmp(str, "-env", 4) == 0) {
|
||||||
track = 0;
|
|
||||||
str += 4;
|
str += 4;
|
||||||
|
} else if (strncmp(str, "-literal", 8) == 0) {
|
||||||
|
str += 8;
|
||||||
|
flags |= VAR_EXPORT_LITERAL;
|
||||||
} else {
|
} else {
|
||||||
track = VAR_EXPORT_PARENT;
|
flags |= VAR_EXPORT_PARENT;
|
||||||
}
|
}
|
||||||
val = Var_Subst(NULL, str, VAR_GLOBAL, FALSE, TRUE);
|
val = Var_Subst(NULL, str, VAR_GLOBAL, VARF_WANTRES);
|
||||||
if (*val) {
|
if (*val) {
|
||||||
av = brk_string(val, &ac, FALSE, &as);
|
av = brk_string(val, &ac, FALSE, &as);
|
||||||
for (i = 0; i < ac; i++) {
|
for (i = 0; i < ac; i++) {
|
||||||
@@ -760,10 +778,10 @@ Var_Export(char *str, int isExport)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Var_Export1(name, track)) {
|
if (Var_Export1(name, flags)) {
|
||||||
if (VAR_EXPORTED_ALL != var_exportedVars)
|
if (VAR_EXPORTED_ALL != var_exportedVars)
|
||||||
var_exportedVars = VAR_EXPORTED_YES;
|
var_exportedVars = VAR_EXPORTED_YES;
|
||||||
if (isExport && track) {
|
if (isExport && (flags & VAR_EXPORT_PARENT)) {
|
||||||
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
|
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -830,7 +848,7 @@ Var_UnExport(char *str)
|
|||||||
/* Using .MAKE.EXPORTED */
|
/* Using .MAKE.EXPORTED */
|
||||||
n = snprintf(tmp, sizeof(tmp), "${" MAKE_EXPORTED ":O:u}");
|
n = snprintf(tmp, sizeof(tmp), "${" MAKE_EXPORTED ":O:u}");
|
||||||
if (n < (int)sizeof(tmp)) {
|
if (n < (int)sizeof(tmp)) {
|
||||||
vlist = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
|
vlist = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vlist) {
|
if (vlist) {
|
||||||
@@ -860,7 +878,7 @@ Var_UnExport(char *str)
|
|||||||
n = snprintf(tmp, sizeof(tmp),
|
n = snprintf(tmp, sizeof(tmp),
|
||||||
"${" MAKE_EXPORTED ":N%s}", v->name);
|
"${" MAKE_EXPORTED ":N%s}", v->name);
|
||||||
if (n < (int)sizeof(tmp)) {
|
if (n < (int)sizeof(tmp)) {
|
||||||
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
|
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
|
||||||
Var_Set(MAKE_EXPORTED, cp, VAR_GLOBAL, 0);
|
Var_Set(MAKE_EXPORTED, cp, VAR_GLOBAL, 0);
|
||||||
free(cp);
|
free(cp);
|
||||||
}
|
}
|
||||||
@@ -915,7 +933,7 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
|
|||||||
* point in searching them all just to save a bit of memory...
|
* point in searching them all just to save a bit of memory...
|
||||||
*/
|
*/
|
||||||
if (strchr(name, '$') != NULL) {
|
if (strchr(name, '$') != NULL) {
|
||||||
expanded_name = Var_Subst(NULL, name, ctxt, FALSE, TRUE);
|
expanded_name = Var_Subst(NULL, name, ctxt, VARF_WANTRES);
|
||||||
if (expanded_name[0] == 0) {
|
if (expanded_name[0] == 0) {
|
||||||
if (DEBUG(VAR)) {
|
if (DEBUG(VAR)) {
|
||||||
fprintf(debug_file, "Var_Set(\"%s\", \"%s\", ...) "
|
fprintf(debug_file, "Var_Set(\"%s\", \"%s\", ...) "
|
||||||
@@ -983,7 +1001,10 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
|
|||||||
|
|
||||||
Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
|
Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
|
||||||
}
|
}
|
||||||
|
if (*name == '.') {
|
||||||
|
if (strcmp(name, SAVE_DOLLARS) == 0)
|
||||||
|
save_dollars = s2Boolean(val, save_dollars);
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(expanded_name);
|
free(expanded_name);
|
||||||
@@ -1026,7 +1047,7 @@ Var_Append(const char *name, const char *val, GNode *ctxt)
|
|||||||
char *expanded_name = NULL;
|
char *expanded_name = NULL;
|
||||||
|
|
||||||
if (strchr(name, '$') != NULL) {
|
if (strchr(name, '$') != NULL) {
|
||||||
expanded_name = Var_Subst(NULL, name, ctxt, FALSE, TRUE);
|
expanded_name = Var_Subst(NULL, name, ctxt, VARF_WANTRES);
|
||||||
if (expanded_name[0] == 0) {
|
if (expanded_name[0] == 0) {
|
||||||
if (DEBUG(VAR)) {
|
if (DEBUG(VAR)) {
|
||||||
fprintf(debug_file, "Var_Append(\"%s\", \"%s\", ...) "
|
fprintf(debug_file, "Var_Append(\"%s\", \"%s\", ...) "
|
||||||
@@ -1091,7 +1112,7 @@ Var_Exists(const char *name, GNode *ctxt)
|
|||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if ((cp = strchr(name, '$')) != NULL) {
|
if ((cp = strchr(name, '$')) != NULL) {
|
||||||
cp = Var_Subst(NULL, name, ctxt, FALSE, TRUE);
|
cp = Var_Subst(NULL, name, ctxt, VARF_WANTRES);
|
||||||
}
|
}
|
||||||
v = VarFind(cp ? cp : name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
|
v = VarFind(cp ? cp : name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
|
||||||
free(cp);
|
free(cp);
|
||||||
@@ -1389,7 +1410,7 @@ VarSYSVMatch(GNode *ctx, Var_Parse_State *vpstate,
|
|||||||
addSpace = TRUE;
|
addSpace = TRUE;
|
||||||
|
|
||||||
if ((ptr = Str_SYSVMatch(word, pat->lhs, &len)) != NULL) {
|
if ((ptr = Str_SYSVMatch(word, pat->lhs, &len)) != NULL) {
|
||||||
varexp = Var_Subst(NULL, pat->rhs, ctx, FALSE, TRUE);
|
varexp = Var_Subst(NULL, pat->rhs, ctx, VARF_WANTRES);
|
||||||
Str_SYSVSubst(buf, varexp, ptr, len);
|
Str_SYSVSubst(buf, varexp, ptr, len);
|
||||||
free(varexp);
|
free(varexp);
|
||||||
} else {
|
} else {
|
||||||
@@ -1629,14 +1650,14 @@ VarSubstitute(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
VarREError(int errnum, regex_t *pat, const char *str)
|
VarREError(int reerr, regex_t *pat, const char *str)
|
||||||
{
|
{
|
||||||
char *errbuf;
|
char *errbuf;
|
||||||
int errlen;
|
int errlen;
|
||||||
|
|
||||||
errlen = regerror(errnum, pat, 0, 0);
|
errlen = regerror(reerr, pat, 0, 0);
|
||||||
errbuf = bmake_malloc(errlen);
|
errbuf = bmake_malloc(errlen);
|
||||||
regerror(errnum, pat, errbuf, errlen);
|
regerror(reerr, pat, errbuf, errlen);
|
||||||
Error("%s: %s", str, errbuf);
|
Error("%s: %s", str, errbuf);
|
||||||
free(errbuf);
|
free(errbuf);
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1830,7 @@ VarLoopExpand(GNode *ctx MAKE_ATTR_UNUSED,
|
|||||||
|
|
||||||
if (word && *word) {
|
if (word && *word) {
|
||||||
Var_Set(loop->tvar, word, loop->ctxt, VAR_NO_EXPORT);
|
Var_Set(loop->tvar, word, loop->ctxt, VAR_NO_EXPORT);
|
||||||
s = Var_Subst(NULL, loop->str, loop->ctxt, loop->errnum, TRUE);
|
s = Var_Subst(NULL, loop->str, loop->ctxt, loop->errnum | VARF_WANTRES);
|
||||||
if (s != NULL && *s != '\0') {
|
if (s != NULL && *s != '\0') {
|
||||||
if (addSpace && *s != '\n')
|
if (addSpace && *s != '\n')
|
||||||
Buf_AddByte(buf, ' ');
|
Buf_AddByte(buf, ' ');
|
||||||
@@ -2143,13 +2164,14 @@ VarUniq(const char *str)
|
|||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
|
VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
|
||||||
int errnum, const char **tstr, int delim, int *flags,
|
int flags, const char **tstr, int delim, int *vflags,
|
||||||
int *length, VarPattern *pattern)
|
int *length, VarPattern *pattern)
|
||||||
{
|
{
|
||||||
const char *cp;
|
const char *cp;
|
||||||
char *rstr;
|
char *rstr;
|
||||||
Buffer buf;
|
Buffer buf;
|
||||||
int junk;
|
int junk;
|
||||||
|
int errnum = flags & VARF_UNDEFERR;
|
||||||
|
|
||||||
Buf_Init(&buf, 0);
|
Buf_Init(&buf, 0);
|
||||||
if (length == NULL)
|
if (length == NULL)
|
||||||
@@ -2171,16 +2193,16 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
|
|||||||
cp++;
|
cp++;
|
||||||
} else if (*cp == '$') {
|
} else if (*cp == '$') {
|
||||||
if (cp[1] == delim) {
|
if (cp[1] == delim) {
|
||||||
if (flags == NULL)
|
if (vflags == NULL)
|
||||||
Buf_AddByte(&buf, *cp);
|
Buf_AddByte(&buf, *cp);
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* Unescaped $ at end of pattern => anchor
|
* Unescaped $ at end of pattern => anchor
|
||||||
* pattern at end.
|
* pattern at end.
|
||||||
*/
|
*/
|
||||||
*flags |= VAR_MATCH_END;
|
*vflags |= VAR_MATCH_END;
|
||||||
} else {
|
} else {
|
||||||
if (flags == NULL || (*flags & VAR_NOSUBST) == 0) {
|
if (vflags == NULL || (*vflags & VAR_NOSUBST) == 0) {
|
||||||
char *cp2;
|
char *cp2;
|
||||||
int len;
|
int len;
|
||||||
void *freeIt;
|
void *freeIt;
|
||||||
@@ -2190,7 +2212,8 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
|
|||||||
* delimiter, assume it's a variable
|
* delimiter, assume it's a variable
|
||||||
* substitution and recurse.
|
* substitution and recurse.
|
||||||
*/
|
*/
|
||||||
cp2 = Var_Parse(cp, ctxt, errnum, TRUE, &len, &freeIt);
|
cp2 = Var_Parse(cp, ctxt, errnum | VARF_WANTRES, &len,
|
||||||
|
&freeIt);
|
||||||
Buf_AddBytes(&buf, strlen(cp2), cp2);
|
Buf_AddBytes(&buf, strlen(cp2), cp2);
|
||||||
free(freeIt);
|
free(freeIt);
|
||||||
cp += len - 1;
|
cp += len - 1;
|
||||||
@@ -2463,7 +2486,7 @@ VarStrftime(const char *fmt, int zulu)
|
|||||||
static char *
|
static char *
|
||||||
ApplyModifiers(char *nstr, const char *tstr,
|
ApplyModifiers(char *nstr, const char *tstr,
|
||||||
int startc, int endc,
|
int startc, int endc,
|
||||||
Var *v, GNode *ctxt, Boolean errnum, Boolean wantit,
|
Var *v, GNode *ctxt, int flags,
|
||||||
int *lengthPtr, void **freePtr)
|
int *lengthPtr, void **freePtr)
|
||||||
{
|
{
|
||||||
const char *start;
|
const char *start;
|
||||||
@@ -2494,7 +2517,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
int rlen;
|
int rlen;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
rval = Var_Parse(tstr, ctxt, errnum, wantit, &rlen, &freeIt);
|
rval = Var_Parse(tstr, ctxt, flags, &rlen, &freeIt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we have not parsed up to endc or ':',
|
* If we have not parsed up to endc or ':',
|
||||||
@@ -2519,10 +2542,9 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
int used;
|
int used;
|
||||||
|
|
||||||
nstr = ApplyModifiers(nstr, rval,
|
nstr = ApplyModifiers(nstr, rval,
|
||||||
0, 0,
|
0, 0, v, ctxt, flags, &used, freePtr);
|
||||||
v, ctxt, errnum, wantit, &used, freePtr);
|
|
||||||
if (nstr == var_Error
|
if (nstr == var_Error
|
||||||
|| (nstr == varNoError && errnum == 0)
|
|| (nstr == varNoError && (flags & VARF_UNDEFERR) == 0)
|
||||||
|| strlen(rval) != (size_t) used) {
|
|| strlen(rval) != (size_t) used) {
|
||||||
free(freeIt);
|
free(freeIt);
|
||||||
goto out; /* error already reported */
|
goto out; /* error already reported */
|
||||||
@@ -2557,7 +2579,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
char *sv_name;
|
char *sv_name;
|
||||||
VarPattern pattern;
|
VarPattern pattern;
|
||||||
int how;
|
int how;
|
||||||
int flags;
|
int vflags;
|
||||||
|
|
||||||
if (v->name[0] == 0)
|
if (v->name[0] == 0)
|
||||||
goto bad_modifier;
|
goto bad_modifier;
|
||||||
@@ -2593,9 +2615,9 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
delim = startc == PROPEN ? PRCLOSE : BRCLOSE;
|
delim = startc == PROPEN ? PRCLOSE : BRCLOSE;
|
||||||
pattern.flags = 0;
|
pattern.flags = 0;
|
||||||
|
|
||||||
flags = (wantit) ? 0 : VAR_NOSUBST;
|
vflags = (flags & VARF_WANTRES) ? 0 : VAR_NOSUBST;
|
||||||
pattern.rhs = VarGetPattern(ctxt, &parsestate, errnum,
|
pattern.rhs = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim, &flags,
|
&cp, delim, &vflags,
|
||||||
&pattern.rightLen,
|
&pattern.rightLen,
|
||||||
NULL);
|
NULL);
|
||||||
if (v->flags & VAR_JUNK) {
|
if (v->flags & VAR_JUNK) {
|
||||||
@@ -2609,7 +2631,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
termc = *--cp;
|
termc = *--cp;
|
||||||
delim = '\0';
|
delim = '\0';
|
||||||
|
|
||||||
if (wantit) {
|
if (flags & VARF_WANTRES) {
|
||||||
switch (how) {
|
switch (how) {
|
||||||
case '+':
|
case '+':
|
||||||
Var_Append(v->name, pattern.rhs, v_ctxt);
|
Var_Append(v->name, pattern.rhs, v_ctxt);
|
||||||
@@ -2640,29 +2662,30 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
case '@':
|
case '@':
|
||||||
{
|
{
|
||||||
VarLoop_t loop;
|
VarLoop_t loop;
|
||||||
int flags = VAR_NOSUBST;
|
int vflags = VAR_NOSUBST;
|
||||||
|
|
||||||
cp = ++tstr;
|
cp = ++tstr;
|
||||||
delim = '@';
|
delim = '@';
|
||||||
if ((loop.tvar = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((loop.tvar = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim,
|
&cp, delim,
|
||||||
&flags, &loop.tvarLen,
|
&vflags, &loop.tvarLen,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((loop.str = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((loop.str = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim,
|
&cp, delim,
|
||||||
&flags, &loop.strLen,
|
&vflags, &loop.strLen,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
termc = *cp;
|
termc = *cp;
|
||||||
delim = '\0';
|
delim = '\0';
|
||||||
|
|
||||||
loop.errnum = errnum;
|
loop.errnum = flags & VARF_UNDEFERR;
|
||||||
loop.ctxt = ctxt;
|
loop.ctxt = ctxt;
|
||||||
newStr = VarModify(ctxt, &parsestate, nstr, VarLoopExpand,
|
newStr = VarModify(ctxt, &parsestate, nstr, VarLoopExpand,
|
||||||
&loop);
|
&loop);
|
||||||
|
Var_Delete(loop.tvar, ctxt);
|
||||||
free(loop.tvar);
|
free(loop.tvar);
|
||||||
free(loop.str);
|
free(loop.str);
|
||||||
break;
|
break;
|
||||||
@@ -2671,15 +2694,19 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
case 'U':
|
case 'U':
|
||||||
{
|
{
|
||||||
Buffer buf; /* Buffer for patterns */
|
Buffer buf; /* Buffer for patterns */
|
||||||
int wantit_; /* want data in buffer */
|
int nflags;
|
||||||
|
|
||||||
if (wantit) {
|
if (flags & VARF_WANTRES) {
|
||||||
|
int wantres;
|
||||||
if (*tstr == 'U')
|
if (*tstr == 'U')
|
||||||
wantit_ = ((v->flags & VAR_JUNK) != 0);
|
wantres = ((v->flags & VAR_JUNK) != 0);
|
||||||
else
|
else
|
||||||
wantit_ = ((v->flags & VAR_JUNK) == 0);
|
wantres = ((v->flags & VAR_JUNK) == 0);
|
||||||
|
nflags = flags & ~VARF_WANTRES;
|
||||||
|
if (wantres)
|
||||||
|
nflags |= VARF_WANTRES;
|
||||||
} else
|
} else
|
||||||
wantit_ = wantit;
|
nflags = flags;
|
||||||
/*
|
/*
|
||||||
* Pass through tstr looking for 1) escaped delimiters,
|
* Pass through tstr looking for 1) escaped delimiters,
|
||||||
* '$'s and backslashes (place the escaped character in
|
* '$'s and backslashes (place the escaped character in
|
||||||
@@ -2708,7 +2735,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
int len;
|
int len;
|
||||||
void *freeIt;
|
void *freeIt;
|
||||||
|
|
||||||
cp2 = Var_Parse(cp, ctxt, errnum, wantit_, &len, &freeIt);
|
cp2 = Var_Parse(cp, ctxt, nflags, &len, &freeIt);
|
||||||
Buf_AddBytes(&buf, strlen(cp2), cp2);
|
Buf_AddBytes(&buf, strlen(cp2), cp2);
|
||||||
free(freeIt);
|
free(freeIt);
|
||||||
cp += len - 1;
|
cp += len - 1;
|
||||||
@@ -2721,7 +2748,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
|
|
||||||
if ((v->flags & VAR_JUNK) != 0)
|
if ((v->flags & VAR_JUNK) != 0)
|
||||||
v->flags |= VAR_KEEP;
|
v->flags |= VAR_KEEP;
|
||||||
if (wantit_) {
|
if (nflags & VARF_WANTRES) {
|
||||||
newStr = Buf_Destroy(&buf, FALSE);
|
newStr = Buf_Destroy(&buf, FALSE);
|
||||||
} else {
|
} else {
|
||||||
newStr = nstr;
|
newStr = nstr;
|
||||||
@@ -2768,12 +2795,12 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
delim = '!';
|
delim = '!';
|
||||||
emsg = NULL;
|
emsg = NULL;
|
||||||
cp = ++tstr;
|
cp = ++tstr;
|
||||||
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim,
|
&cp, delim,
|
||||||
NULL, &pattern.rightLen,
|
NULL, &pattern.rightLen,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (wantit)
|
if (flags & VARF_WANTRES)
|
||||||
newStr = Cmd_Exec(pattern.rhs, &emsg);
|
newStr = Cmd_Exec(pattern.rhs, &emsg);
|
||||||
else
|
else
|
||||||
newStr = varNoError;
|
newStr = varNoError;
|
||||||
@@ -2801,7 +2828,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
cp = tstr+1; /* point to char after '[' */
|
cp = tstr+1; /* point to char after '[' */
|
||||||
delim = ']'; /* look for closing ']' */
|
delim = ']'; /* look for closing ']' */
|
||||||
estr = VarGetPattern(ctxt, &parsestate,
|
estr = VarGetPattern(ctxt, &parsestate,
|
||||||
errnum, &cp, delim,
|
flags, &cp, delim,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (estr == NULL)
|
if (estr == NULL)
|
||||||
goto cleanup; /* report missing ']' */
|
goto cleanup; /* report missing ']' */
|
||||||
@@ -2978,6 +3005,9 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
parsestate.varSpace = 0; /* no separator */
|
parsestate.varSpace = 0; /* no separator */
|
||||||
cp = tstr + 2;
|
cp = tstr + 2;
|
||||||
} else if (tstr[2] == '\\') {
|
} else if (tstr[2] == '\\') {
|
||||||
|
const char *xp = &tstr[3];
|
||||||
|
int base = 8; /* assume octal */
|
||||||
|
|
||||||
switch (tstr[3]) {
|
switch (tstr[3]) {
|
||||||
case 'n':
|
case 'n':
|
||||||
parsestate.varSpace = '\n';
|
parsestate.varSpace = '\n';
|
||||||
@@ -2987,12 +3017,20 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
parsestate.varSpace = '\t';
|
parsestate.varSpace = '\t';
|
||||||
cp = tstr + 4;
|
cp = tstr + 4;
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
base = 16;
|
||||||
|
xp++;
|
||||||
|
goto get_numeric;
|
||||||
|
case '0':
|
||||||
|
base = 0;
|
||||||
|
goto get_numeric;
|
||||||
default:
|
default:
|
||||||
if (isdigit((unsigned char)tstr[3])) {
|
if (isdigit((unsigned char)tstr[3])) {
|
||||||
char *ep;
|
char *ep;
|
||||||
|
|
||||||
|
get_numeric:
|
||||||
parsestate.varSpace =
|
parsestate.varSpace =
|
||||||
strtoul(&tstr[3], &ep, 0);
|
strtoul(xp, &ep, base);
|
||||||
if (*ep != ':' && *ep != endc)
|
if (*ep != ':' && *ep != endc)
|
||||||
goto bad_modifier;
|
goto bad_modifier;
|
||||||
cp = ep;
|
cp = ep;
|
||||||
@@ -3152,7 +3190,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
* expand it.
|
* expand it.
|
||||||
*/
|
*/
|
||||||
cp2 = pattern;
|
cp2 = pattern;
|
||||||
pattern = Var_Subst(NULL, cp2, ctxt, errnum, TRUE);
|
pattern = Var_Subst(NULL, cp2, ctxt, flags | VARF_WANTRES);
|
||||||
free(cp2);
|
free(cp2);
|
||||||
}
|
}
|
||||||
if (DEBUG(VAR))
|
if (DEBUG(VAR))
|
||||||
@@ -3188,14 +3226,14 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cp = tstr;
|
cp = tstr;
|
||||||
if ((pattern.lhs = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((pattern.lhs = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim,
|
&cp, delim,
|
||||||
&pattern.flags,
|
&pattern.flags,
|
||||||
&pattern.leftLen,
|
&pattern.leftLen,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim, NULL,
|
&cp, delim, NULL,
|
||||||
&pattern.rightLen,
|
&pattern.rightLen,
|
||||||
&pattern)) == NULL)
|
&pattern)) == NULL)
|
||||||
@@ -3242,7 +3280,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
int lhs_flags, rhs_flags;
|
int lhs_flags, rhs_flags;
|
||||||
|
|
||||||
/* find ':', and then substitute accordingly */
|
/* find ':', and then substitute accordingly */
|
||||||
if (wantit) {
|
if (flags & VARF_WANTRES) {
|
||||||
cond_rc = Cond_EvalExpression(NULL, v->name, &value, 0, FALSE);
|
cond_rc = Cond_EvalExpression(NULL, v->name, &value, 0, FALSE);
|
||||||
if (cond_rc == COND_INVALID) {
|
if (cond_rc == COND_INVALID) {
|
||||||
lhs_flags = rhs_flags = VAR_NOSUBST;
|
lhs_flags = rhs_flags = VAR_NOSUBST;
|
||||||
@@ -3262,7 +3300,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
|
|
||||||
cp = ++tstr;
|
cp = ++tstr;
|
||||||
delim = ':';
|
delim = ':';
|
||||||
if ((pattern.lhs = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((pattern.lhs = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim, &lhs_flags,
|
&cp, delim, &lhs_flags,
|
||||||
&pattern.leftLen,
|
&pattern.leftLen,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
@@ -3270,7 +3308,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
|
|
||||||
/* BROPEN or PROPEN */
|
/* BROPEN or PROPEN */
|
||||||
delim = endc;
|
delim = endc;
|
||||||
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate, errnum,
|
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate, flags,
|
||||||
&cp, delim, &rhs_flags,
|
&cp, delim, &rhs_flags,
|
||||||
&pattern.rightLen,
|
&pattern.rightLen,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
@@ -3311,12 +3349,12 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
|
|
||||||
cp = tstr;
|
cp = tstr;
|
||||||
|
|
||||||
if ((re = VarGetPattern(ctxt, &parsestate, errnum, &cp, delim,
|
if ((re = VarGetPattern(ctxt, &parsestate, flags, &cp, delim,
|
||||||
NULL, NULL, NULL)) == NULL)
|
NULL, NULL, NULL)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((pattern.replace = VarGetPattern(ctxt, &parsestate,
|
if ((pattern.replace = VarGetPattern(ctxt, &parsestate,
|
||||||
errnum, &cp, delim, NULL,
|
flags, &cp, delim, NULL,
|
||||||
NULL, NULL)) == NULL){
|
NULL, NULL)) == NULL){
|
||||||
free(re);
|
free(re);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -3440,7 +3478,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
case 's':
|
case 's':
|
||||||
if (tstr[1] == 'h' && (tstr[2] == endc || tstr[2] == ':')) {
|
if (tstr[1] == 'h' && (tstr[2] == endc || tstr[2] == ':')) {
|
||||||
const char *emsg;
|
const char *emsg;
|
||||||
if (wantit) {
|
if (flags & VARF_WANTRES) {
|
||||||
newStr = Cmd_Exec(nstr, &emsg);
|
newStr = Cmd_Exec(nstr, &emsg);
|
||||||
if (emsg)
|
if (emsg)
|
||||||
Error(emsg, nstr);
|
Error(emsg, nstr);
|
||||||
@@ -3493,12 +3531,12 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
delim='=';
|
delim='=';
|
||||||
cp = tstr;
|
cp = tstr;
|
||||||
if ((pattern.lhs = VarGetPattern(ctxt, &parsestate,
|
if ((pattern.lhs = VarGetPattern(ctxt, &parsestate,
|
||||||
errnum, &cp, delim, &pattern.flags,
|
flags, &cp, delim, &pattern.flags,
|
||||||
&pattern.leftLen, NULL)) == NULL)
|
&pattern.leftLen, NULL)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
delim = endc;
|
delim = endc;
|
||||||
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate,
|
if ((pattern.rhs = VarGetPattern(ctxt, &parsestate,
|
||||||
errnum, &cp, delim, NULL, &pattern.rightLen,
|
flags, &cp, delim, NULL, &pattern.rightLen,
|
||||||
&pattern)) == NULL)
|
&pattern)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@@ -3581,8 +3619,9 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
* Input:
|
* Input:
|
||||||
* str The string to parse
|
* str The string to parse
|
||||||
* ctxt The context for the variable
|
* ctxt The context for the variable
|
||||||
* errnum TRUE if undefined variables are an error
|
* flags VARF_UNDEFERR if undefineds are an error
|
||||||
* wantit TRUE if we actually want the result
|
* VARF_WANTRES if we actually want the result
|
||||||
|
* VARF_ASSIGN if we are in a := assignment
|
||||||
* lengthPtr OUT: The length of the specification
|
* lengthPtr OUT: The length of the specification
|
||||||
* freePtr OUT: Non-NULL if caller should free *freePtr
|
* freePtr OUT: Non-NULL if caller should free *freePtr
|
||||||
*
|
*
|
||||||
@@ -3601,9 +3640,8 @@ ApplyModifiers(char *nstr, const char *tstr,
|
|||||||
*/
|
*/
|
||||||
/* coverity[+alloc : arg-*4] */
|
/* coverity[+alloc : arg-*4] */
|
||||||
char *
|
char *
|
||||||
Var_Parse(const char *str, GNode *ctxt,
|
Var_Parse(const char *str, GNode *ctxt, int flags,
|
||||||
Boolean errnum, Boolean wantit,
|
int *lengthPtr, void **freePtr)
|
||||||
int *lengthPtr, void **freePtr)
|
|
||||||
{
|
{
|
||||||
const char *tstr; /* Pointer into str */
|
const char *tstr; /* Pointer into str */
|
||||||
Var *v; /* Variable in invocation */
|
Var *v; /* Variable in invocation */
|
||||||
@@ -3671,7 +3709,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
/*
|
/*
|
||||||
* Error
|
* Error
|
||||||
*/
|
*/
|
||||||
return (errnum ? var_Error : varNoError);
|
return (flags & VARF_UNDEFERR) ? var_Error : varNoError;
|
||||||
} else {
|
} else {
|
||||||
haveModifier = FALSE;
|
haveModifier = FALSE;
|
||||||
tstr = &str[1];
|
tstr = &str[1];
|
||||||
@@ -3708,7 +3746,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
if (*tstr == '$') {
|
if (*tstr == '$') {
|
||||||
int rlen;
|
int rlen;
|
||||||
void *freeIt;
|
void *freeIt;
|
||||||
char *rval = Var_Parse(tstr, ctxt, errnum, wantit, &rlen, &freeIt);
|
char *rval = Var_Parse(tstr, ctxt, flags, &rlen, &freeIt);
|
||||||
if (rval != NULL) {
|
if (rval != NULL) {
|
||||||
Buf_AddBytes(&buf, strlen(rval), rval);
|
Buf_AddBytes(&buf, strlen(rval), rval);
|
||||||
}
|
}
|
||||||
@@ -3821,7 +3859,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
return(pstr);
|
return(pstr);
|
||||||
} else {
|
} else {
|
||||||
Buf_Destroy(&buf, TRUE);
|
Buf_Destroy(&buf, TRUE);
|
||||||
return (errnum ? var_Error : varNoError);
|
return (flags & VARF_UNDEFERR) ? var_Error : varNoError;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@@ -3855,7 +3893,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
*/
|
*/
|
||||||
nstr = Buf_GetAll(&v->val, NULL);
|
nstr = Buf_GetAll(&v->val, NULL);
|
||||||
if (strchr(nstr, '$') != NULL) {
|
if (strchr(nstr, '$') != NULL) {
|
||||||
nstr = Var_Subst(NULL, nstr, ctxt, errnum, wantit);
|
nstr = Var_Subst(NULL, nstr, ctxt, flags);
|
||||||
*freePtr = nstr;
|
*freePtr = nstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3868,7 +3906,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
extraFree = NULL;
|
extraFree = NULL;
|
||||||
if (extramodifiers != NULL) {
|
if (extramodifiers != NULL) {
|
||||||
nstr = ApplyModifiers(nstr, extramodifiers, '(', ')',
|
nstr = ApplyModifiers(nstr, extramodifiers, '(', ')',
|
||||||
v, ctxt, errnum, wantit, &used, &extraFree);
|
v, ctxt, flags, &used, &extraFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (haveModifier) {
|
if (haveModifier) {
|
||||||
@@ -3876,7 +3914,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
tstr++;
|
tstr++;
|
||||||
|
|
||||||
nstr = ApplyModifiers(nstr, tstr, startc, endc,
|
nstr = ApplyModifiers(nstr, tstr, startc, endc,
|
||||||
v, ctxt, errnum, wantit, &used, freePtr);
|
v, ctxt, flags, &used, freePtr);
|
||||||
tstr += used;
|
tstr += used;
|
||||||
free(extraFree);
|
free(extraFree);
|
||||||
} else {
|
} else {
|
||||||
@@ -3917,7 +3955,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
nstr = bmake_strndup(start, *lengthPtr);
|
nstr = bmake_strndup(start, *lengthPtr);
|
||||||
*freePtr = nstr;
|
*freePtr = nstr;
|
||||||
} else {
|
} else {
|
||||||
nstr = errnum ? var_Error : varNoError;
|
nstr = (flags & VARF_UNDEFERR) ? var_Error : varNoError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nstr != Buf_GetAll(&v->val, NULL))
|
if (nstr != Buf_GetAll(&v->val, NULL))
|
||||||
@@ -3932,15 +3970,16 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
* Var_Subst --
|
* Var_Subst --
|
||||||
* Substitute for all variables in the given string in the given context
|
* Substitute for all variables in the given string in the given context
|
||||||
* If undefErr is TRUE, Parse_Error will be called when an undefined
|
* If flags & VARF_UNDEFERR, Parse_Error will be called when an undefined
|
||||||
* variable is encountered.
|
* variable is encountered.
|
||||||
*
|
*
|
||||||
* Input:
|
* Input:
|
||||||
* var Named variable || NULL for all
|
* var Named variable || NULL for all
|
||||||
* str the string which to substitute
|
* str the string which to substitute
|
||||||
* ctxt the context wherein to find variables
|
* ctxt the context wherein to find variables
|
||||||
* undefErr TRUE if undefineds are an error
|
* flags VARF_UNDEFERR if undefineds are an error
|
||||||
* wantit TRUE if we actually want the result
|
* VARF_WANTRES if we actually want the result
|
||||||
|
* VARF_ASSIGN if we are in a := assignment
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* The resulting string.
|
* The resulting string.
|
||||||
@@ -3950,8 +3989,7 @@ Var_Parse(const char *str, GNode *ctxt,
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
Var_Subst(const char *var, const char *str, GNode *ctxt,
|
Var_Subst(const char *var, const char *str, GNode *ctxt, int flags)
|
||||||
Boolean undefErr, Boolean wantit)
|
|
||||||
{
|
{
|
||||||
Buffer buf; /* Buffer for forming things */
|
Buffer buf; /* Buffer for forming things */
|
||||||
char *val; /* Value to substitute for a variable */
|
char *val; /* Value to substitute for a variable */
|
||||||
@@ -3975,6 +4013,8 @@ Var_Subst(const char *var, const char *str, GNode *ctxt,
|
|||||||
* In such a case, we skip over the escape character and store the
|
* In such a case, we skip over the escape character and store the
|
||||||
* dollar sign into the buffer directly.
|
* dollar sign into the buffer directly.
|
||||||
*/
|
*/
|
||||||
|
if (save_dollars && (flags & VARF_ASSIGN))
|
||||||
|
Buf_AddByte(&buf, *str);
|
||||||
str++;
|
str++;
|
||||||
Buf_AddByte(&buf, *str);
|
Buf_AddByte(&buf, *str);
|
||||||
str++;
|
str++;
|
||||||
@@ -4049,7 +4089,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = Var_Parse(str, ctxt, undefErr, wantit, &length, &freeIt);
|
val = Var_Parse(str, ctxt, flags, &length, &freeIt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When we come down here, val should either point to the
|
* When we come down here, val should either point to the
|
||||||
@@ -4066,7 +4106,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt,
|
|||||||
*/
|
*/
|
||||||
if (oldVars) {
|
if (oldVars) {
|
||||||
str += length;
|
str += length;
|
||||||
} else if (undefErr || val == var_Error) {
|
} else if ((flags & VARF_UNDEFERR) || val == var_Error) {
|
||||||
/*
|
/*
|
||||||
* If variable is undefined, complain and skip the
|
* If variable is undefined, complain and skip the
|
||||||
* variable. The complaint will stop us from doing anything
|
* variable. The complaint will stop us from doing anything
|
||||||
|
|||||||
+48
-16
@@ -1,5 +1,5 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
# $Id: dirdeps.mk,v 1.55 2015/10/20 22:04:53 sjg Exp $
|
# $Id: dirdeps.mk,v 1.59 2016/02/26 23:32:29 sjg Exp $
|
||||||
|
|
||||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@@ -122,6 +122,9 @@ _DIRDEP_USE_LEVEL?= 0
|
|||||||
# and non-specific Makefile.depend*
|
# and non-specific Makefile.depend*
|
||||||
|
|
||||||
.if !target(_DIRDEP_USE)
|
.if !target(_DIRDEP_USE)
|
||||||
|
# make sure we get the behavior we expect
|
||||||
|
.MAKE.SAVE_DOLLARS = no
|
||||||
|
|
||||||
# do some setup we only need once
|
# do some setup we only need once
|
||||||
_CURDIR ?= ${.CURDIR}
|
_CURDIR ?= ${.CURDIR}
|
||||||
_OBJDIR ?= ${.OBJDIR}
|
_OBJDIR ?= ${.OBJDIR}
|
||||||
@@ -257,11 +260,8 @@ DEP_RELDIR := ${DIRDEPS:R:[1]}
|
|||||||
MK_DIRDEPS_CACHE = no
|
MK_DIRDEPS_CACHE = no
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# reset each time through
|
||||||
# pickup customizations
|
_build_all_dirs =
|
||||||
# as below you can use !target(_DIRDEP_USE) to protect things
|
|
||||||
# which should only be done once.
|
|
||||||
.-include "local.dirdeps.mk"
|
|
||||||
|
|
||||||
# the first time we are included the _DIRDEP_USE target will not be defined
|
# the first time we are included the _DIRDEP_USE target will not be defined
|
||||||
# we can use this as a clue to do initialization and other one time things.
|
# we can use this as a clue to do initialization and other one time things.
|
||||||
@@ -281,6 +281,14 @@ DEBUG_DIRDEPS ?= no
|
|||||||
# remember the initial value of DEP_RELDIR - we test for it below.
|
# remember the initial value of DEP_RELDIR - we test for it below.
|
||||||
_DEP_RELDIR := ${DEP_RELDIR}
|
_DEP_RELDIR := ${DEP_RELDIR}
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# pickup customizations
|
||||||
|
# as below you can use !target(_DIRDEP_USE) to protect things
|
||||||
|
# which should only be done once.
|
||||||
|
.-include "local.dirdeps.mk"
|
||||||
|
|
||||||
|
.if !target(_DIRDEP_USE)
|
||||||
# things we skip for host tools
|
# things we skip for host tools
|
||||||
SKIP_HOSTDIR ?=
|
SKIP_HOSTDIR ?=
|
||||||
|
|
||||||
@@ -400,6 +408,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
|
|||||||
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
|
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
|
||||||
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
|
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
|
||||||
.MAKE.DEPENDFILE=.none \
|
.MAKE.DEPENDFILE=.none \
|
||||||
|
${.MAKEFLAGS:tW:S,-D ,-D,g:tw:M*WITH*} \
|
||||||
3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \
|
3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \
|
||||||
mv ${.TARGET}.new ${.TARGET}
|
mv ${.TARGET}.new ${.TARGET}
|
||||||
|
|
||||||
@@ -480,7 +489,11 @@ _build_dirs += ${_machines:@m@${_CURDIR}.$m@}
|
|||||||
_build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
_build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
||||||
.if ${DEP_TARGET_SPEC} == ${TARGET_SPEC}
|
.if ${DEP_TARGET_SPEC} == ${TARGET_SPEC}
|
||||||
# pickup local dependencies now
|
# pickup local dependencies now
|
||||||
|
.if ${MAKE_VERSION} < 20160220
|
||||||
.-include <.depend>
|
.-include <.depend>
|
||||||
|
.else
|
||||||
|
.dinclude <.depend>
|
||||||
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
@@ -532,22 +545,25 @@ _build_dirs += \
|
|||||||
# qualify everything now
|
# qualify everything now
|
||||||
_build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u}
|
_build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u}
|
||||||
|
|
||||||
|
_build_all_dirs += ${_build_dirs}
|
||||||
|
_build_all_dirs := ${_build_all_dirs:O:u}
|
||||||
|
|
||||||
.endif # empty DIRDEPS
|
.endif # empty DIRDEPS
|
||||||
|
|
||||||
# Normally if doing make -V something,
|
# Normally if doing make -V something,
|
||||||
# we do not want to waste time chasing DIRDEPS
|
# we do not want to waste time chasing DIRDEPS
|
||||||
# but if we want to count the number of Makefile.depend* read, we do.
|
# but if we want to count the number of Makefile.depend* read, we do.
|
||||||
.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
|
.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
|
||||||
.if !empty(_build_dirs)
|
.if !empty(_build_all_dirs)
|
||||||
.if ${BUILD_DIRDEPS_CACHE} == "yes"
|
.if ${BUILD_DIRDEPS_CACHE} == "yes"
|
||||||
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
|
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
|
||||||
echo 'dirdeps: ${_build_dirs:${M_oneperline}}'; echo; } >&3; echo
|
echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo
|
||||||
x!= { ${_build_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
|
||||||
.else
|
.else
|
||||||
# this makes it all happen
|
# this makes it all happen
|
||||||
dirdeps: ${_build_dirs}
|
dirdeps: ${_build_all_dirs}
|
||||||
.endif
|
.endif
|
||||||
${_build_dirs}: _DIRDEP_USE
|
${_build_all_dirs}: _DIRDEP_USE
|
||||||
|
|
||||||
.if ${_debug_reldir}
|
.if ${_debug_reldir}
|
||||||
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
|
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
|
||||||
@@ -581,14 +597,14 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
# Now find more dependencies - and recurse.
|
# Now find more dependencies - and recurse.
|
||||||
.for d in ${_build_dirs}
|
.for d in ${_build_all_dirs}
|
||||||
.if ${_DIRDEP_CHECKED:M$d} == ""
|
.if ${_DIRDEP_CHECKED:M$d} == ""
|
||||||
# once only
|
# once only
|
||||||
_DIRDEP_CHECKED += $d
|
_DIRDEP_CHECKED += $d
|
||||||
.if ${_debug_search}
|
.if ${_debug_search}
|
||||||
.info checking $d
|
.info checking $d
|
||||||
.endif
|
.endif
|
||||||
# Note: _build_dirs is fully qualifed so d:R is always the directory
|
# Note: _build_all_dirs is fully qualifed so d:R is always the directory
|
||||||
.if exists(${d:R})
|
.if exists(${d:R})
|
||||||
# Warning: there is an assumption here that MACHINE is always
|
# Warning: there is an assumption here that MACHINE is always
|
||||||
# the first entry in TARGET_SPEC_VARS.
|
# the first entry in TARGET_SPEC_VARS.
|
||||||
@@ -628,28 +644,37 @@ DIRDEPS =
|
|||||||
DEP_RELDIR := ${RELDIR}
|
DEP_RELDIR := ${RELDIR}
|
||||||
_DEP_RELDIR := ${RELDIR}
|
_DEP_RELDIR := ${RELDIR}
|
||||||
# pickup local dependencies
|
# pickup local dependencies
|
||||||
|
.if ${MAKE_VERSION} < 20160220
|
||||||
.-include <.depend>
|
.-include <.depend>
|
||||||
|
.else
|
||||||
|
.dinclude <.depend>
|
||||||
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# bootstrapping new dependencies made easy?
|
# bootstrapping new dependencies made easy?
|
||||||
.if (make(bootstrap) || make(bootstrap-recurse)) && !target(bootstrap)
|
.if !target(bootstrap) && (make(bootstrap) || \
|
||||||
|
make(bootstrap-this) || \
|
||||||
|
make(bootstrap-recurse) || \
|
||||||
|
make(bootstrap-empty))
|
||||||
|
|
||||||
.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T})
|
.if exists(${.CURDIR}/${.MAKE.DEPENDFILE:T})
|
||||||
# stop here
|
# stop here
|
||||||
${.TARGETS:Mboot*}:
|
${.TARGETS:Mboot*}:
|
||||||
.else
|
.elif !make(bootstrap-empty)
|
||||||
# find a Makefile.depend to use as _src
|
# find a Makefile.depend to use as _src
|
||||||
_src != cd ${.CURDIR} && for m in ${.MAKE.DEPENDFILE_PREFERENCE:T:S,${MACHINE},*,}; do test -s $$m || continue; echo $$m; break; done; echo
|
_src != cd ${.CURDIR} && for m in ${.MAKE.DEPENDFILE_PREFERENCE:T:S,${MACHINE},*,}; do test -s $$m || continue; echo $$m; break; done; echo
|
||||||
.if empty(_src)
|
.if empty(_src)
|
||||||
.error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}
|
.error cannot find any of ${.MAKE.DEPENDFILE_PREFERENCE:T}${.newline}Use: bootstrap-empty
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
_src?= ${.MAKE.DEPENDFILE:T}
|
_src?= ${.MAKE.DEPENDFILE:T}
|
||||||
|
|
||||||
|
# just create Makefile.depend* for this dir
|
||||||
bootstrap-this: .NOTMAIN
|
bootstrap-this: .NOTMAIN
|
||||||
@echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T}
|
@echo Bootstrapping ${RELDIR}/${.MAKE.DEPENDFILE:T} from ${_src:T}
|
||||||
(cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T})
|
(cd ${.CURDIR} && sed 's,${_src:E},${MACHINE},g' ${_src} > ${.MAKE.DEPENDFILE:T})
|
||||||
|
|
||||||
|
# create Makefile.depend* for this dir and its dependencies
|
||||||
bootstrap: bootstrap-recurse
|
bootstrap: bootstrap-recurse
|
||||||
bootstrap-recurse: bootstrap-this
|
bootstrap-recurse: bootstrap-this
|
||||||
|
|
||||||
@@ -664,4 +689,11 @@ bootstrap-recurse: .NOTMAIN .MAKE
|
|||||||
done
|
done
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# create an empty Makefile.depend* to get the ball rolling.
|
||||||
|
bootstrap-empty: .NOTMAIN .NOMETA
|
||||||
|
@echo Creating empty ${RELDIR}/${.MAKE.DEPENDFILE:T}; \
|
||||||
|
echo You need to build ${RELDIR} to correctly populate it.
|
||||||
|
@{ echo DIRDEPS=; echo ".include <dirdeps.mk>"; } > ${.CURDIR}/${.MAKE.DEPENDFILE:T}
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
# $Id: gendirdeps.mk,v 1.29 2015/10/03 05:00:46 sjg Exp $
|
# $Id: gendirdeps.mk,v 1.30 2016/02/27 00:20:39 sjg Exp $
|
||||||
|
|
||||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@@ -310,7 +310,7 @@ CAT_DEPEND ?= .depend
|
|||||||
# .depend may contain things we don't want.
|
# .depend may contain things we don't want.
|
||||||
# The sed command at the end of the stream, allows for the filters
|
# The sed command at the end of the stream, allows for the filters
|
||||||
# to output _{VAR} tokens which we will turn into proper ${VAR} references.
|
# to output _{VAR} tokens which we will turn into proper ${VAR} references.
|
||||||
${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS}
|
${_DEPENDFILE}: .NOMETA ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS}
|
||||||
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
||||||
echo 'DIRDEPS = \'; \
|
echo 'DIRDEPS = \'; \
|
||||||
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
||||||
@@ -330,7 +330,7 @@ DIRDEPS := ${SUBDIR:S,^,${RELDIR}/,:O:u}
|
|||||||
|
|
||||||
all: ${_DEPENDFILE}
|
all: ${_DEPENDFILE}
|
||||||
|
|
||||||
${_DEPENDFILE}: ${MAKEFILE} ${_this}
|
${_DEPENDFILE}: .NOMETA ${MAKEFILE} ${_this}
|
||||||
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
@(${GENDIRDEPS_HEADER} echo '# Autogenerated - do NOT edit!'; echo; \
|
||||||
echo 'DIRDEPS = \'; \
|
echo 'DIRDEPS = \'; \
|
||||||
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
# $Id: meta.autodep.mk,v 1.36 2014/08/02 23:10:29 sjg Exp $
|
# $Id: meta.autodep.mk,v 1.40 2016/02/22 22:44:58 sjg Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||||
@@ -87,7 +87,7 @@ WANT_UPDATE_DEPENDFILE ?= yes
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${WANT_UPDATE_DEPENDFILE:Uno:tl} != "no"
|
.if ${WANT_UPDATE_DEPENDFILE:Uno:tl} != "no"
|
||||||
.if ${.MAKE.MODE:Mmeta*} == "" || ${.MAKE.MODE:M*read*} != ""
|
.if ${.MAKE.MODE:Uno:Mmeta*} == "" || ${.MAKE.MODE:Uno:M*read*} != ""
|
||||||
UPDATE_DEPENDFILE = no
|
UPDATE_DEPENDFILE = no
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
# $Id: meta.stage.mk,v 1.35 2015/05/20 06:40:33 sjg Exp $
|
# $Id: meta.stage.mk,v 1.43 2016/02/24 18:46:32 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2011, Simon J. Gerraty
|
# @(#) Copyright (c) 2011, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -27,7 +27,7 @@ _dirdep = ${RELDIR}
|
|||||||
CLEANFILES+= .dirdep
|
CLEANFILES+= .dirdep
|
||||||
|
|
||||||
# this allows us to trace dependencies back to their src dir
|
# this allows us to trace dependencies back to their src dir
|
||||||
.dirdep:
|
.dirdep: .NOPATH
|
||||||
@echo '${_dirdep}' > $@
|
@echo '${_dirdep}' > $@
|
||||||
|
|
||||||
.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == ""
|
.if defined(NO_POSIX_SHELL) || ${type printf:L:sh:Mbuiltin} == ""
|
||||||
@@ -242,7 +242,7 @@ CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes
|
|||||||
# for non-jobs mode the order here matters
|
# for non-jobs mode the order here matters
|
||||||
staging: ${STAGE_TARGETS:N*_links} ${STAGE_TARGETS:M*_links}
|
staging: ${STAGE_TARGETS:N*_links} ${STAGE_TARGETS:M*_links}
|
||||||
|
|
||||||
.if ${.MAKE.JOBS:U0} > 0 && ${STAGE_TARGETS:M*_links} != ""
|
.if ${.MAKE.JOBS:U0} > 0 && ${STAGE_TARGETS:U:M*_links} != ""
|
||||||
# the above isn't sufficient
|
# the above isn't sufficient
|
||||||
.for t in ${STAGE_TARGETS:N*links:O:u}
|
.for t in ${STAGE_TARGETS:N*links:O:u}
|
||||||
.ORDER: $t stage_links
|
.ORDER: $t stage_links
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ _metaError: .NOMETA .NOTMAIN
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
# Are we, after all, in meta mode?
|
# Are we, after all, in meta mode?
|
||||||
.if ${.MAKE.MODE:Mmeta*} != ""
|
.if ${.MAKE.MODE:Uno:Mmeta*} != ""
|
||||||
MKDEP_MK = meta.autodep.mk
|
MKDEP_MK = meta.autodep.mk
|
||||||
|
|
||||||
# if we think we are updating dependencies,
|
# if we think we are updating dependencies,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
# $Id: sys.dependfile.mk,v 1.6 2014/08/02 18:02:06 sjg Exp $
|
# $Id: sys.dependfile.mk,v 1.7 2016/02/20 01:57:39 sjg Exp $
|
||||||
#
|
#
|
||||||
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
||||||
#
|
#
|
||||||
@@ -49,8 +49,10 @@ _e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}
|
|||||||
# MACHINE specific depend files are supported, but *not* default.
|
# MACHINE specific depend files are supported, but *not* default.
|
||||||
# If any already exist, we should follow suit.
|
# If any already exist, we should follow suit.
|
||||||
_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
|
_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
|
||||||
# MACHINE must be the last entry in _aml ;-)
|
# make sure we restore MACHINE
|
||||||
|
_m := ${MACHINE}
|
||||||
_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
|
_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
|
||||||
|
MACHINE := ${_m}
|
||||||
.if !empty(_e)
|
.if !empty(_e)
|
||||||
.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
|
.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
|
|||||||
CLEANDIRS+= FreeBSD
|
CLEANDIRS+= FreeBSD
|
||||||
CLEANFILES+= bootstrap
|
CLEANFILES+= bootstrap
|
||||||
|
|
||||||
# $Id: Makefile,v 1.49 2015/12/20 22:54:40 sjg Exp $
|
# $Id: Makefile,v 1.55 2016/03/07 22:02:47 sjg Exp $
|
||||||
|
|
||||||
# Base version on src date
|
# Base version on src date
|
||||||
MAKE_VERSION= 20151220
|
MAKE_VERSION= 20160307
|
||||||
|
|
||||||
PROG?= ${.CURDIR:T}
|
PROG?= ${.CURDIR:T}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user