417
|
1 CC = gcc
|
|
2 # -O3
|
|
3 CFLAGS = -g -Wall -I.
|
|
4 BASE=0
|
|
5 STAGE=1
|
|
6 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE)
|
|
7 ARCH=mips
|
|
8 MC=mc-$(ARCH)
|
|
9 MLIB = -lm
|
|
10 PRINTF= # printf.c
|
|
11 CONVERTER=conv/c.o conv/null.o
|
|
12 # conv/c2cbc.o conv/cbc2c.o
|
|
13 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o
|
|
14 # CODE=mc-code-ia32.c
|
|
15 CODE=mc-code-$(ARCH).c
|
|
16
|
|
17 all: mc mc-ia32 mc-powerpc mc-mips
|
|
18
|
|
19 mc: mc-$(ARCH)
|
|
20 cp mc-$(ARCH) mc
|
|
21
|
|
22 TAGS:
|
|
23 ctags mc-code-powerpc.c mc-code.h mc-codegen.c mc-codegen.h \
|
|
24 mc-macro.c \
|
|
25 mc-parse.c mc-tree.c mc-switch.c mc-switch.h \
|
|
26 mc.h conv/c.c conv/c.h \
|
|
27 conv/conv.h conv/convdef.h conv/null.c
|
|
28
|
|
29 mc-powerpc : mc-code-powerpc.o $(COMPLIB) $(CONVERTER)
|
|
30 $(CC) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@
|
|
31
|
|
32 mc-ia32 : mc-code-ia32.o $(COMPLIB) $(CONVERTER)
|
|
33 $(CC) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@
|
|
34
|
|
35 mc-mips : mc-code-mips.o $(COMPLIB) $(CONVERTER)
|
|
36 $(CC) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@
|
|
37
|
|
38 conv/conv.h: conv_func.tbl conv_func.pl
|
|
39 perl conv_func.pl
|
|
40 conv/convdef.h: conv_func.tbl conv_func.pl
|
|
41 perl conv_func.pl
|
|
42 conv/null.c: conv_func.tbl conv_func.pl
|
|
43 perl conv_func.pl
|
|
44
|
|
45 mc.h-new:
|
|
46 perl mc-h-renum.pl mc.h > mc.h.1
|
|
47 mv mc.h.1 mc.h
|
|
48
|
|
49 check-all: check-all-c check-all-code
|
|
50
|
|
51 check-all-c:
|
|
52 make check TARGET=test/basic
|
|
53 make check TARGET=test/call
|
|
54 make check TARGET=test/fact0
|
|
55 make check TARGET=test/float
|
|
56 make check TARGET=test/ifdef
|
|
57 make check TARGET=test/int
|
|
58 make check TARGET=test/macro
|
|
59 make check TARGET=test/regargs
|
|
60 make check TARGET=test/short
|
|
61 make check TARGET=test/simp
|
|
62 make check TARGET=test/simp0
|
|
63 make check TARGET=test/simp1
|
|
64 make check TARGET=test/static
|
|
65 make check TARGET=test/tmp
|
|
66 make check TARGET=test/tmp10
|
|
67 make check TARGET=test/tmp11
|
|
68 make check TARGET=test/tmp12
|
|
69 make check TARGET=test/tmp5
|
|
70 make check TARGET=test/tmp7
|
|
71 make check TARGET=test/tmp8
|
|
72 make check TARGET=test/tmp9
|
|
73 make check TARGET=test/enum
|
|
74 make check TARGET=test/obsf
|
|
75 make check TARGET=test/long
|
|
76 make check TARGET=test/tstdarg
|
|
77 make check TARGET=test/switch
|
|
78 make check TARGET=test/strinit
|
|
79 make check TARGET=test/code-gen-all
|
|
80 make check TARGET=test/bitfield
|
|
81 make check TARGET=test/bitfield1
|
|
82 #MK =-make
|
|
83 MK=
|
|
84 check-all-code:
|
|
85 make check-code$(MK) TARGET=test/arg
|
|
86 make check-code$(MK) TARGET=test/conv
|
|
87 make check-code$(MK) TARGET=test/conv1
|
|
88 make check-code$(MK) TARGET=test/fact-a
|
|
89 make check-code$(MK) TARGET=test/fact
|
|
90 make check-code$(MK) TARGET=test/goto
|
|
91 # make check-code$(MK) TARGET=test/test1
|
|
92 # make check-code$(MK) TARGET=test/tmp1
|
|
93 make check-code$(MK) TARGET=test/tmp2
|
|
94 make check-code$(MK) TARGET=test/tmp4
|
|
95 # make check-code$(MK) TARGET=test/tmp6
|
|
96
|
|
97 check-nkf:
|
|
98 ( cd nkf203; $(CC) -g -o nkf1 nkf.c utf8tbl.c )
|
|
99 ( cd nkf203; ../mc-$(ARCH) -s nkf.c utf8tbl.c )
|
|
100 ( cd nkf203; $(CC) -g -o nkf nkf.s utf8tbl.s )
|
|
101 ( cd nkf203; perl test.pl )
|
|
102
|
|
103 # -./$(MC) -Itest/ -s $(TARGET).c
|
|
104
|
|
105 check: $(MC) $(TARGET).c
|
|
106 -gcc $(TARGET).c -o b.out $(MLIB)
|
|
107 -./b.out > $(TARGET).gcc.out
|
|
108 -./$(MC) -s $(TARGET).c
|
|
109 -gcc $(TARGET).s $(MLIB)
|
|
110 -./a.out > $(TARGET).$(MC).out
|
|
111 -diff $(TARGET).gcc.out $(TARGET).$(MC).out
|
|
112
|
|
113 check-code: $(MC)
|
|
114 -./$(MC) -s $(TARGET).c
|
|
115 -gcc $(TARGET).s $(MLIB)
|
|
116 -./a.out > $(TARGET).$(MC).out
|
|
117 -diff $(TARGET).code-out $(TARGET).$(MC).out
|
|
118 check-code-make: $(MC)
|
|
119 -./$(MC) -s $(TARGET).c
|
|
120 -gcc $(TARGET).s $(MLIB)
|
|
121 -./a.out > $(TARGET).code-out
|
|
122
|
|
123 test/code-gen-all.c: test/code-gen.pl test/code-gen.c
|
|
124 perl test/code-gen.pl < test/code-gen.c > test/code-gen-all.c
|
|
125
|
|
126 tags: tags-$(ARCH)
|
|
127
|
|
128 tags-$(ARCH):
|
|
129 ctags mc.h mc-code.h mc-code-$(ARCH).c mc-codegen.c mc-codegen.h \
|
|
130 mc-parse.c mc-tree.c \
|
|
131 conv/c.c conv/c.h \
|
|
132 conv/conv.h conv/convdef.h
|
|
133
|
|
134 tar :
|
|
135 make clean
|
|
136 tar cBf - . | gzip > ../comp.tgz
|
|
137
|
|
138 depend :
|
|
139 makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
|
|
140 mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
|
|
141 mc-macro.c mc-macro.h mc-parse.h \
|
|
142 conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
|
|
143 conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
|
|
144 mc-code-powerpc.c \
|
|
145 mc-code-mips.c
|
|
146
|
|
147 clean :
|
|
148 -rm -f mc mc-ia32 mc-powerpc mc-mips *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i
|
|
149
|
|
150 mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o $(CONVERTER)
|
|
151 $(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o $(CONVERTER)
|
|
152
|
|
153 mc2 : b00.s b01.s b02.s b03.s mc-macro.o $(CONVERTER)
|
|
154 $(CC) -g -o $@ $(PRINTF) b00.s b01.s b02.s b03.s b04.s mc-macro.o $(CONVERTER)
|
|
155
|
|
156 b00.s : mc-parse.c $(MC)
|
|
157 ./$(MC) -s -ob00.s mc-parse.c
|
|
158 b01.s : $(CODE) $(MC)
|
|
159 ./$(MC) -s -ob01.s $(CODE)
|
|
160 b02.s : mc-codegen.c $(MC)
|
|
161 ./$(MC) -s -ob02.s mc-codegen.c
|
|
162 b03.s : mc-tree.c $(MC)
|
|
163 ./$(MC) -s -ob03.s mc-tree.c
|
|
164 b04.s : mc-switch.c $(MC)
|
|
165 ./$(MC) -s -ob04.s mc-switch.c
|
|
166
|
|
167 b10.s : mc-parse.c mc1
|
|
168 ./mc1 -s -ob10.s mc-parse.c
|
|
169 b11.s : $(CODE) $(PRINTF) mc1
|
|
170 ./mc1 -s -ob11.s $(CODE)
|
|
171 b12.s : mc-codegen.c mc1
|
|
172 ./mc1 -s -ob12.s mc-codegen.c
|
|
173 b13.s : mc-tree.c mc1
|
|
174 ./mc1 -s -ob13.s mc-tree.c
|
|
175 b14.s : mc-switch.c mc1
|
|
176 ./mc1 -s -ob14.s mc-switch.c
|
|
177
|
|
178 b20.s : mc-parse.c mc2
|
|
179 ./mc2 -s -ob20.s mc-parse.c
|
|
180 b21.s : $(CODE) $(PRINTF) mc2
|
|
181 ./mc2 -s -ob21.s $(CODE)
|
|
182 b22.s : mc-codegen.c mc2
|
|
183 ./mc2 -s -ob22.s mc-codegen.c
|
|
184 b23.s : mc-tree.c mc2
|
|
185 ./mc2 -s -ob23.s mc-tree.c
|
|
186 b24.s : mc-switch.c mc1
|
|
187 ./mc2 -s -ob24.s mc-switch.c
|
|
188
|
|
189 diff : b00.s b01.s b02.s b03.s b04.s b10.s b11.s b12.s b13.s b14.s
|
|
190 -diff b00.s b10.s
|
|
191 -diff b01.s b11.s
|
|
192 -diff b02.s b12.s
|
|
193 -diff b03.s b13.s
|
|
194 -diff b04.s b14.s
|
|
195
|
|
196 diff2 : b00.s b01.s b02.s b03.s b04.s b20.s b21.s b22.s b23.s b24.s
|
|
197 -diff b00.s b20.s
|
|
198 -diff b01.s b21.s
|
|
199 -diff b02.s b22.s
|
|
200 -diff b03.s b23.s
|
|
201 -diff b04.s b24.s
|
|
202
|
|
203
|
|
204 # DO NOT DELETE
|
|
205
|
|
206 mc-code-ia32.o: /usr/include/stdio.h /usr/include/features.h
|
|
207 mc-code-ia32.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
208 mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
209 mc-code-ia32.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
210 mc-code-ia32.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
211 mc-code-ia32.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
212 mc-code-ia32.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
213 mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
214 mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
215 mc-code-ia32.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
|
|
216 mc-code-ia32.o: mc-code.h
|
|
217 mc-codegen.o: /usr/include/stdio.h /usr/include/features.h
|
|
218 mc-codegen.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
219 mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
220 mc-codegen.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
221 mc-codegen.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
222 mc-codegen.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
223 mc-codegen.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
224 mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
225 mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
226 mc-codegen.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
|
|
227 mc-codegen.o: mc-code.h
|
|
228 mc-parse.o: /usr/include/stdio.h /usr/include/features.h
|
|
229 mc-parse.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
230 mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
231 mc-parse.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
232 mc-parse.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
233 mc-parse.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
234 mc-parse.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
235 mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
236 mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
237 mc-parse.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
|
|
238 mc-parse.o: mc-switch.h mc-macro.h conv/conv.h
|
|
239 mc-tree.o: /usr/include/stdio.h /usr/include/features.h
|
|
240 mc-tree.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
241 mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
242 mc-tree.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
243 mc-tree.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
244 mc-tree.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
245 mc-tree.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
246 mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
247 mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
248 mc-tree.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h
|
|
249 mc-switch.o: /usr/include/stdio.h /usr/include/features.h
|
|
250 mc-switch.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
251 mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
252 mc-switch.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
253 mc-switch.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
254 mc-switch.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
255 mc-switch.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
256 mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
257 mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
258 mc-switch.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
|
|
259 mc-switch.o: mc-code.h
|
|
260 mc-macro.o: /usr/include/stdio.h /usr/include/features.h
|
|
261 mc-macro.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
262 mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
263 mc-macro.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
264 mc-macro.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
265 mc-macro.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
266 mc-macro.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
267 mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
268 mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
269 mc-macro.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-macro.h
|
|
270 mc-macro.o: mc-code.h
|
|
271 conv/c.o: /usr/include/stdio.h /usr/include/features.h
|
|
272 conv/c.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
273 conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
274 conv/c.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
275 conv/c.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
276 conv/c.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
277 conv/c.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
278 conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
279 conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
280 conv/c.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
|
|
281 conv/c.o: conv/convdef.h conv/c.h
|
|
282 conv/c2cbc.o: mc.h
|
|
283 conv/cbc2c.o: mc.h
|
|
284 conv/null.o: /usr/include/stdio.h /usr/include/features.h
|
|
285 conv/null.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
286 conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
287 conv/null.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
288 conv/null.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
289 conv/null.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
290 conv/null.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
291 conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
292 conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
293 conv/null.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
|
|
294 conv/null.o: conv/convdef.h conv/null.h
|
|
295 mc-code-powerpc.o: /usr/include/stdio.h /usr/include/features.h
|
|
296 mc-code-powerpc.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
297 mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
298 mc-code-powerpc.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
299 mc-code-powerpc.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
300 mc-code-powerpc.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
301 mc-code-powerpc.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
302 mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
303 mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
304 mc-code-powerpc.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
|
|
305 mc-code-powerpc.o: mc-codegen.h
|
|
306 mc-code-mips.o: /usr/include/stdio.h /usr/include/features.h
|
|
307 mc-code-mips.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
|
|
308 mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
|
|
309 mc-code-mips.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
|
|
310 mc-code-mips.o: /usr/include/bits/sched.h /usr/include/libio.h
|
|
311 mc-code-mips.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
312 mc-code-mips.o: /usr/include/bits/wchar.h /usr/include/gconv.h
|
|
313 mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
|
|
314 mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
|
|
315 mc-code-mips.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
|
|
316 mc-code-mips.o: mc-codegen.h
|