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