version 1.229, 2014/08/23 15:05:40 |
version 1.230, 2014/09/07 20:55:34 |
Line 182 static const char * tracefile; |
|
Line 182 static const char * tracefile; |
|
static void MainParseArgs(int, char **); |
static void MainParseArgs(int, char **); |
static int ReadMakefile(const void *, const void *); |
static int ReadMakefile(const void *, const void *); |
static void usage(void) MAKE_ATTR_DEAD; |
static void usage(void) MAKE_ATTR_DEAD; |
static int MarkSysMkTargets(void *, void *); |
|
|
|
static Boolean ignorePWD; /* if we use -C, PWD is meaningless */ |
static Boolean ignorePWD; /* if we use -C, PWD is meaningless */ |
static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */ |
static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */ |
Line 1205 main(int argc, char **argv) |
|
Line 1204 main(int argc, char **argv) |
|
Fatal("%s: cannot open %s.", progname, |
Fatal("%s: cannot open %s.", progname, |
(char *)Lst_Datum(ln)); |
(char *)Lst_Datum(ln)); |
} |
} |
/* |
|
* Rules from system makefiles are somewhat special. For instance, |
|
* they're not eligible to become main targets. A sensible sys.mk |
|
* only contains suffix transformations and variables, but clearing |
|
* the suffix list makes suffix transformations into regular rules, |
|
* which could otherwise become main targets. |
|
*/ |
|
Lst_ForEach(Targ_List(), MarkSysMkTargets, NULL); |
|
|
|
if (!Lst_IsEmpty(makefiles)) { |
if (!Lst_IsEmpty(makefiles)) { |
LstNode ln; |
LstNode ln; |
Line 1384 main(int argc, char **argv) |
|
Line 1375 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); |
|
|
|
Suff_End(); |
Targ_End(); |
Targ_End(); |
Suff_End(); /* targets refer to suffixes, clean after Targ */ |
|
Arch_End(); |
Arch_End(); |
Var_End(); |
Var_End(); |
Parse_End(); |
Parse_End(); |
Line 1497 Cmd_Exec(const char *cmd, const char **e |
|
Line 1488 Cmd_Exec(const char *cmd, const char **e |
|
int status; /* command exit status */ |
int status; /* command exit status */ |
Buffer buf; /* buffer to store the result */ |
Buffer buf; /* buffer to store the result */ |
char *cp; |
char *cp; |
int cc; /* bytes read, or -1 */ |
int cc; |
int savederr; /* saved errno */ |
|
|
|
|
|
*errnum = NULL; |
*errnum = NULL; |
savederr = 0; |
|
|
|
if (!shellName) |
if (!shellName) |
Shell_Init(); |
Shell_Init(); |
Line 1565 Cmd_Exec(const char *cmd, const char **e |
|
Line 1554 Cmd_Exec(const char *cmd, const char **e |
|
Buf_AddBytes(&buf, cc, result); |
Buf_AddBytes(&buf, cc, result); |
} |
} |
while (cc > 0 || (cc == -1 && errno == EINTR)); |
while (cc > 0 || (cc == -1 && errno == EINTR)); |
if (cc == -1) |
|
savederr = errno; |
|
|
|
/* |
/* |
* Close the input side of the pipe. |
* Close the input side of the pipe. |
Line 1583 Cmd_Exec(const char *cmd, const char **e |
|
Line 1570 Cmd_Exec(const char *cmd, const char **e |
|
cc = Buf_Size(&buf); |
cc = Buf_Size(&buf); |
res = Buf_Destroy(&buf, FALSE); |
res = Buf_Destroy(&buf, FALSE); |
|
|
if (savederr != 0) |
if (cc == 0) |
*errnum = "Couldn't read shell's output for \"%s\""; |
*errnum = "Couldn't read shell's output for \"%s\""; |
|
|
if (WIFSIGNALED(status)) |
if (WIFSIGNALED(status)) |
|
|
exit(2); |
exit(2); |
} |
} |
|
|
/*- |
|
*----------------------------------------------------------------------- |
|
* MarkSysMkTargets -- set OP_FROM_SYS_MK on a target node in Lst_ForEach(). |
|
* |
|
* Input: |
|
* target node to set the attribute on (GNode *) |
|
* |
|
* Results: |
|
* Always 0 to not abort Lst_ForEach() prematurely. |
|
*----------------------------------------------------------------------- |
|
*/ |
|
static int |
|
MarkSysMkTargets(void *target, void *unused) |
|
{ |
|
(void)unused; |
|
((GNode *)target)->type |= OP_FROM_SYS_MK; |
|
return 0; |
|
} |
|
|
|
|
|
int |
int |
PrintAddr(void *a, void *b) |
PrintAddr(void *a, void *b) |