/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1984-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* compiler and loader for the architecture independent makefile object format
*
* The format fields are labeled by sequence number and type:
*
* # sfputu()/sfgetu()
* $ size,string (no trailing 0)
* @ 0 terminated string
*
* additions to the header, rules, variables and trailer sections, with
* the proviso that the section order is not changed and that sequence 1
* fields must appear in all future formats. This means that the
* property, dynamic and status field bit values are permanently fixed
* by each sequence. Field addition semantics are controlled by the
* sequence number.
*
* header:
*
* 1 4 magic must match
* 1 @ ident identification string (information only)
* 1 # size header size
* 1 # flags OBJ_* flags
* 1 # strings string table size
* 1 # lists number of lists
* 1 # rules number of rules
* 1 # rulenum (RULENUM-MINRULENUM)
* 1 # rulestr (RULESTR-MINRULESTR)
* 1 # variables number of variables
* 1 # varnum (VARNUM-MINVARNUM)
* 1 # varstr (VARSTR-MINVARSTR)
* 1 4 magic again for verification
* * # ... [header number fields additions here]
*
* optional headers:
*
* 1 # size header size
* 1 # type header type
* * * ... header contents
*
* HEADER_PREREQS:
*
* 1 # type {0:end COMP_*:type}
* 1 # time time
* 1 @ name unbound name
* ...
*
* variables:
*
* 1 # property
* * # ... [variable number field additions here]
* 1 $ name name string
* 1 $ value value string
* * $ ... [variable string field additions here]
*
* rules:
*
* 1 # property
* 1 # dynamic
* 1 # attribute
* 1 # encoded status|semaphore|view|scan
* 1 # prereqs prereq list index
* 1 # time rule time
* 1 # nsec rule nsec [2004-12-01]
* 1 # eventnsec event nsec [2004-12-01]
* * # ... [rule number field additions here]
* 1 $ name name string
* 1 $ action action string
* 1 $ data event time or state string
* * $ ... [rule string field additions here]
*
* lists:
*
* 1 # rule rule index
*
* trailer:
*
* 1 @ options option string
* * @ ... [trailer string fields additions here]
*
* NOTE: the old format compatibility code should probably be dropped in 95
* NOTE: HA -- as of 1997-08-11 2.1 was still in production use
*/
#include "make.h"
#include "options.h"
#if !__STDC__
#endif
#include <ccode.h>
/*
* old rule load() replacement puns on struct rule
*
* rule.mark is not used as load() may be triggered
* by staterule() while marks are in use
*/
#define setoldrule(r,o) (r->status=OLDRULE,r->action=(char*)o,r->prereqs=(List_t*)oldrules,oldrules=r)
{
} Compstate_t;
{
} Loadstate_t;
{
} object;
/*
* old object format compatibility
* frozen 1992-12-25
*/
{
} OLD_header_t;
{
{
union
{
} u1;
union
{
} u2;
#if BINDINDEX
#else
#endif
} OLD_rule_t;
{
} OLD_var_t;
{
};
{
0,
sizeof(char),
sizeof(short),
sizeof(long),
sizeof(char*),
sizeof(OLD_list_t),
sizeof(OLD_rule_t),
sizeof(OLD_var_t),
0,
};
/*
* initialize the object ccode tables
*/
void
initcode(void)
{
if (!object.initialized)
{
}
}
/*
* read canonical 0 terminated string from object file
*/
static char*
{
char* s;
return s;
}
/*
* write canonical 0 terminated string to file
*/
static void
{
register int c;
register unsigned char* map;
{
while (c = *(unsigned char*)s++)
if (sep >= 0)
}
else
}
/*
* recursively mark r and its prerequisites for compilation
*/
static void
{
register List_t* p;
r->dynamic &= ~D_compiled;
markcompile(p->rule);
}
/*
* mark state file garbage candidates
*/
static void
{
register List_t* p;
register int i;
Rule_t* x;
if (garbage)
else
for (i = RULE; i <= STATERULES; i++)
markgarbage(x, garbage);
}
/*
* compile a string
*/
static void
{
register int c;
register unsigned char* map;
if (s)
{
c = strlen(s) + 1;
while (c = *s++)
else
}
else
}
/*
* initialize rules for compilation
* if h!=0 then all rules marked compiled
*/
static int
compinit(const char* s, char* v, void* h)
{
NoP(s);
r->complink = 0;
{
}
if (h || (r->property & P_internal))
r->dynamic |= D_compiled;
return 0;
}
/*
* mark selected rules and immediate prereqs for compilation
*
* NOTE: remember to clear r->mark (from markcompile())
*/
static int
compselect(const char* s, char* v, void* h)
{
register char* select = (char*)h;
NoP(s);
{
{
markcompile(r);
}
}
return 0;
}
/*
* mark rules so that only state vars and immediate prereqs will be compiled
*
* NOTE: remember to clear r->mark (from markgarbage())
*/
static int
compstate(const char* s, char* v, void* h)
{
NoP(s);
NoP(h);
r->dynamic |= D_compiled;
{
markgarbage(r, 1);
}
return 0;
}
/*
* mark prerequisites for compilation
*
* NOTE: remember to clear r->mark (from markcompile())
*/
static int
compmark(const char* s, char* v, void* h)
{
register List_t* p;
NoP(s);
NoP(h);
r->complink = 0;
{
{
r->dynamic &= ~D_compiled;
}
}
markcompile(r);
return 0;
}
/*
* weed out the real garbage
*/
static int
compkeep(const char* s, char* v, void* h)
{
NoP(s);
NoP(h);
markgarbage(r, 0);
return 0;
}
/*
* compile an individual rule
*/
static int
comprule(const char* s, char* v, void* h)
{
register List_t* p;
Rule_t x;
NoP(s);
/*
* compile each rule only once
*/
return 0;
r->dynamic |= D_compiled;
#if DEBUG
if (r->property & P_internal)
#endif
/*
* set the current rule index for prerequisite list compilation
*/
x = *r;
r = &x;
/*
* make sure the unbound rule name is compiled
*/
{
{
r->prereqs = 0;
r->action = 0;
r->dynamic &= ~D_compiled;
}
{
r->uname = 0;
}
r->time = 0;
#if BINDINDEX
r->view = 0;
#endif
}
#if !BINDINDEX
r->view = 0;
#endif
/*
* compile the fields
*/
if (p = r->prereqs)
{
}
else
/*
* 2004-12-01
*/
if (r->property & P_staterule)
else
return 0;
}
/*
* a final pass before complist() to catch any prereqs
* that eluded comprule()
*/
static int
compcheck(const char* s, char* v, void* h)
{
register List_t* p;
register Rule_t* a;
/*
* ignore aliases and rules not set up by comprule()
*/
if (!r->complink || !(r->mark & M_compile) || s != r->name && !(r->dynamic & D_alias) || state.stateview == 0 && !(r->property & P_state))
return 0;
if (p = r->prereqs)
{
do
{
if ((!(a = getrule(r->name)) || a == r) && ((r->property & P_state) || !r->uname || !(a = getrule(r->uname)) || a == r))
{
r->dynamic &= ~D_compiled;
break;
}
} while (p = p->next);
}
return 0;
}
/*
* compile the prerequisite list for r
*/
static int
complist(const char* s, char* v, void* h)
{
register List_t* p;
/*
* ignore aliases and rules not set up by comprule()
*/
if (!r->complink || !(r->mark & M_compile) || s != r->name && !(r->dynamic & D_alias) || state.stateview == 0 && !(r->property & P_state))
return 0;
if (p = r->prereqs)
{
}
return 0;
}
/*
* compile an individual variable
*/
static int
compvar(const char* s, char* u, void* h)
{
char* t;
unsigned long property;
char* value;
/*
* compile each variable only once
* don't compile command arg variable definitions
*/
if ((v->property & V_compiled) || state.stateview < 0 && !(v->property & V_frozen) && ((v->property & V_import) || (v->property & (V_oldvalue|V_readonly)) == V_readonly) || state.stateview == 0 && !(v->property & V_retain))
return 0;
v->property |= V_compiled;
/*
* check for possible old value
*
* if v->oldvalue is set in load() then the
* variable is frozen and the frozen value
* is different than the makefile value
*/
property &= ~V_CLEAROBJECT;
else
{
property &= ~V_CLEARSTATE;
if (property & V_oldvalue)
{
{
{
value = t;
property &= ~V_oldvalue;
}
property &= ~V_oldvalue;
}
#if DEBUG
else
#endif
}
property |= V_oldvalue;
}
/*
* write the variable fields
*/
return 0;
}
/*
* clear temporary marks on r
*/
static int
clearmarks(const char* s, char* v, void* h)
{
NoP(s);
NoP(h);
r->complink = 0;
return 0;
}
/*
* compile the current rules and variables into objfile
*/
void
{
List_t* p;
List_t* q;
Rule_t* r;
/*
* initialize the object globals
*/
/*
* create the object temporary file
*/
sfstrclose(sp);
{
return;
}
/*
* skip the header until everything else is done
*/
/*
* write the optional headers
*/
{
{
}
sfstrclose(sp);
}
/*
* mark the rules and prerequisites for compilation
*/
if (select)
{
}
else
{
/*
* compile and write the variables
*/
{
/*
* check state file garbage collection
*
* NOTE: only the head of each garbage list is
* counted so the percentage threshold
* should probably be low
*/
if ((100 * object.garbage / (object.rules ? object.rules : 1) < PCTGARBAGE && !(state.test & 0x00008000)))
{
}
#if BINDINDEX
#endif
}
}
/*
*/
markcompile(p->rule);
#if BINDINDEX
{
{
}
{
}
}
#endif
/*
* compile and write the rules
*/
/*
* despite the effort a few elusive prereqs manage to avoid comprule()
* the compcheck() pass sets up complink for these prereqs
*/
/*
* compile and write the prerequisite lists
*/
/*
* write the trailer
*/
{
/*
* pre 2004-09-09 will just do "--"
*/
{
}
else
{
}
}
/*
* clear temporary marks
*/
/*
* write the real header
*/
/*
* commit to the temporary object and clean up
*/
remtmp(0);
{
Time_t t;
Time_t x;
/*
* set the state file times to the latest
* possible event time modulo the file
* system time precision
*/
t = CURTIME;
{
}
}
r->view = 0;
{
sfprintf(state.mam.out, "%sexec %s : compile into %s object\n", state.mam.label, state.mam.dynamic ? mamname(r) : null, error_info.id);
}
message((-1, "%d%% [%d/%d] state file garbage collection recovery", (object.garbage - cs.rules) * 100 / object.garbage, object.garbage - cs.rules, object.garbage));
}
/*
* register input file prerequisite
*/
void
{
{
if (r)
{
/*
* COMP_NSEC for subsecond granularity
* and bind checks
* ignored by old implementations
*/
}
else
{
}
}
}
/*
* promote lower view prereqs of top view state
*/
static int
promote(const char* s, char* v, void* h)
{
register List_t* p;
NoP(s);
NoP(h);
{
{
r = p->rule;
{
unviewname(r->name);
}
}
}
return 0;
}
/*
* associate one rule with each name
*/
static int
atomize(const char* s, char* v, void* h)
{
register List_t* p;
NoP(s);
NoP(h);
if (isoldrule(r))
{
#if DEBUG
error(PANIC, "old rule %s still in table.rule%s", r->name, r == getrule(r->name) ? null : " -- duplicate hash");
#endif
return 0;
}
return 0;
}
/*
* repair prereq list corruption
*/
static int
repair(const char* s, char* v, void* h)
{
register List_t* p;
register List_t* q;
NoP(s);
NoP(h);
p = 0;
q = r->prereqs;
while (q)
if (q->rule)
{
p = q;
q = q->next;
}
else if (p)
else
return 0;
}
/*
* return the object file name
* assumes the main makefile has already been read
*/
char*
objectfile(void)
{
char* dir;
{
if (streq(state.writeobject, "-") || !stat(state.writeobject, &st) && S_ISDIR(st.st_mode) && (dir = state.writeobject))
else
sfstrclose(sp);
}
return state.objectfile;
}
/*
* remove temporary compilation files
*/
void
{
{
}
if (fatal)
lockstate(0);
}
/*
* load a string
*/
static char*
{
register int n;
register char* s;
return 0;
return s;
}
/*
* initialize object state
*/
static void
loadinit(void)
{
}
/*
* check if file is loadable object
* if source!=0 then source prereqs are checked
*/
int
{
register List_t* p;
char* s;
char* sn;
long n;
Time_t t;
int lowres;
long old = 0;
Rule_t* x;
loadinit();
{
if (n >= MAGICSIZE && !memcmp(s, MAGIC, MAGICSIZE) || n >= sizeof(old) && ((old = OLD_MAGIC, swapop(s, &old, sizeof(old)) >= 0) || (old = OLD_OLD_MAGIC, swapop(s, &old, sizeof(old)) >= 0)))
{
if (!source)
/*
* check previous source prerequisites
*/
if (!old && !sfseek(sp, (Sfoff_t)0, SEEK_SET) && sfseek(sp, (Sfoff_t)MAGICSIZE, SEEK_SET) == MAGICSIZE)
{
{
{
/*UNDENT...*/
lowres = 1;
sn = 0;
tn = 0;
{
break;
{
{
s = x->name;
t = x->time;
/*
* put bound makefile prereqs in state as a query courtesy
*/
}
else
t = 0;
t = tmxgetmtime(&st);
if (!t)
{
if ((n & COMP_DONTCARE) && !tm)
continue;
break;
}
tn = 0;
/*
* check prerequisite file time with previous
*/
debug((-4, "%s%s%s%s%sprerequisite %s [%s] state [%s]", (n & COMP_DONTCARE) ? "optional " : null, (n & COMP_BASE) ? "base " : null, (n & COMP_FILE) ? "-f " : null, (n & COMP_GLOBAL) ? "-g " : null, (n & COMP_INCLUDE) ? "include " : null, s, timestr(t), timestr(tm)));
if (t != tm)
{
else
break;
}
sn = 0;
tn = 0;
/*
* check that explicit prerequisite still specified
*/
if (n & (COMP_FILE|COMP_GLOBAL))
{
{
else
{
error(state.exec || state.mam.out ? -1 : 1, "%s: %sfile %s option order changed", r->name, (n & COMP_GLOBAL) ? "global " : null, s);
goto nope;
}
break;
}
if (!p)
{
error(state.exec || state.mam.out ? -1 : 1, "%s: %sfile %s was specified last time", r->name, (n & COMP_GLOBAL) ? "global " : null, s);
break;
}
}
{
if (n & COMP_RULES)
}
}
else if (n & COMP_NSEC)
{
if (*s)
{
}
lowres = 0;
}
else if (n & COMP_OPTIONS)
}
nope:
if (n)
ok = 0;
/*
* check for explicit file prereqs not specified last time
*/
else if (ok)
{
ok = 0;
if (state.writeobject)
error(state.exec || state.mam.out ? -1 : 1, "%s: global file %s not specified last time", r->name, p->rule->name);
}
else if (ok)
{
ok = 0;
if (state.writeobject)
error(state.exec || state.mam.out ? -1 : 1, "%s: file %s not specified last time", r->name, p->rule->name);
}
return 1;
/*...INDENT*/
break;
}
}
}
}
}
return 0;
}
/*
* load compiled rules and variables from objfile
* return:
* -1 partially loaded => punt
* 0 not loaded
* 1 loaded
*/
int
{
register int n;
register Rule_t* r;
register Var_t* v;
register List_t* d;
register char* s;
char* p = 0;
int promoted = 0;
int recompile = 0;
Var_t* x;
List_t* a;
int flags;
int strings;
int lists;
int rules;
int rulenum;
int rulestr;
int variables;
int varnum;
int varstr;
int attrclash;
int garbage;
int oscan;
int scanclash;
int sequence;
int lowres;
unsigned long attr;
unsigned long attrclear;
unsigned long oattribute;
unsigned long ts;
unsigned long tn;
char ident[64];
int old;
int old_swap;
long old_magic;
if (source)
{
/*
* compare with current preprocess options
*/
{
error(state.exec || state.mam.out ? -1 : 1, "%s: options changed from \"%s\" to \"%s\"", objfile, object.options, s);
return 0;
}
}
loadinit();
/*
* empty object files are ok
*/
{
return 0;
}
{
{
return 0;
}
return 1;
}
/*
* check for other users within last ucheck minutes
*/
/*
* check the header
*/
goto badmagic;
errno = 0;
{
old = 1;
goto badio;
if ((old_magic = OLD_MAGIC, (old_swap = swapop(&old_header.magic, &old_magic, sizeof(old_magic)))) < 0 && (old_magic = OLD_OLD_MAGIC, (old_swap = swapop(&old_header.magic, &old_magic, sizeof(old_magic)))) < 0)
goto badmagic;
if (old_swap)
{
}
goto badversion;
if (memcmp(((char*)&old_header) + sizeof(old_header.magic), ((char*)&old_stamp) + sizeof(old_stamp.magic), sizeof(old_header) - sizeof(old_header.magic)))
{
if (memcmp(((char*)&old_header) + sizeof(old_header.magic), ((char*)&old_stamp) + sizeof(old_stamp.magic), sizeof(old_header) - sizeof(old_header.magic)))
goto badversion;
sequence = 2;
}
s++;
else
strncopy(ident, s, sizeof(ident));
goto badmagic;
return 0;
off = sizeof(old_header) + rules * sizeof(old_rule) + lists * sizeof(old_list) + variables * sizeof(old_var);
goto badio;
}
else
{
old = 0;
if (s = strrchr(s, ' '))
s++;
else
s = "old";
strncopy(ident, s, sizeof(ident));
goto badmagic;
/*
* read the optional headers
*/
for (;;)
{
goto badio;
break;
}
}
message((-3, "%s sequence=%d lists=%d rules=%d variables=%d strings=%d", ident, sequence, lists, rules, variables, strings));
{
}
/*
* allocate strings and structs in one chunk
* and compute pointers to the compiled data
*/
if (!(p = newof(0, char, lists * sizeof(List_t) + rules * sizeof(Rule_t) + variables * sizeof(Var_t) + strings, 0)))
{
goto bad;
}
/*
* read the string table
*/
if (!old)
goto badio;
/*
* load the variables and check for any frozen
* variables that may have changed
*/
if (old)
{
goto badio;
}
{
if (old)
{
goto badio;
if (old_swap)
switch (sequence)
{
case 2: /* 01/24/89 */
break;
}
}
else
{
#if !_HUH_1993_10_01 /* drop this eventually */
#endif
/*
* variable number field additions here
*/
for (n = varnum; n > 0; n--)
/*
* variable string field additions here
*/
for (n = varstr; n > 0; n--)
}
if ((state.exec || !state.base || state.compileonly) && (v->property & V_frozen) && (!(x = getvar(v->name)) && ((v->property & V_oldvalue) || (v->property & V_import) && *v->value) || x && ((x->property & (V_append|V_readonly)) == (V_append|V_readonly) || ((v->property|x->property) & (V_import|V_readonly)) && !streq(v->value, x->value)) || (v->property & V_functional)))
{
error((state.exec || state.mam.out) && !state.explain ? -1 : 1, "%s: frozen %svariable %s changed", objfile, ((v->property|(x ? x->property : 0)) & V_import) ? "environment " : ((x ? x->property : 0) & V_readonly) ? "command argument " : null, v->name);
recompile = 1;
v->property &= ~V_readonly;
}
else
}
goto badio;
if (recompile)
{
recompile = 0;
goto bad;
}
recompile = -1;
p = 0;
v = ov;
/*
* enter the variables
*/
{
if (!(x = getvar(v->name)) || !(x->property & (V_readonly|V_restored)) && (!(x->property & V_import) || !state.global))
{
if (x)
freevar(x);
}
else
{
{
}
}
v->property |= V_restored;
}
#if BINDINDEX
/*
* initialize the bind index maps
*/
#endif
/*
* load and enter the rules
*/
if (old)
{
off = sizeof(old_header);
goto badio;
}
garbage = 0;
{
register Rule_t* o;
if (old)
{
goto badio;
if (old_swap)
switch (sequence)
{
case 2: /* 01/24/89 */
r->property =
((r->property & 0x0000ffffL)) |
r->dynamic =
((r->dynamic & 0x000003ffL)) |
break;
}
if (r->property & P_staterule)
{
}
switch (sequence)
{
case 0: /* 1989-09-11 */
if ((r->property & P_attribute) && (r->attribute && !(r->property & P_use) && !streq(r->name, internal.attribute->name) || r->scan && !streq(r->name, internal.scan->name)))
/*FALLTHROUGH*/
case 1: /* 1991-07-17 */
if (r->property & P_staterule)
{
if (isaltstate(r->name))
{
r->property |= P_implicit;
r->time = 0;
}
}
/*FALLTHROUGH*/
}
}
else
{
{
}
r->prereqs = d + n - 1;
/*
* 2004-12-01
*/
if (n = rulenum)
{
n--;
}
else
tn = 0;
/*
* 2004-12-01
*/
if ((r->property & P_staterule) && n)
{
n--;
}
else
tn = 0;
/*
* rule number field additions here
*/
while (n--)
if (r->property & P_staterule)
{
if (lowres)
}
else
/*
* rule string field additions here
*/
for (n = rulestr; n > 0; n--)
}
goto badio;
{
/*
* check for index atom consistency
* remap inconsistent state file atoms
*/
if (r->scan)
{
attr = ~0;
{
{
error((state.exec || state.mam.out) && !state.explain ? -1 : 1, "%s: %s %s definition changed", objfile, r->name, internal.scan->name);
return -1;
}
}
else
{
{
error((state.exec || state.mam.out) && !state.explain ? -1 : 1, "%s: %s %s definition clashes with %s", objfile, r->name, internal.scan->name, a->rule->name);
return -1;
attr = 0;
break;
}
attr = 0;
}
if (attr != ~0)
{
if (!scanclash)
{
scanclash = 1;
for (n = 0; n < elementsof(scanmap); n++)
scanmap[n] = n;
}
r->property &= ~P_attribute;
if (o)
continue;
}
}
else if (r->attribute)
{
attr = ~0;
{
{
error((state.exec || state.mam.out) && !state.explain ? -1 : 1, "%s: %s %s definition changed", objfile, r->name, internal.attribute->name);
return -1;
}
}
else
{
error((state.exec || state.mam.out) && !state.explain ? -1 : 1, "%s: %s %s definition clashes with %s", objfile, r->name, internal.attribute->name, a->rule->name);
return -1;
attr = 0;
}
if (attr != ~0)
{
if (!attrclash)
{
attrclash = 1;
attrclear = 0;
for (n = 0; n < CHAR_BIT * sizeof(unsigned long); n++)
attrmap[n] = (1<<n);
}
for (n = 0; n < CHAR_BIT * sizeof(unsigned long); n++)
if (r->attribute == (1<<n))
{
break;
}
continue;
}
}
}
else
{
if (attrclash)
{
for (n = 0; n < CHAR_BIT * sizeof(unsigned long); n++)
if (r->attribute & (1<<n))
}
if (scanclash)
}
if (r->dynamic & D_compiled)
{
{
}
else
{
if (n)
{
promoted = 1;
}
if (!o)
{
{
garbage++;
}
}
{
/*
* ignore state file prereqs and action
*/
setoldrule(r, o);
continue;
}
{
/*
* o was updated after r was saved
*/
setoldrule(r, o);
continue;
}
else if (!isoldrule(o))
{
{
{
}
}
else if ((r->property & (P_parameter|P_statevar)) == P_statevar && (o->property & (P_parameter|P_statevar)) == (P_parameter|P_statevar))
r->property |= P_parameter;
setoldrule(o, r);
}
}
}
else if (o)
{
/*
* r is just a reference -- keep the old rule
* but retain some attributes
*/
setoldrule(r, o);
}
else
{
r->time = 0;
{
{
garbage++;
}
/*
* clear reference secondary attributes
*/
r->property &= (P_attribute|P_dontcare|P_ignore|P_parameter|P_state|P_staterule|P_statevar|P_terminal);
}
}
#if BINDINDEX
if (r->dynamic & D_bindindex)
{
if (o)
{
if (o->dynamic & D_bindindex)
{
if (r->source)
{
if (isoldrule(o))
}
else if (r->view)
{
if (isoldrule(o))
}
}
else if (r->source)
{
error(3, "%s: too many %s directories -- %d max", r->name, internal.source->name, elementsof(state.source));
if (isoldrule(o))
else
{
o->dynamic |= D_bindindex;
}
}
}
else if (r->source)
{
error(3, "%s: too many %s directories -- %d max", r->name, internal.source->name, elementsof(state.source));
}
}
#endif
}
r = or;
/*
* load the prerequisite lists
*/
if (old)
{
goto badio;
}
if (lists)
{
{
if (old)
{
goto badio;
if (old_swap)
d->next = d + 1;
d++;
}
(d - 1)->next = 0;
else if (n < 0)
{
{
while (d < xd)
{
(d - 1)->next = 0;
d++;
}
corrupt = 0;
}
break;
}
else
{
d->rule = r + n - 1;
d->next = d + 1;
d++;
}
}
if (!old)
{
(d - 1)->next = 0;
}
}
goto badio;
/*
* collect state file garbage collection stats
*/
{
Time_t t;
Time_t q;
/*
* handle low time resolution by making
* sure the current time is at least as
* recent as the state file time, previously
* set in compile() to take into account
* the file system time precision
*/
t = tmxgetmtime(&st);
q = CURTIME;
if (q >= t)
t = 0;
else if ((t -= q) > tmxsns(5,0))
t = tmxsns(5,0);
if (t)
{
error(state.tolerance ? 1 : -1, "%s: state time sync delay %lu.%09lu", objfile, tmxsec(t), tmxnsec(t));
tmxsleep(t);
}
}
/*
* readjust the internal rule pointers
*/
initrule();
/*
* make sure top view state has top view prereqs
*/
if (promoted)
/*
* associate one rule with each name
*/
if (oldrules)
{
for (;;)
{
{
}
break;
}
do
{
}
/*
* check special indices
*/
/*
* reset compiled options
*/
{
if (old)
{
if (old_trailer.options)
}
{
/*
* check for load time actions
*
* state.global++ enables setvar() V_import override
*/
immediate(r);
}
}
return 1;
{
/*
* old old versions were only numbers
*/
error(1, "%s: old format (%s) incompatible with make loader (%s)", objfile, old_header.version, old_stamp.version);
}
else
error(1, "%s: old format (%s) generated on an incompatible architecture", objfile, old_header.version);
return 0;
goto bad;
bad:
if (p)
free(p);
return recompile;
}