proto.make 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. # $Header$
  2. # make ANSI C compiler
  3. #PARAMS do not remove this line!
  4. UTIL_BIN = \
  5. $(UTIL_HOME)/bin
  6. SRC_DIR = \
  7. $(SRC_HOME)/lang/cem/cemcom.ansi
  8. TABGEN= $(UTIL_BIN)/tabgen
  9. LLGEN = $(UTIL_BIN)/LLgen
  10. LLGENOPTIONS = \
  11. -v
  12. SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
  13. $(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
  14. GEN_G = tokenfile.g
  15. GFILES= $(GEN_G) $(SRC_G)
  16. SRC_C = \
  17. $(SRC_DIR)/Version.c \
  18. $(SRC_DIR)/LLlex.c \
  19. $(SRC_DIR)/LLmessage.c \
  20. $(SRC_DIR)/arith.c \
  21. $(SRC_DIR)/blocks.c \
  22. $(SRC_DIR)/ch3.c \
  23. $(SRC_DIR)/ch3bin.c \
  24. $(SRC_DIR)/ch3mon.c \
  25. $(SRC_DIR)/code.c \
  26. $(SRC_DIR)/conversion.c \
  27. $(SRC_DIR)/cstoper.c \
  28. $(SRC_DIR)/dataflow.c \
  29. $(SRC_DIR)/declarator.c \
  30. $(SRC_DIR)/decspecs.c \
  31. $(SRC_DIR)/domacro.c \
  32. $(SRC_DIR)/dumpidf.c \
  33. $(SRC_DIR)/error.c \
  34. $(SRC_DIR)/eval.c \
  35. $(SRC_DIR)/expr.c \
  36. $(SRC_DIR)/field.c \
  37. $(SRC_DIR)/fltcstoper.c \
  38. $(SRC_DIR)/idf.c \
  39. $(SRC_DIR)/init.c \
  40. $(SRC_DIR)/input.c \
  41. $(SRC_DIR)/l_comment.c \
  42. $(SRC_DIR)/l_ev_ord.c \
  43. $(SRC_DIR)/l_lint.c \
  44. $(SRC_DIR)/l_misc.c \
  45. $(SRC_DIR)/l_outdef.c \
  46. $(SRC_DIR)/l_states.c \
  47. $(SRC_DIR)/label.c \
  48. $(SRC_DIR)/main.c \
  49. $(SRC_DIR)/options.c \
  50. $(SRC_DIR)/pragma.c \
  51. $(SRC_DIR)/proto.c \
  52. $(SRC_DIR)/replace.c \
  53. $(SRC_DIR)/skip.c \
  54. $(SRC_DIR)/stab.c \
  55. $(SRC_DIR)/stack.c \
  56. $(SRC_DIR)/struct.c \
  57. $(SRC_DIR)/switch.c \
  58. $(SRC_DIR)/tokenname.c \
  59. $(SRC_DIR)/type.c \
  60. $(SRC_DIR)/util.c
  61. GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
  62. symbol2str.c char.c Lpars.c next.c
  63. CFILES= $(SRC_C) $(GEN_C)
  64. SRC_H = \
  65. $(SRC_DIR)/LLlex.h \
  66. $(SRC_DIR)/align.h \
  67. $(SRC_DIR)/arith.h \
  68. $(SRC_DIR)/assert.h \
  69. $(SRC_DIR)/atw.h \
  70. $(SRC_DIR)/class.h \
  71. $(SRC_DIR)/decspecs.h \
  72. $(SRC_DIR)/file_info.h \
  73. $(SRC_DIR)/input.h \
  74. $(SRC_DIR)/interface.h \
  75. $(SRC_DIR)/l_class.h \
  76. $(SRC_DIR)/l_comment.h \
  77. $(SRC_DIR)/l_em.h \
  78. $(SRC_DIR)/l_lint.h \
  79. $(SRC_DIR)/label.h \
  80. $(SRC_DIR)/level.h \
  81. $(SRC_DIR)/mes.h \
  82. $(SRC_DIR)/sizes.h \
  83. $(SRC_DIR)/specials.h \
  84. $(SRC_DIR)/tokenname.h
  85. GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
  86. idfsize.h ifdepth.h inputtype.h macbuf.h lint.h \
  87. nobitfield.h nopp.h nocross.h \
  88. nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
  89. strsize.h trgt_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
  90. regcount.h dbsymtab.h \
  91. code.h declar.h def.h expr.h field.h estack.h util.h proto.h replace.h \
  92. idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
  93. l_outdef.h stack.h
  94. HFILES= $(GEN_H) $(SRC_H)
  95. NEXTFILES = \
  96. $(SRC_DIR)/code.str \
  97. $(SRC_DIR)/declar.str \
  98. $(SRC_DIR)/def.str \
  99. $(SRC_DIR)/expr.str \
  100. $(SRC_DIR)/field.str \
  101. $(SRC_DIR)/estack.str \
  102. $(SRC_DIR)/util.str \
  103. $(SRC_DIR)/proto.str \
  104. $(SRC_DIR)/replace.str \
  105. $(SRC_DIR)/idf.str \
  106. $(SRC_DIR)/macro.str \
  107. $(SRC_DIR)/stack.str \
  108. $(SRC_DIR)/stmt.str \
  109. $(SRC_DIR)/struct.str \
  110. $(SRC_DIR)/switch.str \
  111. $(SRC_DIR)/type.str \
  112. $(SRC_DIR)/l_brace.str \
  113. $(SRC_DIR)/l_state.str \
  114. $(SRC_DIR)/l_outdef.str
  115. all: make.main
  116. make -f make.main main
  117. install: all
  118. @-mkdir $(TARGET_HOME)
  119. @-mkdir $(TARGET_HOME)/lib.bin
  120. cp main $(TARGET_HOME)/lib.bin/em_cemcom.ansi
  121. if [ $(DO_MACHINE_INDEP) = y ] ; \
  122. then cp $(SRC_DIR)/cemcom.ansi.1 cemcom.ansi.6 ; \
  123. mk_manpage cemcom.ansi.6 $(TARGET_HOME) ; \
  124. rm -f cemcom.ansi.6 ; \
  125. fi
  126. cmp: all
  127. -cmp main $(TARGET_HOME)/lib.bin/em_cemcom.ansi
  128. opr:
  129. make pr | opr
  130. pr:
  131. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
  132. $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
  133. lint: make.main
  134. make -f make.main lint
  135. Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
  136. echo $(CFILES) | tr ' ' '\012' > Cfiles
  137. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  138. resolved: Cfiles
  139. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  140. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  141. touch resolved
  142. # there is no file called "dependencies"; we want dependencies checked
  143. # every time. This means that make.main is made every time. Oh well ...
  144. # it does not take much time.
  145. dependencies: resolved
  146. do_deps `grep '.c$$' Cfiles`
  147. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  148. sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
  149. echo '#DEPENDENCIES' >> make.main
  150. cat *.dep >> make.main
  151. make_macros: Makefile
  152. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  153. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  154. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  155. echo 'CC=$(CC)' >> make_macros
  156. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  157. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  158. echo 'LINT=$(LINT)' >> make_macros
  159. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  160. echo 'SUF=$(SUF)' >> make_macros
  161. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  162. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  163. lists: Cfiles
  164. echo "C_SRC = \\" > lists
  165. echo $(CFILES) >> lists
  166. echo "OBJ = \\" >> lists
  167. echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
  168. clean:
  169. -make -f make.main clean
  170. rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
  171. rm -f resolved *.dep lists make.main make_macros
  172. LLfiles: $(GFILES)
  173. $(LLGEN) $(LLGENOPTIONS) $(GFILES)
  174. @touch LLfiles
  175. hfiles: Parameters $(SRC_DIR)/make.hfiles
  176. $(SRC_DIR)/make.hfiles Parameters
  177. touch hfiles
  178. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  179. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  180. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  181. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  182. code.h: $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
  183. $(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
  184. declar.h: $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
  185. $(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
  186. def.h: $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
  187. $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
  188. expr.h: $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
  189. $(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
  190. field.h: $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
  191. $(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
  192. estack.h: $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
  193. $(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
  194. util.h: $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
  195. $(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
  196. proto.h: $(SRC_DIR)/proto.str $(SRC_DIR)/make.allocd
  197. $(SRC_DIR)/make.allocd < $(SRC_DIR)/proto.str > proto.h
  198. replace.h: $(SRC_DIR)/replace.str $(SRC_DIR)/make.allocd
  199. $(SRC_DIR)/make.allocd < $(SRC_DIR)/replace.str > replace.h
  200. idf.h: $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
  201. $(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
  202. macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
  203. $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
  204. stack.h: $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
  205. $(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
  206. stmt.h: $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
  207. $(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
  208. struct.h: $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
  209. $(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
  210. switch.h: $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
  211. $(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
  212. type.h: $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
  213. $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
  214. l_brace.h: $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
  215. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
  216. l_state.h: $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
  217. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
  218. l_outdef.h: $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
  219. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
  220. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  221. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  222. char.c: $(SRC_DIR)/char.tab
  223. $(TABGEN) -f$(SRC_DIR)/char.tab >char.c