Pristine Ack-5.5
[Ack-5.5.git] / util / grind / proto.make
1 # $Id: proto.make,v 1.11 1994/06/24 11:00:54 ceriel Exp $
2
3 #PARAMS         do not remove this line!
4
5 SRC_DIR = $(SRC_HOME)/util/grind
6 UTIL_BIN = $(UTIL_HOME)/bin
7 TABGEN= $(UTIL_BIN)/tabgen
8 LLGEN = $(UTIL_BIN)/LLgen
9 LLGENOPTIONS = -v
10 EXTRALIB =
11
12 SRC_G1 =        $(SRC_DIR)/commands.g
13 GEN_G1 =        tokenfile.g
14 GFILES1=        $(GEN_G1) $(SRC_G1)
15
16 SRC_G2 =        $(SRC_DIR)/db_symtab.g
17 GEN_G2 =        
18 GFILES2 =       $(GEN_G2) $(SRC_G2)
19
20 SRC_C = \
21         $(SRC_DIR)/main.c \
22         $(SRC_DIR)/list.c \
23         $(SRC_DIR)/tree.c \
24         $(SRC_DIR)/expr.c \
25         $(SRC_DIR)/position.c \
26         $(SRC_DIR)/tokenname.c \
27         $(SRC_DIR)/idf.c \
28         $(SRC_DIR)/run.c \
29         $(SRC_DIR)/symbol.c \
30         $(SRC_DIR)/print.c \
31         $(SRC_DIR)/type.c \
32         $(SRC_DIR)/rd.c \
33         $(SRC_DIR)/do_comm.c \
34         $(SRC_DIR)/modula-2.c \
35         $(SRC_DIR)/pascal.c \
36         $(SRC_DIR)/c.c
37 GEN_C = db_symtab.c commands.c Lpars.c DBSpars.c avl.c scope.c itemlist.c \
38         langdep.c ops.c chtab.c symbol2str.c next.c
39 CFILES= $(SRC_C) $(GEN_C)
40
41 SRC_H = \
42         $(SRC_DIR)/tokenname.h \
43         $(SRC_DIR)/operator.h \
44         $(SRC_DIR)/class.h \
45         $(SRC_DIR)/position.h \
46         $(SRC_DIR)/idf.h \
47         $(SRC_DIR)/message.h \
48         $(SRC_DIR)/avl.h \
49         $(SRC_DIR)/scope.h \
50         $(SRC_DIR)/langdep.h \
51         $(SRC_DIR)/sizes.h \
52         $(SRC_DIR)/token.h \
53         $(SRC_DIR)/expr.h \
54         $(SRC_DIR)/rd.h
55 GEN_H = file.h type.h symbol.h tree.h Lpars.h DBSpars.h ops.h
56 HFILES= $(GEN_H) $(SRC_H)
57
58 NEXTFILES =     $(SRC_DIR)/file.hh \
59                 $(SRC_DIR)/type.hh \
60                 $(SRC_DIR)/symbol.hh \
61                 $(SRC_DIR)/tree.hh \
62                 $(SRC_DIR)/avl.cc \
63                 $(SRC_DIR)/scope.cc \
64                 $(SRC_DIR)/itemlist.cc \
65                 $(SRC_DIR)/langdep.cc
66
67 all:            make.main
68                 make -f make.main "EXTRALIB="$(EXTRALIB) grind
69
70 install:        all
71                 cp grind $(TARGET_HOME)/bin/grind
72                 if [ $(DO_MACHINE_INDEP) = y ] ; \
73                 then    mk_manpage $(SRC_DIR)/grind.1 $(TARGET_HOME) ; \
74                 fi
75
76 cmp:            all
77                 -cmp grind $(TARGET_HOME)/bin/grind
78
79 opr:
80                 make pr | opr
81
82 pr:
83                 @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
84                         $(SRC_DIR)/char.ct operators.ot \
85                         $(SRC_G1) $(SRC_G2) \
86                         $(SRC_H) $(NEXTFILES) \
87                         $(SRC_C)
88
89 lint:           make.main
90                 make -f make.main lint
91
92 Cfiles:         LLfiles $(GEN_C) $(GEN_H) Makefile
93                 echo $(CFILES) | tr ' ' '\012' > Cfiles
94                 echo $(HFILES) | tr ' ' '\012' >> Cfiles
95
96 resolved:       Cfiles
97                 CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
98                 -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
99                 touch resolved
100
101 # there is no file called "dependencies"; we want dependencies checked 
102 # every time. This means that make.main is made every time. Oh well ...
103 # it does not take much time.
104 dependencies:   resolved
105                 do_deps `grep '.c$$' Cfiles`
106
107 make.main:      dependencies make_macros lists $(SRC_DIR)/proto.main
108                 rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
109                 cat *.dep >> make.main
110
111 make_macros:    Makefile
112                 echo 'SRC_DIR=$(SRC_DIR)' > make_macros
113                 echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
114                 echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
115                 echo 'CC=$(CC)' >> make_macros
116                 echo 'COPTIONS=$(COPTIONS)' >> make_macros
117                 echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
118                 echo 'LINT=$(LINT)' >> make_macros
119                 echo 'LINTSUF=$(LINTSUF)' >> make_macros
120                 echo 'LINTPREF=$(LINTPREF)' >> make_macros
121                 echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
122                 echo 'SUF=$(SUF)' >> make_macros
123                 echo 'LIBSUF=$(LIBSUF)' >> make_macros
124                 echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
125
126 lists:          Cfiles
127                 echo "C_SRC = \\" > lists
128                 echo $(CFILES) >> lists
129                 echo "OBJ = \\" >> lists
130                 echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
131
132 clean:
133                 -make -f make.main clean
134                 rm -f $(GEN_C) $(GEN_G) $(GEN_H) \
135                         LL1files LL2files Cfiles LL.output DBS.output
136                 rm -f resolved *.dep lists make.main make_macros tokenfile.[cg]
137
138 LLfiles:        LL1files LL2files
139
140 LL1files:       $(GFILES1)
141                 $(LLGEN) $(LLGENOPTIONS) $(GFILES1)
142                 @touch LL1files
143
144 LL2files:       $(GFILES2)
145                 $(LLGEN) $(LLGENOPTIONS) $(GFILES2)
146                 @touch LL2files
147
148 tokenfile.g:    $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
149                 $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
150
151 symbol2str.c:   $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
152                 $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
153
154 file.h:         $(SRC_DIR)/file.hh $(SRC_DIR)/make.allocd
155                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/file.hh > file.h
156
157 symbol.h:       $(SRC_DIR)/symbol.hh $(SRC_DIR)/make.allocd
158                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/symbol.hh > symbol.h
159
160 tree.h:         $(SRC_DIR)/tree.hh $(SRC_DIR)/make.allocd
161                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/tree.hh > tree.h
162
163 type.h:         $(SRC_DIR)/type.hh $(SRC_DIR)/make.allocd
164                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.hh > type.h
165
166 avl.c:          $(SRC_DIR)/avl.cc $(SRC_DIR)/make.allocd
167                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/avl.cc > avl.c
168
169 itemlist.c:     $(SRC_DIR)/itemlist.cc $(SRC_DIR)/make.allocd
170                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/itemlist.cc > itemlist.c
171
172 langdep.c:      $(SRC_DIR)/langdep.cc $(SRC_DIR)/make.allocd
173                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/langdep.cc > langdep.c
174
175 scope.c:        $(SRC_DIR)/scope.cc $(SRC_DIR)/make.allocd
176                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.cc > scope.c
177
178 next.c:         $(NEXTFILES) $(SRC_DIR)/make.next
179                 $(SRC_DIR)/make.next $(NEXTFILES) > next.c
180
181 chtab.c:        $(SRC_DIR)/char.ct
182                 $(TABGEN) -f$(SRC_DIR)/char.ct >chtab.c
183
184 ops.c ops.h:    $(SRC_DIR)/operators.ot $(SRC_DIR)/make.ops
185                 $(SRC_DIR)/make.ops $(SRC_DIR)/operators.ot