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
140 S_VAR, /* variable -> value */
141 S_TARGET, /* target -> rule */
142 S_TIME, /* file -> time */
143 S_PID, /* pid -> products */
144 S_NODE, /* target name -> node */
145 S_AGG, /* aggregate -> time */
146 S_BITCH, /* bitched about aggregate not there */
147 S_NOEXPORT, /* var -> noexport */
148 S_OVERRIDE, /* can't override */
149 S_OUTOFDATE, /* n1\377n2 -> 2(outofdate) or 1(not outofdate) */
150 S_MAKEFILE, /* target -> node */
151 S_MAKEVAR, /* dumpable mk variable */
152 S_EXPORTED, /* var -> current exported value */
153 S_WESET, /* variable; we set in the mkfile */
154 S_INTERNAL /* an internal mk variable (e.g., stem, target) */
158 extern int nflag, tflag, iflag, kflag, aflag, mflag;
162 extern char *explain;
163 extern Shell *shellt;
164 extern Word *shellcmd;
166 extern Shell shshell, rcshell;
168 #define SYNERR(l) (fprint(2, "mk: %s:%d: syntax error; ", infile, ((l)>=0)?(l):mkinline))
169 #define RERR(r) (fprint(2, "mk: %s:%d: rule error; ", (r)->file, (r)->line))
170 #define NAMEBLOCK 1000
171 #define BIGBLOCK 20000
173 #define SEP(c) (((c)==' ')||((c)=='\t')||((c)=='\n'))
174 #define WORDCHR(r) ((r) > ' ' && !utfrune("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", (r)))
176 #define DEBUG(x) (debug&(x))
181 #define LSEEK(f,o,p) seek(f,o,p)
183 #define PERCENT(ch) (((ch) == '%') || ((ch) == '&'))