version 1.105, 2012/09/21 07:55:20 |
version 1.106, 2012/10/02 10:29:31 |
|
|
Lst systemIncludePath = &theSysIncPath; |
Lst systemIncludePath = &theSysIncPath; |
Lst userIncludePath = &theUserIncPath; |
Lst userIncludePath = &theUserIncPath; |
|
|
#ifdef CLEANUP |
|
static LIST targCmds; /* command lines for targets */ |
|
#endif |
|
|
|
static GNode *mainNode; /* The main target to create. This is the |
static GNode *mainNode; /* The main target to create. This is the |
* first target on the first dependency |
* first target on the first dependency |
* line in the first makefile */ |
* line in the first makefile */ |
|
|
static unsigned int handle_special_targets(Lst); |
static unsigned int handle_special_targets(Lst); |
static void dump_targets(void); |
static void dump_targets(void); |
|
|
#define SPECIAL_EXEC 4U |
|
#define SPECIAL_IGNORE 5U |
|
#define SPECIAL_INCLUDES 6U |
|
#define SPECIAL_INVISIBLE 8U |
|
#define SPECIAL_JOIN 9U |
|
#define SPECIAL_LIBS 10U |
|
#define SPECIAL_MADE 11U |
|
#define SPECIAL_MAIN 12U |
|
#define SPECIAL_MAKE 13U |
|
#define SPECIAL_MFLAGS 14U |
|
#define SPECIAL_NOTMAIN 15U |
|
#define SPECIAL_NOTPARALLEL 16U |
|
#define SPECIAL_NULL 17U |
|
#define SPECIAL_OPTIONAL 18U |
|
#define SPECIAL_ORDER 19U |
|
#define SPECIAL_PARALLEL 20U |
|
#define SPECIAL_PHONY 22U |
|
#define SPECIAL_PRECIOUS 23U |
|
#define SPECIAL_SILENT 25U |
|
#define SPECIAL_SINGLESHELL 26U |
|
#define SPECIAL_SUFFIXES 27U |
|
#define SPECIAL_USE 28U |
|
#define SPECIAL_WAIT 29U |
|
#define SPECIAL_NOPATH 30U |
|
#define SPECIAL_ERROR 31U |
|
#define SPECIAL_CHEAP 32U |
|
#define SPECIAL_EXPENSIVE 33U |
|
|
|
|
|
#define P(k) k, sizeof(k), K_##k |
#define P(k) k, sizeof(k), K_##k |
|
|
static struct { |
static struct { |
|
|
} specials[] = { |
} specials[] = { |
{ P(NODE_EXEC), SPECIAL_EXEC | SPECIAL_TARGETSOURCE, OP_EXEC, }, |
{ P(NODE_EXEC), SPECIAL_EXEC | SPECIAL_TARGETSOURCE, OP_EXEC, }, |
{ P(NODE_IGNORE), SPECIAL_IGNORE | SPECIAL_TARGETSOURCE, OP_IGNORE, }, |
{ P(NODE_IGNORE), SPECIAL_IGNORE | SPECIAL_TARGETSOURCE, OP_IGNORE, }, |
{ P(NODE_INCLUDES), SPECIAL_INCLUDES | SPECIAL_TARGET, 0, }, |
{ P(NODE_INCLUDES), SPECIAL_DEPRECATED | SPECIAL_TARGET, 0, }, |
{ P(NODE_INVISIBLE),SPECIAL_INVISIBLE | SPECIAL_TARGETSOURCE,OP_INVISIBLE, }, |
{ P(NODE_INVISIBLE),SPECIAL_INVISIBLE | SPECIAL_TARGETSOURCE,OP_INVISIBLE, }, |
{ P(NODE_JOIN), SPECIAL_JOIN | SPECIAL_TARGETSOURCE, OP_JOIN, }, |
{ P(NODE_JOIN), SPECIAL_JOIN | SPECIAL_TARGETSOURCE, OP_JOIN, }, |
{ P(NODE_LIBS), SPECIAL_LIBS | SPECIAL_TARGET, 0, }, |
{ P(NODE_LIBS), SPECIAL_DEPRECATED | SPECIAL_TARGET, 0, }, |
{ P(NODE_MADE), SPECIAL_MADE | SPECIAL_TARGETSOURCE, OP_MADE, }, |
{ P(NODE_MADE), SPECIAL_MADE | SPECIAL_TARGETSOURCE, OP_MADE, }, |
{ P(NODE_MAIN), SPECIAL_MAIN | SPECIAL_TARGET, 0, }, |
{ P(NODE_MAIN), SPECIAL_MAIN | SPECIAL_TARGET, 0, }, |
{ P(NODE_MAKE), SPECIAL_MAKE | SPECIAL_TARGETSOURCE, OP_MAKE, }, |
{ P(NODE_MAKE), SPECIAL_MAKE | SPECIAL_TARGETSOURCE, OP_MAKE, }, |
|
|
{ P(NODE_NOTMAIN), SPECIAL_NOTMAIN | SPECIAL_TARGETSOURCE, OP_NOTMAIN, }, |
{ P(NODE_NOTMAIN), SPECIAL_NOTMAIN | SPECIAL_TARGETSOURCE, OP_NOTMAIN, }, |
{ P(NODE_NOTPARALLEL),SPECIAL_NOTPARALLEL | SPECIAL_TARGET, 0, }, |
{ P(NODE_NOTPARALLEL),SPECIAL_NOTPARALLEL | SPECIAL_TARGET, 0, }, |
{ P(NODE_NO_PARALLEL),SPECIAL_NOTPARALLEL | SPECIAL_TARGET, 0, }, |
{ P(NODE_NO_PARALLEL),SPECIAL_NOTPARALLEL | SPECIAL_TARGET, 0, }, |
{ P(NODE_NULL), SPECIAL_NULL | SPECIAL_TARGET, 0, }, |
{ P(NODE_NULL), SPECIAL_DEPRECATED | SPECIAL_TARGET, 0, }, |
{ P(NODE_OPTIONAL), SPECIAL_OPTIONAL | SPECIAL_TARGETSOURCE,OP_OPTIONAL, }, |
{ P(NODE_OPTIONAL), SPECIAL_OPTIONAL | SPECIAL_TARGETSOURCE,OP_OPTIONAL, }, |
{ P(NODE_ORDER), SPECIAL_ORDER | SPECIAL_TARGET, 0, }, |
{ P(NODE_ORDER), SPECIAL_ORDER | SPECIAL_TARGET, 0, }, |
{ P(NODE_PARALLEL), SPECIAL_PARALLEL | SPECIAL_TARGET, 0, }, |
{ P(NODE_PARALLEL), SPECIAL_PARALLEL | SPECIAL_TARGET, 0, }, |
|
|
gn->type &= ~OP_DUMMY; |
gn->type &= ~OP_DUMMY; |
} |
} |
|
|
/* try to find a proper location for a target in a file, by |
|
* 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); |
Array_AtEnd(>argets, gn); |
} |
} |
|
|
|
|
if (seen_normal != 0) { |
if (seen_normal != 0) { |
specType = SPECIAL_NONE; |
specType = SPECIAL_NONE; |
return 0; |
return 0; |
} |
} else if (seen_path != 0) { |
else if (seen_path != 0) { |
|
specType = SPECIAL_PATH; |
specType = SPECIAL_PATH; |
return 0; |
return 0; |
} else if (seen_special == 0) { |
} else if (seen_special == 0) { |
|
|
* NOW GO FOR THE SOURCES |
* NOW GO FOR THE SOURCES |
*/ |
*/ |
if (specType == SPECIAL_SUFFIXES || specType == SPECIAL_PATH || |
if (specType == SPECIAL_SUFFIXES || specType == SPECIAL_PATH || |
specType == SPECIAL_INCLUDES || specType == SPECIAL_LIBS || |
specType == SPECIAL_DEPRECATED) { |
specType == SPECIAL_NULL) { |
|
while (*line) { |
while (*line) { |
/* |
/* |
* If the target was one that doesn't take files as its |
* If the target was one that doesn't take files as its |
|
|
Dir_AddDiri((Lst)Lst_Datum(ln), line, cp); |
Dir_AddDiri((Lst)Lst_Datum(ln), line, cp); |
break; |
break; |
} |
} |
case SPECIAL_INCLUDES: |
|
Suff_AddIncludei(line, cp); |
|
break; |
|
case SPECIAL_LIBS: |
|
Suff_AddLibi(line, cp); |
|
break; |
|
case SPECIAL_NULL: |
|
Suff_SetNulli(line, cp); |
|
break; |
|
default: |
default: |
break; |
break; |
} |
} |
|
|
|
|
|
|
Array_ForEach(targets, ParseAddCmd, cmd); |
Array_ForEach(targets, ParseAddCmd, cmd); |
#ifdef CLEANUP |
|
Lst_AtEnd(&targCmds, cmd); |
|
#endif |
|
} |
} |
|
|
static bool |
static bool |
|
|
Array_Init(>argets, TARGETS_SIZE); |
Array_Init(>argets, TARGETS_SIZE); |
Array_Init(&gsources, SOURCES_SIZE); |
Array_Init(&gsources, SOURCES_SIZE); |
create_special_nodes(); |
create_special_nodes(); |
|
|
LowParse_Init(); |
|
#ifdef CLEANUP |
|
Static_Lst_Init(&targCmds); |
|
#endif |
|
} |
} |
|
|
#ifdef CLEANUP |
|
void |
|
Parse_End(void) |
|
{ |
|
Lst_Destroy(&targCmds, (SimpleProc)free); |
|
Lst_Destroy(systemIncludePath, Dir_Destroy); |
|
Lst_Destroy(userIncludePath, Dir_Destroy); |
|
LowParse_End(); |
|
} |
|
#endif |
|
|
|
|
|
void |
void |
Parse_MainName(Lst listmain) /* result list */ |
Parse_MainName(Lst listmain) /* result list */ |