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