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