Pristine Ack-5.5
[Ack-5.5.git] / fcc / cemcom / proto.make
1 # $Id: proto.make,v 1.4 1994/06/24 11:03:20 ceriel Exp $
2
3 # make C compiler
4
5 #PARAMS         do not remove this line!
6
7 UTIL_BIN = \
8         $(UTIL_HOME)/bin
9 SRC_DIR = \
10         $(SRC_HOME)/lang/cem/cemcom
11 FSRC_DIR = \
12         $(SRC_HOME)/fcc/cemcom
13
14 TABGEN= $(UTIL_BIN)/tabgen
15 LLGEN = $(UTIL_BIN)/LLgen
16 LLGENOPTIONS = \
17         -v
18
19 SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
20         $(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
21 GEN_G = tokenfile.g
22 GFILES= $(GEN_G) $(SRC_G)
23
24 SRC_C = \
25         $(SRC_DIR)/Version.c \
26         $(SRC_DIR)/LLlex.c \
27         $(SRC_DIR)/LLmessage.c \
28         $(SRC_DIR)/arith.c \
29         $(SRC_DIR)/asm.c \
30         $(SRC_DIR)/blocks.c \
31         $(SRC_DIR)/ch7.c \
32         $(SRC_DIR)/ch7bin.c \
33         $(SRC_DIR)/ch7mon.c \
34         $(SRC_DIR)/code.c \
35         $(SRC_DIR)/conversion.c \
36         $(SRC_DIR)/cstoper.c \
37         $(SRC_DIR)/dataflow.c \
38         $(SRC_DIR)/declarator.c \
39         $(SRC_DIR)/decspecs.c \
40         $(SRC_DIR)/domacro.c \
41         $(SRC_DIR)/dumpidf.c \
42         $(SRC_DIR)/error.c \
43         $(SRC_DIR)/eval.c \
44         $(SRC_DIR)/expr.c \
45         $(SRC_DIR)/field.c \
46         $(SRC_DIR)/idf.c \
47         $(SRC_DIR)/init.c \
48         $(SRC_DIR)/input.c \
49         $(SRC_DIR)/l_comment.c \
50         $(SRC_DIR)/l_ev_ord.c \
51         $(SRC_DIR)/l_lint.c \
52         $(SRC_DIR)/l_misc.c \
53         $(SRC_DIR)/l_outdef.c \
54         $(SRC_DIR)/l_states.c \
55         $(SRC_DIR)/label.c \
56         $(SRC_DIR)/main.c \
57         $(SRC_DIR)/options.c \
58         $(SRC_DIR)/replace.c \
59         $(SRC_DIR)/scan.c \
60         $(SRC_DIR)/skip.c \
61         $(SRC_DIR)/stack.c \
62         $(SRC_DIR)/struct.c \
63         $(SRC_DIR)/switch.c \
64         $(SRC_DIR)/tokenname.c \
65         $(SRC_DIR)/type.c \
66         $(SRC_DIR)/util.c \
67         $(SRC_DIR)/stab.c
68
69 GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
70         symbol2str.c char.c Lpars.c next.c
71 CFILES= $(SRC_C) $(GEN_C)
72
73 SRC_H = \
74         $(SRC_DIR)/LLlex.h \
75         $(SRC_DIR)/align.h \
76         $(SRC_DIR)/arith.h \
77         $(SRC_DIR)/assert.h \
78         $(SRC_DIR)/atw.h \
79         $(SRC_DIR)/class.h \
80         $(SRC_DIR)/decspecs.h \
81         $(SRC_DIR)/file_info.h \
82         $(SRC_DIR)/input.h \
83         $(SRC_DIR)/interface.h \
84         $(SRC_DIR)/l_class.h \
85         $(SRC_DIR)/l_comment.h \
86         $(SRC_DIR)/l_em.h \
87         $(SRC_DIR)/l_lint.h \
88         $(SRC_DIR)/label.h \
89         $(SRC_DIR)/level.h \
90         $(SRC_DIR)/mes.h \
91         $(SRC_DIR)/sizes.h \
92         $(SRC_DIR)/specials.h \
93         $(SRC_DIR)/tokenname.h
94
95 GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
96         idfsize.h ifdepth.h inputtype.h lint.h \
97         nobitfield.h nopp.h nocross.h \
98         nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
99         strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
100         regcount.h \
101         code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \
102         idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
103         l_outdef.h stack.h lapbuf.h noRoption.h nofloat.h dbsymtab.h
104
105 HFILES= $(GEN_H) $(SRC_H)
106
107 NEXTFILES = \
108         $(SRC_DIR)/code.str \
109         $(SRC_DIR)/declar.str \
110         $(SRC_DIR)/decspecs.str \
111         $(SRC_DIR)/def.str \
112         $(SRC_DIR)/expr.str \
113         $(SRC_DIR)/field.str \
114         $(SRC_DIR)/estack.str \
115         $(SRC_DIR)/util.str \
116         $(SRC_DIR)/idf.str \
117         $(SRC_DIR)/macro.str \
118         $(SRC_DIR)/stack.str \
119         $(SRC_DIR)/stmt.str \
120         $(SRC_DIR)/struct.str \
121         $(SRC_DIR)/switch.str \
122         $(SRC_DIR)/type.str \
123         $(SRC_DIR)/l_brace.str \
124         $(SRC_DIR)/l_state.str \
125         $(SRC_DIR)/l_outdef.str
126
127 all:            make.main
128                 make -f make.main main
129
130 install:        all
131                 cp main $(TARGET_HOME)/lib.bin/c_cccompat
132
133 cmp:            all
134                 -cmp main $(TARGET_HOME)/lib.bin/c_cccompat
135
136 opr:
137                 make pr | opr
138
139 pr:
140                 @pr $(FSRC_DIR)/proto.make $(FSRC_DIR)/proto.main \
141                         $(FSRC_DIR)/Parameters.vax4 $(FSRC_DIR)/Parameters.sun3
142
143 lint:           make.main
144                 make -f make.main lint
145
146 Cfiles:         hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
147                 echo $(CFILES) | tr ' ' '\012' > Cfiles
148                 echo $(HFILES) | tr ' ' '\012' >> Cfiles
149
150 resolved:       Cfiles
151                 CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
152                 -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
153                 touch resolved
154
155 # there is no file called "dependencies"; we want dependencies checked 
156 # every time. This means that make.main is made every time. Oh well ...
157 # it does not take much time.
158 dependencies:   resolved
159                 do_deps `grep '.c$$' Cfiles`
160
161 make.main:      dependencies make_macros lists $(FSRC_DIR)/proto.main
162                 rm_deps $(FSRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
163                 cat *.dep >> make.main
164
165 make_macros:    Makefile
166                 echo 'SRC_DIR=$(SRC_DIR)' > make_macros
167                 echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
168                 echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
169                 echo 'CC=$(CC)' >> make_macros
170                 echo 'COPTIONS=$(COPTIONS) -DPEEPHOLE' >> make_macros
171                 echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
172                 echo 'LINT=$(LINT)' >> make_macros
173                 echo 'LINTSUF=$(LINTSUF)' >> make_macros
174                 echo 'LINTPREF=$(LINTPREF)' >> make_macros
175                 echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
176                 echo 'SUF=$(SUF)' >> make_macros
177                 echo 'LIBSUF=$(LIBSUF)' >> make_macros
178                 echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
179                 if [ $(MACH) = m68020 ] ; then \
180                         echo 'CE=$(TARGET_HOME)/lib.bin/sun3/ce.$(LIBSUF) $(TARGET_HOME)/lib.bin/sun3/back.$(LIBSUF)' >> make_macros ; \
181                 else \
182                         echo 'CE=$(TARGET_HOME)/lib.bin/vax4/ce.$(LIBSUF) $(TARGET_HOME)/lib.bin/vax4/back_vax.$(LIBSUF)' >> make_macros ; \
183                 fi
184
185 lists:          Cfiles
186                 echo "C_SRC = \\" > lists
187                 echo $(CFILES) >> lists
188                 echo "OBJ = \\" >> lists
189                 echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
190
191 clean:
192                 -make -f make.main clean
193                 rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
194                 rm -f resolved *.dep lists make.main make_macros
195
196 LLfiles:        $(GFILES)
197                 $(LLGEN) $(LLGENOPTIONS) $(GFILES)
198                 @touch LLfiles
199
200 hfiles:         Parameters $(SRC_DIR)/make.hfiles
201                 $(SRC_DIR)/make.hfiles Parameters
202                 touch hfiles
203
204 Parameters:     $(FSRC_DIR)/Parameters.sun3 $(FSRC_DIR)/Parameters.vax4
205                 if [ $(MACH) = m68020 ] ; then \
206                         cp $(FSRC_DIR)/Parameters.sun3 Parameters ; \
207                 else \
208                         cp $(FSRC_DIR)/Parameters.vax4 Parameters ; \
209                 fi
210
211 tokenfile.g:    $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
212                 $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
213
214 symbol2str.c:   $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
215                 $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
216
217 code.h:         $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
218                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
219
220 declar.h:       $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
221                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
222
223 def.h:  $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
224                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
225
226 expr.h: $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
227                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
228
229 field.h:        $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
230                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
231
232 estack.h:       $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
233                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
234
235 util.h: $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
236                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
237
238 decspecs.h:     $(SRC_DIR)/decspecs.str $(SRC_DIR)/make.allocd
239                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/decspecs.str > decspecs.h
240
241 idf.h:  $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
242                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
243
244 macro.h:        $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
245                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
246
247 stack.h:        $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
248                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
249
250 stmt.h: $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
251                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
252
253 struct.h:       $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
254                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
255
256 switch.h:       $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
257                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
258
259 type.h: $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
260                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
261
262 l_brace.h:      $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
263                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
264
265 l_state.h:      $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
266                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
267
268 l_outdef.h:     $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
269                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
270
271 next.c:         $(NEXTFILES) $(SRC_DIR)/make.next
272                 $(SRC_DIR)/make.next $(NEXTFILES) > next.c
273
274 char.c:         $(SRC_DIR)/char.tab
275                 $(TABGEN) -f$(SRC_DIR)/char.tab >char.c