1 |
4 |
hellwig |
A=.a
|
2 |
|
|
O=.o
|
3 |
|
|
E=
|
4 |
|
|
CC=cc
|
5 |
|
|
CFLAGS=-g
|
6 |
|
|
LDFLAGS=-g
|
7 |
|
|
LD=$(CC)
|
8 |
|
|
AR=ar ruv
|
9 |
|
|
RANLIB=ranlib
|
10 |
|
|
DIFF=diff
|
11 |
|
|
RM=rm -f
|
12 |
|
|
TSTDIR=$(BUILDDIR)/$(TARGET)/tst
|
13 |
|
|
CUSTOM=custom.mk
|
14 |
|
|
include $(CUSTOM)
|
15 |
|
|
B=$(BUILDDIR)/
|
16 |
|
|
T=$(TSTDIR)/
|
17 |
|
|
|
18 |
|
|
what:
|
19 |
|
|
-@echo make all rcc lburg cpp lcc bprint liblcc triple clean clobber
|
20 |
|
|
|
21 |
|
|
all:: rcc lburg cpp lcc bprint liblcc
|
22 |
|
|
|
23 |
|
|
rcc: $Brcc$E
|
24 |
|
|
lburg: $Blburg$E
|
25 |
|
|
cpp: $Bcpp$E
|
26 |
|
|
lcc: $Blcc$E
|
27 |
|
|
bprint: $Bbprint$E
|
28 |
|
|
liblcc: $Bliblcc$A
|
29 |
|
|
|
30 |
|
|
RCCOBJS=$Balloc$O \
|
31 |
|
|
$Bbind$O \
|
32 |
|
|
$Bdag$O \
|
33 |
|
|
$Bdagcheck$O \
|
34 |
|
|
$Bdecl$O \
|
35 |
|
|
$Benode$O \
|
36 |
|
|
$Berror$O \
|
37 |
|
|
$Bexpr$O \
|
38 |
|
|
$Bevent$O \
|
39 |
|
|
$Binit$O \
|
40 |
|
|
$Binits$O \
|
41 |
|
|
$Binput$O \
|
42 |
|
|
$Blex$O \
|
43 |
|
|
$Blist$O \
|
44 |
|
|
$Bmain$O \
|
45 |
|
|
$Boutput$O \
|
46 |
|
|
$Bprof$O \
|
47 |
|
|
$Bprofio$O \
|
48 |
|
|
$Bsimp$O \
|
49 |
|
|
$Bstmt$O \
|
50 |
|
|
$Bstring$O \
|
51 |
|
|
$Bsym$O \
|
52 |
|
|
$Btrace$O \
|
53 |
|
|
$Btree$O \
|
54 |
|
|
$Btypes$O \
|
55 |
|
|
$Bnull$O \
|
56 |
|
|
$Bsymbolic$O \
|
57 |
|
|
$Bgen$O \
|
58 |
|
|
$Bbytecode$O \
|
59 |
|
|
$Balpha$O \
|
60 |
|
|
$Bmips$O \
|
61 |
|
|
$Beco32$O \
|
62 |
|
|
$Bsparc$O \
|
63 |
|
|
$Bstab$O \
|
64 |
|
|
$Bx86$O \
|
65 |
|
|
$Bx86linux$O
|
66 |
|
|
|
67 |
|
|
$Brcc$E:: $Bmain$O $Blibrcc$A $(EXTRAOBJS)
|
68 |
|
|
$(LD) $(LDFLAGS) -o $@ $Bmain$O $(EXTRAOBJS) $Blibrcc$A $(EXTRALIBS)
|
69 |
|
|
|
70 |
|
|
$Blibrcc$A: $(RCCOBJS)
|
71 |
|
|
$(AR) $@ $(RCCOBJS); $(RANLIB) $@ || true
|
72 |
|
|
|
73 |
|
|
$(RCCOBJS): src/c.h src/ops.h src/token.h src/config.h
|
74 |
|
|
|
75 |
|
|
$Balloc$O: src/alloc.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/alloc.c
|
76 |
|
|
$Bbind$O: src/bind.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/bind.c
|
77 |
|
|
$Bdag$O: src/dag.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/dag.c
|
78 |
|
|
$Bdecl$O: src/decl.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/decl.c
|
79 |
|
|
$Benode$O: src/enode.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/enode.c
|
80 |
|
|
$Berror$O: src/error.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/error.c
|
81 |
|
|
$Bevent$O: src/event.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/event.c
|
82 |
|
|
$Bexpr$O: src/expr.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/expr.c
|
83 |
|
|
$Bgen$O: src/gen.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/gen.c
|
84 |
|
|
$Binit$O: src/init.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/init.c
|
85 |
|
|
$Binits$O: src/inits.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/inits.c
|
86 |
|
|
$Binput$O: src/input.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/input.c
|
87 |
|
|
$Blex$O: src/lex.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/lex.c
|
88 |
|
|
$Blist$O: src/list.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/list.c
|
89 |
|
|
$Bmain$O: src/main.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/main.c
|
90 |
|
|
$Bnull$O: src/null.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/null.c
|
91 |
|
|
$Boutput$O: src/output.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/output.c
|
92 |
|
|
$Bprof$O: src/prof.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/prof.c
|
93 |
|
|
$Bprofio$O: src/profio.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/profio.c
|
94 |
|
|
$Bsimp$O: src/simp.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/simp.c
|
95 |
|
|
$Bstmt$O: src/stmt.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/stmt.c
|
96 |
|
|
$Bstring$O: src/string.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/string.c
|
97 |
|
|
$Bsym$O: src/sym.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/sym.c
|
98 |
|
|
$Bsymbolic$O: src/symbolic.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/symbolic.c
|
99 |
|
|
$Bbytecode$O: src/bytecode.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/bytecode.c
|
100 |
|
|
$Btrace$O: src/trace.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/trace.c
|
101 |
|
|
$Btree$O: src/tree.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/tree.c
|
102 |
|
|
$Btypes$O: src/types.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/types.c
|
103 |
|
|
$Bstab$O: src/stab.c src/stab.h; $(CC) $(CFLAGS) -c -Isrc -o $@ src/stab.c
|
104 |
|
|
|
105 |
|
|
$Bdagcheck$O: $Bdagcheck.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bdagcheck.c
|
106 |
|
|
$Balpha$O: $Balpha.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Balpha.c
|
107 |
|
|
$Bmips$O: $Bmips.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bmips.c
|
108 |
|
|
$Beco32$O: $Beco32.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Beco32.c
|
109 |
|
|
$Bsparc$O: $Bsparc.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bsparc.c
|
110 |
|
|
$Bx86$O: $Bx86.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bx86.c
|
111 |
|
|
$Bx86linux$O: $Bx86linux.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bx86linux.c
|
112 |
|
|
|
113 |
|
|
$Bdagcheck.c: $Blburg$E src/dagcheck.md; $Blburg src/dagcheck.md $@
|
114 |
|
|
$Balpha.c: $Blburg$E src/alpha.md; $Blburg src/alpha.md $@
|
115 |
|
|
$Bmips.c: $Blburg$E src/mips.md; $Blburg src/mips.md $@
|
116 |
|
|
$Beco32.c: $Blburg$E src/eco32.md; $Blburg src/eco32.md $@
|
117 |
|
|
$Bsparc.c: $Blburg$E src/sparc.md; $Blburg src/sparc.md $@
|
118 |
|
|
$Bx86.c: $Blburg$E src/x86.md; $Blburg src/x86.md $@
|
119 |
|
|
$Bx86linux.c: $Blburg$E src/x86linux.md; $Blburg src/x86linux.md $@
|
120 |
|
|
|
121 |
|
|
$Bbprint$E: $Bbprint$O; $(LD) $(LDFLAGS) -o $@ $Bbprint$O
|
122 |
|
|
$Bops$E: $Bops$O; $(LD) $(LDFLAGS) -o $@ $Bops$O
|
123 |
|
|
|
124 |
|
|
$Bbprint$O: etc/bprint.c src/profio.c; $(CC) $(CFLAGS) -c -Isrc -o $@ etc/bprint.c
|
125 |
|
|
$Bops$O: etc/ops.c src/ops.h; $(CC) $(CFLAGS) -c -Isrc -o $@ etc/ops.c
|
126 |
|
|
|
127 |
|
|
$Blcc$E: $Blcc$O $Bhost$O; $(LD) $(LDFLAGS) -o $@ $Blcc$O $Bhost$O
|
128 |
|
|
|
129 |
|
|
$Blcc$O: etc/lcc.c; $(CC) $(CFLAGS) -c -o $@ etc/lcc.c
|
130 |
|
|
$Bhost$O: $(HOSTFILE); $(CC) $(CFLAGS) -DLCCDIR=\"$(BUILDDIR)/\" -c -o $@ $(HOSTFILE)
|
131 |
|
|
|
132 |
|
|
LIBOBJS=$Bassert$O $Bbbexit$O $Byynull$O
|
133 |
|
|
|
134 |
|
|
$Bliblcc$A: $(LIBOBJS); $(AR) $@ $Bassert$O $Bbbexit$O $Byynull$O; $(RANLIB) $@ || true
|
135 |
|
|
|
136 |
|
|
$Bassert$O: lib/assert.c; $(CC) $(CFLAGS) -c -o $@ lib/assert.c
|
137 |
|
|
$Byynull$O: lib/yynull.c; $(CC) $(CFLAGS) -c -o $@ lib/yynull.c
|
138 |
|
|
$Bbbexit$O: lib/bbexit.c; $(CC) $(CFLAGS) -c -o $@ lib/bbexit.c
|
139 |
|
|
|
140 |
|
|
$Blburg$E: $Blburg$O $Bgram$O; $(LD) $(LDFLAGS) -o $@ $Blburg$O $Bgram$O
|
141 |
|
|
|
142 |
|
|
$Blburg$O $Bgram$O: lburg/lburg.h
|
143 |
|
|
|
144 |
|
|
$Blburg$O: lburg/lburg.c; $(CC) $(CFLAGS) -c -Ilburg -o $@ lburg/lburg.c
|
145 |
|
|
$Bgram$O: lburg/gram.c; $(CC) $(CFLAGS) -c -Ilburg -o $@ lburg/gram.c
|
146 |
|
|
|
147 |
|
|
CPPOBJS=$Bcpp$O $Blexer$O $Bnlist$O $Btokens$O $Bmacro$O $Beval$O \
|
148 |
|
|
$Binclude$O $Bhideset$O $Bgetopt$O $Bunix$O
|
149 |
|
|
|
150 |
|
|
$Bcpp$E: $(CPPOBJS)
|
151 |
|
|
$(LD) $(LDFLAGS) -o $@ $(CPPOBJS)
|
152 |
|
|
|
153 |
|
|
$(CPPOBJS): cpp/cpp.h
|
154 |
|
|
|
155 |
|
|
$Bcpp$O: cpp/cpp.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/cpp.c
|
156 |
|
|
$Blexer$O: cpp/lex.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/lex.c
|
157 |
|
|
$Bnlist$O: cpp/nlist.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/nlist.c
|
158 |
|
|
$Btokens$O: cpp/tokens.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/tokens.c
|
159 |
|
|
$Bmacro$O: cpp/macro.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/macro.c
|
160 |
|
|
$Beval$O: cpp/eval.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/eval.c
|
161 |
|
|
$Binclude$O: cpp/include.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/include.c
|
162 |
|
|
$Bhideset$O: cpp/hideset.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/hideset.c
|
163 |
|
|
$Bgetopt$O: cpp/getopt.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/getopt.c
|
164 |
|
|
$Bunix$O: cpp/unix.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/unix.c
|
165 |
|
|
|
166 |
|
|
test: $T8q.s \
|
167 |
|
|
$Tarray.s \
|
168 |
|
|
$Tcf.s \
|
169 |
|
|
$Tcq.s \
|
170 |
|
|
$Tcvt.s \
|
171 |
|
|
$Tfields.s \
|
172 |
|
|
$Tfront.s \
|
173 |
|
|
$Tincr.s \
|
174 |
|
|
$Tinit.s \
|
175 |
|
|
$Tlimits.s \
|
176 |
|
|
$Tparanoia.s \
|
177 |
|
|
$Tsort.s \
|
178 |
|
|
$Tspill.s \
|
179 |
|
|
$Tstdarg.s \
|
180 |
|
|
$Tstruct.s \
|
181 |
|
|
$Tswitch.s \
|
182 |
|
|
$Twf1.s \
|
183 |
|
|
$Tyacc.s
|
184 |
|
|
|
185 |
|
|
$T8q.s: tst/8q.c tst/8q.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
186 |
|
|
$Tarray.s: tst/array.c tst/array.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
187 |
|
|
$Tcf.s: tst/cf.c tst/cf.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
188 |
|
|
$Tcq.s: tst/cq.c tst/cq.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
189 |
|
|
$Tcvt.s: tst/cvt.c tst/cvt.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
190 |
|
|
$Tfields.s: tst/fields.c tst/fields.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
191 |
|
|
$Tfront.s: tst/front.c tst/front.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
192 |
|
|
$Tincr.s: tst/incr.c tst/incr.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
193 |
|
|
$Tinit.s: tst/init.c tst/init.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
194 |
|
|
$Tlimits.s: tst/limits.c tst/limits.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
195 |
|
|
$Tparanoia.s: tst/paranoia.c tst/paranoia.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
196 |
|
|
$Tsort.s: tst/sort.c tst/sort.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
197 |
|
|
$Tspill.s: tst/spill.c tst/spill.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
198 |
|
|
$Tstdarg.s: tst/stdarg.c tst/stdarg.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
199 |
|
|
$Tstruct.s: tst/struct.c tst/struct.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
200 |
|
|
$Tswitch.s: tst/switch.c tst/switch.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
201 |
|
|
$Twf1.s: tst/wf1.c tst/wf1.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
202 |
|
|
$Tyacc.s: tst/yacc.c tst/yacc.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
|
203 |
|
|
|
204 |
|
|
testclean:
|
205 |
|
|
$(RM) $T8q$E $T8q.s $T8q.2 $T8q.1
|
206 |
|
|
$(RM) $Tarray$E $Tarray.s $Tarray.2 $Tarray.1
|
207 |
|
|
$(RM) $Tcf$E $Tcf.s $Tcf.2 $Tcf.1
|
208 |
|
|
$(RM) $Tcq$E $Tcq.s $Tcq.2 $Tcq.1
|
209 |
|
|
$(RM) $Tcvt$E $Tcvt.s $Tcvt.2 $Tcvt.1
|
210 |
|
|
$(RM) $Tfields$E $Tfields.s $Tfields.2 $Tfields.1
|
211 |
|
|
$(RM) $Tfront$E $Tfront.s $Tfront.2 $Tfront.1
|
212 |
|
|
$(RM) $Tincr$E $Tincr.s $Tincr.2 $Tincr.1
|
213 |
|
|
$(RM) $Tinit$E $Tinit.s $Tinit.2 $Tinit.1
|
214 |
|
|
$(RM) $Tlimits$E $Tlimits.s $Tlimits.2 $Tlimits.1
|
215 |
|
|
$(RM) $Tparanoia$E $Tparanoia.s $Tparanoia.2 $Tparanoia.1
|
216 |
|
|
$(RM) $Tsort$E $Tsort.s $Tsort.2 $Tsort.1
|
217 |
|
|
$(RM) $Tspill$E $Tspill.s $Tspill.2 $Tspill.1
|
218 |
|
|
$(RM) $Tstdarg$E $Tstdarg.s $Tstdarg.2 $Tstdarg.1
|
219 |
|
|
$(RM) $Tstruct$E $Tstruct.s $Tstruct.2 $Tstruct.1
|
220 |
|
|
$(RM) $Tswitch$E $Tswitch.s $Tswitch.2 $Tswitch.1
|
221 |
|
|
$(RM) $Twf1$E $Twf1.s $Twf1.2 $Twf1.1
|
222 |
|
|
$(RM) $Tyacc$E $Tyacc.s $Tyacc.2 $Tyacc.1
|
223 |
|
|
|
224 |
|
|
clean:: testclean
|
225 |
|
|
$(RM) $B*$O
|
226 |
|
|
$(RM) $Bdagcheck.c $Balpha.c $Bmips.c $Beco32.c $Bx86.c $Bsparc.c $Bx86linux.c
|
227 |
|
|
$(RM) $Brcc1$E $Brcc1$E $B1rcc$E $B2rcc$E
|
228 |
|
|
$(RM) $B*.ilk
|
229 |
|
|
|
230 |
|
|
clobber:: clean
|
231 |
|
|
$(RM) $Brcc$E $Blburg$E $Bcpp$E $Blcc$E $Bcp$E $Bbprint$E $B*$A
|
232 |
|
|
$(RM) $B*.pdb $B*.pch
|
233 |
|
|
|
234 |
|
|
RCCSRCS=src/alloc.c \
|
235 |
|
|
src/bind.c \
|
236 |
|
|
src/dag.c \
|
237 |
|
|
src/decl.c \
|
238 |
|
|
src/enode.c \
|
239 |
|
|
src/error.c \
|
240 |
|
|
src/expr.c \
|
241 |
|
|
src/event.c \
|
242 |
|
|
src/init.c \
|
243 |
|
|
src/inits.c \
|
244 |
|
|
src/input.c \
|
245 |
|
|
src/lex.c \
|
246 |
|
|
src/list.c \
|
247 |
|
|
src/main.c \
|
248 |
|
|
src/output.c \
|
249 |
|
|
src/prof.c \
|
250 |
|
|
src/profio.c \
|
251 |
|
|
src/simp.c \
|
252 |
|
|
src/stmt.c \
|
253 |
|
|
src/string.c \
|
254 |
|
|
src/sym.c \
|
255 |
|
|
src/trace.c \
|
256 |
|
|
src/tree.c \
|
257 |
|
|
src/types.c \
|
258 |
|
|
src/null.c \
|
259 |
|
|
src/symbolic.c \
|
260 |
|
|
src/bytecode.c \
|
261 |
|
|
src/gen.c \
|
262 |
|
|
src/stab.c \
|
263 |
|
|
$Bdagcheck.c \
|
264 |
|
|
$Balpha.c \
|
265 |
|
|
$Bmips.c \
|
266 |
|
|
$Beco32.c \
|
267 |
|
|
$Bsparc.c \
|
268 |
|
|
$Bx86linux.c \
|
269 |
|
|
$Bx86.c
|
270 |
|
|
|
271 |
|
|
C=$Blcc -A -d0.6 -Wo-lccdir=$(BUILDDIR) -Isrc -I$(BUILDDIR)
|
272 |
|
|
triple: $B2rcc$E
|
273 |
|
|
strip $B1rcc$E $B2rcc$E
|
274 |
|
|
dd if=$B1rcc$E of=$Brcc1$E bs=512 skip=1
|
275 |
|
|
dd if=$B2rcc$E of=$Brcc2$E bs=512 skip=1
|
276 |
|
|
if cmp $Brcc1$E $Brcc2$E; then \
|
277 |
|
|
mv $B2rcc$E $Brcc$E; \
|
278 |
|
|
$(RM) $B1rcc$E $Brcc[12]$E; fi
|
279 |
|
|
|
280 |
|
|
$B1rcc$E: $Brcc$E $Blcc$E $Bcpp$E
|
281 |
|
|
$C -o $@ -B$B $(RCCSRCS)
|
282 |
|
|
$B2rcc$E: $B1rcc$E
|
283 |
|
|
$C -o $@ -B$B1 $(RCCSRCS)
|