Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / m2mm / proto.make
1 # $Id: proto.make,v 1.9 1997/02/21 17:22:41 ceriel Exp $
2
3 # make Modula-2 makefile generator
4
5 #PARAMS         do not remove this line!
6
7 UTIL_BIN = \
8         $(UTIL_HOME)/bin
9 SRC_DIR = \
10         $(SRC_HOME)/lang/m2/m2mm
11
12 TABGEN= $(UTIL_BIN)/tabgen
13 LLGEN = $(UTIL_BIN)/LLgen
14 LLGENOPTIONS = \
15         -v -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)/lib.c $(SRC_DIR)/tokenname.c \
24         $(SRC_DIR)/idf.c $(SRC_DIR)/input.c $(SRC_DIR)/misc.c \
25         $(SRC_DIR)/options.c
26 GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
27         symbol2str.c char.c Lpars.c Lncor.c
28 CFILES= $(SRC_C) $(GEN_C)
29
30 SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/class.h \
31         $(SRC_DIR)/f_info.h \
32         $(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
33         $(SRC_DIR)/tokenname.h
34 GEN_H = Lpars.h
35 HFILES= $(GEN_H) $(SRC_H)
36
37 all:            make.main
38                 make -f make.main main
39
40 install:        all
41                 cp main $(TARGET_HOME)/bin/m2mm
42                 if [ $(DO_MACHINE_INDEP) = y ] ; \
43                 then    mk_manpage $(SRC_DIR)/m2mm.1 $(TARGET_HOME) ; \
44                 fi
45
46 cmp:            all
47                 -cmp main $(TARGET_HOME)/lib.bin/em_m2
48
49 opr:
50                 make pr | opr
51
52 pr:
53                 @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
54                         $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(SRC_C)
55
56 lint:           make.main
57                 make -f make.main lint
58
59 Cfiles:         LLfiles $(GEN_C) $(GEN_H) Makefile
60                 echo $(CFILES) | tr ' ' '\012' > Cfiles
61                 echo $(HFILES) | tr ' ' '\012' >> Cfiles
62
63 resolved:       Cfiles
64                 CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
65                 -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
66                 touch resolved
67
68 # there is no file called "dependencies"; we want dependencies checked 
69 # every time. This means that make.main is made every time. Oh well ...
70 # it does not take much time.
71 dependencies:   resolved
72                 do_deps `grep '.c$$' Cfiles`
73
74 make.main:      dependencies make_macros lists $(SRC_DIR)/proto.main
75                 rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
76                 cat *.dep >> make.main
77
78 make_macros:    Makefile
79                 echo 'SRC_DIR=$(SRC_DIR)' > make_macros
80                 echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
81                 echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
82                 echo 'CC=$(CC)' >> make_macros
83                 echo 'COPTIONS=$(COPTIONS)' >> make_macros
84                 echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
85                 echo 'LINT=$(LINT)' >> make_macros
86                 echo 'LINTSUF=$(LINTSUF)' >> make_macros
87                 echo 'LINTPREF=$(LINTPREF)' >> make_macros
88                 echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
89                 echo 'SUF=$(SUF)' >> make_macros
90                 echo 'LIBSUF=$(LIBSUF)' >> make_macros
91                 echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
92
93 lists:          Cfiles
94                 echo "C_SRC = \\" > lists
95                 echo $(CFILES) >> lists
96                 echo "OBJ = \\" >> lists
97                 echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
98
99 clean:
100                 -make -f make.main clean
101                 rm -f $(GEN_C) $(GEN_G) $(GEN_H) LLfiles Cfiles LL.output
102                 rm -f resolved *.dep lists make.main make_macros
103
104 LLfiles:        $(GFILES)
105                 $(LLGEN) $(LLGENOPTIONS) $(GFILES)
106                 @touch LLfiles
107                 @if [ -f Lncor.c ] ; then : ; else touch Lncor.c ; fi
108
109 tokenfile.g:    $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
110                 $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
111
112 symbol2str.c:   $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
113                 $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
114
115 char.c:         $(SRC_DIR)/char.tab
116                 $(TABGEN) -f$(SRC_DIR)/char.tab >char.c