version 1.233, 2015/09/10 17:15:11 |
version 1.234, 2015/10/11 04:51:24 |
Line 692 Main_SetObjdir(const char *path) |
|
Line 692 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, 0); |
path = p = Var_Subst(NULL, buf, VAR_GLOBAL, FALSE, TRUE); |
} |
} |
|
|
if (path[0] != '/') { |
if (path[0] != '/') { |
Line 775 MakeMode(const char *mode) |
|
Line 775 MakeMode(const char *mode) |
|
char *mp = NULL; |
char *mp = NULL; |
|
|
if (!mode) |
if (!mode) |
mode = mp = Var_Subst(NULL, "${" MAKE_MODE ":tl}", VAR_GLOBAL, 0); |
mode = mp = Var_Subst(NULL, "${" MAKE_MODE ":tl}", |
|
VAR_GLOBAL, FALSE, TRUE); |
|
|
if (mode && *mode) { |
if (mode && *mode) { |
if (strstr(mode, "compat")) { |
if (strstr(mode, "compat")) { |
Line 1217 main(int argc, char **argv) |
|
Line 1218 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, 0); |
VAR_CMD, FALSE, TRUE); |
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); |
Line 1228 main(int argc, char **argv) |
|
Line 1229 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, 0); |
VAR_CMD, FALSE, TRUE); |
doing_depend = TRUE; |
doing_depend = TRUE; |
(void)ReadMakefile(makeDependfile, NULL); |
(void)ReadMakefile(makeDependfile, NULL); |
doing_depend = FALSE; |
doing_depend = FALSE; |
Line 1267 main(int argc, char **argv) |
|
Line 1268 main(int argc, char **argv) |
|
*/ |
*/ |
static char VPATH[] = "${VPATH}"; |
static char VPATH[] = "${VPATH}"; |
|
|
vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE); |
vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE, TRUE); |
path = vpath; |
path = vpath; |
do { |
do { |
/* skip to end of directory */ |
/* skip to end of directory */ |
Line 1314 main(int argc, char **argv) |
|
Line 1315 main(int argc, char **argv) |
|
char *value; |
char *value; |
|
|
if (strchr(var, '$')) { |
if (strchr(var, '$')) { |
value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, 0); |
value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, |
|
FALSE, TRUE); |
} else if (expandVars) { |
} else if (expandVars) { |
char tmp[128]; |
char tmp[128]; |
|
|
if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp))) |
if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp))) |
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, 0); |
value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, |
|
FALSE, TRUE); |
} else { |
} else { |
value = Var_Value(var, VAR_GLOBAL, &p1); |
value = Var_Value(var, VAR_GLOBAL, &p1); |
} |
} |
Line 1859 PrintOnError(GNode *gn, const char *s) |
|
Line 1862 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, 0); |
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE); |
if (cp) { |
if (cp) { |
if (*cp) |
if (*cp) |
printf("%s", cp); |
printf("%s", cp); |
Line 1888 Main_ExportMAKEFLAGS(Boolean first) |
|
Line 1891 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, 0); |
s = Var_Subst(NULL, tmp, VAR_CMD, FALSE, TRUE); |
if (s && *s) { |
if (s && *s) { |
#ifdef POSIX |
#ifdef POSIX |
setenv("MAKEFLAGS", s, 1); |
setenv("MAKEFLAGS", s, 1); |
Line 1910 getTmpdir(void) |
|
Line 1913 getTmpdir(void) |
|
* Honor $TMPDIR but only if it is valid. |
* Honor $TMPDIR but only if it is valid. |
* Ensure it ends with /. |
* Ensure it ends with /. |
*/ |
*/ |
tmpdir = Var_Subst(NULL, "${TMPDIR:tA:U" _PATH_TMP "}/", VAR_GLOBAL, 0); |
tmpdir = Var_Subst(NULL, "${TMPDIR:tA:U" _PATH_TMP "}/", VAR_GLOBAL, |
|
FALSE, TRUE); |
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); |
Line 1965 getBoolean(const char *name, Boolean bf) |
|
Line 1969 getBoolean(const char *name, Boolean bf) |
|
char *cp; |
char *cp; |
|
|
if (snprintf(tmp, sizeof(tmp), "${%s:tl}", name) < (int)(sizeof(tmp))) { |
if (snprintf(tmp, sizeof(tmp), "${%s:tl}", name) < (int)(sizeof(tmp))) { |
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, 0); |
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE); |
|
|
if (cp) { |
if (cp) { |
switch(*cp) { |
switch(*cp) { |