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