Pristine Ack-5.5
[Ack-5.5.git] / lang / occam / comp / proto.make
1 # $Id: proto.make,v 1.6 1994/06/24 12:27:13 ceriel Exp $
2
3 # make occam compiler
4
5 #PARAMS         do not remove this line!
6
7 UTIL_BIN = \
8         $(UTIL_HOME)/bin
9 SRC_DIR = \
10         $(SRC_HOME)/lang/occam/comp
11
12 TABGEN= $(UTIL_BIN)/tabgen
13 LLGEN = $(UTIL_BIN)/LLgen
14 LLGENOPTIONS = \
15         -v
16
17 SRC_G = $(SRC_DIR)/occam.g
18 GEN_G =
19 GFILES= $(GEN_G) $(SRC_G)
20
21 SRC_C = \
22         $(SRC_DIR)/builtin.c \
23         $(SRC_DIR)/code.c \
24         $(SRC_DIR)/em.c \
25         $(SRC_DIR)/expr.c \
26         $(SRC_DIR)/keytab.c \
27         $(SRC_DIR)/report.c \
28         $(SRC_DIR)/symtab.c
29 GEN_C = occam.c lex.yy.c Lpars.c
30 CFILES= $(SRC_C) $(GEN_C)
31
32 SRC_H = \
33         $(SRC_DIR)/code.h \
34         $(SRC_DIR)/em.h \
35         $(SRC_DIR)/expr.h \
36         $(SRC_DIR)/sizes.h \
37         $(SRC_DIR)/symtab.h \
38         $(SRC_DIR)/token.h
39 GEN_H = Lpars.h
40 HFILES= $(GEN_H) $(SRC_H)
41
42 SRC_L = $(SRC_DIR)/lex.l
43 GEN_L =
44 LFILES = $(SRC_L) $(GEN_L)
45
46 all:            make.main
47                 make -f make.main main
48
49 install:        all
50                 cp main $(TARGET_HOME)/lib.bin/em_occam
51
52 cmp:            all
53                 -cmp main $(TARGET_HOME)/lib.bin/em_occam
54
55 opr:
56                 make pr | opr
57
58 pr:
59                 @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
60                         $(SRC_L) $(SRC_G) $(SRC_H) $(SRC_C)
61
62 lint:           make.main
63                 make -f make.main lint
64
65 Cfiles:         LLfiles $(GEN_C) $(GEN_H) Makefile
66                 echo $(CFILES) | tr ' ' '\012' > Cfiles
67                 echo $(HFILES) | tr ' ' '\012' >> Cfiles
68
69 resolved:       Cfiles
70                 CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
71                 -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
72                 touch resolved
73
74 # there is no file called "dependencies"; we want dependencies checked 
75 # every time. This means that make.main is made every time. Oh well ...
76 # it does not take much time.
77 dependencies:   resolved
78                 do_deps `grep '.c$$' Cfiles`
79
80 make.main:      dependencies make_macros lists $(SRC_DIR)/proto.main
81                 rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
82                 cat *.dep >> make.main
83
84 make_macros:    Makefile
85                 echo 'SRC_DIR=$(SRC_DIR)' > make_macros
86                 echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
87                 echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
88                 echo 'CC=$(CC)' >> make_macros
89                 echo 'COPTIONS=$(COPTIONS)' >> make_macros
90                 echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
91                 echo 'LINT=$(LINT)' >> make_macros
92                 echo 'LINTSUF=$(LINTSUF)' >> make_macros
93                 echo 'LINTPREF=$(LINTPREF)' >> make_macros
94                 echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
95                 echo 'SUF=$(SUF)' >> make_macros
96                 echo 'LIBSUF=$(LIBSUF)' >> make_macros
97                 echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
98
99 lists:          Cfiles
100                 echo "C_SRC = \\" > lists
101                 echo $(CFILES) >> lists
102                 echo "OBJ = \\" >> lists
103                 echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
104
105 clean:
106                 -make -f make.main clean
107                 rm -f $(GEN_C) $(GEN_G) $(GEN_H) $(GEN_L) LLfiles Cfiles LL.output
108                 rm -f resolved *.dep lists make.main make_macros
109
110 LLfiles:        $(GFILES)
111                 $(LLGEN) $(LLGENOPTIONS) $(GFILES)
112                 @touch LLfiles
113
114 lex.yy.c:       $(LFILES)
115                 flex -s $(LFILES)