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