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