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