version 1.165, 2020/12/22 22:31:50 |
version 1.166, 2020/12/31 17:39:36 |
Line 254 meta_name(char *mname, size_t mnamelen, |
|
Line 254 meta_name(char *mname, size_t mnamelen, |
|
* So we use realpath() just to get the dirname, and leave the |
* So we use realpath() just to get the dirname, and leave the |
* basename as given to us. |
* basename as given to us. |
*/ |
*/ |
if ((cp = strrchr(tname, '/'))) { |
if ((cp = strrchr(tname, '/')) != NULL) { |
if (cached_realpath(tname, buf)) { |
if (cached_realpath(tname, buf) != NULL) { |
if ((rp = strrchr(buf, '/'))) { |
if ((rp = strrchr(buf, '/')) != NULL) { |
rp++; |
rp++; |
cp++; |
cp++; |
if (strcmp(cp, rp) != 0) |
if (strcmp(cp, rp) != 0) |
Line 327 is_submake(const char *cmd, GNode *gn) |
|
Line 327 is_submake(const char *cmd, GNode *gn) |
|
p_len = strlen(p_make); |
p_len = strlen(p_make); |
} |
} |
cp = strchr(cmd, '$'); |
cp = strchr(cmd, '$'); |
if ((cp)) { |
if (cp != NULL) { |
(void)Var_Subst(cmd, gn, VARE_WANTRES, &mp); |
(void)Var_Subst(cmd, gn, VARE_WANTRES, &mp); |
/* TODO: handle errors */ |
/* TODO: handle errors */ |
cmd = mp; |
cmd = mp; |
Line 374 printCMD(const char *cmd, FILE *fp, GNod |
|
Line 374 printCMD(const char *cmd, FILE *fp, GNod |
|
{ |
{ |
char *cmd_freeIt = NULL; |
char *cmd_freeIt = NULL; |
|
|
if (strchr(cmd, '$')) { |
if (strchr(cmd, '$') != NULL) { |
(void)Var_Subst(cmd, gn, VARE_WANTRES, &cmd_freeIt); |
(void)Var_Subst(cmd, gn, VARE_WANTRES, &cmd_freeIt); |
/* TODO: handle errors */ |
/* TODO: handle errors */ |
cmd = cmd_freeIt; |
cmd = cmd_freeIt; |
Line 451 meta_needed(GNode *gn, const char *dname |
|
Line 451 meta_needed(GNode *gn, const char *dname |
|
} |
} |
|
|
/* make sure these are canonical */ |
/* make sure these are canonical */ |
if (cached_realpath(dname, objdir_realpath)) |
if (cached_realpath(dname, objdir_realpath) != NULL) |
dname = objdir_realpath; |
dname = objdir_realpath; |
|
|
/* If we aren't in the object directory, don't create a meta file. */ |
/* If we aren't in the object directory, don't create a meta file. */ |
|
|
|
|
|
|
#define get_mode_bf(bf, token) \ |
#define get_mode_bf(bf, token) \ |
if ((cp = strstr(make_mode, token))) \ |
if ((cp = strstr(make_mode, token)) != NULL) \ |
bf = boolValue(cp + sizeof (token) - 1) |
bf = boolValue(cp + sizeof (token) - 1) |
|
|
/* |
/* |
Line 593 meta_mode_init(const char *make_mode) |
|
Line 593 meta_mode_init(const char *make_mode) |
|
writeMeta = TRUE; |
writeMeta = TRUE; |
|
|
if (make_mode != NULL) { |
if (make_mode != NULL) { |
if (strstr(make_mode, "env")) |
if (strstr(make_mode, "env") != NULL) |
metaEnv = TRUE; |
metaEnv = TRUE; |
if (strstr(make_mode, "verb")) |
if (strstr(make_mode, "verb") != NULL) |
metaVerbose = TRUE; |
metaVerbose = TRUE; |
if (strstr(make_mode, "read")) |
if (strstr(make_mode, "read") != NULL) |
writeMeta = FALSE; |
writeMeta = FALSE; |
if (strstr(make_mode, "nofilemon")) |
if (strstr(make_mode, "nofilemon") != NULL) |
useFilemon = FALSE; |
useFilemon = FALSE; |
if (strstr(make_mode, "ignore-cmd")) |
if (strstr(make_mode, "ignore-cmd") != NULL) |
metaIgnoreCMDs = TRUE; |
metaIgnoreCMDs = TRUE; |
if (useFilemon) |
if (useFilemon) |
get_mode_bf(filemonMissing, "missing-filemon="); |
get_mode_bf(filemonMissing, "missing-filemon="); |
Line 814 meta_job_output(Job *job, char *cp, cons |
|
Line 814 meta_job_output(Job *job, char *cp, cons |
|
(void)Var_Subst("${" MAKE_META_PREFIX "}", |
(void)Var_Subst("${" MAKE_META_PREFIX "}", |
VAR_GLOBAL, VARE_WANTRES, &meta_prefix); |
VAR_GLOBAL, VARE_WANTRES, &meta_prefix); |
/* TODO: handle errors */ |
/* TODO: handle errors */ |
if ((cp2 = strchr(meta_prefix, '$'))) |
if ((cp2 = strchr(meta_prefix, '$')) != NULL) |
meta_prefix_len = (size_t)(cp2 - meta_prefix); |
meta_prefix_len = (size_t)(cp2 - meta_prefix); |
else |
else |
meta_prefix_len = strlen(meta_prefix); |
meta_prefix_len = strlen(meta_prefix); |
Line 843 meta_cmd_finish(void *pbmp) |
|
Line 843 meta_cmd_finish(void *pbmp) |
|
pbm = &Mybm; |
pbm = &Mybm; |
|
|
#ifdef USE_FILEMON |
#ifdef USE_FILEMON |
if (pbm->filemon) { |
if (pbm->filemon != NULL) { |
while (filemon_process(pbm->filemon) > 0) |
while (filemon_process(pbm->filemon) > 0) |
continue; |
continue; |
if (filemon_close(pbm->filemon) == -1) |
if (filemon_close(pbm->filemon) == -1) |
Line 1046 meta_ignore(GNode *gn, const char *p) |
|
Line 1046 meta_ignore(GNode *gn, const char *p) |
|
#define DEQUOTE(p) if (*p == '\'') { \ |
#define DEQUOTE(p) if (*p == '\'') { \ |
char *ep; \ |
char *ep; \ |
p++; \ |
p++; \ |
if ((ep = strchr(p, '\''))) \ |
if ((ep = strchr(p, '\'')) != NULL) \ |
*ep = '\0'; \ |
*ep = '\0'; \ |
} |
} |
|
|
Line 1377 meta_oodate(GNode *gn, Boolean oodate) |
|
Line 1377 meta_oodate(GNode *gn, Boolean oodate) |
|
|
|
/* ignore anything containing the string "tmp" */ |
/* ignore anything containing the string "tmp" */ |
/* XXX: The arguments to strstr must be swapped. */ |
/* XXX: The arguments to strstr must be swapped. */ |
if ((strstr("tmp", p))) |
if (strstr("tmp", p) != NULL) |
break; |
break; |
|
|
if ((link_src != NULL && cached_lstat(p, &cst) < 0) || |
if ((link_src != NULL && cached_lstat(p, &cst) < 0) || |
Line 1493 meta_oodate(GNode *gn, Boolean oodate) |
|
Line 1493 meta_oodate(GNode *gn, Boolean oodate) |
|
char *cmd = cmdNode->datum; |
char *cmd = cmdNode->datum; |
Boolean hasOODATE = FALSE; |
Boolean hasOODATE = FALSE; |
|
|
if (strstr(cmd, "$?")) |
if (strstr(cmd, "$?") != NULL) |
hasOODATE = TRUE; |
hasOODATE = TRUE; |
else if ((cp = strstr(cmd, ".OODATE"))) { |
else if ((cp = strstr(cmd, ".OODATE")) != NULL) { |
/* check for $[{(].OODATE[:)}] */ |
/* check for $[{(].OODATE[:)}] */ |
if (cp > cmd + 2 && cp[-2] == '$') |
if (cp > cmd + 2 && cp[-2] == '$') |
hasOODATE = TRUE; |
hasOODATE = TRUE; |
Line 1508 meta_oodate(GNode *gn, Boolean oodate) |
|
Line 1508 meta_oodate(GNode *gn, Boolean oodate) |
|
(void)Var_Subst(cmd, gn, VARE_WANTRES|VARE_UNDEFERR, &cmd); |
(void)Var_Subst(cmd, gn, VARE_WANTRES|VARE_UNDEFERR, &cmd); |
/* TODO: handle errors */ |
/* TODO: handle errors */ |
|
|
if ((cp = strchr(cmd, '\n'))) { |
if ((cp = strchr(cmd, '\n')) != NULL) { |
int n; |
int n; |
|
|
/* |
/* |