version 1.104, 2012/04/20 13:28:11 |
version 1.105, 2012/09/21 07:55:20 |
|
|
gn->type &= ~OP_DUMMY; |
gn->type &= ~OP_DUMMY; |
} |
} |
|
|
if (gn != NULL) |
/* try to find a proper location for a target in a file, by |
Array_AtEnd(>argets, gn); |
* filling it repeatedly until the target has commands.. |
|
* This is not perfect for .USE targets... |
|
*/ |
|
if ((gn->type & OP_HAS_COMMANDS) == 0) |
|
Parse_FillLocation(&gn->origin); |
|
|
|
Array_AtEnd(>argets, gn); |
} |
} |
|
|
static void |
static void |
|
|
{ |
{ |
GNode *gn = (GNode *)gnp; |
GNode *gn = (GNode *)gnp; |
/* if target already supplied, ignore commands */ |
/* if target already supplied, ignore commands */ |
if (!(gn->type & OP_HAS_COMMANDS)) { |
if (!(gn->type & OP_HAS_COMMANDS)) |
Lst_AtEnd(&gn->commands, cmd); |
Lst_AtEnd(&gn->commands, cmd); |
if (!gn->origin.lineno) |
|
Parse_FillLocation(&gn->origin); |
|
} |
|
} |
} |
|
|
/*- |
/*- |
|
|
{ |
{ |
/* add the command to the list of |
/* add the command to the list of |
* commands of all targets in the dependency spec */ |
* commands of all targets in the dependency spec */ |
char *cmd = estrdup(line); |
|
|
|
|
struct command *cmd; |
|
size_t len = strlen(line); |
|
|
|
cmd = emalloc(sizeof(struct command) + len); |
|
memcpy(&cmd->string, line, len+1); |
|
Parse_FillLocation(&cmd->location); |
|
|
|
|
Array_ForEach(targets, ParseAddCmd, cmd); |
Array_ForEach(targets, ParseAddCmd, cmd); |
#ifdef CLEANUP |
#ifdef CLEANUP |
Lst_AtEnd(&targCmds, cmd); |
Lst_AtEnd(&targCmds, cmd); |
|
|
size_t pos; |
size_t pos; |
char *end; |
char *end; |
char *cp; |
char *cp; |
char *dep; |
char *cmd; |
|
|
/* let's start a new set of commands */ |
/* let's start a new set of commands */ |
Array_Reset(targets); |
Array_Reset(targets); |
|
|
/* XXX this is a dirty heuristic to handle target: dep ; commands */ |
/* XXX this is a dirty heuristic to handle target: dep ; commands */ |
dep = NULL; |
cmd = NULL; |
/* First we need to find eventual dependencies */ |
/* First we need to find eventual dependencies */ |
pos = strcspn(stripped, ":!"); |
pos = strcspn(stripped, ":!"); |
/* go over :!, and find ; */ |
/* go over :!, and find ; */ |
|
|
if (line != stripped) |
if (line != stripped) |
/* find matching ; in original... The |
/* find matching ; in original... The |
* original might be slightly longer. */ |
* original might be slightly longer. */ |
dep = strchr(line+(end-stripped), ';'); |
cmd = strchr(line+(end-stripped), ';'); |
else |
else |
dep = end; |
cmd = end; |
/* kill end of line. */ |
/* kill end of line. */ |
*end = '\0'; |
*end = '\0'; |
} |
} |
|
|
ParseDoDependency(cp); |
ParseDoDependency(cp); |
free(cp); |
free(cp); |
|
|
/* Parse dependency if it's not empty. */ |
/* Parse command if it's not empty. */ |
if (dep != NULL) { |
if (cmd != NULL) { |
do { |
do { |
dep++; |
cmd++; |
} while (isspace(*dep)); |
} while (isspace(*cmd)); |
if (*dep != '\0') |
if (*cmd != '\0') |
parse_commands(targets, dep); |
parse_commands(targets, cmd); |
} |
} |
} |
} |
|
|