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