Pristine Ack-5.5
[Ack-5.5.git] / lang / pc / comp / proto.make
1 # $Id: proto.make,v 1.5 1994/06/24 12:36:06 ceriel Exp $
2
3 # make Pascal compiler
4
5 #PARAMS         do not remove this line!
6
7 UTIL_BIN = \
8         $(UTIL_HOME)/bin
9 SRC_DIR = \
10         $(SRC_HOME)/lang/pc/comp
11
12 TABGEN= $(UTIL_BIN)/tabgen
13 LLGEN = $(UTIL_BIN)/LLgen
14 LLGENOPTIONS = \
15         -v
16
17 SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
18         $(SRC_DIR)/expression.g $(SRC_DIR)/statement.g
19 GEN_G = tokenfile.g
20 GFILES= $(GEN_G) $(SRC_G)
21
22 SRC_C = $(SRC_DIR)/LLlex.c $(SRC_DIR)/LLmessage.c $(SRC_DIR)/body.c \
23         $(SRC_DIR)/error.c $(SRC_DIR)/label.c $(SRC_DIR)/readwrite.c \
24         $(SRC_DIR)/main.c $(SRC_DIR)/tokenname.c $(SRC_DIR)/idf.c \
25         $(SRC_DIR)/input.c $(SRC_DIR)/type.c $(SRC_DIR)/def.c \
26         $(SRC_DIR)/misc.c $(SRC_DIR)/enter.c $(SRC_DIR)/progs.c \
27         $(SRC_DIR)/typequiv.c $(SRC_DIR)/node.c $(SRC_DIR)/cstoper.c \
28         $(SRC_DIR)/chk_expr.c $(SRC_DIR)/options.c $(SRC_DIR)/scope.c \
29         $(SRC_DIR)/desig.c $(SRC_DIR)/code.c $(SRC_DIR)/lookup.c \
30         $(SRC_DIR)/stab.c
31 GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
32         symbol2str.c char.c Lpars.c casestat.c tmpvar.c next.c
33 CFILES= $(SRC_C) $(GEN_C)
34
35 SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/chk_expr.h $(SRC_DIR)/class.h \
36         $(SRC_DIR)/const.h $(SRC_DIR)/debug.h $(SRC_DIR)/f_info.h \
37         $(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
38         $(SRC_DIR)/misc.h $(SRC_DIR)/required.h $(SRC_DIR)/tokenname.h
39
40 GEN_H = errout.h idfsize.h numsize.h strsize.h target_sizes.h \
41         inputtype.h density.h nocross.h def.h debugcst.h \
42         type.h Lpars.h node.h dbsymtab.h scope.h desig.h
43
44 HFILES= $(GEN_H) $(SRC_H)
45
46 NEXTFILES = \
47         $(SRC_DIR)/def.H $(SRC_DIR)/type.H $(SRC_DIR)/node.H \
48         $(SRC_DIR)/scope.H $(SRC_DIR)/desig.H \
49         $(SRC_DIR)/tmpvar.C $(SRC_DIR)/casestat.C
50
51 all:            make.main
52                 make -f make.main main
53
54 install:        all
55                 cp main $(TARGET_HOME)/lib.bin/em_pc
56
57 cmp:            all
58                 -cmp main $(TARGET_HOME)/lib.bin/em_pc
59
60 opr:
61                 make pr | opr
62
63 pr:
64                 @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
65                         $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
66
67 lint:           make.main
68                 make -f make.main lint
69
70 Cfiles:         hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
71                 echo $(CFILES) | tr ' ' '\012' > Cfiles
72                 echo $(HFILES) | tr ' ' '\012' >> Cfiles
73
74 resolved:       Cfiles
75                 CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
76                 -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
77                 touch resolved
78
79 # there is no file called "dependencies"; we want dependencies checked 
80 # every time. This means that make.main is made every time. Oh well ...
81 # it does not take much time.
82 dependencies:   resolved
83                 do_deps `grep '.c$$' Cfiles`
84
85 make.main:      dependencies make_macros lists $(SRC_DIR)/proto.main
86                 rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
87                 cat *.dep >> make.main
88
89 make_macros:    Makefile
90                 echo 'SRC_DIR=$(SRC_DIR)' > make_macros
91                 echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
92                 echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
93                 echo 'CC=$(CC)' >> make_macros
94                 echo 'COPTIONS=$(COPTIONS)' >> make_macros
95                 echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
96                 echo 'LINT=$(LINT)' >> make_macros
97                 echo 'LINTSUF=$(LINTSUF)' >> make_macros
98                 echo 'LINTPREF=$(LINTPREF)' >> make_macros
99                 echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
100                 echo 'SUF=$(SUF)' >> make_macros
101                 echo 'LIBSUF=$(LIBSUF)' >> make_macros
102                 echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
103
104 lists:          Cfiles
105                 echo "C_SRC = \\" > lists
106                 echo $(CFILES) >> lists
107                 echo "OBJ = \\" >> lists
108                 echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
109
110 clean:
111                 -make -f make.main clean
112                 rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
113                 rm -f resolved *.dep lists make.main make_macros
114
115 LLfiles:        $(GFILES)
116                 $(LLGEN) $(LLGENOPTIONS) $(GFILES)
117                 @touch LLfiles
118
119 hfiles:         Parameters $(SRC_DIR)/make.hfiles
120                 $(SRC_DIR)/make.hfiles Parameters
121                 touch hfiles
122
123 tokenfile.g:    $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
124                 $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
125
126 symbol2str.c:   $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
127                 $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
128
129 def.h:          $(SRC_DIR)/make.allocd $(SRC_DIR)/def.H
130                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.H > def.h
131
132 type.h:         $(SRC_DIR)/make.allocd $(SRC_DIR)/type.H
133                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.H > type.h
134
135 scope.h:        $(SRC_DIR)/make.allocd $(SRC_DIR)/scope.H
136                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.H > scope.h
137
138 node.h:         $(SRC_DIR)/make.allocd $(SRC_DIR)/node.H
139                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/node.H > node.h
140
141 desig.h:        $(SRC_DIR)/make.allocd $(SRC_DIR)/desig.H
142                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/desig.H > desig.h
143
144 tmpvar.c:       $(SRC_DIR)/make.allocd $(SRC_DIR)/tmpvar.C
145                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/tmpvar.C > tmpvar.c
146
147 casestat.c:     $(SRC_DIR)/make.allocd $(SRC_DIR)/casestat.C
148                 $(SRC_DIR)/make.allocd < $(SRC_DIR)/casestat.C > casestat.c
149
150 next.c:         $(NEXTFILES) $(SRC_DIR)/make.next
151                 $(SRC_DIR)/make.next $(NEXTFILES) > next.c
152
153 char.c:         $(SRC_DIR)/char.tab
154                 $(TABGEN) -f$(SRC_DIR)/char.tab >char.c