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