1 # $Id: proto.make,v 1.7 1994/06/24 11:38:04 ceriel Exp $
3 # make ANSI C pre-processor
5 #PARAMS do not remove this line!
10 $(SRC_HOME)/lang/cem/cpp.ansi
12 TABGEN= $(UTIL_BIN)/tabgen
13 LLGEN = $(UTIL_BIN)/LLgen
17 SRC_G = $(SRC_DIR)/expression.g
19 GFILES= $(GEN_G) $(SRC_G)
23 $(SRC_DIR)/LLmessage.c \
26 $(SRC_DIR)/domacro.c \
32 $(SRC_DIR)/options.c \
33 $(SRC_DIR)/preprocess.c \
34 $(SRC_DIR)/replace.c \
36 $(SRC_DIR)/tokenname.c \
39 GEN_C = tokenfile.c expression.c symbol2str.c char.c Lpars.c next.c
40 CFILES= $(SRC_C) $(GEN_C)
45 $(SRC_DIR)/file_info.h \
48 $(SRC_DIR)/interface.h \
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
56 HFILES= $(GEN_H) $(SRC_H)
59 $(SRC_DIR)/macro.str \
60 $(SRC_DIR)/replace.str
63 make -f make.main main
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) ; \
74 -cmp main $(TARGET_HOME)/lib.bin/cpp.ansi
80 @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
81 $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
84 make -f make.main lint
86 Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
87 echo $(CFILES) | tr ' ' '\012' > Cfiles
88 echo $(HFILES) | tr ' ' '\012' >> 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
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`
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
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
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
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
132 $(LLGEN) $(LLGENOPTIONS) $(GFILES)
135 hfiles: Parameters $(SRC_DIR)/make.hfiles
136 $(SRC_DIR)/make.hfiles Parameters
139 tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
140 $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
142 symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
143 $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
145 replace.h: $(SRC_DIR)/replace.str $(SRC_DIR)/make.allocd
146 $(SRC_DIR)/make.allocd < $(SRC_DIR)/replace.str > replace.h
148 macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
149 $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
151 next.c: $(NEXTFILES) $(SRC_DIR)/make.next
152 $(SRC_DIR)/make.next $(NEXTFILES) > next.c
154 char.c: $(SRC_DIR)/char.tab
155 $(TABGEN) -f$(SRC_DIR)/char.tab >char.c