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