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