Introduction
Introduction Statistics Contact Development Disclaimer Help
mk.h - 9base - revived minimalist port of Plan 9 userland to Unix
git clone git://git.suckless.org/9base
Log
Files
Refs
README
LICENSE
---
mk.h (4258B)
---
1 #include "sys.h"
2
3 #undef assert
4 #define assert mkassert
5 extern Biobuf bout;
6
7 typedef struct Bufblock
8 {
9 struct Bufblock *next;
10 char *start;
11 char *end;
12 char *current;
13 } Bufblock;
14
15 typedef struct Word
16 {
17 char *s;
18 struct Word *next;
19 } Word;
20
21 typedef struct Envy
22 {
23 char *name;
24 Word *values;
25 } Envy;
26
27 extern Envy *envy;
28
29 typedef struct Shell
30 {
31 char *name;
32 char *termchars; /* used in parse.c to isolate ass…
33 int iws; /* inter-word separator i…
34 char *(*charin)(char*, char*); /* search for unesc…
35 char *(*expandquote)(char*, Rune, Bufblock*); /* e…
36 int (*escapetoken)(Biobuf*, Bufblock*, int, int); …
37 char *(*copyq)(char*, Rune, Bufblock*); /* check f…
38 int (*matchname)(char*); /* does name match */
39 } Shell;
40
41 typedef struct Rule
42 {
43 char *target; /* one target */
44 Word *tail; /* constituents of ta…
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 da…
53 struct Rule *chain; /* hashed per target */
54 struct Rule *next;
55 Shell *shellt; /* shell to use with this r…
56 Word *shellcmd;
57 } Rule;
58
59 extern Rule *rules, *metarules, *patrule;
60
61 /* Rule.attr */
62 #define META 0x0001
63 #define UNUSED 0x0002
64 #define UPD 0x0004
65 #define QUIET 0x0008
66 #define VIR 0x0010
67 #define REGEXP 0x0020
68 #define NOREC 0x0040
69 #define DEL 0x0080
70 #define NOVIRT 0x0100
71
72 #define NREGEXP 10
73
74 typedef struct Arc
75 {
76 short flag;
77 struct Node *n;
78 Rule *r;
79 char *stem;
80 char *prog;
81 char *match[NREGEXP];
82 struct Arc *next;
83 } Arc;
84
85 /* Arc.flag */
86 #define TOGO 1
87
88 typedef struct Node
89 {
90 char *name;
91 long time;
92 unsigned short flags;
93 Arc *prereqs;
94 struct Node *next; /* list for a rule */
95 } Node;
96
97 /* Node.flags */
98 #define VIRTUAL 0x0001
99 #define CYCLE 0x0002
100 #define READY 0x0004
101 #define CANPRETEND 0x0008
102 #define PRETENDING 0x0010
103 #define NOTMADE 0x0020
104 #define BEINGMADE 0x0040
105 #define MADE 0x0080
106 #define MADESET(n,m) n->flags = (n->flags&~(NOTMAD…
107 #define PROBABLE 0x0100
108 #define VACUOUS 0x0200
109 #define NORECIPE 0x0400
110 #define DELETE 0x0800
111 #define NOMINUSE 0x1000
112
113 typedef struct Job
114 {
115 Rule *r; /* master rule for job */
116 Node *n; /* list of node targets */
117 char *stem;
118 char **match;
119 Word *p; /* prerequistes */
120 Word *np; /* new prerequistes */
121 Word *t; /* targets */
122 Word *at; /* all targets */
123 int nproc; /* slot number */
124 struct Job *next;
125 } Job;
126 extern Job *jobs;
127
128 typedef struct Symtab
129 {
130 short space;
131 char *name;
132 union {
133 void *ptr;
134 uintptr value;
135 } u;
136 struct Symtab *next;
137 } Symtab;
138
139 enum {
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 outofda…
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…
155 };
156
157 extern int debug;
158 extern int nflag, tflag, iflag, kflag, aflag, mflag;
159 extern int mkinline;
160 extern char *infile;
161 extern int nreps;
162 extern char *explain;
163 extern Shell *shellt;
164 extern Word *shellcmd;
165
166 extern Shell shshell, rcshell;
167
168 #define SYNERR(l) (fprint(2, "mk: %s:%d: syntax error; ", …
169 #define RERR(r) (fprint(2, "mk: %s:%d: rule error;…
170 #define NAMEBLOCK 1000
171 #define BIGBLOCK 20000
172
173 #define SEP(c) (((c)==' ')||((c)=='\t')||((c)=='\n…
174 #define WORDCHR(r) ((r) > ' ' && !utfrune("!\"#$%&'()*+,-./:;<=>?…
175
176 #define DEBUG(x) (debug&(x))
177 #define D_PARSE 0x01
178 #define D_GRAPH 0x02
179 #define D_EXEC 0x04
180
181 #define LSEEK(f,o,p) seek(f,o,p)
182
183 #define PERCENT(ch) (((ch) == '%') || ((ch) == '&'))
184
185 #include "fns.h"
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.