4
#define assert mkassert
7
typedef struct Bufblock
32
char *termchars; /* used in parse.c to isolate assignment attribute */
33
int iws; /* inter-word separator in environment */
34
char *(*charin)(char*, char*); /* search for unescaped characters */
35
char *(*expandquote)(char*, Rune, Bufblock*); /* extract escaped token */
36
int (*escapetoken)(Biobuf*, Bufblock*, int, int); /* input escaped token */
37
char *(*copyq)(char*, Rune, Bufblock*); /* check for quoted strings */
38
int (*matchname)(char*); /* does name match */
43
char *target; /* one target */
44
Word *tail; /* constituents of targets */
45
char *recipe; /* do it ! */
46
short attr; /* attributes */
47
short line; /* source line */
48
char *file; /* source file */
49
Word *alltargets; /* all the targets */
50
int rule; /* rule number */
51
Reprog *pat; /* reg exp goo */
52
char *prog; /* to use in out of date */
53
struct Rule *chain; /* hashed per target */
55
Shell *shellt; /* shell to use with this rule */
59
extern Rule *rules, *metarules, *patrule;
94
struct Node *next; /* list for a rule */
98
#define VIRTUAL 0x0001
101
#define CANPRETEND 0x0008
102
#define PRETENDING 0x0010
103
#define NOTMADE 0x0020
104
#define BEINGMADE 0x0040
106
#define MADESET(n,m) n->flags = (n->flags&~(NOTMADE|BEINGMADE|MADE))|(m)
107
#define PROBABLE 0x0100
108
#define VACUOUS 0x0200
109
#define NORECIPE 0x0400
110
#define DELETE 0x0800
111
#define NOMINUSE 0x1000
115
Rule *r; /* master rule for job */
116
Node *n; /* list of node targets */
119
Word *p; /* prerequistes */
120
Word *np; /* new prerequistes */
121
Word *t; /* targets */
122
Word *at; /* all targets */
123
int nproc; /* slot number */
128
typedef struct Symtab
137
S_VAR, /* variable -> value */
138
S_TARGET, /* target -> rule */
139
S_TIME, /* file -> time */
140
S_PID, /* pid -> products */
141
S_NODE, /* target name -> node */
142
S_AGG, /* aggregate -> time */
143
S_BITCH, /* bitched about aggregate not there */
144
S_NOEXPORT, /* var -> noexport */
145
S_OVERRIDE, /* can't override */
146
S_OUTOFDATE, /* n1\377n2 -> 2(outofdate) or 1(not outofdate) */
147
S_MAKEFILE, /* target -> node */
148
S_MAKEVAR, /* dumpable mk variable */
149
S_EXPORTED, /* var -> current exported value */
150
S_WESET, /* variable; we set in the mkfile */
151
S_INTERNAL /* an internal mk variable (e.g., stem, target) */
155
extern int nflag, tflag, iflag, kflag, aflag, mflag;
159
extern char *explain;
160
extern Shell *shellt;
161
extern Word *shellcmd;
163
extern Shell shshell, rcshell;
165
#define SYNERR(l) (fprint(2, "mk: %s:%d: syntax error; ", infile, ((l)>=0)?(l):mkinline))
166
#define RERR(r) (fprint(2, "mk: %s:%d: rule error; ", (r)->file, (r)->line))
167
#define NAMEBLOCK 1000
168
#define BIGBLOCK 20000
170
#define SEP(c) (((c)==' ')||((c)=='\t')||((c)=='\n'))
171
#define WORDCHR(r) ((r) > ' ' && !utfrune("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", (r)))
173
#define DEBUG(x) (debug&(x))
178
#define LSEEK(f,o,p) seek(f,o,p)
180
#define PERCENT(ch) (((ch) == '%') || ((ch) == '&'))