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