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