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