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